@camstack/system 1.2.458 → 1.2.460

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/addon-runner.js +26 -11
  2. package/dist/addon-runner.mjs +26 -11
  3. package/dist/addon-utils.mjs +1 -1
  4. package/dist/{agent-https-DOELEug8.js → agent-https-Dnr_nIVx.js} +3 -723
  5. package/dist/{agent-https-CQA3W-3e.mjs → agent-https-Iw3RSQup.mjs} +4 -616
  6. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  7. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
  8. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  9. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
  10. package/dist/builtins/alerts/alerts.addon.js +5 -7
  11. package/dist/builtins/alerts/alerts.addon.mjs +5 -7
  12. package/dist/builtins/alerts/record-kinds.d.ts +1 -1
  13. package/dist/builtins/autotrack/index.js +1 -1
  14. package/dist/builtins/autotrack/index.mjs +1 -1
  15. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +242 -4
  16. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +243 -5
  17. package/dist/builtins/calendars/calendars.addon.js +2 -10
  18. package/dist/builtins/calendars/calendars.addon.mjs +2 -3
  19. package/dist/builtins/calendars/record-kinds.d.ts +1 -1
  20. package/dist/builtins/camera-grid/index.js +1 -1
  21. package/dist/builtins/camera-grid/index.mjs +1 -1
  22. package/dist/builtins/composer/composer.addon.js +2 -2
  23. package/dist/builtins/composer/composer.addon.mjs +2 -2
  24. package/dist/builtins/console-logging/index.js +1 -1
  25. package/dist/builtins/console-logging/index.mjs +1 -1
  26. package/dist/builtins/core-blocks/core-blocks.addon.js +4 -6
  27. package/dist/builtins/core-blocks/core-blocks.addon.mjs +4 -6
  28. package/dist/builtins/device-history/device-history.addon.js +1 -1
  29. package/dist/builtins/device-history/device-history.addon.mjs +1 -1
  30. package/dist/builtins/device-manager/device-manager.addon.js +2 -4
  31. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -4
  32. package/dist/builtins/hub-forwarder/index.js +1 -1
  33. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  34. package/dist/builtins/keychain/index.js +41 -43
  35. package/dist/builtins/keychain/index.mjs +41 -43
  36. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  37. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  38. package/dist/builtins/local-auth/local-auth.addon.js +24 -40
  39. package/dist/builtins/local-auth/local-auth.addon.mjs +27 -43
  40. package/dist/builtins/local-network/local-network.addon.js +2 -2
  41. package/dist/builtins/local-network/local-network.addon.mjs +2 -2
  42. package/dist/builtins/loki-logging/index.js +1 -1
  43. package/dist/builtins/loki-logging/index.mjs +1 -1
  44. package/dist/builtins/native-metrics/native-metrics.addon.js +39 -4
  45. package/dist/builtins/native-metrics/native-metrics.addon.mjs +48 -13
  46. package/dist/builtins/native-metrics/node-metrics-history-recorder.d.ts +16 -2
  47. package/dist/builtins/platform-probe/coral-accelerators.d.ts +10 -1
  48. package/dist/builtins/platform-probe/index.js +7 -4
  49. package/dist/builtins/platform-probe/index.mjs +13 -10
  50. package/dist/builtins/platform-probe/platform-scorer.d.ts +4 -1
  51. package/dist/builtins/record-entries/index.js +1 -1
  52. package/dist/builtins/record-entries/index.mjs +1 -1
  53. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  54. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  55. package/dist/builtins/snapshot/index.js +1 -1
  56. package/dist/builtins/snapshot/index.mjs +1 -1
  57. package/dist/builtins/sqlite-storage/file-host-protocol.d.ts +0 -15
  58. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  59. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
  60. package/dist/builtins/sqlite-storage/index.js +1 -1
  61. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  62. package/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +0 -44
  63. package/dist/builtins/sqlite-storage/records/records-catalog.d.ts +0 -2
  64. package/dist/builtins/sqlite-storage/records/records-engine-types.d.ts +0 -21
  65. package/dist/builtins/sqlite-storage/records/records-engine.d.ts +3 -20
  66. package/dist/builtins/sqlite-storage/records/records-plan.d.ts +9 -4
  67. package/dist/builtins/sqlite-storage/records/records-provider.d.ts +4 -18
  68. package/dist/builtins/sqlite-storage/records/records-sql.d.ts +1 -1
  69. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +0 -17
  70. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +21 -196
  71. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +21 -196
  72. package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +6 -14
  73. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +2 -2
  74. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +7 -9
  75. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +7 -9
  76. package/dist/builtins/system-config/system-config.addon.js +667 -40
  77. package/dist/builtins/system-config/system-config.addon.mjs +737 -127
  78. package/dist/builtins/winston-logging/index.js +1 -1
  79. package/dist/builtins/winston-logging/index.mjs +1 -1
  80. package/dist/{composition-sources-BVguN7VV.mjs → composition-sources-DNRZWR1j.mjs} +1 -1
  81. package/dist/{composition-sources-DURQNDJ4.js → composition-sources-b0e_2I-D.js} +1 -1
  82. package/dist/{constants-Njka8Cv6.js → constants-6OeJiZgi.js} +1 -1
  83. package/dist/{constants-FGjnsE2x.mjs → constants-BnkOdj9Q.mjs} +1 -1
  84. package/dist/{coral-accelerators-DcnZvctM.mjs → coral-accelerators-Qhn5TOYZ.mjs} +18 -15
  85. package/dist/{coral-accelerators-Bi_c3Rft.js → coral-accelerators-oUXmmbc2.js} +13 -10
  86. package/dist/{custom-action-registry-stpC3Zy-.mjs → custom-action-registry-DStvrQKI.mjs} +37 -37
  87. package/dist/{device-ca-lEaAQ9Xi.mjs → device-ca-Bnkw8GyU.mjs} +1 -1
  88. package/dist/{device-ca-BrVK_5s3.js → device-ca-CPTDs--d.js} +1 -1
  89. package/dist/{dist-BZQjLPiz.js → dist-Bn-RNanh.js} +29 -130
  90. package/dist/{dist-B_GRPhnY.mjs → dist-Wy8cTxg6.mjs} +30 -113
  91. package/dist/file-host-worker.js +1 -1
  92. package/dist/file-host-worker.mjs +1 -1
  93. package/dist/{hub-mdns-ciao-Bg2HfTwP.mjs → hub-mdns-ciao-CJu0nhla.mjs} +2 -2
  94. package/dist/{hub-mdns-ciao-nce3TXs_.js → hub-mdns-ciao-CTBTlia4.js} +2 -2
  95. package/dist/index.d.ts +1 -0
  96. package/dist/index.js +56 -31
  97. package/dist/index.mjs +257 -233
  98. package/dist/kernel/deps/addon-deps-manager.d.ts +9 -0
  99. package/dist/{restore-archive-C7kLDI_0.mjs → restore-archive-CM23Pq9B.mjs} +177 -424
  100. package/dist/{restore-archive-FyfZ8YMC.js → restore-archive-DM1OBYq4.js} +89 -342
  101. package/dist/{wal-maintenance-Duejh7Lx.mjs → wal-maintenance-Bj_MmDkr.mjs} +0 -0
  102. package/dist/{wal-maintenance-DfSIOj24.js → wal-maintenance-CaJjuLHq.js} +0 -0
  103. package/package.json +1 -1
  104. package/dist/builtins/records/legacy-table-row-count.d.ts +0 -5
  105. package/dist/builtins/records/phase6-declare-gate.d.ts +0 -28
  106. package/dist/builtins/sqlite-storage/records/count-settings-array-legacy.d.ts +0 -5
  107. package/dist/builtins/sqlite-storage/records/count-settings-brokers-legacy.d.ts +0 -6
  108. package/dist/phase6-declare-gate-Dag1_WR2.js +0 -98
  109. package/dist/phase6-declare-gate-Lb-mrVvz.mjs +0 -93
@@ -1,9 +1,9 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { Gi as defineCustomActions, Ui as customAction, Zi as hydrateSchema, ni as BaseAddon, ti as errMsg, ut as ServerNameSchema, xr as shortHostname } from "../../dist-B_GRPhnY.mjs";
2
+ import { Ui as customAction, Wi as defineCustomActions, Xi as hydrateSchema, ni as BaseAddon, ti as errMsg, ut as ServerNameSchema, xr as shortHostname } from "../../dist-Wy8cTxg6.mjs";
3
3
  import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
4
- import { c as Pkcs10CertificateRequest } from "../../x509.es-DK__ETIe.mjs";
5
- import { a as MESH_CA_KEY_REF, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY } from "../../constants-FGjnsE2x.mjs";
6
- import { $ as generateMeshCa, B as setProcessAgentHttpsNames, H as MESH_NODE_CERTIFICATES_COLLECTION, I as AGENT_HTTPS_NAMES_COLLECTION, J as setProcessMeshCertificateRegistry, K as describeMeshLeaf, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, Q as exportMeshPrivateKeyPem, R as AgentHttpsNames, U as MESH_NODE_CERTIFICATES_COLUMNS, V as systemConfigRecordKinds, W as MeshCertificateRegistry, X as caFingerprintCompact, Z as createMeshCsrPem, at as subjectCn, et as generateMeshKeyPair, it as loadMeshCa, nt as issueMeshLeafForNode, rt as issueMeshLeafFromCsr, tt as isValidAgentNodeId, u as isPrivateAddress, z as getProcessAgentHttpsNames } from "../../agent-https-CQA3W-3e.mjs";
4
+ import { S as backdatedNotBefore, a as KeyUsageFlags, c as Pkcs10CertificateRequest, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, l as Pkcs10CertificateRequestGenerator, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension } from "../../x509.es-DK__ETIe.mjs";
5
+ import { B as setProcessAgentHttpsNames, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, R as AgentHttpsNames, V as systemConfigRecordKinds, u as isPrivateAddress, z as getProcessAgentHttpsNames } from "../../agent-https-Iw3RSQup.mjs";
6
+ import { a as MESH_CA_KEY_REF, c as SERVER_AUTH_OID, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, r as MESH_CA_COMMON_NAME, s as MESH_CA_VALIDITY_DAYS, t as CLIENT_AUTH_OID } from "../../constants-BnkOdj9Q.mjs";
7
7
  import { t as require_src } from "../../src-hG4grMU4.mjs";
8
8
  import { z } from "zod";
9
9
  import { X509Certificate, createHash, createPrivateKey, randomBytes, randomInt, sign, timingSafeEqual, verify, webcrypto } from "node:crypto";
@@ -288,8 +288,161 @@ function parsePayload(value) {
288
288
  };
289
289
  }
290
290
  //#endregion
