@selfhelp/shared 1.7.0 → 1.7.2

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 CHANGED
@@ -9,6 +9,42 @@ All notable changes to `@selfhelp/shared` will be documented in this file.
9
9
 
10
10
  This project follows semantic versioning.
11
11
 
12
+ ## v1.7.2
13
+
14
+ ### Added
15
+
16
+ - `InstanceManifest` now models the optional `backupSchedule`
17
+ (`BackupSchedulePolicy` + `BackupRetentionPolicy`) and `envOverrides` fields,
18
+ mirroring the manager's authoritative manifest contract
19
+ (`sh-manager/packages/schemas/src/types.ts`). Both are optional — additive and
20
+ backward compatible. This restores the cross-repo `distribution.test.ts`
21
+ parity check, which was red against the manager's `instance-manifest.json`
22
+ example fixture.
23
+
24
+ ### Changed
25
+
26
+ - **Lint is now a blocking CI gate.** `npm run lint -- --max-warnings=0` runs on
27
+ every PR/push to `main` (`plugin-sdk-check.yml`) and before npm publish
28
+ (`publish.yml` now runs headers → lint → typecheck → build → test before
29
+ `npm publish`). The strict, type-aware ESLint flat config already existed but
30
+ was not enforced by any workflow; no lint rules were changed and no runtime
31
+ behavior changed.
32
+
33
+ ## v1.7.1
34
+
35
+ ### Changed
36
+
37
+ - Documented the `frontend_compatibility` preflight check code in the
38
+ system-maintenance contract (`types/api/system.ts`). The frontend-only update
39
+ preflight (`IFrontendUpdatePreflight`) now carries the standardized
40
+ `ICompatibilityError` fields under a `frontend_compatibility` check when the
41
+ running core forbids the target frontend, or the target frontend needs a
42
+ different core — the bidirectional frontend ⇄ core rule the SelfHelp Manager
43
+ enforces, now mirrored by the CMS so its verdict matches the manager's instead
44
+ of always reporting "OK". No shape change: `IUpdatePreflightCheck` already
45
+ carries `code` plus the compatibility fields, so this is a documentation /
46
+ contract-clarification release (additive, backward compatible).
47
+
12
48
  ## v1.7.0
13
49
 
14
50
  ### Added
