@camstack/server 1.2.796 → 1.2.797
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +3 -4
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/bootstrap-form-actions.d.ts +21 -0
- package/system/dist/builtins/system-config/system-config.addon.d.ts +5 -10
- package/system/dist/builtins/system-config/system-config.addon.js +49 -17
- package/system/dist/builtins/system-config/system-config.addon.mjs +330 -298
- package/system/dist/index.mjs +1 -1
- package/system/dist/{restore-archive-DR05cy7P.mjs → restore-archive-DfFB1J2w.mjs} +81 -81
- package/system/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.797",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -66,8 +66,7 @@
|
|
|
66
66
|
],
|
|
67
67
|
"requires": {
|
|
68
68
|
"addons": {
|
|
69
|
-
"@camstack/addon-
|
|
70
|
-
"@camstack/addon-provider-dreame": ">=0.2.170"
|
|
69
|
+
"@camstack/addon-admin-ui": ">=1.2.607"
|
|
71
70
|
},
|
|
72
71
|
"wrapper": {
|
|
73
72
|
"desktop": ">=0.0.1",
|
|
@@ -76,7 +75,7 @@
|
|
|
76
75
|
}
|
|
77
76
|
},
|
|
78
77
|
"dependencies": {
|
|
79
|
-
"@camstack/addon-admin-ui": "1.2.
|
|
78
|
+
"@camstack/addon-admin-ui": "1.2.607",
|
|
80
79
|
"@camstack/addon-agent-ui": "1.2.339",
|
|
81
80
|
"@camstack/addon-auth": "1.2.178",
|
|
82
81
|
"@camstack/addon-benchmark": "1.2.312",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Bo as BaseAddon, Ia as storageOccupancyCapability, _i as mayWriteToLocation, ac as nodePin, bc as toNodeId, kc as EventCategory, wn as backupCapability } from "../../dist-Dgkqkron.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
|
-
import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-
|
|
3
|
+
import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-DfFB1J2w.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import * as fs$1 from "node:fs";
|
|
6
6
|
import * as path$1 from "node:path";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* System → Authentication / the first-login server name — the bootstrap form.
|
|
3
|
+
*
|
|
4
|
+
* `system-config` owns nine keys that stay bootstrap `ConfigManager` values
|
|
5
|
+
* (`server.name`, `server.port|host|dataPath`, `auth.tokenExpiry|accessTokenExpiry|
|
|
6
|
+
* trustedProxies|trustedNetworks|corsOrigins`). They are NOT addon settings: no
|
|
7
|
+
* capability declares them, so the addon-level hooks (`getGlobalSettings` /
|
|
8
|
+
* `updateGlobalSettings`) are not their carrier. The form is served by this
|
|
9
|
+
* action pair instead (D986 §7).
|
|
10
|
+
*
|
|
11
|
+
* Reading is open to any signed-in caller, as `getGlobalSettings` was; a save is
|
|
12
|
+
* admin-only, as `addonSettings.updateGlobalSettings` was.
|
|
13
|
+
*/
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import { type CustomActionsSpec } from "@camstack/types";
|
|
16
|
+
/** The save input: the patch of the fields the operator changed. */
|
|
17
|
+
export interface BootstrapFormSaveInput {
|
|
18
|
+
readonly patch: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export declare const BootstrapFormSaveInputSchema: z.ZodType<BootstrapFormSaveInput>;
|
|
21
|
+
export declare const bootstrapFormActions: CustomActionsSpec;
|
|
@@ -33,15 +33,9 @@ export declare class SystemConfigAddon extends BaseAddon {
|
|
|
33
33
|
private readAgentDashboardOrigins;
|
|
34
34
|
/** The keychain handle for owner `system`; `null` where there is no door. */
|
|
35
35
|
private systemSecrets;
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
* The admin UI / `addonSettings` cap prefer {@link BaseAddon.updateGlobalSettingsAsOperator}.
|
|
40
|
-
* That BaseAddon path writes the generic addon store and never reaches the
|
|
41
|
-
* yml sections. Route the operator write through the same section-aware path
|
|
42
|
-
* as {@link updateGlobalSettings}.
|
|
43
|
-
*/
|
|
44
|
-
override updateGlobalSettingsAsOperator(patch: Record<string, unknown>, _nodeId?: string): Promise<void>;
|
|
36
|
+
private buildBootstrapSchema;
|
|
37
|
+
/** The hydrated bootstrap form (`getBootstrapForm`). A section that cannot be read fails the call. */
|
|
38
|
+
getBootstrapForm(): Promise<ConfigUISchemaWithValues>;
|
|
45
39
|
/**
|
|
46
40
|
* The value to store for a `name` in a save, or `undefined` for "leave the row
|
|
47
41
|
* alone". The whole form posts every field, so an empty box on a hub that was
|
|
@@ -51,6 +45,7 @@ export declare class SystemConfigAddon extends BaseAddon {
|
|
|
51
45
|
* name — refused whole, like the network lists.
|
|
52
46
|
*/
|
|
53
47
|
private normalizeServerName;
|
|
54
|
-
|
|
48
|
+
/** Validate and write the patch (`saveBootstrapForm`, admin-only). A refused patch writes nothing. */
|
|
49
|
+
saveBootstrapForm(patch: Record<string, unknown>): Promise<void>;
|
|
55
50
|
}
|
|
56
51
|
export default SystemConfigAddon;
|
|
@@ -88708,6 +88708,35 @@ var HubPairing = class {
|
|
|
88708
88708
|
}
|
|
88709
88709
|
};
|
|
88710
88710
|
//#endregion
|
|
88711
|
+
//#region src/builtins/system-config/bootstrap-form-actions.ts
|
|
88712
|
+
/**
|
|
88713
|
+
* System → Authentication / the first-login server name — the bootstrap form.
|
|
88714
|
+
*
|
|
88715
|
+
* `system-config` owns nine keys that stay bootstrap `ConfigManager` values
|
|
88716
|
+
* (`server.name`, `server.port|host|dataPath`, `auth.tokenExpiry|accessTokenExpiry|
|
|
88717
|
+
* trustedProxies|trustedNetworks|corsOrigins`). They are NOT addon settings: no
|
|
88718
|
+
* capability declares them, so the addon-level hooks (`getGlobalSettings` /
|
|
88719
|
+
* `updateGlobalSettings`) are not their carrier. The form is served by this
|
|
88720
|
+
* action pair instead (D986 §7).
|
|
88721
|
+
*
|
|
88722
|
+
* Reading is open to any signed-in caller, as `getGlobalSettings` was; a save is
|
|
88723
|
+
* admin-only, as `addonSettings.updateGlobalSettings` was.
|
|
88724
|
+
*/
|
|
88725
|
+
/** The hydrated form: schema with each field's stored value inline. */
|
|
88726
|
+
var BootstrapFormSchema = zod.z.custom((value) => typeof value === "object" && value !== null && Array.isArray(Reflect.get(value, "sections")));
|
|
88727
|
+
/** Field key → new value. Only the keys the operator changed. */
|
|
88728
|
+
var BootstrapFormPatchSchema = zod.z.record(zod.z.string(), zod.z.unknown());
|
|
88729
|
+
var BootstrapFormSaveInputSchema = zod.z.object({ patch: BootstrapFormPatchSchema });
|
|
88730
|
+
var bootstrapFormActions = require_dist.defineCustomActions({
|
|
88731
|
+
/** The hydrated bootstrap form. A section that cannot be read fails the call. */
|
|
88732
|
+
getBootstrapForm: require_dist.customAction(zod.z.object({}), BootstrapFormSchema, { kind: "query" }),
|
|
88733
|
+
/** Validate and write the patch; a refused patch writes nothing. */
|
|
88734
|
+
saveBootstrapForm: require_dist.customAction(BootstrapFormSaveInputSchema, zod.z.object({ success: zod.z.literal(true) }), {
|
|
88735
|
+
kind: "mutation",
|
|
88736
|
+
auth: "admin"
|
|
88737
|
+
})
|
|
88738
|
+
});
|
|
88739
|
+
//#endregion
|
|
88711
88740
|
//#region src/builtins/system-config/mesh-actions.ts
|
|
88712
88741
|
/**
|
|
88713
88742
|
* System → Cluster — agent-ui unlock tickets (D821).
|
|
@@ -88788,7 +88817,7 @@ var SECTION_TITLES = {
|
|
|
88788
88817
|
var SYSTEM_SECRET_OWNER = "system";
|
|
88789
88818
|
/** The form key (and the `server` section key) of the hub's human name (D861). */
|
|
88790
88819
|
var SERVER_NAME_FIELD = "name";
|
|
88791
|
-
/** Keys that map 1:1 to a given yml section — used by `
|
|
88820
|
+
/** Keys that map 1:1 to a given yml section — used by `saveBootstrapForm`
|
|
88792
88821
|
* to figure out which section owns each key in the incoming patch. */
|
|
88793
88822
|
var KEY_TO_SECTION = {
|
|
88794
88823
|
port: "server",
|
|
@@ -88841,10 +88870,20 @@ var SystemConfigAddon = class extends require_dist.BaseAddon {
|
|
|
88841
88870
|
onReady: (ca) => this.onMeshCaReady(ca)
|
|
88842
88871
|
});
|
|
88843
88872
|
await this.meshCaKeeper.start();
|
|
88844
|
-
this.ctx.logger.info("Initialized — exposes yml-backed
|
|
88873
|
+
this.ctx.logger.info("Initialized — exposes the yml-backed bootstrap form via getBootstrapForm / saveBootstrapForm");
|
|
88845
88874
|
return {
|
|
88846
|
-
customActions:
|
|
88847
|
-
|
|
88875
|
+
customActions: {
|
|
88876
|
+
...systemConfigMeshActions,
|
|
88877
|
+
...bootstrapFormActions
|
|
88878
|
+
},
|
|
88879
|
+
actionHandlers: {
|
|
88880
|
+
getBootstrapForm: async () => this.getBootstrapForm(),
|
|
88881
|
+
saveBootstrapForm: async (input) => {
|
|
88882
|
+
await this.saveBootstrapForm(BootstrapFormSaveInputSchema.parse(input).patch);
|
|
88883
|
+
return { success: true };
|
|
88884
|
+
},
|
|
88885
|
+
mintAgentUiUnlockTicket: async (input) => this.mintAgentUiUnlock(parseMintUnlockInput(input))
|
|
88886
|
+
}
|
|
88848
88887
|
};
|
|
88849
88888
|
}
|
|
88850
88889
|
async onShutdown() {
|
|
@@ -88995,7 +89034,7 @@ var SystemConfigAddon = class extends require_dist.BaseAddon {
|
|
|
88995
89034
|
const forOwner = this.ctx.secrets?.forOwner ?? null;
|
|
88996
89035
|
return forOwner === null ? null : forOwner(SYSTEM_SECRET_OWNER);
|
|
88997
89036
|
}
|
|
88998
|
-
|
|
89037
|
+
buildBootstrapSchema() {
|
|
88999
89038
|
return { sections: [
|
|
89000
89039
|
{
|
|
89001
89040
|
id: "system-config-server",
|
|
@@ -89131,8 +89170,9 @@ var SystemConfigAddon = class extends require_dist.BaseAddon {
|
|
|
89131
89170
|
}
|
|
89132
89171
|
] };
|
|
89133
89172
|
}
|
|
89134
|
-
|
|
89135
|
-
|
|
89173
|
+
/** The hydrated bootstrap form (`getBootstrapForm`). A section that cannot be read fails the call. */
|
|
89174
|
+
async getBootstrapForm() {
|
|
89175
|
+
const schema = this.buildBootstrapSchema();
|
|
89136
89176
|
if (!this.ctx.settings) return require_dist.hydrateSchema(schema, {});
|
|
89137
89177
|
const sectionNames = Object.keys(SECTION_TITLES);
|
|
89138
89178
|
const merged = {};
|
|
@@ -89149,15 +89189,6 @@ var SystemConfigAddon = class extends require_dist.BaseAddon {
|
|
|
89149
89189
|
return require_dist.hydrateSchema(schema, merged, { inlineSecretsAsViews: true });
|
|
89150
89190
|
}
|
|
89151
89191
|
/**
|
|
89152
|
-
* The admin UI / `addonSettings` cap prefer {@link BaseAddon.updateGlobalSettingsAsOperator}.
|
|
89153
|
-
* That BaseAddon path writes the generic addon store and never reaches the
|
|
89154
|
-
* yml sections. Route the operator write through the same section-aware path
|
|
89155
|
-
* as {@link updateGlobalSettings}.
|
|
89156
|
-
*/
|
|
89157
|
-
async updateGlobalSettingsAsOperator(patch, _nodeId) {
|
|
89158
|
-
await this.updateGlobalSettings(patch);
|
|
89159
|
-
}
|
|
89160
|
-
/**
|
|
89161
89192
|
* The value to store for a `name` in a save, or `undefined` for "leave the row
|
|
89162
89193
|
* alone". The whole form posts every field, so an empty box on a hub that was
|
|
89163
89194
|
* never named is the NORMAL case and must write nothing (D861: a seed never
|
|
@@ -89176,7 +89207,8 @@ var SystemConfigAddon = class extends require_dist.BaseAddon {
|
|
|
89176
89207
|
if (!parsed.success) throw new Error(parsed.error.issues[0]?.message ?? "The server name is not valid");
|
|
89177
89208
|
return parsed.data;
|
|
89178
89209
|
}
|
|
89179
|
-
|
|
89210
|
+
/** Validate and write the patch (`saveBootstrapForm`, admin-only). A refused patch writes nothing. */
|
|
89211
|
+
async saveBootstrapForm(patch) {
|
|
89180
89212
|
if (!this.ctx.settings) throw new Error("system-config: ctx.settings not available — cannot write sections");
|
|
89181
89213
|
const perSection = /* @__PURE__ */ new Map();
|
|
89182
89214
|
for (const [key, value] of Object.entries(patch)) {
|