291
+ //#region src/kernel/moleculer/mesh-mtls/mesh-ca.ts
292
+ /**
293
+ * Hub mesh CA — EC P-256, key in the keychain, cert in `cluster.meshCa`.
294
+ *
295
+ * Distinct from the HTTPS local CA (`tls/cert-issue.ts`, RSA): the mesh CA
296
+ * signs node leaves (CN = nodeID) and unlock-ticket JWS (ES256). Issuance uses
297
+ * `@peculiar/x509` over WebCrypto — same library the HTTPS path already uses
298
+ * (installed `1.14.3`; registry latest at adoption time was `2.1.0` — stay on
299
+ * the pinned range already shipping).
300
+ */
301
+ cryptoProvider.set(webcrypto);
302
+ var MS_PER_DAY = 864e5;
303
+ /** Key generation — EC P-256 (plan). WebCrypto DOM names are not in @types/node. */
304
+ var MESH_KEY_ALGORITHM = {
305
+ name: "ECDSA",
306
+ namedCurve: "P-256"
307
+ };
308
+ /** Signing — ECDSA with SHA-256. */
309
+ var MESH_SIGNING_ALGORITHM = {
310
+ name: "ECDSA",
311
+ hash: "SHA-256"
312
+ };
313
+ /** A node id: letters, digits, `.`, `_`, `-`; at most 63 characters; starts with a letter or digit. */
314
+ var NODE_ID_PATTERN = /^[a-z0-9][a-z0-9._-]{0,62}$/i;
315
+ /** Ids no agent may take: the hub's own, whatever the case (D857). */
316
+ var RESERVED_NODE_IDS = new Set(["hub"]);
317
+ /** True for an id an agent may carry: the pattern, and not a reserved name. */
318
+ function isValidAgentNodeId(nodeId) {
319
+ return NODE_ID_PATTERN.test(nodeId) && !RESERVED_NODE_IDS.has(nodeId.toLowerCase());
320
+ }
321
+ function freshSerial() {
322
+ return `00${randomBytes(16).toString("hex")}`;
323
+ }
324
+ function toPkcs8Pem(pkcs8) {
325
+ return `${PemConverter.encode(pkcs8, "PRIVATE KEY")}\n`;
326
+ }
327
+ function toCertPem(cert) {
328
+ return `${cert.toString("pem")}\n`;
329
+ }
330
+ async function exportKeyPem(key) {
331
+ return toPkcs8Pem(await webcrypto.subtle.exportKey("pkcs8", key));
332
+ }
333
+ /** SHA-256 fingerprint of the DER cert, colon-hex uppercase (Node style). */
334
+ function caFingerprint(certPem) {
335
+ return new X509Certificate(certPem).fingerprint256;
336
+ }
337
+ /** Compact fingerprint (lowercase hex, no colons). */
338
+ function caFingerprintCompact(certPem) {
339
+ return createHash("sha256").update(new X509Certificate(certPem).raw).digest("hex");
340
+ }
341
+ async function generateMeshCa(now = /* @__PURE__ */ new Date()) {
342
+ const keys = await webcrypto.subtle.generateKey(MESH_KEY_ALGORITHM, true, ["sign", "verify"]);
343
+ const extensions = [
344
+ new BasicConstraintsExtension(true, 0, true),
345
+ new KeyUsagesExtension(KeyUsageFlags.keyCertSign | KeyUsageFlags.cRLSign, true),
346
+ await SubjectKeyIdentifierExtension.create(keys.publicKey)
347
+ ];
348
+ const cert = await X509CertificateGenerator.createSelfSigned({
349
+ serialNumber: freshSerial(),
350
+ name: `CN=${MESH_CA_COMMON_NAME}`,
351
+ notBefore: backdatedNotBefore(now),
352
+ notAfter: new Date(now.getTime() + MESH_CA_VALIDITY_DAYS * MS_PER_DAY),
353
+ keys,
354
+ signingAlgorithm: MESH_SIGNING_ALGORITHM,
355
+ extensions
356
+ });
357
+ return {
358
+ certPem: toCertPem(cert),
359
+ keyPem: await exportKeyPem(keys.privateKey),
360
+ cert,
361
+ privateKey: keys.privateKey,
362
+ publicKey: keys.publicKey
363
+ };
364
+ }
365
+ async function loadMeshCa(certPem, keyPem) {
366
+ const cert = new X509Certificate$1(certPem);
367
+ return {
368
+ certPem,
369
+ keyPem,
370
+ cert,
371
+ privateKey: await webcrypto.subtle.importKey("pkcs8", PemConverter.decodeFirst(keyPem), MESH_KEY_ALGORITHM, true, ["sign"]),
372
+ publicKey: await cert.publicKey.export(webcrypto)
373
+ };
374
+ }
375
+ /**
376
+ * Issue a leaf from a CSR. CN must be present; when `expectedNodeId` is set
377
+ * it must match. Validity: 30 days.
378
+ */
379
+ async function issueMeshLeafFromCsr(ca, csrPem, opts = {}) {
380
+ const csr = new Pkcs10CertificateRequest(csrPem);
381
+ if (!await csr.verify(webcrypto)) throw new Error("CSR signature is invalid");
382
+ const cn = subjectCn(csr.subject);
383
+ if (cn === null || cn.length === 0) throw new Error("CSR subject has no CN");
384
+ if (opts.allowReserved !== true && !isValidAgentNodeId(cn)) throw new Error(`CSR CN '${cn}' is not an id an agent may carry`);
385
+ if (opts.expectedNodeId !== void 0 && opts.expectedNodeId !== cn) throw new Error(`CSR CN '${cn}' does not match the token nodeId '${opts.expectedNodeId}'`);
386
+ const now = opts.now ?? /* @__PURE__ */ new Date();
387
+ const validDays = opts.validDays ?? 30;
388
+ const serialNumber = freshSerial();
389
+ const notAfter = new Date(now.getTime() + validDays * MS_PER_DAY);
390
+ const extensions = [
391
+ new BasicConstraintsExtension(false, void 0, true),
392
+ new KeyUsagesExtension(KeyUsageFlags.digitalSignature, true),
393
+ new ExtendedKeyUsageExtension([SERVER_AUTH_OID, CLIENT_AUTH_OID]),
394
+ await SubjectKeyIdentifierExtension.create(csr.publicKey),
395
+ await AuthorityKeyIdentifierExtension.create(ca.cert)
396
+ ];
397
+ return {
398
+ certPem: toCertPem(await X509CertificateGenerator.create({
399
+ serialNumber,
400
+ subject: `CN=${cn}`,
401
+ issuer: ca.cert.subject,
402
+ notBefore: backdatedNotBefore(now),
403
+ notAfter,
404
+ publicKey: csr.publicKey,
405
+ signingKey: ca.privateKey,
406
+ signingAlgorithm: MESH_SIGNING_ALGORITHM,
407
+ extensions
408
+ })),
409
+ serialNumber,
410
+ notAfter,
411
+ commonName: cn
412
+ };
413
+ }
414
+ /** Issue a leaf for a known nodeID with a freshly generated key pair (tests / hub self). */
415
+ async function issueMeshLeafForNode(ca, nodeId, opts = {}) {
416
+ const keys = await webcrypto.subtle.generateKey(MESH_KEY_ALGORITHM, true, ["sign", "verify"]);
417
+ return {
418
+ ...await issueMeshLeafFromCsr(ca, await createMeshCsrPem(keys, nodeId), {
419
+ expectedNodeId: nodeId,
420
+ now: opts.now,
421
+ validDays: opts.validDays,
422
+ allowReserved: true
423
+ }),
424
+ keyPem: await exportKeyPem(keys.privateKey)
425
+ };
426
+ }
427
+ function subjectCn(subject) {
428
+ return /(?:^|,)\s*CN\s*=\s*([^,]+)/i.exec(subject)?.[1]?.trim() ?? null;
429
+ }
430
+ async function createMeshCsrPem(keys, commonName) {
431
+ return `${(await Pkcs10CertificateRequestGenerator.create({
432
+ name: `CN=${commonName}`,
433
+ keys,
434
+ signingAlgorithm: MESH_SIGNING_ALGORITHM
435
+ })).toString("pem")}\n`;
436
+ }
437
+ async function generateMeshKeyPair() {
438
+ return webcrypto.subtle.generateKey(MESH_KEY_ALGORITHM, true, ["sign", "verify"]);
439
+ }
440
+ async function exportMeshPrivateKeyPem(key) {
441
+ return exportKeyPem(key);
442
+ }
443
+ //#endregion
291
444
  //#region src/kernel/moleculer/mesh-mtls/mesh-ca-keeper.ts
