@camstack/system 1.2.381 → 1.2.383

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 (133) hide show
  1. package/dist/addon-runner.js +4 -2
  2. package/dist/addon-runner.mjs +4 -2
  3. package/dist/addon-utils.js +1 -1
  4. package/dist/addon-utils.mjs +1 -1
  5. package/dist/auth/admin-token-manager.d.ts +75 -0
  6. package/dist/auth/api-key-manager.d.ts +1 -14
  7. package/dist/auth/auth-audit-log.d.ts +59 -0
  8. package/dist/auth/auth-manager.d.ts +28 -16
  9. package/dist/auth/cidr.d.ts +22 -0
  10. package/dist/auth/login-session-manager.d.ts +158 -0
  11. package/dist/auth/user-management-internal.d.ts +69 -0
  12. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  13. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  14. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  15. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  16. package/dist/builtins/alerts/alerts.addon.js +1 -1
  17. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  18. package/dist/builtins/autotrack/index.js +1 -1
  19. package/dist/builtins/autotrack/index.mjs +1 -1
  20. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +14 -0
  21. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +291 -3631
  22. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +284 -3617
  23. package/dist/builtins/backup-orchestrator/encryption-key-store.d.ts +36 -0
  24. package/dist/builtins/backup-orchestrator/manifest-store.d.ts +19 -1
  25. package/dist/builtins/backup-orchestrator/restore-archive.d.ts +24 -0
  26. package/dist/builtins/calendars/calendars.addon.js +1 -1
  27. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  28. package/dist/builtins/camera-grid/index.js +1 -1
  29. package/dist/builtins/camera-grid/index.mjs +1 -1
  30. package/dist/builtins/composer/composer.addon.js +2 -2
  31. package/dist/builtins/composer/composer.addon.mjs +2 -2
  32. package/dist/builtins/console-logging/index.js +1 -1
  33. package/dist/builtins/console-logging/index.mjs +1 -1
  34. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  35. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  36. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  37. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  38. package/dist/builtins/hub-forwarder/index.js +1 -1
  39. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  40. package/dist/builtins/keychain/index.js +1110 -735
  41. package/dist/builtins/keychain/index.mjs +1109 -734
  42. package/dist/builtins/keychain/keychain-reset-trigger.d.ts +25 -0
  43. package/dist/builtins/keychain/keychain-service.d.ts +36 -3
  44. package/dist/builtins/keychain/keychain-store.d.ts +24 -1
  45. package/dist/builtins/keychain/system-held-secrets.d.ts +2 -1
  46. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  47. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  48. package/dist/builtins/local-auth/local-auth.addon.d.ts +16 -0
  49. package/dist/builtins/local-auth/local-auth.addon.js +1028 -294
  50. package/dist/builtins/local-auth/local-auth.addon.mjs +1035 -299
  51. package/dist/builtins/local-network/local-network.addon.js +3 -3
  52. package/dist/builtins/local-network/local-network.addon.mjs +3 -3
  53. package/dist/builtins/loki-logging/index.js +97 -29
  54. package/dist/builtins/loki-logging/index.mjs +97 -29
  55. package/dist/builtins/loki-logging/loki-logging.addon.d.ts +7 -23
  56. package/dist/builtins/loki-logging/retire-enabled-flag.d.ts +23 -0
  57. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  58. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  59. package/dist/builtins/platform-probe/index.js +1 -1
  60. package/dist/builtins/platform-probe/index.mjs +1 -1
  61. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  62. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  63. package/dist/builtins/snapshot/index.js +1 -1
  64. package/dist/builtins/snapshot/index.mjs +1 -1
  65. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  66. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  67. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  68. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  69. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +2 -2
  70. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +2 -2
  71. package/dist/builtins/system-backup/backup-encryption.d.ts +57 -0
  72. package/dist/builtins/system-backup/system-backup.service.d.ts +16 -1
  73. package/dist/builtins/system-config/cluster-secret-keeper.d.ts +7 -0
  74. package/dist/builtins/system-config/index.d.ts +1 -0
  75. package/dist/builtins/system-config/index.js +2 -0
  76. package/dist/builtins/system-config/index.mjs +2 -2
  77. package/dist/builtins/system-config/mesh-actions.d.ts +19 -0
  78. package/dist/builtins/system-config/system-config.addon.d.ts +47 -4
  79. package/dist/builtins/system-config/system-config.addon.js +87858 -43
  80. package/dist/builtins/system-config/system-config.addon.mjs +87813 -39
  81. package/dist/builtins/winston-logging/index.js +1 -1
  82. package/dist/builtins/winston-logging/index.mjs +1 -1
  83. package/dist/{child-cap-dispatch-hf-Gce_4.js → child-cap-dispatch-BD8fhJ1b.js} +7 -4
  84. package/dist/{child-cap-dispatch-BTe4eKep.mjs → child-cap-dispatch-C68N2a6Y.mjs} +11 -8
  85. package/dist/{composition-sources-4SmsP0O4.js → composition-sources-ChpT_Yw4.js} +1 -1
  86. package/dist/{composition-sources-CgOQVIwa.mjs → composition-sources-DM7Ft_tp.mjs} +1 -1
  87. package/dist/{cluster-secret-BUiG8DCo.js → constants-CDpry1_T.js} +82 -1
  88. package/dist/{cluster-secret-DgJTZ4qY.mjs → constants-e3mCa1jG.mjs} +23 -2
  89. package/dist/{dist-BugrtARh.js → dist-CUNGH0fs.js} +1755 -157
  90. package/dist/{dist-BC0GnGeg.mjs → dist-osl3bkF0.mjs} +1732 -158
  91. package/dist/{event-loop-stall-monitor-GgpnfAC0.mjs → event-loop-stall-monitor-BeeWMnyT.mjs} +15 -15
  92. package/dist/{event-loop-stall-monitor-CnQ-K6Gn.js → event-loop-stall-monitor-Dk28EF8B.js} +15 -15
  93. package/dist/{hub-cap-forward-CH6_VWVO.mjs → hub-cap-forward-CDiN1p98.mjs} +18 -2
  94. package/dist/{hub-cap-forward-COCmYaup.js → hub-cap-forward-W8oEm4ME.js} +23 -1
  95. package/dist/index.d.ts +16 -1
  96. package/dist/index.js +1023 -83525
  97. package/dist/index.mjs +1218 -83794
  98. package/dist/{jwt-signing-key-CsuVKA1W.mjs → jwt-signing-key-MQLxLfgF.mjs} +1 -1
  99. package/dist/{jwt-signing-key-CjoZcol8.js → jwt-signing-key-WI6z7JBo.js} +1 -1
  100. package/dist/kernel/index.d.ts +17 -1
  101. package/dist/kernel/moleculer/agent-mesh-authenticator.d.ts +41 -0
  102. package/dist/kernel/moleculer/broker-factory.d.ts +25 -2
  103. package/dist/kernel/moleculer/child-addon-call-dispatch.d.ts +1 -0
  104. package/dist/kernel/moleculer/hub-service.d.ts +9 -0
  105. package/dist/kernel/moleculer/mesh-access-middleware.d.ts +33 -0
  106. package/dist/kernel/moleculer/mesh-auth-mode.d.ts +64 -0
  107. package/dist/kernel/moleculer/mesh-authenticator.d.ts +71 -0
  108. package/dist/kernel/moleculer/mesh-auto-enforce.d.ts +26 -0
  109. package/dist/kernel/moleculer/mesh-join-client.d.ts +51 -0
  110. package/dist/kernel/moleculer/mesh-join-proof.d.ts +39 -0
  111. package/dist/kernel/moleculer/mesh-mtls/constants.d.ts +20 -0
  112. package/dist/kernel/moleculer/mesh-mtls/index.d.ts +9 -0
  113. package/dist/kernel/moleculer/mesh-mtls/mesh-ca-keeper.d.ts +55 -0
  114. package/dist/kernel/moleculer/mesh-mtls/mesh-ca.d.ts +45 -0
  115. package/dist/kernel/moleculer/mesh-mtls/mesh-crl.d.ts +16 -0
  116. package/dist/kernel/moleculer/mesh-mtls/mesh-enroll.d.ts +27 -0
  117. package/dist/kernel/moleculer/mesh-mtls/mesh-join-token.d.ts +55 -0
  118. package/dist/kernel/moleculer/mesh-mtls/mesh-tls-enabler.d.ts +5 -0
  119. package/dist/kernel/moleculer/mesh-mtls/tls-tcp-transporter.d.ts +92 -0
  120. package/dist/kernel/system-settings-policy.d.ts +4 -3
  121. package/dist/kernel/transport/hub-cap-forward.d.ts +14 -3
  122. package/dist/kernel/transport/index.d.ts +1 -1
  123. package/dist/ms-DlIWNkkk.mjs +160 -0
  124. package/dist/ms-t68_FaqE.js +171 -0
  125. package/dist/restore-archive-C5f9yX90.js +4139 -0
  126. package/dist/restore-archive-CZRtI1k9.mjs +4045 -0
  127. package/dist/{retired-settings-keys-MCVhxPkJ.mjs → retired-settings-keys-LuDd4y3M.mjs} +1 -1
  128. package/dist/{retired-settings-keys-DCuetwOt.js → retired-settings-keys-WLrbzdPR.js} +1 -1
  129. package/dist/tls-BWpwU-d5.js +1160 -0
  130. package/dist/tls-C2NT-Orr.mjs +949 -0
  131. package/dist/{tls-CCMX7MjX.js → x509.es-BhTzcFhZ.js} +65 -1108
  132. package/dist/{tls-CJHogwTl.mjs → x509.es-Xf3K_brW.mjs} +40 -950
  133. package/package.json +3 -2