package/dist/index.d.mts CHANGED
@@ -552,9 +552,11 @@ interface IUpdatePreflightCheck {
552
552
  message: string;
553
553
  /**
554
554
  * Standardized compatibility-error fields. Version/compatibility checks
555
- * (e.g. `plugin_compatibility`) populate these so the admin/operator sees
556
- * exactly which component blocks which target and the range it requires.
557
- * Absent on non-compatibility checks.
555
+ * (`plugin_compatibility` for a core update blocked by an installed plugin;
556
+ * `frontend_compatibility` for a frontend-only update the running core
557
+ * forbids or that needs a different core) populate these so the
558
+ * admin/operator sees exactly which component blocks which target and the
559
+ * range it requires. Absent on non-compatibility checks.
558
560
  */
559
561
  component?: string;
560
562
  component_id?: string;
@@ -728,11 +730,16 @@ interface IFrontendUpdateRequest {
728
730
  type IFrontendUpdateReleases = IUpdateReleases;
729
731
  type IFrontendUpdateReleasesResponse = IUpdateReleasesResponse;
730
732
  /**
731
- * GET /admin/system/update/frontend/preflight — lightweight compatibility
732
- * verdict for a frontend-only target. Reuses {@link IUpdatePreflight}; the
733
- * frontend is stateless so `database.destructive`/`requires_backup` are always
734
- * false and the authoritative frontend ⇄ core + signature checks are deferred to
735
- * the manager. Aliased for call-site clarity.
733
+ * GET /admin/system/update/frontend/preflight — compatibility verdict for a
734
+ * frontend-only target. Reuses {@link IUpdatePreflight}; the frontend is
735
+ * stateless so `database.destructive`/`requires_backup` are always false. The
736
+ * frontend ⇄ core compatibility rule IS evaluated here (as a
737
+ * `frontend_compatibility` check) against the same signed registry metadata the
738
+ * SelfHelp Manager resolves, so the CMS verdict matches the manager's instead of
739
+ * always reporting "OK"; the manager still re-verifies signatures + image
740
+ * digests at execution and remains the final authority (it also enforces the
741
+ * running core's range from the instance lock when the core release has left the
742
+ * registry). Aliased for call-site clarity.
736
743
  */
737
744
  type IFrontendUpdatePreflight = IUpdatePreflight;
738
745
  type IFrontendUpdatePreflightResponse = IUpdatePreflightResponse;
@@ -839,6 +846,27 @@ interface InstanceResourceConfig {
839
846
  logMaxSizeMb?: number;
840
847
  logMaxFiles?: number;
841
848
  }
849
+ /**
850
+ * GFS (grandfather-father-son) retention numbers for SCHEDULED backups.
851
+ * Mirrors the manager's authoritative `BackupRetentionPolicy`
852
+ * (sh-manager/packages/schemas/src/types.ts).
853
+ */
854
+ interface BackupRetentionPolicy {
855
+ daily: number;
856
+ weekly: number;
857
+ monthly: number;
858
+ maxAgeDays: number;
859
+ }
860
+ /**
861
+ * Per-instance nightly backup schedule stored in the instance manifest.
862
+ * Mirrors the manager's authoritative `BackupSchedulePolicy`.
863
+ */
864
+ interface BackupSchedulePolicy {
865
+ enabled: boolean;
866
+ /** Daily run time as `HH:MM` in the manager server's local time. */
867
+ time: string;
868
+ retention: BackupRetentionPolicy;
869
+ }
842
870
  interface InstanceManifest {
843
871
  manifestVersion: number;
844
872
  instanceId: string;
@@ -857,6 +885,14 @@ interface InstanceManifest {
857
885
  routing: InstanceRouting;
858
886
  installedPlugins: InstalledPlugin[];
859
887
  resources?: InstanceResourceConfig;
888
+ /** Optional scheduled-backup policy; absent = no scheduled backups. */
889
+ backupSchedule?: BackupSchedulePolicy;
890
+ /**
891
+ * Operator-set non-secret environment overrides merged on top of the
892
+ * generated `.env`. Manager-controlled structural keys and secrets are
893
+ * never stored here. Mirrors the manager's authoritative manifest contract.
894
+ */
895
+ envOverrides?: Record<string, string>;
860
896
  }
861
897
  interface LockServiceEntry {
862
898
  image: string;
@@ -1446,4 +1482,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
1446
1482
  */
1447
1483
  declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
1448
1484
 
1449
- export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMissingStyle, type INoAccessStyle, type INotFoundStyle, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, IStyleWithSpacing, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, PERMISSIONS, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, type TPermission, type TPlatform, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, parseSpacing, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, transformPageData, transformPagesData };
1485
+ export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMissingStyle, type INoAccessStyle, type INotFoundStyle, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, IStyleWithSpacing, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, PERMISSIONS, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, type TPermission, type TPlatform, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, parseSpacing, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, transformPageData, transformPagesData };
package/dist/index.d.ts CHANGED
@@ -552,9 +552,11 @@ interface IUpdatePreflightCheck {
552
552
  message: string;
553
553
  /**
554
554
  * Standardized compatibility-error fields. Version/compatibility checks
555
- * (e.g. `plugin_compatibility`) populate these so the admin/operator sees
556
- * exactly which component blocks which target and the range it requires.
557
- * Absent on non-compatibility checks.
555
+ * (`plugin_compatibility` for a core update blocked by an installed plugin;
556
+ * `frontend_compatibility` for a frontend-only update the running core
557
+ * forbids or that needs a different core) populate these so the
558
+ * admin/operator sees exactly which component blocks which target and the
559
+ * range it requires. Absent on non-compatibility checks.
558
560
  */
559
561
  component?: string;
560
562
  component_id?: string;
@@ -728,11 +730,16 @@ interface IFrontendUpdateRequest {
728
730
  type IFrontendUpdateReleases = IUpdateReleases;
729
731
  type IFrontendUpdateReleasesResponse = IUpdateReleasesResponse;
730
732
  /**
731
- * GET /admin/system/update/frontend/preflight — lightweight compatibility
732
- * verdict for a frontend-only target. Reuses {@link IUpdatePreflight}; the
733
- * frontend is stateless so `database.destructive`/`requires_backup` are always
734
- * false and the authoritative frontend ⇄ core + signature checks are deferred to
735
- * the manager. Aliased for call-site clarity.
733
+ * GET /admin/system/update/frontend/preflight — compatibility verdict for a
734
+ * frontend-only target. Reuses {@link IUpdatePreflight}; the frontend is
735
+ * stateless so `database.destructive`/`requires_backup` are always false. The
736
+ * frontend ⇄ core compatibility rule IS evaluated here (as a
737
+ * `frontend_compatibility` check) against the same signed registry metadata the
738
+ * SelfHelp Manager resolves, so the CMS verdict matches the manager's instead of
739
+ * always reporting "OK"; the manager still re-verifies signatures + image
740
+ * digests at execution and remains the final authority (it also enforces the
741
+ * running core's range from the instance lock when the core release has left the
742
+ * registry). Aliased for call-site clarity.
736
743
  */
737
744
  type IFrontendUpdatePreflight = IUpdatePreflight;
738
745
  type IFrontendUpdatePreflightResponse = IUpdatePreflightResponse;
@@ -839,6 +846,27 @@ interface InstanceResourceConfig {
839
846
  logMaxSizeMb?: number;
840
847
  logMaxFiles?: number;
841
848
  }
849
+ /**
850
+ * GFS (grandfather-father-son) retention numbers for SCHEDULED backups.
851
+ * Mirrors the manager's authoritative `BackupRetentionPolicy`
852
+ * (sh-manager/packages/schemas/src/types.ts).
853
+ */
854
+ interface BackupRetentionPolicy {
855
+ daily: number;
856
+ weekly: number;
857
+ monthly: number;
858
+ maxAgeDays: number;
859
+ }
860
+ /**
861
+ * Per-instance nightly backup schedule stored in the instance manifest.
862
+ * Mirrors the manager's authoritative `BackupSchedulePolicy`.
863
+ */
864
+ interface BackupSchedulePolicy {
865
+ enabled: boolean;
866
+ /** Daily run time as `HH:MM` in the manager server's local time. */
867
+ time: string;
868
+ retention: BackupRetentionPolicy;
869
+ }
842
870
  interface InstanceManifest {
843
871
  manifestVersion: number;
844
872
  instanceId: string;
@@ -857,6 +885,14 @@ interface InstanceManifest {
857
885
  routing: InstanceRouting;
858
886
  installedPlugins: InstalledPlugin[];
859
887
  resources?: InstanceResourceConfig;
888
+ /** Optional scheduled-backup policy; absent = no scheduled backups. */
889
+ backupSchedule?: BackupSchedulePolicy;
890
+ /**
891
+ * Operator-set non-secret environment overrides merged on top of the
892
+ * generated `.env`. Manager-controlled structural keys and secrets are
893
+ * never stored here. Mirrors the manager's authoritative manifest contract.
894
+ */
895
+ envOverrides?: Record<string, string>;
860
896
  }
861
897
  interface LockServiceEntry {
862
898
  image: string;
@@ -1446,4 +1482,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
1446
1482
  */
1447
1483
  declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
1448
1484
 
1449
- export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMissingStyle, type INoAccessStyle, type INotFoundStyle, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, IStyleWithSpacing, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, PERMISSIONS, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, type TPermission, type TPlatform, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, parseSpacing, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, transformPageData, transformPagesData };
1485
+ export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMeta, type IMissingStyle, type INoAccessStyle, type INotFoundStyle, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageSectionWithFields, type IPageSectionsData, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type ISpacingValue, IStyleWithSpacing, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, PERMISSIONS, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, type TPermission, type TPlatform, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, type WorkerRelease, buildConditionContext, classifyClass, classifyClassString, evaluateCondition, findRemap, parseSpacing, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, spacingToClasses, transformPageData, transformPagesData };
@@ -395,12 +395,12 @@ function usePluginRealtime(options) {
395
395
  (0, import_react.useEffect)(() => {
396
396
  if (!enabled) {
397
397
  setIsOnline(false);
398
- return;
398
+ return void 0;
399
399
  }
400
400
  const factory = transportFactory ?? (isEventSourceAvailable() ? defaultTransportFactory : null);
401
401
  if (factory === null) {
402
402
  setIsOnline(false);
403
- return;
403
+ return void 0;
404
404
  }
405
405
  let cancelled = false;
406
406
  let transport = null;
@@ -412,7 +412,7 @@ function usePluginRealtime(options) {
412
412
  } catch (err) {
413
413
  setError(err instanceof Error ? err : new Error(String(err)));
414
414
  setIsOnline(false);
415
- return;
415
+ return void 0;
416
416
  }
417
417
  const eventName = `plugin/${pluginId}/${expandedTopic}`;
418
418
  const url = buildSseUrl(endpoint, pluginId, expandedTopic);
@@ -351,12 +351,12 @@ function usePluginRealtime(options) {
351
351
  useEffect(() => {
352
352
  if (!enabled) {
353
353
  setIsOnline(false);
354
- return;
354
+ return void 0;
355
355
  }
356
356
  const factory = transportFactory ?? (isEventSourceAvailable() ? defaultTransportFactory : null);
357
357
  if (factory === null) {
358
358
  setIsOnline(false);
359
- return;
359
+ return void 0;
360
360
  }
361
361
  let cancelled = false;
362
362
  let transport = null;
@@ -368,7 +368,7 @@ function usePluginRealtime(options) {
368
368
  } catch (err) {
369
369
  setError(err instanceof Error ? err : new Error(String(err)));
370
370
  setIsOnline(false);
371
- return;
371
+ return void 0;
372
372
  }
373
373
  const eventName = `plugin/${pluginId}/${expandedTopic}`;
374
374
  const url = buildSseUrl(endpoint, pluginId, expandedTopic);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selfhelp/shared",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "Shared TypeScript package for SelfHelp web frontend and mobile app: style registry, types, API contracts, Mantine theme tokens, condition + interpolation engines, CMS class allow-list.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,7 +54,8 @@
54
54
  "scripts": {
55
55
  "build": "tsup src/index.ts src/registry/index.ts src/theme/index.ts src/theme/tailwind.ts src/plugin-sdk/index.ts src/testing/index.ts --format cjs,esm --dts --clean --no-splitting",
56
56
  "dev": "tsup src/index.ts src/registry/index.ts src/theme/index.ts src/theme/tailwind.ts src/plugin-sdk/index.ts src/testing/index.ts --format cjs,esm --dts --watch --no-splitting",
57
- "lint": "eslint . --ext .ts",
57
+ "lint": "eslint .",
58
+ "lint:fix": "eslint . --fix",
58
59
  "typecheck": "tsc --noEmit",
59
60
  "test": "vitest run --passWithNoTests",
60
61
  "test:coverage": "vitest run --coverage",
@@ -78,17 +79,19 @@
78
79
  }
79
80
  },
80
81
  "devDependencies": {
82
+ "@eslint/js": "^9.18.0",
81
83
  "@types/json-logic-js": "^2.0.8",
82
84
  "@types/node": "^22.10.0",
83
85
  "@types/react": "^19.2.15",
84
- "@typescript-eslint/eslint-plugin": "^8.0.0",
85
- "@typescript-eslint/parser": "^8.0.0",
86
86
  "@vitest/coverage-istanbul": "^2.1.9",
87
87
  "eslint": "^9.18.0",
88
+ "eslint-plugin-unused-imports": "^4.1.4",
89
+ "globals": "^14.0.0",
88
90
  "license-check-and-add": "^4.0.5",
89
91
  "react": "^19.2.6",
90
92
  "tsup": "^8.3.5",
91
93
  "typescript": "^5.6.0",
94
+ "typescript-eslint": "^8.18.0",
92
95
  "vitest": "^2.1.0"
93
96
  },
94
97
  "publishConfig": {
@@ -100,7 +100,7 @@ export function evaluateCondition(
100
100
  // jsonLogic typings are loose; the result of any boolean rule is
101
101
  // a boolean, but rules like {var: 'x'} can return raw values, so
102
102
  // we coerce.
103
- const raw = jsonLogic.apply(parsed as jsonLogic.RulesLogic, context as Record<string, unknown>);
103
+ const raw: unknown = jsonLogic.apply(parsed as jsonLogic.RulesLogic, context);
104
104
  const visible = Boolean(raw);
105
105
  return options.withDebug
106
106
  ? { visible, debug: { condition: trimmed, result: visible, variables: { ...context } } }
@@ -167,7 +167,7 @@ export function usePluginRealtime<TPayload = unknown>(
167
167
  useEffect(() => {
168
168
  if (!enabled) {
169
169
  setIsOnline(false);
170
- return;
170
+ return undefined;
171
171
  }
172
172
 
173
173
  const factory = transportFactory ?? (isEventSourceAvailable() ? defaultTransportFactory : null);
@@ -176,7 +176,7 @@ export function usePluginRealtime<TPayload = unknown>(
176
176
  // `react-native-sse`). Stay quiet — the plan forbids polling
177
177
  // here; the consumer must render an offline banner instead.
178
178
  setIsOnline(false);
179
- return;
179
+ return undefined;
180
180
  }
181
181
 
182
182
  let cancelled = false;
@@ -190,7 +190,7 @@ export function usePluginRealtime<TPayload = unknown>(
190
190
  } catch (err) {
191
191
  setError(err instanceof Error ? err : new Error(String(err)));
192
192
  setIsOnline(false);
193
- return;
193
+ return undefined;
194
194
  }
195
195
 
196
196
  const eventName = `plugin/${pluginId}/${expandedTopic}`;
@@ -468,12 +468,12 @@ export interface ILockFileSeed {
468
468
  export function seedFromLockFile(lockJson: unknown): ILockFileSeed {
469
469
  const plugins: ILockFilePluginEntry[] = [];
470
470
  if (lockJson && typeof lockJson === 'object' && 'plugins' in lockJson) {
471
- const raw = (lockJson as { plugins: unknown }).plugins;
471
+ const raw = lockJson.plugins;
472
472
  if (raw && typeof raw === 'object') {
473
473
  for (const [pluginId, entry] of Object.entries(raw as Record<string, unknown>)) {
474
474
  const version =
475
475
  entry && typeof entry === 'object' && 'version' in entry
476
- ? String((entry as { version: unknown }).version)
476
+ ? String(entry.version)
477
477
  : '0.0.0';
478
478
  plugins.push({ pluginId, version });
479
479
  }
@@ -67,7 +67,7 @@ describe('release-channel enum parity', () => {
67
67
  const matches = [...src.matchAll(/channel:\s*\{\s*enum:\s*(\[[^\]]*\])/g)];
68
68
  expect(matches.length).toBeGreaterThan(0);
69
69
  for (const m of matches) {
70
- const arr = JSON.parse(m[1]!.replace(/'/g, '"')) as string[];
70
+ const arr = JSON.parse(m[1].replace(/'/g, '"')) as string[];
71
71
  expect([...arr].sort()).toEqual([...CANONICAL].sort());
72
72
  }
73
73
  });
@@ -53,7 +53,7 @@ const SPEC: Record<string, { required: string[]; optional?: string[]; kind?: str
53
53
  },
54
54
  'instance-manifest.json': {
55
55
  required: ['manifestVersion', 'instanceId', 'displayName', 'domain', 'mode', 'createdAt', 'updatedAt', 'registry', 'versions', 'images', 'routing', 'installedPlugins'],
56
- optional: ['resources'],
56
+ optional: ['resources', 'backupSchedule', 'envOverrides'],
57
57
  },
58
58
  'instance-lock.json': {
59
59
  required: ['lockfileVersion', 'generatedAt', 'registry', 'core', 'services', 'plugins'],
@@ -50,7 +50,7 @@ function interfaceFields(source: string, name: string): string[] {
50
50
  const line = rawLine.trim();
51
51
  if (line === '' || line.startsWith('//') || line.startsWith('*') || line.startsWith('/*')) continue;
52
52
  const m = /^([A-Za-z_][A-Za-z0-9_]*)\??\s*:/.exec(line);
53
- if (m) fields.push(m[1]!);
53
+ if (m) fields.push(m[1]);
54
54
  }
55
55
  return fields;
56
56
  }
@@ -4,27 +4,27 @@
4
4
  */
5
5
 
6
6
  import { describe, expect, it } from 'vitest';
7
- import { SYSTEM_ENDPOINTS } from '../system';
8
- import type {
9
- IFrontendUpdatePreflight,
10
- IFrontendUpdateReleases,
11
- IFrontendUpdateRequest,
12
- IFrontendUpdateRequestResponse,
13
- IMaintenanceSetRequest,
14
- ISystemAdvisories,
15
- ISystemAdvisoriesResponse,
16
- ISystemAdvisory,
17
- ISystemHealth,
18
- ISystemMaintenance,
19
- ISystemVersion,
20
- IUpdatePreflight,
21
- IUpdateRequest,
22
- IUpdateRequestResponse,
23
- IUpdateStatus,
24
- IUpdateStatusResponse,
25
- TSystemAdvisorySeverity,
26
- TUpdateKind,
27
- TUpdateOperationStatus,
7
+ import {
8
+ SYSTEM_ENDPOINTS,
9
+ type IFrontendUpdatePreflight,
10
+ type IFrontendUpdateReleases,
11
+ type IFrontendUpdateRequest,
12
+ type IFrontendUpdateRequestResponse,
13
+ type IMaintenanceSetRequest,
14
+ type ISystemAdvisories,
15
+ type ISystemAdvisoriesResponse,
16
+ type ISystemAdvisory,
17
+ type ISystemHealth,
18
+ type ISystemMaintenance,
19
+ type ISystemVersion,
20
+ type IUpdatePreflight,
21
+ type IUpdateRequest,
22
+ type IUpdateRequestResponse,
23
+ type IUpdateStatus,
24
+ type IUpdateStatusResponse,
25
+ type TSystemAdvisorySeverity,
26
+ type TUpdateKind,
27
+ type TUpdateOperationStatus,
28
28
  } from '../system';
29
29
 
30
30
  /**
@@ -226,7 +226,7 @@ describe('system maintenance contracts', () => {
226
226
  rollback: { automatic_before_migrations: true, automatic_after_destructive_migrations: false },
227
227
  };
228
228
 
229
- const check = blocked.checks[0]!;
229
+ const check = blocked.checks[0];
230
230
  expect(blocked.status).toBe('blocked');
231
231
  expect(check.component).toBe('plugin');
232
232
  expect(check.component_id).toBe('sh2-shp-survey-js');
@@ -178,9 +178,11 @@ export interface IUpdatePreflightCheck {
178
178
  message: string;
179
179
  /**
180
180
  * Standardized compatibility-error fields. Version/compatibility checks
181
- * (e.g. `plugin_compatibility`) populate these so the admin/operator sees
182
- * exactly which component blocks which target and the range it requires.
183
- * Absent on non-compatibility checks.
181
+ * (`plugin_compatibility` for a core update blocked by an installed plugin;
182
+ * `frontend_compatibility` for a frontend-only update the running core
183
+ * forbids or that needs a different core) populate these so the
184
+ * admin/operator sees exactly which component blocks which target and the
185
+ * range it requires. Absent on non-compatibility checks.
184
186
  */
185
187
  component?: string;
186
188
  component_id?: string;
@@ -385,11 +387,16 @@ export type IFrontendUpdateReleases = IUpdateReleases;
385
387
  export type IFrontendUpdateReleasesResponse = IUpdateReleasesResponse;
386
388
 
387
389
  /**
388
- * GET /admin/system/update/frontend/preflight — lightweight compatibility
389
- * verdict for a frontend-only target. Reuses {@link IUpdatePreflight}; the
390
- * frontend is stateless so `database.destructive`/`requires_backup` are always
391
- * false and the authoritative frontend ⇄ core + signature checks are deferred to
392
- * the manager. Aliased for call-site clarity.
390
+ * GET /admin/system/update/frontend/preflight — compatibility verdict for a
391
+ * frontend-only target. Reuses {@link IUpdatePreflight}; the frontend is
392
+ * stateless so `database.destructive`/`requires_backup` are always false. The
393
+ * frontend ⇄ core compatibility rule IS evaluated here (as a
394
+ * `frontend_compatibility` check) against the same signed registry metadata the
395
+ * SelfHelp Manager resolves, so the CMS verdict matches the manager's instead of
396
+ * always reporting "OK"; the manager still re-verifies signatures + image
397
+ * digests at execution and remains the final authority (it also enforces the
398
+ * running core's range from the instance lock when the core release has left the
399
+ * registry). Aliased for call-site clarity.
393
400
  */
394
401
  export type IFrontendUpdatePreflight = IUpdatePreflight;
395
402
  export type IFrontendUpdatePreflightResponse = IUpdatePreflightResponse;
@@ -121,6 +121,29 @@ export interface InstanceResourceConfig {
121
121
  logMaxFiles?: number;
122
122
  }
123
123
 
124
+ /**
125
+ * GFS (grandfather-father-son) retention numbers for SCHEDULED backups.
126
+ * Mirrors the manager's authoritative `BackupRetentionPolicy`
127
+ * (sh-manager/packages/schemas/src/types.ts).
128
+ */
129
+ export interface BackupRetentionPolicy {
130
+ daily: number;
131
+ weekly: number;
132
+ monthly: number;
133
+ maxAgeDays: number;
134
+ }
135
+
136
+ /**
137
+ * Per-instance nightly backup schedule stored in the instance manifest.
138
+ * Mirrors the manager's authoritative `BackupSchedulePolicy`.
139
+ */
140
+ export interface BackupSchedulePolicy {
141
+ enabled: boolean;
142
+ /** Daily run time as `HH:MM` in the manager server's local time. */
143
+ time: string;
144
+ retention: BackupRetentionPolicy;
145
+ }
146
+
124
147
  export interface InstanceManifest {
125
148
  manifestVersion: number;
126
149
  instanceId: string;
@@ -139,6 +162,14 @@ export interface InstanceManifest {
139
162
  routing: InstanceRouting;
140
163
  installedPlugins: InstalledPlugin[];
141
164
  resources?: InstanceResourceConfig;
165
+ /** Optional scheduled-backup policy; absent = no scheduled backups. */
166
+ backupSchedule?: BackupSchedulePolicy;
167
+ /**
168
+ * Operator-set non-secret environment overrides merged on top of the
169
+ * generated `.env`. Manager-controlled structural keys and secrets are
170
+ * never stored here. Mirrors the manager's authoritative manifest contract.
171
+ */
172
+ envOverrides?: Record<string, string>;
142
173
  }
143
174
 
144
175
  // ---------------------------------------------------------------------------
@@ -55,7 +55,10 @@ export function spacingToClasses(
55
55
  spacingToTailwind: Record<string, string>
56
56
  ): string[] {
57
57
  const classes: string[] = [];
58
- for (const [key, raw] of Object.entries(spacing)) {
58
+ // `Object.entries` widens the value of an index-signature-free interface to
59
+ // `any`; restate the real `ISpacingValue` value type so the computed lookup
60
+ // below stays type-safe. Runtime behaviour is unchanged.
61
+ for (const [key, raw] of Object.entries(spacing) as Array<[string, string | undefined]>) {
59
62
  if (!raw) continue;
60
63
  const tail = spacingToTailwind[raw] ?? raw;
61
64
  classes.push(`${key}-${tail}`);