292
- var SLOT$2 = Symbol.for("camstack.mesh.ca");
445
+ var SLOT$3 = Symbol.for("camstack.mesh.ca");
293
446
  var NOT_LOADED = {
294
447
  state: "unavailable",
295
448
  reason: "not-loaded"
@@ -301,10 +454,10 @@ function isState(value) {
301
454
  return state === "unavailable" && typeof Reflect.get(value, "reason") === "string";
302
455
  }
303
456
  function setProcessMeshCa(state) {
304
- Reflect.set(globalThis, SLOT$2, state);
457
+ Reflect.set(globalThis, SLOT$3, state);
305
458
  }
306
459
  function getProcessMeshCaState() {
307
- const value = Reflect.get(globalThis, SLOT$2);
460
+ const value = Reflect.get(globalThis, SLOT$3);
308
461
  return isState(value) ? value : NOT_LOADED;
309
462
  }
310
463
  function requireProcessMeshCa() {
@@ -446,10 +599,10 @@ async function loadOrGenerateMeshCa(deps) {
446
599
  var MeshCrl = class {
447
600
  serials = /* @__PURE__ */ new Set();
448
601
  revoke(serialNumber) {
449
- this.serials.add(normalizeSerial(serialNumber));
602
+ this.serials.add(normalizeSerial$1(serialNumber));
450
603
  }
451
604
  isRevoked(serialNumber) {
452
- return this.serials.has(normalizeSerial(serialNumber));
605
+ return this.serials.has(normalizeSerial$1(serialNumber));
453
606
  }
454
607
  list() {
455
608
  return [...this.serials];
@@ -457,21 +610,478 @@ var MeshCrl = class {
457
610
  /** Restore from persisted serials (system-settings). */
458
611
  replaceAll(serials) {
459
612
  this.serials.clear();
460
- for (const s of serials) this.serials.add(normalizeSerial(s));
613
+ for (const s of serials) this.serials.add(normalizeSerial$1(s));
461
614
  }
462
615
  };
463
- function normalizeSerial(serial) {
616
+ function normalizeSerial$1(serial) {
464
617
  return serial.replace(/^0x/i, "").replace(/:/g, "").toLowerCase();
465
618
  }
466
- var SLOT$1 = Symbol.for("camstack.mesh.crl");
619
+ var SLOT$2 = Symbol.for("camstack.mesh.crl");
467
620
  function processMeshCrl() {
468
- const existing = Reflect.get(globalThis, SLOT$1);
621
+ const existing = Reflect.get(globalThis, SLOT$2);
469
622
  if (existing instanceof MeshCrl) return existing;
470
623
  const crl = new MeshCrl();
471
- Reflect.set(globalThis, SLOT$1, crl);
624
+ Reflect.set(globalThis, SLOT$2, crl);
472
625
  return crl;
473
626
  }
474
627
  //#endregion
628
+ //#region src/kernel/moleculer/mesh-mtls/mesh-certificate-registry.ts
629
+ /**
630
+ * The hub's record of every mesh leaf (D856): which certificate each node holds,
631
+ * when it expires, and which serials are revoked.
632
+ *
633
+ * Three ways a row appears:
634
+ * - `enroll` / `renewal` / `boot` - the hub issued it and wrote it down at the
635
+ * moment of issuing (the authoritative record);
636
+ * - `observed` - a node enrolled before this record existed (or by a path that
637
+ * did not write it) presented this leaf on its LIVE mutual-TLS connection.
638
+ *
639
+ * Revoked serials are persisted here and replayed into the in-memory CRL at boot,
640
+ * so a revocation survives a hub restart. Hub only: agents persist none of it.
641
+ */
642
+ /**
643
+ * @durable class=config owner=system-config
644
+ * write="the hub records every mesh leaf it issues (enroll, renewal, boot) and every
645
+ * leaf a connected node is observed presenting; a revocation stamps revokedAt"
646
+ * retention="a revoked or expired row is kept 90 days past its end, then reaped; a
647
+ * live row is never deleted. Forgetting a node does not delete its rows."
648
+ */
649
+ var MESH_NODE_CERTIFICATES_COLLECTION = "mesh_node_certificates";
650
+ var MESH_NODE_CERTIFICATES_COLUMNS = [
651
+ {
652
+ name: "id",
653
+ type: "TEXT",
654
+ primaryKey: true,
655
+ notNull: true
656
+ },
657
+ {
658
+ name: "nodeId",
659
+ type: "TEXT",
660
+ notNull: true
661
+ },
662
+ {
663
+ name: "serial",
664
+ type: "TEXT",
665
+ notNull: true
666
+ },
667
+ {
668
+ name: "fingerprint",
669
+ type: "TEXT",
670
+ notNull: true
671
+ },
672
+ {
673
+ name: "notBefore",
674
+ type: "INTEGER",
675
+ notNull: true
676
+ },
677
+ {
678
+ name: "notAfter",
679
+ type: "INTEGER",
680
+ notNull: true
681
+ },
682
+ {
683
+ name: "issuedAt",
684
+ type: "INTEGER",
685
+ notNull: true
686
+ },
687
+ {
688
+ name: "issuedVia",
689
+ type: "TEXT",
690
+ notNull: true
691
+ },
692
+ {
693
+ name: "revokedAt",
694
+ type: "INTEGER"
695
+ },
696
+ {
697
+ name: "revokedReason",
698
+ type: "TEXT"
699
+ }
700
+ ];
701
+ var RETENTION_MS = 90 * 864e5;
702
+ /**
703
+ * A leaf the hub signed for a renewal that did not complete. It must not be the node's
704
+ * `current` leaf, but it is NOT on the CRL: the node may still hold it (the swap
705
+ * could have landed without the hub seeing it), and cutting it off would be the
706
+ * outage the hand-over exists to prevent. If the node is later seen presenting it, it
707
+ * is reinstated.
708
+ */
709
+ var RENEWAL_ABANDONED = "renewal-abandoned";
710
+ var VIAS = [
711
+ "enroll",
712
+ "pairing",
713
+ "renewal",
714
+ "boot",
715
+ "observed"
716
+ ];
717
+ /** CN, serial, fingerprint and validity of a leaf PEM (or DER). */
718
+ function describeMeshLeaf(cert) {
719
+ const x509 = new X509Certificate(cert);
720
+ return {
721
+ cn: subjectCn(x509.subject) ?? "",
722
+ serial: x509.serialNumber,
723
+ fingerprint: x509.fingerprint256,
724
+ notBefore: Date.parse(x509.validFrom),
725
+ notAfter: Date.parse(x509.validTo)
726
+ };
727
+ }
728
+ function normalizeSerial(serial) {
729
+ return serial.replace(/^0x/i, "").replace(/:/g, "").toLowerCase();
730
+ }
731
+ function parse$2(data) {
732
+ const str = (k) => {
733
+ const v = data[k];
734
+ return typeof v === "string" && v.length > 0 ? v : null;
735
+ };
736
+ const num = (k) => {
737
+ const v = data[k];
738
+ return typeof v === "number" && Number.isFinite(v) ? v : null;
739
+ };
740
+ const nodeId = str("nodeId");
741
+ const serial = str("serial");
742
+ const fingerprint = str("fingerprint");
743
+ const notBefore = num("notBefore");
744
+ const notAfter = num("notAfter");
745
+ const issuedAt = num("issuedAt");
746
+ if (nodeId === null || serial === null || fingerprint === null || notBefore === null || notAfter === null || issuedAt === null) return null;
747
+ return {
748
+ nodeId,
749
+ serial,
750
+ fingerprint,
751
+ notBefore,
752
+ notAfter,
753
+ issuedAt,
754
+ issuedVia: VIAS.find((v) => v === data["issuedVia"]) ?? "observed",
755
+ revokedAt: num("revokedAt"),
756
+ revokedReason: str("revokedReason")
757
+ };
758
+ }
759
+ var MeshCertificateRegistry = class {
760
+ store;
761
+ deps;
762
+ rows = /* @__PURE__ */ new Map();
763
+ constructor(store, deps = {}) {
764
+ this.store = store;
765
+ this.deps = deps;
766
+ }
767
+ recordToBody(record) {
768
+ return {
769
+ nodeId: record.nodeId,
770
+ serial: record.serial,
771
+ fingerprint: record.fingerprint,
772
+ notBefore: record.notBefore,
773
+ notAfter: record.notAfter,
774
+ issuedAt: record.issuedAt,
775
+ issuedVia: record.issuedVia,
776
+ revokedAt: record.revokedAt,
777
+ revokedReason: record.revokedReason
778
+ };
779
+ }
780
+ now() {
781
+ return (this.deps.now ?? Date.now)();
782
+ }
783
+ async load() {
784
+ const kind = this.deps.meshKind ?? null;
785
+ if (kind !== null) {
786
+ const page = await kind.query({ limit: 1e4 });
787
+ for (const row of page.records) {
788
+ const { fingerprint: _fp, ...body } = row.data;
789
+ const record = parse$2({
790
+ ...body,
791
+ fingerprint: row.id
792
+ });
793
+ if (record !== null) this.rows.set(record.fingerprint, record);
794
+ }
795
+ return;
796
+ }
797
+ const rows = await this.store.query.query({ collection: MESH_NODE_CERTIFICATES_COLLECTION });
798
+ for (const row of rows) {
799
+ const record = parse$2(row.data);
800
+ if (record !== null) this.rows.set(record.fingerprint, record);
801
+ }
802
+ }
803
+ /** Write down a leaf the hub just issued. Idempotent per fingerprint. */
804
+ async recordIssued(nodeId, certPem, via) {
805
+ const leaf = describeMeshLeaf(certPem);
806
+ const existing = this.rows.get(leaf.fingerprint);
807
+ if (existing !== void 0) return existing;
808
+ const record = {
809
+ nodeId,
810
+ serial: leaf.serial,
811
+ fingerprint: leaf.fingerprint,
812
+ notBefore: leaf.notBefore,
813
+ notAfter: leaf.notAfter,
814
+ issuedAt: this.now(),
815
+ issuedVia: via,
816
+ revokedAt: null,
817
+ revokedReason: null
818
+ };
819
+ await this.insert(record);
820
+ this.deps.logger?.info("Mesh certificate recorded", {
821
+ tags: { nodeId },
822
+ meta: {
823
+ via,
824
+ serial: leaf.serial,
825
+ notAfter: new Date(leaf.notAfter).toISOString()
826
+ }
827
+ });
828
+ return record;
829
+ }
830
+ /**
831
+ * A node was seen presenting `leaf` on its live connection. A leaf the hub already
832
+ * knows is left alone; an unknown one is recorded `observed` (a node enrolled
833
+ * before this record existed).
834
+ */
835
+ async recordObserved(nodeId, leaf) {
836
+ const known = this.rows.get(leaf.fingerprint);
837
+ if (known !== void 0) {
838
+ if (known.revokedReason !== "renewal-abandoned") return known.revokedAt === null ? this.abandonRenewalsNewerThan(known) : false;
839
+ const reinstated = {
840
+ ...known,
841
+ revokedAt: null,
842
+ revokedReason: null
843
+ };
844
+ this.rows.set(known.fingerprint, reinstated);
845
+ await this.persist(reinstated);
846
+ this.deps.logger?.warn("An abandoned renewal leaf is in use - reinstated", {
847
+ tags: { nodeId },
848
+ meta: { serial: known.serial }
849
+ });
850
+ return true;
851
+ }
852
+ const record = {
853
+ nodeId,
854
+ serial: leaf.serial,
855
+ fingerprint: leaf.fingerprint,
856
+ notBefore: leaf.notBefore,
857
+ notAfter: leaf.notAfter,
858
+ issuedAt: this.now(),
859
+ issuedVia: "observed",
860
+ revokedAt: null,
861
+ revokedReason: null
862
+ };
863
+ await this.insert(record);
864
+ this.deps.logger?.info("Mesh certificate observed on a live connection and recorded", {
865
+ tags: { nodeId },
866
+ meta: {
867
+ serial: leaf.serial,
868
+ fingerprint: leaf.fingerprint
869
+ }
870
+ });
871
+ return true;
872
+ }
873
+ list(nodeId) {
874
+ return [...this.rows.values()].filter((r) => nodeId === void 0 || r.nodeId === nodeId).toSorted((a, b) => b.issuedAt - a.issuedAt);
875
+ }
876
+ /** The newest non-revoked leaf of a node, or `undefined`. */
877
+ currentFor(nodeId) {
878
+ return this.list(nodeId).find((r) => r.revokedAt === null);
879
+ }
880
+ /** Every non-revoked leaf of a node (a renewal in flight has two). */
881
+ liveFor(nodeId) {
882
+ return this.list(nodeId).filter((r) => r.revokedAt === null);
883
+ }
884
+ /** Stamp a leaf revoked (and mirror it into `crl`). `false` when unknown or already revoked. */
885
+ async revoke(fingerprint, reason, crl) {
886
+ const record = this.rows.get(fingerprint);
887
+ if (record === void 0 || record.revokedAt !== null) return false;
888
+ const revoked = {
889
+ ...record,
890
+ revokedAt: this.now(),
891
+ revokedReason: reason
892
+ };
893
+ this.rows.set(fingerprint, revoked);
894
+ crl?.revoke(record.serial);
895
+ await this.persist(revoked);
896
+ this.deps.logger?.warn("Mesh certificate revoked", {
897
+ tags: { nodeId: record.nodeId },
898
+ meta: {
899
+ serial: record.serial,
900
+ reason
901
+ }
902
+ });
903
+ return true;
904
+ }
905
+ /**
906
+ * Operator revocation of a whole node: EVERY leaf of the node that is not already on the
907
+ * CRL goes on it - the current one, an observed one, a renewal one, and a leaf that was set
908
+ * aside (`renewal-abandoned`: a copy of it may sit on a stolen box, and it must not stay
909
+ * valid just because the hub once set it aside). Returns the serials put on the CRL.
910
+ * A leaf revoked this way is never reinstated by `recordObserved`.
911
+ */
912
+ async revokeAllForNode(nodeId, reason, crl, keepFingerprint) {
913
+ const serials = [];
914
+ for (const record of this.list(nodeId)) {
915
+ if (keepFingerprint !== void 0 && record.fingerprint === keepFingerprint) continue;
916
+ if (record.revokedAt !== null && record.revokedReason !== "renewal-abandoned") continue;
917
+ const revoked = {
918
+ ...record,
919
+ revokedAt: record.revokedAt ?? this.now(),
920
+ revokedReason: reason
921
+ };
922
+ this.rows.set(record.fingerprint, revoked);
923
+ crl.revoke(record.serial);
924
+ await this.persist(revoked);
925
+ serials.push(record.serial);
926
+ }
927
+ if (serials.length > 0) this.deps.logger?.warn("Every mesh certificate of the node revoked", {
928
+ tags: { nodeId },
929
+ meta: {
930
+ serials,
931
+ reason
932
+ }
933
+ });
934
+ return serials;
935
+ }
936
+ /**
937
+ * At boot: a node with TWO live leaves had a renewal in flight when the hub stopped. The
938
+ * newer (renewal) one is set aside - it is not the node's current leaf until the node is
939
+ * seen presenting it, which reinstates it. It is NOT put on the CRL.
940
+ */
941
+ async settleInterruptedRenewals() {
942
+ let settled = 0;
943
+ const byNode = /* @__PURE__ */ new Map();
944
+ for (const record of this.rows.values()) {
945
+ if (record.revokedAt !== null) continue;
946
+ byNode.set(record.nodeId, [...byNode.get(record.nodeId) ?? [], record]);
947
+ }
948
+ for (const records of byNode.values()) {
949
+ if (records.length < 2) continue;
950
+ for (const record of records) if (record.issuedVia === "renewal" && await this.abandon(record.fingerprint)) settled += 1;
951
+ }
952
+ return settled;
953
+ }
954
+ /** Set a never-completed renewal leaf aside (not current, NOT on the CRL). */
955
+ /** Fingerprints of renewal leaves whose handover is running right now (this process only). */
956
+ renewalsInFlight = /* @__PURE__ */ new Set();
957
+ /**
958
+ * A renewal's leaf is "in flight" from signing until the handover ends. While it is, a node seen
959
+ * presenting its OLD leaf is simply not swapped yet: the new leaf is not set aside (that would
960
+ * flap set-aside / reinstate on the node's first connection with it).
961
+ */
962
+ beginRenewal(fingerprint) {
963
+ this.renewalsInFlight.add(fingerprint);
964
+ }
965
+ endRenewal(fingerprint) {
966
+ this.renewalsInFlight.delete(fingerprint);
967
+ }
968
+ async abandonRenewalsNewerThan(presented) {
969
+ let changed = false;
970
+ for (const record of this.liveFor(presented.nodeId)) {
971
+ if (record.fingerprint === presented.fingerprint) continue;
972
+ if (record.issuedVia !== "renewal" || record.issuedAt <= presented.issuedAt) continue;
973
+ if (this.renewalsInFlight.has(record.fingerprint)) continue;
974
+ if (await this.abandon(record.fingerprint)) changed = true;
975
+ }
976
+ return changed;
977
+ }
978
+ async abandon(fingerprint) {
979
+ const record = this.rows.get(fingerprint);
980
+ if (record === void 0 || record.revokedAt !== null) return false;
981
+ const abandoned = {
982
+ ...record,
983
+ revokedAt: this.now(),
984
+ revokedReason: RENEWAL_ABANDONED
985
+ };
986
+ this.rows.set(fingerprint, abandoned);
987
+ await this.persist(abandoned);
988
+ this.deps.logger?.warn("Renewal leaf set aside (not current, not on the CRL)", {
989
+ tags: { nodeId: record.nodeId },
990
+ meta: { serial: record.serial }
991
+ });
992
+ return true;
993
+ }
994
+ /** Replay every persisted revocation into `crl` (hub boot). Set-aside leaves are not revocations. */
995
+ restoreCrl(crl) {
996
+ let restored = 0;
997
+ for (const record of this.rows.values()) {
998
+ if (record.revokedAt === null || record.revokedReason === "renewal-abandoned") continue;
999
+ crl.revoke(record.serial);
1000
+ restored += 1;
1001
+ }
1002
+ return restored;
1003
+ }
1004
+ /** Is `serial` listed as revoked here? */
1005
+ isRevoked(serial) {
1006
+ const wanted = normalizeSerial(serial);
1007
+ for (const record of this.rows.values()) if (record.revokedAt !== null && record.revokedReason !== "renewal-abandoned" && normalizeSerial(record.serial) === wanted) return true;
1008
+ return false;
1009
+ }
1010
+ async reap() {
1011
+ const cutoff = this.now() - RETENTION_MS;
1012
+ const dead = [...this.rows.values()].filter((r) => (r.revokedAt ?? r.notAfter) < cutoff);
1013
+ for (const r of dead) {
1014
+ this.rows.delete(r.fingerprint);
1015
+ await this.deleteRow(r.fingerprint);
1016
+ }
1017
+ return dead.length;
1018
+ }
1019
+ async insert(record) {
1020
+ this.rows.set(record.fingerprint, record);
1021
+ const kind = this.deps.meshKind ?? null;
1022
+ if (kind !== null) {
1023
+ const parsed = systemConfigRecordKinds["mesh-node-certificates"].schema.safeParse(this.recordToBody(record));
1024
+ if (!parsed.success) throw new Error(parsed.error.message);
1025
+ await kind.put({
1026
+ id: record.fingerprint,
1027
+ data: parsed.data
1028
+ });
1029
+ return;
1030
+ }
1031
+ await this.store.insert.mutate({
1032
+ collection: MESH_NODE_CERTIFICATES_COLLECTION,
1033
+ record: {
1034
+ id: record.fingerprint,
1035
+ data: { ...record }
1036
+ }
1037
+ });
1038
+ }
1039
+ async deleteRow(fingerprint) {
1040
+ const kind = this.deps.meshKind ?? null;
1041
+ if (kind !== null) {
1042
+ await kind.delete(fingerprint);
1043
+ return;
1044
+ }
1045
+ await this.store.delete.mutate({
1046
+ collection: MESH_NODE_CERTIFICATES_COLLECTION,
1047
+ key: fingerprint
1048
+ });
1049
+ }
1050
+ async persist(record) {
1051
+ try {
1052
+ const kind = this.deps.meshKind ?? null;
1053
+ if (kind !== null) {
1054
+ const parsed = systemConfigRecordKinds["mesh-node-certificates"].schema.safeParse(this.recordToBody(record));
1055
+ if (!parsed.success) throw new Error(parsed.error.message);
1056
+ await kind.put({
1057
+ id: record.fingerprint,
1058
+ data: parsed.data
1059
+ });
1060
+ return;
1061
+ }
1062
+ await this.store.update.mutate({
1063
+ collection: MESH_NODE_CERTIFICATES_COLLECTION,
1064
+ id: record.fingerprint,
1065
+ data: { ...record }
1066
+ });
1067
+ } catch (error) {
1068
+ this.deps.logger?.error("Mesh certificate write failed - the change holds until restart", {
1069
+ tags: { nodeId: record.nodeId },
1070
+ meta: { error: error instanceof Error ? error.message : String(error) }
1071
+ });
1072
+ }
1073
+ }
1074
+ };
1075
+ var SLOT$1 = Symbol.for("camstack.mesh.certificate-registry");
1076
+ function setProcessMeshCertificateRegistry(registry) {
1077
+ if (registry === null) Reflect.deleteProperty(globalThis, SLOT$1);
1078
+ else Reflect.set(globalThis, SLOT$1, registry);
1079
+ }
1080
+ function getProcessMeshCertificateRegistry() {
1081
+ const value = Reflect.get(globalThis, SLOT$1);
1082
+ return value !== null && typeof value === "object" && typeof Reflect.get(value, "recordIssued") === "function" ? value : null;
1083
+ }
1084
+ //#endregion
475
1085
  //#region src/kernel/moleculer/mesh-mtls/mesh-tls-gate.ts
476
1086
  var STATE_SLOT = Symbol.for("camstack.mesh.tls-listener-state");
477
1087
  function setProcessMeshTlsListenerState(state) {
@@ -20803,7 +21413,7 @@ var require_utils$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20803
21413
  var kleur = require_kleur();
20804
21414
  var os$17 = __require("os");
20805
21415
  var path$39 = __require("path");
20806
- var fs$18 = __require("fs");
21416
+ var fs$19 = __require("fs");
20807
21417
  var { TimeoutError } = require_errors$2();
20808
21418
  var lut = [];
20809
21419
  for (let i = 0; i < 256; i++) lut[i] = (i < 16 ? "0" : "") + i.toString(16);
@@ -21096,7 +21706,7 @@ var require_utils$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
21096
21706
  makeDirs(p) {
21097
21707
  p.split(path$39.sep).reduce((prevPath, folder) => {
21098
21708
  const currentPath = path$39.join(prevPath, folder, path$39.sep);
21099
- if (!fs$18.existsSync(currentPath)) fs$18.mkdirSync(currentPath);
21709
+ if (!fs$19.existsSync(currentPath)) fs$19.mkdirSync(currentPath);
21100
21710
  return currentPath;
21101
21711
  }, "");
21102
21712
  },
@@ -22322,7 +22932,7 @@ var require_csv = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22322
22932
  var { makeDirs } = require_utils$3();
22323
22933
  var _ = require_lodash();
22324
22934
  var path$38 = __require("path");
22325
- var fs$17 = __require("fs");
22935
+ var fs$18 = __require("fs");
22326
22936
  var METRIC = require_constants$6();
22327
22937
  var MODE_METRIC = "metric";
22328
22938
  var MODE_LABEL = "label";
@@ -22481,8 +23091,8 @@ var require_csv = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22481
23091
  */
22482
23092
  writeRow(filename, headers, fields) {
22483
23093
  try {
22484
- if (!fs$17.existsSync(filename)) fs$17.writeFileSync(filename, headers.join(this.opts.delimiter) + this.opts.rowDelimiter);
22485
- fs$17.appendFileSync(filename, fields.join(this.opts.delimiter) + this.opts.rowDelimiter);
23094
+ if (!fs$18.existsSync(filename)) fs$18.writeFileSync(filename, headers.join(this.opts.delimiter) + this.opts.rowDelimiter);
23095
+ fs$18.appendFileSync(filename, fields.join(this.opts.delimiter) + this.opts.rowDelimiter);
22486
23096
  } catch (err) {
22487
23097
  /* istanbul ignore next */
22488
23098
  this.logger.error(`Unable to write metrics values to the '${filename}' file. Error: ${err.message}`, fields, err);
@@ -30514,7 +31124,7 @@ var require_process$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
30514
31124
  //#endregion
30515
31125
  //#region ../../node_modules/detect-libc/lib/filesystem.js
30516
31126
  var require_filesystem = /* @__PURE__ */ __commonJSMin(((exports, module) => {
30517
- var fs$16 = __require("fs");
31127
+ var fs$17 = __require("fs");
30518
31128
  var LDD_PATH = "/usr/bin/ldd";
30519
31129
  var SELF_PATH = "/proc/self/exe";
30520
31130
  var MAX_LENGTH = 2048;
@@ -30525,10 +31135,10 @@ var require_filesystem = /* @__PURE__ */ __commonJSMin(((exports, module) => {
30525
31135
  * @returns {Buffer}
30526
31136
  */
30527
31137
  var readFileSync = (path) => {
30528
- const fd = fs$16.openSync(path, "r");
31138
+ const fd = fs$17.openSync(path, "r");
30529
31139
  const buffer = Buffer.alloc(MAX_LENGTH);
30530
- const bytesRead = fs$16.readSync(fd, buffer, 0, MAX_LENGTH, 0);
30531
- fs$16.close(fd, () => {});
31140
+ const bytesRead = fs$17.readSync(fd, buffer, 0, MAX_LENGTH, 0);
31141
+ fs$17.close(fd, () => {});
30532
31142
  return buffer.subarray(0, bytesRead);
30533
31143
  };
30534
31144
  /**
@@ -30538,13 +31148,13 @@ var require_filesystem = /* @__PURE__ */ __commonJSMin(((exports, module) => {
30538
31148
  * @returns {Promise<Buffer>}
30539
31149
  */
30540
31150
  var readFile = (path) => new Promise((resolve, reject) => {
30541
- fs$16.open(path, "r", (err, fd) => {
31151
+ fs$17.open(path, "r", (err, fd) => {
30542
31152
  if (err) reject(err);
30543
31153
  else {
30544
31154
  const buffer = Buffer.alloc(MAX_LENGTH);
30545
- fs$16.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
31155
+ fs$17.read(fd, buffer, 0, MAX_LENGTH, 0, (_, bytesRead) => {
30546
31156
  resolve(buffer.subarray(0, bytesRead));
30547
- fs$16.close(fd, () => {});
31157
+ fs$17.close(fd, () => {});
30548
31158
  });
30549
31159
  }
30550
31160
  });
@@ -30797,7 +31407,7 @@ var require_detect_libc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
30797
31407
  //#endregion
30798
31408
  //#region ../../node_modules/node-gyp-build-optional-packages/index.js
30799
31409
  var require_node_gyp_build_optional_packages = /* @__PURE__ */ __commonJSMin(((exports, module) => {
30800
- var fs$15 = __require("fs");
31410
+ var fs$16 = __require("fs");
30801
31411
  var path$37 = __require("path");
30802
31412
  var url$2 = __require("url");
30803
31413
  var vars = process.config && process.config.variables || {};
@@ -30864,7 +31474,7 @@ var require_node_gyp_build_optional_packages = /* @__PURE__ */ __commonJSMin(((e
30864
31474
  };
30865
31475
  function readdirSync(dir) {
30866
31476
  try {
30867
- return fs$15.readdirSync(dir);
31477
+ return fs$16.readdirSync(dir);
30868
31478
  } catch (err) {
30869
31479
  return [];
30870
31480
  }
@@ -36343,7 +36953,7 @@ var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
36343
36953
  var require_file$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
36344
36954
  var FormattedLogger = require_formatted();
36345
36955
  var _ = require_lodash();
36346
- var fs$14 = __require("fs/promises");
36956
+ var fs$15 = __require("fs/promises");
36347
36957
  var path$36 = __require("path");
36348
36958
  var os$11 = __require("os");
36349
36959
  var { makeDirs } = require_utils$3();
@@ -36447,7 +37057,7 @@ var require_file$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
36447
37057
  const rows = Array.from(this.queue);
36448
37058
  this.queue.length = 0;
36449
37059
  const buf = rows.join(this.opts.eol) + this.opts.eol;
36450
- return fs$14.appendFile(filename, buf).catch((err) => {
37060
+ return fs$15.appendFile(filename, buf).catch((err) => {
36451
37061
  /* istanbul ignore next */
36452
37062
  console.debug("Unable to write log file:", filename, err);
36453
37063
  });
@@ -37965,7 +38575,7 @@ var require_clone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
37965
38575
  //#endregion
37966
38576
  //#region ../../node_modules/graceful-fs/graceful-fs.js
37967
38577
  var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
37968
- var fs$13 = __require("fs");
38578
+ var fs$14 = __require("fs");
37969
38579
  var polyfills = require_polyfills();
37970
38580
  var legacy = require_legacy_streams();
37971
38581
  var clone = require_clone();
@@ -37994,36 +38604,36 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
37994
38604
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
37995
38605
  console.error(m);
37996
38606
  };
37997
- if (!fs$13[gracefulQueue]) {
37998
- publishQueue(fs$13, global[gracefulQueue] || []);
37999
- fs$13.close = (function(fs$close) {
38607
+ if (!fs$14[gracefulQueue]) {
38608
+ publishQueue(fs$14, global[gracefulQueue] || []);
38609
+ fs$14.close = (function(fs$close) {
38000
38610
  function close(fd, cb) {
38001
- return fs$close.call(fs$13, fd, function(err) {
38611
+ return fs$close.call(fs$14, fd, function(err) {
38002
38612
  if (!err) resetQueue();
38003
38613
  if (typeof cb === "function") cb.apply(this, arguments);
38004
38614
  });
38005
38615
  }
38006
38616
  Object.defineProperty(close, previousSymbol, { value: fs$close });
38007
38617
  return close;
38008
- })(fs$13.close);
38009
- fs$13.closeSync = (function(fs$closeSync) {
38618
+ })(fs$14.close);
38619
+ fs$14.closeSync = (function(fs$closeSync) {
38010
38620
  function closeSync(fd) {
38011
- fs$closeSync.apply(fs$13, arguments);
38621
+ fs$closeSync.apply(fs$14, arguments);
38012
38622
  resetQueue();
38013
38623
  }
38014
38624
  Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
38015
38625
  return closeSync;
38016
- })(fs$13.closeSync);
38626
+ })(fs$14.closeSync);
38017
38627
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
38018
- debug(fs$13[gracefulQueue]);
38019
- __require("assert").equal(fs$13[gracefulQueue].length, 0);
38628
+ debug(fs$14[gracefulQueue]);
38629
+ __require("assert").equal(fs$14[gracefulQueue].length, 0);
38020
38630
  });
38021
38631
  }
38022
- if (!global[gracefulQueue]) publishQueue(global, fs$13[gracefulQueue]);
38023
- module.exports = patch(clone(fs$13));
38024
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$13.__patched) {
38025
- module.exports = patch(fs$13);
38026
- fs$13.__patched = true;
38632
+ if (!global[gracefulQueue]) publishQueue(global, fs$14[gracefulQueue]);
38633
+ module.exports = patch(clone(fs$14));
38634
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$14.__patched) {
38635
+ module.exports = patch(fs$14);
38636
+ fs$14.__patched = true;
38027
38637
  }
38028
38638
  function patch(fs) {
38029
38639
  polyfills(fs);
@@ -38278,23 +38888,23 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
38278
38888
  }
38279
38889
  function enqueue(elem) {
38280
38890
  debug("ENQUEUE", elem[0].name, elem[1]);
38281
- fs$13[gracefulQueue].push(elem);
38891
+ fs$14[gracefulQueue].push(elem);
38282
38892
  retry();
38283
38893
  }
38284
38894
  var retryTimer;
38285
38895
  function resetQueue() {
38286
38896
  var now = Date.now();
38287
- for (var i = 0; i < fs$13[gracefulQueue].length; ++i) if (fs$13[gracefulQueue][i].length > 2) {
38288
- fs$13[gracefulQueue][i][3] = now;
38289
- fs$13[gracefulQueue][i][4] = now;
38897
+ for (var i = 0; i < fs$14[gracefulQueue].length; ++i) if (fs$14[gracefulQueue][i].length > 2) {
38898
+ fs$14[gracefulQueue][i][3] = now;
38899
+ fs$14[gracefulQueue][i][4] = now;
38290
38900
  }
38291
38901
  retry();
38292
38902
  }
38293
38903
  function retry() {
38294
38904
  clearTimeout(retryTimer);
38295
38905
  retryTimer = void 0;
38296
- if (fs$13[gracefulQueue].length === 0) return;
38297
- var elem = fs$13[gracefulQueue].shift();
38906
+ if (fs$14[gracefulQueue].length === 0) return;
38907
+ var elem = fs$14[gracefulQueue].shift();
38298
38908
  var fn = elem[0];
38299
38909
  var args = elem[1];
38300
38910
  var err = elem[2];
@@ -38313,7 +38923,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
38313
38923
  if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
38314
38924
  debug("RETRY", fn.name, args);
38315
38925
  fn.apply(null, args.concat([startTime]));
38316
- } else fs$13[gracefulQueue].push(elem);
38926
+ } else fs$14[gracefulQueue].push(elem);
38317
38927
  }
38318
38928
  if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
38319
38929
  }
@@ -39868,9 +40478,9 @@ var require_output = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39868
40478
  //#region ../../node_modules/streamroller/node_modules/fs-extra/lib/index.js
39869
40479
  var require_lib$4 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39870
40480
  module.exports = Object.assign({}, require_fs(), require_copy_sync(), require_copy(), require_empty(), require_ensure(), require_json(), require_mkdirs(), require_move_sync(), require_move(), require_output(), require_path_exists(), require_remove());
39871
- var fs$12 = __require("fs");
39872
- if (Object.getOwnPropertyDescriptor(fs$12, "promises")) Object.defineProperty(module.exports, "promises", { get() {
39873
- return fs$12.promises;
40481
+ var fs$13 = __require("fs");
40482
+ if (Object.getOwnPropertyDescriptor(fs$13, "promises")) Object.defineProperty(module.exports, "promises", { get() {
40483
+ return fs$13.promises;
39874
40484
  } });
39875
40485
  }));
39876
40486
  //#endregion
@@ -40534,12 +41144,12 @@ var require_dateFile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
40534
41144
  var require_fileSync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
40535
41145
  var debug = require_src()("log4js:fileSync");
40536
41146
  var path$13 = __require("path");
40537
- var fs$11 = __require("fs");
41147
+ var fs$12 = __require("fs");
40538
41148
  var eol = __require("os").EOL || "\n";
40539
41149
  function touchFile(file, options) {
40540
- if (fs$11.existsSync(file)) return;
40541
- const id = fs$11.openSync(file, options.flags, options.mode);
40542
- fs$11.closeSync(id);
41150
+ if (fs$12.existsSync(file)) return;
41151
+ const id = fs$12.openSync(file, options.flags, options.mode);
41152
+ fs$12.closeSync(id);
40543
41153
  }
40544
41154
  var RollingFileSync = class {
40545
41155
  constructor(filename, size, backups, options) {
@@ -40556,7 +41166,7 @@ var require_fileSync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
40556
41166
  function currentFileSize(file) {
40557
41167
  let fileSize = 0;
40558
41168
  try {
40559
- fileSize = fs$11.statSync(file).size;
41169
+ fileSize = fs$12.statSync(file).size;
40560
41170
  } catch (e) {
40561
41171
  touchFile(file, options);
40562
41172
  }
@@ -40587,15 +41197,15 @@ var require_fileSync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
40587
41197
  debug(`Index of ${fileToRename} is ${idx}`);
40588
41198
  if (idx < that.backups) {
40589
41199
  try {
40590
- fs$11.unlinkSync(`${filename}.${idx + 1}`);
41200
+ fs$12.unlinkSync(`${filename}.${idx + 1}`);
40591
41201
  } catch (e) {}
40592
41202
  debug(`Renaming ${fileToRename} -> ${filename}.${idx + 1}`);
40593
- fs$11.renameSync(path$13.join(path$13.dirname(filename), fileToRename), `${filename}.${idx + 1}`);
41203
+ fs$12.renameSync(path$13.join(path$13.dirname(filename), fileToRename), `${filename}.${idx + 1}`);
40594
41204
  }
40595
41205
  }
40596
41206
  function renameTheFiles() {
40597
41207
  debug("Renaming the old files");
40598
- fs$11.readdirSync(path$13.dirname(filename)).filter(justTheseFiles).sort(byIndex).reverse().forEach(increaseFileIndex);
41208
+ fs$12.readdirSync(path$13.dirname(filename)).filter(justTheseFiles).sort(byIndex).reverse().forEach(increaseFileIndex);
40599
41209
  }
40600
41210
  debug("Rolling, rolling, rolling");
40601
41211
  renameTheFiles();
@@ -40605,7 +41215,7 @@ var require_fileSync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
40605
41215
  function writeTheChunk() {
40606
41216
  debug("writing the chunk to the file");
40607
41217
  that.currentSize += chunk.length;
40608
- fs$11.appendFileSync(that.filename, chunk);
41218
+ fs$12.appendFileSync(that.filename, chunk);
40609
41219
  }
40610
41220
  debug("in write");
40611
41221
  if (this.shouldRoll()) {
@@ -40640,7 +41250,7 @@ var require_fileSync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
40640
41250
  else stream = ((f) => {
40641
41251
  touchFile(f, options);
40642
41252
  return { write(data) {
40643
- fs$11.appendFileSync(f, data);
41253
+ fs$12.appendFileSync(f, data);
40644
41254
  } };
40645
41255
  })(filePath);
40646
41256
  return stream;
@@ -41239,7 +41849,7 @@ var require_log4js$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
41239
41849
  * Website: http://log4js.berlios.de
41240
41850
  */
41241
41851
  var debug = require_src()("log4js:main");
41242
- var fs$10 = __require("fs");
41852
+ var fs$11 = __require("fs");
41243
41853
  var deepClone = require_rfdc()({ proto: true });
41244
41854
  var configuration = require_configuration();
41245
41855
  var layouts = require_layouts();
@@ -41260,7 +41870,7 @@ var require_log4js$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
41260
41870
  function loadConfigurationFile(filename) {
41261
41871
  debug(`Loading configuration from ${filename}`);
41262
41872
  try {
41263
- return JSON.parse(fs$10.readFileSync(filename, "utf8"));
41873
+ return JSON.parse(fs$11.readFileSync(filename, "utf8"));
41264
41874
  } catch (e) {
41265
41875
  throw new Error(`Problem reading config from file "${filename}". Error was ${e.message}`, e);
41266
41876
  }
@@ -42348,7 +42958,7 @@ var require_atomic_sleep = /* @__PURE__ */ __commonJSMin(((exports, module) => {
42348
42958
  //#endregion
42349
42959
  //#region ../../node_modules/sonic-boom/index.js
42350
42960
  var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
42351
- var fs$9 = __require("fs");
42961
+ var fs$10 = __require("fs");
42352
42962
  var EventEmitter$8 = __require("events");
42353
42963
  var inherits = __require("util").inherits;
42354
42964
  var path$11 = __require("path");
@@ -42391,17 +43001,17 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
42391
43001
  const flags = sonic.append ? "a" : "w";
42392
43002
  const mode = sonic.mode;
42393
43003
  if (sonic.sync) try {
42394
- if (sonic.mkdir) fs$9.mkdirSync(path$11.dirname(file), { recursive: true });
42395
- fileOpened(null, fs$9.openSync(file, flags, mode));
43004
+ if (sonic.mkdir) fs$10.mkdirSync(path$11.dirname(file), { recursive: true });
43005
+ fileOpened(null, fs$10.openSync(file, flags, mode));
42396
43006
  } catch (err) {
42397
43007
  fileOpened(err);
42398
43008
  throw err;
42399
43009
  }
42400
- else if (sonic.mkdir) fs$9.mkdir(path$11.dirname(file), { recursive: true }, (err) => {
43010
+ else if (sonic.mkdir) fs$10.mkdir(path$11.dirname(file), { recursive: true }, (err) => {
42401
43011
  if (err) return fileOpened(err);
42402
- fs$9.open(file, flags, mode, fileOpened);
43012
+ fs$10.open(file, flags, mode, fileOpened);
42403
43013
  });
42404
- else fs$9.open(file, flags, mode, fileOpened);
43014
+ else fs$10.open(file, flags, mode, fileOpened);
42405
43015
  }
42406
43016
  function SonicBoom(opts) {
42407
43017
  if (!(this instanceof SonicBoom)) return new SonicBoom(opts);
@@ -42439,8 +43049,8 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
42439
43049
  this.flush = flushBuffer;
42440
43050
  this.flushSync = flushBufferSync;
42441
43051
  this._actualWrite = actualWriteBuffer;
42442
- fsWriteSync = () => fs$9.writeSync(this.fd, this._writingBuf);
42443
- fsWrite = () => fs$9.write(this.fd, this._writingBuf, this.release);
43052
+ fsWriteSync = () => fs$10.writeSync(this.fd, this._writingBuf);
43053
+ fsWrite = () => fs$10.write(this.fd, this._writingBuf, this.release);
42444
43054
  } else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
42445
43055
  this._writingBuf = "";
42446
43056
  this.write = write;
@@ -42448,12 +43058,12 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
42448
43058
  this.flushSync = flushSync;
42449
43059
  this._actualWrite = actualWrite;
42450
43060
  fsWriteSync = () => {
42451
- if (Buffer.isBuffer(this._writingBuf)) return fs$9.writeSync(this.fd, this._writingBuf);
42452
- return fs$9.writeSync(this.fd, this._writingBuf, "utf8");
43061
+ if (Buffer.isBuffer(this._writingBuf)) return fs$10.writeSync(this.fd, this._writingBuf);
43062
+ return fs$10.writeSync(this.fd, this._writingBuf, "utf8");
42453
43063
  };
42454
43064
  fsWrite = () => {
42455
- if (Buffer.isBuffer(this._writingBuf)) return fs$9.write(this.fd, this._writingBuf, this.release);
42456
- return fs$9.write(this.fd, this._writingBuf, "utf8", this.release);
43065
+ if (Buffer.isBuffer(this._writingBuf)) return fs$10.write(this.fd, this._writingBuf, this.release);
43066
+ return fs$10.write(this.fd, this._writingBuf, "utf8", this.release);
42457
43067
  };
42458
43068
  } else throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
42459
43069
  if (typeof fd === "number") {
@@ -42498,7 +43108,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
42498
43108
  return;
42499
43109
  }
42500
43110
  }
42501
- if (this._fsync) fs$9.fsyncSync(this.fd);
43111
+ if (this._fsync) fs$10.fsyncSync(this.fd);
42502
43112
  const len = this._len;
42503
43113
  if (this._reopening) {
42504
43114
  this._writing = false;
@@ -42595,7 +43205,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
42595
43205
  this._flushPending = true;
42596
43206
  const onDrain = () => {
42597
43207
  if (!this._fsync) try {
42598
- fs$9.fsync(this.fd, (err) => {
43208
+ fs$10.fsync(this.fd, (err) => {
42599
43209
  this._flushPending = false;
42600
43210
  cb(err);
42601
43211
  });
@@ -42672,7 +43282,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
42672
43282
  if (this._writing) return;
42673
43283
  const fd = this.fd;
42674
43284
  this.once("ready", () => {
42675
- if (fd !== this.fd) fs$9.close(fd, (err) => {
43285
+ if (fd !== this.fd) fs$10.close(fd, (err) => {
42676
43286
  if (err) return this.emit("error", err);
42677
43287
  });
42678
43288
  });
@@ -42703,7 +43313,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
42703
43313
  while (this._bufs.length || buf.length) {
42704
43314
  if (buf.length <= 0) buf = this._bufs[0];
42705
43315
  try {
42706
- const n = Buffer.isBuffer(buf) ? fs$9.writeSync(this.fd, buf) : fs$9.writeSync(this.fd, buf, "utf8");
43316
+ const n = Buffer.isBuffer(buf) ? fs$10.writeSync(this.fd, buf) : fs$10.writeSync(this.fd, buf, "utf8");
42707
43317
  const releasedBufObj = releaseWritingBuf(buf, this._len, n);
42708
43318
  buf = releasedBufObj.writingBuf;
42709
43319
  this._len = releasedBufObj.len;
@@ -42714,7 +43324,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
42714
43324
  }
42715
43325
  }
42716
43326
  try {
42717
- fs$9.fsyncSync(this.fd);
43327
+ fs$10.fsyncSync(this.fd);
42718
43328
  } catch {}
42719
43329
  }
42720
43330
  function flushBufferSync() {
@@ -42728,7 +43338,7 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
42728
43338
  while (this._bufs.length || buf.length) {
42729
43339
  if (buf.length <= 0) buf = mergeBuf(this._bufs[0], this._lens[0]);
42730
43340
  try {
42731
- const n = fs$9.writeSync(this.fd, buf);
43341
+ const n = fs$10.writeSync(this.fd, buf);
42732
43342
  buf = buf.subarray(n);
42733
43343
  this._len = Math.max(this._len - n, 0);
42734
43344
  if (buf.length <= 0) {
@@ -42750,24 +43360,24 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
42750
43360
  this._writing = true;
42751
43361
  this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
42752
43362
  if (this.sync) try {
42753
- release(null, Buffer.isBuffer(this._writingBuf) ? fs$9.writeSync(this.fd, this._writingBuf) : fs$9.writeSync(this.fd, this._writingBuf, "utf8"));
43363
+ release(null, Buffer.isBuffer(this._writingBuf) ? fs$10.writeSync(this.fd, this._writingBuf) : fs$10.writeSync(this.fd, this._writingBuf, "utf8"));
42754
43364
  } catch (err) {
42755
43365
  release(err);
42756
43366
  }
42757
- else fs$9.write(this.fd, this._writingBuf, release);
43367
+ else fs$10.write(this.fd, this._writingBuf, release);
42758
43368
  }
42759
43369
  function actualWriteBuffer() {
42760
43370
  const release = this.release;
42761
43371
  this._writing = true;
42762
43372
  this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
42763
43373
  if (this.sync) try {
42764
- release(null, fs$9.writeSync(this.fd, this._writingBuf));
43374
+ release(null, fs$10.writeSync(this.fd, this._writingBuf));
42765
43375
  } catch (err) {
42766
43376
  release(err);
42767
43377
  }
42768
43378
  else {
42769
43379
  if (kCopyBuffer) this._writingBuf = Buffer.from(this._writingBuf);
42770
- fs$9.write(this.fd, this._writingBuf, release);
43380
+ fs$10.write(this.fd, this._writingBuf, release);
42771
43381
  }
42772
43382
  }
42773
43383
  function actualClose(sonic) {
@@ -42781,10 +43391,10 @@ var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
42781
43391
  sonic._lens = [];
42782
43392
  assert$1(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
42783
43393
  try {
42784
- fs$9.fsync(sonic.fd, closeWrapped);
43394
+ fs$10.fsync(sonic.fd, closeWrapped);
42785
43395
  } catch {}
42786
43396
  function closeWrapped() {
42787
- if (sonic.fd !== 1 && sonic.fd !== 2) fs$9.close(sonic.fd, done);
43397
+ if (sonic.fd !== 1 && sonic.fd !== 2) fs$10.close(sonic.fd, done);
42788
43398
  else done();
42789
43399
  }
42790
43400
  function done(err) {
@@ -71581,7 +72191,7 @@ var require_tcp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
71581
72191
  var Transporter = require_base$1();
71582
72192
  var _ = require_lodash();
71583
72193
  var { isObject, isString } = require_utils$3();
71584
- var fs$8 = __require("fs");
72194
+ var fs$9 = __require("fs");
71585
72195
  var kleur = require_kleur();
71586
72196
  var Node = require_node();
71587
72197
  var P = require_packets();
@@ -71728,7 +72338,7 @@ var require_tcp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
71728
72338
  if (isString(str) && str.startsWith("file://")) {
71729
72339
  const fName = str.replace("file://", "");
71730
72340
  this.logger.debug(`Load nodes list from file '${fName}'...`);
71731
- let content = fs$8.readFileSync(fName);
72341
+ let content = fs$9.readFileSync(fName);
71732
72342
  if (content && content.length > 0) {
71733
72343
  const str = content.toString().trim();
71734
72344
  if (str.startsWith("{") || str.startsWith("[")) return JSON.parse(str);
@@ -74218,7 +74828,7 @@ var require_ttl = /* @__PURE__ */ __commonJSMin(((exports, module) => {
74218
74828
  //#region ../../node_modules/recursive-watch/index.js
74219
74829
  var require_recursive_watch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
74220
74830
  var os$5 = __require("os");
74221
- var fs$7 = __require("fs");
74831
+ var fs$8 = __require("fs");
74222
74832
  var path$10 = __require("path");
74223
74833
  var Cache = require_ttl();
74224
74834
  var watchDirectory = os$5.platform() === "linux" ? watchFallback : watchRecursive;
@@ -74226,7 +74836,7 @@ var require_recursive_watch = /* @__PURE__ */ __commonJSMin(((exports, module) =
74226
74836
  function watch(name, onchange) {
74227
74837
  var clear = null;
74228
74838
  var stopped = false;
74229
- fs$7.lstat(name, function(_, st) {
74839
+ fs$8.lstat(name, function(_, st) {
74230
74840
  if (!st || stopped) {
74231
74841
  stopped = true;
74232
74842
  return;
@@ -74242,8 +74852,8 @@ var require_recursive_watch = /* @__PURE__ */ __commonJSMin(((exports, module) =
74242
74852
  function watchFile(filename, onchange) {
74243
74853
  var prev = null;
74244
74854
  var prevTime = 0;
74245
- var w = fs$7.watch(filename, function() {
74246
- fs$7.lstat(filename, function(_, st) {
74855
+ var w = fs$8.watch(filename, function() {
74856
+ fs$8.lstat(filename, function(_, st) {
74247
74857
  var now = Date.now();
74248
74858
  if (now - prevTime > 2e3 || !same(st, prev)) onchange(filename);
74249
74859
  prevTime = now;
@@ -74255,7 +74865,7 @@ var require_recursive_watch = /* @__PURE__ */ __commonJSMin(((exports, module) =
74255
74865
  };
74256
74866
  }
74257
74867
  function watchRecursive(directory, onchange) {
74258
- var w = fs$7.watch(directory, { recursive: true }, function(change, filename) {
74868
+ var w = fs$8.watch(directory, { recursive: true }, function(change, filename) {
74259
74869
  if (!filename) return;
74260
74870
  onchange(path$10.join(directory, filename));
74261
74871
  });
@@ -74285,7 +74895,7 @@ var require_recursive_watch = /* @__PURE__ */ __commonJSMin(((exports, module) =
74285
74895
  }
74286
74896
  function update() {
74287
74897
  var filename = queued[0];
74288
- fs$7.lstat(filename, function(err, st) {
74898
+ fs$8.lstat(filename, function(err, st) {
74289
74899
  var w = watching[filename];
74290
74900
  if (err && w) {
74291
74901
  w.close();
@@ -74302,17 +74912,17 @@ var require_recursive_watch = /* @__PURE__ */ __commonJSMin(((exports, module) =
74302
74912
  }
74303
74913
  function visit(next, cb) {
74304
74914
  var dir = path$10.join(directory, next);
74305
- fs$7.lstat(dir, function(err, st) {
74915
+ fs$8.lstat(dir, function(err, st) {
74306
74916
  if (err || !st.isDirectory()) return cb();
74307
74917
  if (watching[dir]) return cb();
74308
74918
  if (loaded) emit(dir);
74309
- var w = fs$7.watch(dir, function(change, filename) {
74919
+ var w = fs$8.watch(dir, function(change, filename) {
74310
74920
  filename = path$10.join(next, filename);
74311
74921
  emit(path$10.join(directory, filename));
74312
74922
  });
74313
74923
  w.on("error", noop);
74314
74924
  watching[dir] = w;
74315
- fs$7.readdir(dir, function(err, list) {
74925
+ fs$8.readdir(dir, function(err, list) {
74316
74926
  if (err) return cb(err);
74317
74927
  loop();
74318
74928
  function loop() {
@@ -74332,7 +74942,7 @@ var require_recursive_watch = /* @__PURE__ */ __commonJSMin(((exports, module) =
74332
74942
  //#endregion
74333
74943
  //#region ../../node_modules/moleculer/src/middlewares/hot-reload.js
74334
74944
  var require_hot_reload = /* @__PURE__ */ __commonJSMin(((exports, module) => {
74335
- var fs$6 = __require("fs");
74945
+ var fs$7 = __require("fs");
74336
74946
  var kleur = require_kleur();
74337
74947
  var path$9 = __require("path");
74338
74948
  var watch = require_recursive_watch();
@@ -74349,7 +74959,7 @@ var require_hot_reload = /* @__PURE__ */ __commonJSMin(((exports, module) => {
74349
74959
  const relPath = path$9.relative(process.cwd(), service.__filename);
74350
74960
  broker.logger.info(`Hot reload '${service.name}' service...`, kleur.grey(relPath));
74351
74961
  return broker.destroyService(service).then(() => {
74352
- if (fs$6.existsSync(service.__filename)) try {
74962
+ if (fs$7.existsSync(service.__filename)) try {
74353
74963
  return broker.loadService(service.__filename);
74354
74964
  } catch (err) {
74355
74965
  broker.logger.error(`Failed to load service '${service.__filename}'`, err);
@@ -74381,7 +74991,7 @@ var require_hot_reload = /* @__PURE__ */ __commonJSMin(((exports, module) => {
74381
74991
  });
74382
74992
  broker.logger.info(kleur.bgMagenta().white().bold(`Reload ${needToReloadDedup.length} service(s)`));
74383
74993
  needToReloadDedup.forEach((svc) => {
74384
- if (typeof svc == "string") if (fs$6.existsSync(svc)) return broker.loadService(svc);
74994
+ if (typeof svc == "string") if (fs$7.existsSync(svc)) return broker.loadService(svc);
74385
74995
  else return;
74386
74996
  return hotReloadService(svc);
74387
74997
  });
@@ -74391,7 +75001,7 @@ var require_hot_reload = /* @__PURE__ */ __commonJSMin(((exports, module) => {
74391
75001
  broker.logger.debug("");
74392
75002
  broker.logger.debug(kleur.yellow().bold("Watching the following project files:"));
74393
75003
  projectFiles.forEach((watchItem, fName) => {
74394
- if (!fs$6.existsSync(fName)) projectFiles.delete(fName);
75004
+ if (!fs$7.existsSync(fName)) projectFiles.delete(fName);
74395
75005
  });
74396
75006
  projectFiles.forEach((watchItem, fName) => {
74397
75007
  const relPath = path$9.relative(process.cwd(), fName);
@@ -74402,7 +75012,7 @@ var require_hot_reload = /* @__PURE__ */ __commonJSMin(((exports, module) => {
74402
75012
  watchItem.services.forEach((svcFullname) => broker.logger.debug(kleur.grey(` ${svcFullname}`)));
74403
75013
  watchItem.others.forEach((filename) => broker.logger.debug(kleur.grey(` ${path$9.relative(process.cwd(), filename)}`)));
74404
75014
  }
74405
- watchItem.watcher = fs$6.watch(fName, (eventType) => {
75015
+ watchItem.watcher = fs$7.watch(fName, (eventType) => {
74406
75016
  const relPath = path$9.relative(process.cwd(), fName);
74407
75017
  broker.logger.info(kleur.magenta().bold(`The '${relPath}' file is changed. (Event: ${eventType})`));
74408
75018
  clearRequireCache(fName);
@@ -74528,7 +75138,7 @@ var require_hot_reload = /* @__PURE__ */ __commonJSMin(((exports, module) => {
74528
75138
  if (filename.endsWith(".service.js") || filename.endsWith(".service.ts")) {
74529
75139
  broker.logger.debug(`There is changes in '${folder}' folder: `, path$9.basename(filename));
74530
75140
  const isLoaded = broker.services.some((svc) => svc.__filename == filename);
74531
- const fileExists = fs$6.existsSync(filename);
75141
+ const fileExists = fs$7.existsSync(filename);
74532
75142
  if (!isLoaded && fileExists) {
74533
75143
  broker.logger.debug("Loading new file: ", path$9.basename(filename));
74534
75144
  needToLoad.add(filename);
@@ -74706,7 +75316,7 @@ var require_compression = /* @__PURE__ */ __commonJSMin(((exports, module) => {
74706
75316
  var require_transit_logger = /* @__PURE__ */ __commonJSMin(((exports, module) => {
74707
75317
  var _ = require_lodash();
74708
75318
  var kleur = require_kleur();
74709
- var fs$5 = __require("fs");
75319
+ var fs$6 = __require("fs");
74710
75320
  var path$8 = __require("path");
74711
75321
  var { makeDirs, safetyObject } = require_utils$3();
74712
75322
  module.exports = function TransitLoggerMiddleware(opts) {
@@ -74732,7 +75342,7 @@ var require_transit_logger = /* @__PURE__ */ __commonJSMin(((exports, module) =>
74732
75342
  } catch {
74733
75343
  data = JSON.stringify(safetyObject(payload), payload instanceof Error ? Object.getOwnPropertyNames(payload) : null, 4);
74734
75344
  }
74735
- fs$5.writeFile(path$8.join(targetFolder, filename), data, () => {});
75345
+ fs$6.writeFile(path$8.join(targetFolder, filename), data, () => {});
74736
75346
  }
74737
75347
  const coloringSend = opts.colors && opts.colors.send ? opts.colors.send.split(".").reduce((a, b) => a[b] || a()[b], kleur) : (s) => s;
74738
75348
  const coloringReceive = opts.colors && opts.colors.receive ? opts.colors.receive.split(".").reduce((a, b) => a[b] || a()[b], kleur) : (s) => s;
@@ -74780,7 +75390,7 @@ var require_transit_logger = /* @__PURE__ */ __commonJSMin(((exports, module) =>
74780
75390
  var require_action_logger = /* @__PURE__ */ __commonJSMin(((exports, module) => {
74781
75391
  var _ = require_lodash();
74782
75392
  var kleur = require_kleur();
74783
- var fs$4 = __require("fs");
75393
+ var fs$5 = __require("fs");
74784
75394
  var path$7 = __require("path");
74785
75395
  var { makeDirs, match, isObject, safetyObject } = require_utils$3();
74786
75396
  module.exports = function ActionLoggerMiddleware(opts) {
@@ -74810,7 +75420,7 @@ var require_action_logger = /* @__PURE__ */ __commonJSMin(((exports, module) =>
74810
75420
  } catch {
74811
75421
  data = JSON.stringify(safetyObject(payload), payload instanceof Error ? Object.getOwnPropertyNames(payload) : null, 4);
74812
75422
  }
74813
- fs$4.writeFile(path$7.join(targetFolder, filename), data, () => {});
75423
+ fs$5.writeFile(path$7.join(targetFolder, filename), data, () => {});
74814
75424
  }
74815
75425
  function isWhiteListed(actionName) {
74816
75426
  return !!opts.whitelist.find((pattern) => match(actionName, pattern));
@@ -82033,7 +82643,7 @@ var require_help = /* @__PURE__ */ __commonJSMin(((exports, module) => {
82033
82643
  //#endregion
82034
82644
  //#region ../../node_modules/args/lib/version.js
82035
82645
  var require_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
82036
- var fs$3 = __require("fs");
82646
+ var fs$4 = __require("fs");
82037
82647
  var path$3 = __require("path");
82038
82648
  /**
82039
82649
  * Retrieves the main module package.json information.
@@ -82046,7 +82656,7 @@ var require_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
82046
82656
  */
82047
82657
  function findPackage(directory) {
82048
82658
  const file = path$3.resolve(directory, "package.json");
82049
- if (fs$3.existsSync(file) && fs$3.statSync(file).isFile()) return __require(file);
82659
+ if (fs$4.existsSync(file) && fs$4.statSync(file).isFile()) return __require(file);
82050
82660
  const parent = path$3.resolve(directory, "..");
82051
82661
  return parent === directory ? null : findPackage(parent);
82052
82662
  }
@@ -82108,7 +82718,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
82108
82718
  //#endregion
82109
82719
  //#region ../../node_modules/dotenv/lib/main.js
82110
82720
  var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
82111
- var fs$2 = __require("fs");
82721
+ var fs$3 = __require("fs");
82112
82722
  var path$2 = __require("path");
82113
82723
  var os$3 = __require("os");
82114
82724
  var crypto = __require("crypto");
@@ -82236,10 +82846,10 @@ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
82236
82846
  function _vaultPath(options) {
82237
82847
  let possibleVaultPath = null;
82238
82848
  if (options && options.path && options.path.length > 0) if (Array.isArray(options.path)) {
82239
- for (const filepath of options.path) if (fs$2.existsSync(filepath)) possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
82849
+ for (const filepath of options.path) if (fs$3.existsSync(filepath)) possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
82240
82850
  } else possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
82241
82851
  else possibleVaultPath = path$2.resolve(process.cwd(), ".env.vault");
82242
- if (fs$2.existsSync(possibleVaultPath)) return possibleVaultPath;
82852
+ if (fs$3.existsSync(possibleVaultPath)) return possibleVaultPath;
82243
82853
  return null;
82244
82854
  }
82245
82855
  function _resolveHome(envPath) {
@@ -82273,7 +82883,7 @@ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
82273
82883
  let lastError;
82274
82884
  const parsedAll = {};
82275
82885
  for (const path of optionPaths) try {
82276
- const parsed = DotenvModule.parse(fs$2.readFileSync(path, { encoding }));
82886
+ const parsed = DotenvModule.parse(fs$3.readFileSync(path, { encoding }));
82277
82887
  DotenvModule.populate(parsedAll, parsed, options);
82278
82888
  } catch (e) {
82279
82889
  if (debug) _debug(`failed to load ${path} ${e.message}`);
@@ -82385,7 +82995,7 @@ var require_runner = /* @__PURE__ */ __commonJSMin(((exports, module) => {
82385
82995
  */
82386
82996
  var ServiceBroker = require_service_broker();
82387
82997
  var utils = require_utils$3();
82388
- var fs$1 = __require("fs");
82998
+ var fs$2 = __require("fs");
82389
82999
  var path$1 = __require("path");
82390
83000
  var { globSync } = require_index_min$1();
82391
83001
  var inspect = __require("util").inspect;
@@ -82610,7 +83220,7 @@ var require_runner = /* @__PURE__ */ __commonJSMin(((exports, module) => {
82610
83220
  */
82611
83221
  isDirectory(p) {
82612
83222
  try {
82613
- return fs$1.lstatSync(p).isDirectory();
83223
+ return fs$2.lstatSync(p).isDirectory();
82614
83224
  } catch {}
82615
83225
  return false;
82616
83226
  }
@@ -82622,7 +83232,7 @@ var require_runner = /* @__PURE__ */ __commonJSMin(((exports, module) => {
82622
83232
  */
82623
83233
  isServiceFile(p) {
82624
83234
  try {
82625
- return !fs$1.lstatSync(p).isDirectory();
83235
+ return !fs$2.lstatSync(p).isDirectory();
82626
83236
  } catch {}
82627
83237
  return false;
82628
83238
  }
@@ -82835,12 +83445,12 @@ var Gt = (n, t, e) => {
82835
83445
  }
82836
83446
  return h;
82837
83447
  };
82838
- var fe = "\0SLASH" + Math.random() + "\0", ue = "\0OPEN" + Math.random() + "\0", qt = "\0CLOSE" + Math.random() + "\0", de = "\0COMMA" + Math.random() + "\0", pe = "\0PERIOD" + Math.random() + "\0", is = new RegExp(fe, "g"), rs = new RegExp(ue, "g"), ns = new RegExp(qt, "g"), os$1 = new RegExp(de, "g"), hs = new RegExp(pe, "g"), as = /\\\\/g, ls = /\\{/g, cs = /\\}/g, fs = /\\,/g, us = /\\./g, ds = 1e5;
83448
+ var fe = "\0SLASH" + Math.random() + "\0", ue = "\0OPEN" + Math.random() + "\0", qt = "\0CLOSE" + Math.random() + "\0", de = "\0COMMA" + Math.random() + "\0", pe = "\0PERIOD" + Math.random() + "\0", is = new RegExp(fe, "g"), rs = new RegExp(ue, "g"), ns = new RegExp(qt, "g"), os$1 = new RegExp(de, "g"), hs = new RegExp(pe, "g"), as = /\\\\/g, ls = /\\{/g, cs = /\\}/g, fs$1 = /\\,/g, us = /\\./g, ds = 1e5;
82839
83449
  function Ht(n) {
82840
83450
  return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
82841
83451
  }
82842
83452
  function ps(n) {
82843
- return n.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs, de).replace(us, pe);
83453
+ return n.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs$1, de).replace(us, pe);
82844
83454
  }
82845
83455
  function ms(n) {
82846
83456
  return n.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os$1, ",").replace(hs, ".");
@@ -83014,7 +83624,7 @@ var xs = new Set([
83014
83624
  "+",
83015
83625
  "*",
83016
83626
  "@"
83017
- ]), be = (n) => xs.has(n), vs = "(?!(?:^|/)\\.\\.?(?:$|/))", Ct = "(?!\\.)", Cs = new Set(["[", "."]), Ts = new Set(["..", "."]), As$1 = /* @__PURE__ */ new Set("().*{}+?[]^$\\!"), ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Kt$1 = "[^/]", Se = Kt$1 + "*?", Ee = Kt$1 + "+?", Q = class n {
83627
+ ]), be = (n) => xs.has(n), vs = "(?!(?:^|/)\\.\\.?(?:$|/))", Ct = "(?!\\.)", Cs = new Set(["[", "."]), Ts = new Set(["..", "."]), As$1 = /* @__PURE__ */ new Set("().*{}+?[]^$\\!"), ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Kt = "[^/]", Se = Kt + "*?", Ee = Kt + "+?", Q = class n {
83018
83628
  type;
83019
83629
  #t;
83020
83630
  #s;
@@ -83241,7 +83851,7 @@ var xs = new Set([
83241
83851
  }
83242
83852
  }
83243
83853
  if (l === "?") {
83244
- r += Kt$1, e = !0;
83854
+ r += Kt, e = !0;
83245
83855
  continue;
83246
83856
  }
83247
83857
  r += ks(l);
@@ -88264,4 +88874,4 @@ function parseMintUnlockInput(input) {
88264
88874
  };
88265
88875
  }
88266
88876
  //#endregion
88267
- export { parseCidrList as $, setProcessMeshPeerTransportLookup as A, requireProcessMeshCa as B, setProcessMeshTlsEnabler as C, getProcessPeerLeaf as D, getProcessNodeMeshTransport as E, setProcessMeshTlsListenerState as F, AGENT_UI_UNLOCK_VERSION as G, AGENT_UI_UNLOCK_TTL_MS as H, MeshCrl as I, mintAgentUiUnlockTicket as J, UnlockTicketJtiStore as K, processMeshCrl as L, revokeMeshCertificate as M, getProcessMeshTlsListenerState as N, isProcessVerifiedMeshPeer as O, openMeshTlsWhenRevocationsLoaded as P, normalizeIp as Q, MeshCaKeeper as R, ServiceBroker as S, SYSTEM_CONFIG_CLUSTER_SECTION_ID, SystemConfigAddon, SystemConfigAddon as default, emitProcessNodeRegistered as T, AGENT_UI_UNLOCK_TYP as U, AGENT_DASHBOARD_ORIGINS_FIELD as V, AGENT_UI_UNLOCK_USE as W, verifyAgentUiUnlockTicket as X, parseAgentDashboardOrigins as Y, createCidrMatcher as Z, signPairingProof as _, hubHostFromMeshAddress as a, TlsTcpTransporter as b, PAIRING_MAX_SESSIONS as c, PAIRING_PROTOCOL as d, readCidrSetting as et, PAIRING_TTL_MS as f, keyFingerprintShort as g, describeCsr as h, AgentPairing as i, renewMeshCertificate as j, onProcessNodeRegistered as k, PAIRING_PATHS as l, computePairingSas as m, HubPairing as n, PAIRING_CODE_DIGITS as o, computePairingCommitment as p, isAllowedAgentDashboardReturnTo as q, PairingHttpError as r, PAIRING_MAX_CODE_ATTEMPTS as s, systemConfigMeshActions as t, PAIRING_PIN_DIGITS as u, verifyPairingProof as v, dropProcessPeer as w, Errors as x, MESH_TLS_PORT_HELLO_FIELD as y, getProcessMeshCaState as z };
88877
+ export { generateMeshKeyPair as $, setProcessMeshPeerTransportLookup as A, describeMeshLeaf as B, setProcessMeshTlsEnabler as C, getProcessPeerLeaf as D, getProcessNodeMeshTransport as E, setProcessMeshTlsListenerState as F, MeshCaKeeper as G, setProcessMeshCertificateRegistry as H, MESH_NODE_CERTIFICATES_COLLECTION as I, caFingerprint as J, getProcessMeshCaState as K, MESH_NODE_CERTIFICATES_COLUMNS as L, revokeMeshCertificate as M, getProcessMeshTlsListenerState as N, isProcessVerifiedMeshPeer as O, openMeshTlsWhenRevocationsLoaded as P, generateMeshCa as Q, MeshCertificateRegistry as R, ServiceBroker as S, SYSTEM_CONFIG_CLUSTER_SECTION_ID, SystemConfigAddon, SystemConfigAddon as default, emitProcessNodeRegistered as T, MeshCrl as U, getProcessMeshCertificateRegistry as V, processMeshCrl as W, createMeshCsrPem as X, caFingerprintCompact as Y, exportMeshPrivateKeyPem as Z, signPairingProof as _, readCidrSetting as _t, hubHostFromMeshAddress as a, AGENT_UI_UNLOCK_TTL_MS as at, TlsTcpTransporter as b, PAIRING_MAX_SESSIONS as c, AGENT_UI_UNLOCK_VERSION as ct, PAIRING_PROTOCOL as d, mintAgentUiUnlockTicket as dt, isValidAgentNodeId as et, PAIRING_TTL_MS as f, parseAgentDashboardOrigins as ft, keyFingerprintShort as g, parseCidrList as gt, describeCsr as h, normalizeIp as ht, AgentPairing as i, AGENT_DASHBOARD_ORIGINS_FIELD as it, renewMeshCertificate as j, onProcessNodeRegistered as k, PAIRING_PATHS as l, UnlockTicketJtiStore as lt, computePairingSas as m, createCidrMatcher as mt, HubPairing as n, issueMeshLeafFromCsr as nt, PAIRING_CODE_DIGITS as o, AGENT_UI_UNLOCK_TYP as ot, computePairingCommitment as p, verifyAgentUiUnlockTicket as pt, requireProcessMeshCa as q, PairingHttpError as r, loadMeshCa as rt, PAIRING_MAX_CODE_ATTEMPTS as s, AGENT_UI_UNLOCK_USE as st, systemConfigMeshActions as t, issueMeshLeafForNode as tt, PAIRING_PIN_DIGITS as u, isAllowedAgentDashboardReturnTo as ut, verifyPairingProof as v, dropProcessPeer as w, Errors as x, MESH_TLS_PORT_HELLO_FIELD as y, RENEWAL_ABANDONED as z };