@@ -1,4 +1,5 @@
1
1
  import { ArchiveSqliteSnapshot, DatabaseSnapshotResult, IScopedLogger } from '@camstack/types';
2
+ import { BACKUP_ENCRYPTION_SCHEME } from './backup-encryption.js';
2
3
  /**
3
4
  * Thrown when an archive build (or a backup run driving one) is
4
5
  * stopped via its `AbortSignal`. Callers use `instanceof` to tell a
@@ -94,11 +95,19 @@ export interface ArchiveManifest {
94
95
  */
95
96
  sqliteSnapshots?: ArchiveSqliteSnapshot[];
96
97
  }
98
+ /** How an archive was encrypted — absent on a plain `.tar.gz`. */
99
+ export interface ArchiveEncryption {
100
+ readonly scheme: typeof BACKUP_ENCRYPTION_SCHEME;
101
+ /** The backup key the archive needs to be restored. */
102
+ readonly keyId: string;
103
+ }
97
104
  export interface CreateArchiveResult {
98
105
  archivePath: string;
99
106
  includedLocations: readonly string[];
100
- /** Archive size in bytes (compressed, on disk). */
107
+ /** Archive size in bytes (compressed — and encrypted, when it is — on disk). */
101
108
  sizeBytes: number;
109
+ /** Present when the archive is encrypted to a backup key. */
110
+ encryption?: ArchiveEncryption;
102
111
  /** Embedded manifest — same shape as `getArchiveManifest()`. */
103
112
  manifest: ArchiveManifest;
104
113
  }
@@ -197,6 +206,12 @@ export declare class SystemBackupService {
197
206
  * because its upload prunes an older archive that HAS it.
198
207
  */
199
208
  owner?: DatabaseOwner;
209
+ /**
210
+ * A backup PUBLIC key: the gzip stream is encrypted to it as it is
211
+ * written, so no plaintext archive ever touches the staging disk. Parsed
212
+ * before any work — a bad key builds nothing.
213
+ */
214
+ encryptTo?: string;
200
215
  }): Promise<CreateArchiveResult>;
201
216
  /**
202
217
  * Tar `present` (filtered by `excluded`) plus the staged manifest into
@@ -17,6 +17,12 @@ export interface ClusterSecretKeeperDeps {
17
17
  readonly readSection: () => Promise<Record<string, unknown>>;
18
18
  readonly logger: KeeperLogger;
19
19
  readonly retryMs?: number;
20
+ /**
21
+ * Generate and store a new secret (D802). Called when no marker is stored.
22
+ * Throws when it cannot (no keychain, locked): the keeper retries on its
23
+ * timer. Absent → nothing is generated (tests of the D797 states).
24
+ */
25
+ readonly generateSecret?: () => Promise<void>;
20
26
  }
21
27
  export declare class ClusterSecretKeeper {
22
28
  private readonly deps;
@@ -29,6 +35,7 @@ export declare class ClusterSecretKeeper {
29
35
  stop(): void;
30
36
  /** Re-read the row and the keychain; publish the gate. */
31
37
  reload(): Promise<void>;
38
+ private generate;
32
39
  private compute;
33
40
  private report;
34
41
  private scheduleRetry;
@@ -1 +1,2 @@
1
1
  export { SystemConfigAddon, default } from './system-config.addon.js';
2
+ export { systemConfigMeshActions, systemConfigMeshActions as customActions, } from './mesh-actions.js';
@@ -5,4 +5,6 @@ Object.defineProperties(exports, {
5
5
  require("../../chunk-Cek0wNdY.js");
6
6
  const require_builtins_system_config_system_config_addon = require("./system-config.addon.js");
7
7
  exports.SystemConfigAddon = require_builtins_system_config_system_config_addon.SystemConfigAddon;
8
+ exports.customActions = require_builtins_system_config_system_config_addon.systemConfigMeshActions;
8
9
  exports.default = require_builtins_system_config_system_config_addon.SystemConfigAddon;
10
+ exports.systemConfigMeshActions = require_builtins_system_config_system_config_addon.systemConfigMeshActions;
@@ -1,2 +1,2 @@
1
- import { SystemConfigAddon } from "./system-config.addon.mjs";
2
- export { SystemConfigAddon, SystemConfigAddon as default };
1
+ import { SystemConfigAddon, t as systemConfigMeshActions } from "./system-config.addon.mjs";
2
+ export { SystemConfigAddon, SystemConfigAddon as default, systemConfigMeshActions as customActions, systemConfigMeshActions };
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ export declare const systemConfigMeshActions: {
3
+ mintJoinToken: import('@camstack/types').CustomActionSpec<z.ZodOptional<z.ZodObject<{
4
+ nodeId: z.ZodOptional<z.ZodString>;
5
+ hubUrl: z.ZodOptional<z.ZodString>;
6
+ hubMeshAddress: z.ZodOptional<z.ZodString>;
7
+ ttlSec: z.ZodOptional<z.ZodNumber>;
8
+ }, z.core.$strip>>, z.ZodObject<{
9
+ token: z.ZodString;
10
+ exp: z.ZodNumber;
11
+ hubUrl: z.ZodString;
12
+ hubMeshAddress: z.ZodString;
13
+ caFingerprint: z.ZodString;
14
+ nodeId: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>, "mutation", "admin", {
16
+ readonly kind: "system";
17
+ }>;
18
+ };
19
+ export type SystemConfigMeshActions = typeof systemConfigMeshActions;
@@ -4,9 +4,42 @@ export declare const SYSTEM_CONFIG_CLUSTER_SECTION_ID = "system-config-cluster";
4
4
  export declare class SystemConfigAddon extends BaseAddon {
5
5
  readonly id = "system-config";
6
6
  private clusterSecretKeeper;
7
+ private meshCaKeeper;
7
8
  constructor();
8
- protected onInitialize(): Promise<void>;
9
+ protected onInitialize(): Promise<{
10
+ customActions: {
11
+ mintJoinToken: import('@camstack/types').CustomActionSpec<import('zod').ZodOptional<import('zod').ZodObject<{
12
+ nodeId: import('zod').ZodOptional<import('zod').ZodString>;
13
+ hubUrl: import('zod').ZodOptional<import('zod').ZodString>;
14
+ hubMeshAddress: import('zod').ZodOptional<import('zod').ZodString>;
15
+ ttlSec: import('zod').ZodOptional<import('zod').ZodNumber>;
16
+ }, import('zod/v4/core').$strip>>, import('zod').ZodObject<{
17
+ token: import('zod').ZodString;
18
+ exp: import('zod').ZodNumber;
19
+ hubUrl: import('zod').ZodString;
20
+ hubMeshAddress: import('zod').ZodString;
21
+ caFingerprint: import('zod').ZodString;
22
+ nodeId: import('zod').ZodOptional<import('zod').ZodString>;
23
+ }, import('zod/v4/core').$strip>, "mutation", "admin", {
24
+ readonly kind: "system";
25
+ }>;
26
+ };
27
+ actionHandlers: {
28
+ mintJoinToken: (input: any) => Promise<{
29
+ token: string;
30
+ exp: number;
31
+ hubUrl: string;
32
+ hubMeshAddress: string;
33
+ caFingerprint: string;
34
+ nodeId?: string;
35
+ }>;
36
+ };
37
+ }>;
9
38
  protected onShutdown(): Promise<void>;
39
+ private onMeshCaReady;
40
+ private mintJoinToken;
41
+ private resolveHubUrl;
42
+ private resolveHubMeshAddress;
10
43
  /** The keychain handle for owner `system`; `null` where there is no door. */
11
44
  private systemSecrets;
12
45
  private buildGlobalSchema;
@@ -14,10 +47,20 @@ export declare class SystemConfigAddon extends BaseAddon {
14
47
  updateGlobalSettings(patch: Record<string, unknown>): Promise<void>;
15
48
  /**
16
49
  * The cluster secret's save path: the value goes to the keychain (owner
17
- * `system`), the row gets the marker; `''` / a view keeps, `$secretClear`
18
- * clears. A value the keychain cannot store is REFUSED — never written
19
- * inline (D787, P5).
50
+ * `system`), the row gets the marker; `''` / a view keeps. `$secretClear` is
51
+ * REFUSED: the secret is mandatory (D802). A value the keychain cannot store
52
+ * is REFUSED — never written inline (D787, P5). `meshAuth` is a plain value.
20
53
  */
21
54
  private writeClusterSection;
55
+ /** `cluster.meshAuth` (D802), then republish it. */
56
+ private writeMeshAuthMode;
57
+ /**
58
+ * First boot, or a keychain reset that cleared the marker (D802): a fresh
59
+ * random secret, stored like an operator save. A NEW secret means every
60
+ * agent must be given it, so the mesh goes (back) to `transition`; on a hub
61
+ * with no agent yet, the hub's auto-enforce ends it at once.
62
+ */
63
+ private generateClusterSecret;
64
+ private storeClusterSecret;
22
65
  }
23
66
  export default SystemConfigAddon;