@jwilleke/ngdpbase-types 0.0.0 → 5.18.0
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/LICENSE +201 -0
- package/README.md +16 -2
- package/lib/packages/ngdpbase-types/index.d.ts +32 -0
- package/lib/packages/ngdpbase-types/testing.d.ts +43 -0
- package/lib/packages/ngdpbase-types/testing.js +53 -0
- package/lib/src/cache/CacheDependencies.d.ts +50 -0
- package/lib/src/cache/CacheDependencies.js +50 -0
- package/lib/src/cache/ICacheAdapter.d.ts +86 -0
- package/lib/src/cache/RegionCache.d.ts +171 -0
- package/lib/src/context/ActorContext.d.ts +48 -0
- package/lib/src/context/ActorContext.js +33 -0
- package/lib/src/context/ApiContext.d.ts +194 -0
- package/lib/src/context/ApiContext.js +273 -0
- package/lib/src/context/BaseContext.d.ts +110 -0
- package/lib/src/context/BaseContext.js +143 -0
- package/lib/src/context/JobContext.d.ts +153 -0
- package/lib/src/context/JobContext.js +144 -0
- package/lib/src/context/WikiContext.d.ts +404 -0
- package/lib/src/context/bootActions.d.ts +64 -0
- package/lib/src/context/bootActions.js +111 -0
- package/lib/src/converters/HtmlConverter.d.ts +70 -0
- package/lib/src/converters/IContentConverter.d.ts +94 -0
- package/lib/src/converters/JSPWikiConverter.d.ts +117 -0
- package/lib/src/converters/conversionWarning.d.ts +15 -0
- package/lib/src/converters/ncm/bridge.d.ts +22 -0
- package/lib/src/converters/ncm/existing.d.ts +23 -0
- package/lib/src/converters/ncm/fix/blocks.d.ts +89 -0
- package/lib/src/converters/ncm/fix/bulletMarkers.d.ts +21 -0
- package/lib/src/converters/ncm/fix/index.d.ts +36 -0
- package/lib/src/converters/ncm/fix/jspwikiBullets.d.ts +20 -0
- package/lib/src/converters/ncm/fix/jspwikiCodeMarkers.d.ts +38 -0
- package/lib/src/converters/ncm/fix/jspwikiHeadings.d.ts +25 -0
- package/lib/src/converters/ncm/fix/jspwikiIndent.d.ts +24 -0
- package/lib/src/converters/ncm/fix/jspwikiInsert.d.ts +21 -0
- package/lib/src/converters/ncm/fix/jspwikiItalic.d.ts +29 -0
- package/lib/src/converters/ncm/fix/jspwikiLinkLeftovers.d.ts +27 -0
- package/lib/src/converters/ncm/fix/moreInformationFooter.d.ts +25 -0
- package/lib/src/converters/ncm/fix/styleClosers.d.ts +25 -0
- package/lib/src/converters/ncm/fix/tightenLists.d.ts +30 -0
- package/lib/src/converters/ncm/fix/types.d.ts +33 -0
- package/lib/src/converters/ncm/footnotes.d.ts +39 -0
- package/lib/src/converters/ncm/images.d.ts +49 -0
- package/lib/src/converters/ncm/index.d.ts +20 -0
- package/lib/src/converters/ncm/links.d.ts +21 -0
- package/lib/src/converters/ncm/normalize.d.ts +39 -0
- package/lib/src/converters/ncm/placeholder.d.ts +25 -0
- package/lib/src/converters/ncm/tables.d.ts +36 -0
- package/lib/src/converters/ncm/types.d.ts +42 -0
- package/lib/src/http/egressPolicy.d.ts +52 -0
- package/lib/src/http/guardedFetch.d.ts +89 -0
- package/lib/src/http/guardedFetch.js +113 -0
- package/lib/src/http/guardedLookup.d.ts +48 -0
- package/lib/src/http/guardedLookup.js +73 -0
- package/lib/src/http/ssrf.d.ts +83 -0
- package/lib/src/http/ssrf.js +311 -0
- package/lib/src/mail/MailProvider.d.ts +36 -0
- package/lib/src/mail/NodemailerMailProvider.d.ts +26 -0
- package/lib/src/managers/AddonsManager.d.ts +691 -0
- package/lib/src/managers/AgentTokenManager.d.ts +269 -0
- package/lib/src/managers/AssetManager.d.ts +116 -0
- package/lib/src/managers/AttachmentManager.d.ts +1032 -0
- package/lib/src/managers/AuthManager.d.ts +1257 -0
- package/lib/src/managers/BackgroundJobManager.d.ts +434 -0
- package/lib/src/managers/BaseManager.d.ts +391 -0
- package/lib/src/managers/BaseManager.js +415 -0
- package/lib/src/managers/CacheManager.d.ts +159 -0
- package/lib/src/managers/CatalogManager.d.ts +235 -0
- package/lib/src/managers/CommentManager.d.ts +75 -0
- package/lib/src/managers/ConfigurationManager.d.ts +747 -0
- package/lib/src/managers/DatabaseManager.d.ts +89 -0
- package/lib/src/managers/DatabaseManager.js +236 -0
- package/lib/src/managers/EmailManager.d.ts +47 -0
- package/lib/src/managers/ExportManager.d.ts +129 -0
- package/lib/src/managers/ExportManager.js +420 -0
- package/lib/src/managers/FootnoteManager.d.ts +118 -0
- package/lib/src/managers/MediaManager.d.ts +279 -0
- package/lib/src/managers/MetricsManager.d.ts +89 -0
- package/lib/src/managers/NotificationManager.d.ts +165 -0
- package/lib/src/managers/OidcManager.d.ts +210 -0
- package/lib/src/managers/OrganizationManager.d.ts +107 -0
- package/lib/src/managers/PageManager.d.ts +1645 -0
- package/lib/src/managers/PersonManager.d.ts +48 -0
- package/lib/src/managers/PluginManager.d.ts +179 -0
- package/lib/src/managers/PluginManager.js +393 -0
- package/lib/src/managers/PolicyEvaluator.d.ts +213 -0
- package/lib/src/managers/RenderingManager.d.ts +358 -0
- package/lib/src/managers/RoleManager.d.ts +134 -0
- package/lib/src/managers/SearchManager.d.ts +402 -0
- package/lib/src/managers/ShareManager.d.ts +251 -0
- package/lib/src/managers/TemplateManager.d.ts +176 -0
- package/lib/src/managers/ThemeManager.d.ts +56 -0
- package/lib/src/managers/UserManager.d.ts +480 -0
- package/lib/src/managers/ValidationManager.d.ts +426 -0
- package/lib/src/managers/VariableManager.d.ts +145 -0
- package/lib/src/middleware/csrf.d.ts +3 -0
- package/lib/src/parsers/LinkParser.d.ts +457 -0
- package/lib/src/parsers/MarkupParser.d.ts +769 -0
- package/lib/src/parsers/context/ParseContext.d.ts +314 -0
- package/lib/src/parsers/data/emoji-map.d.ts +18 -0
- package/lib/src/parsers/dom/DOMBuilder.d.ts +210 -0
- package/lib/src/parsers/dom/DOMParser.d.ts +252 -0
- package/lib/src/parsers/dom/Tokenizer.d.ts +358 -0
- package/lib/src/parsers/dom/WikiDocument.d.ts +272 -0
- package/lib/src/parsers/dom/handlers/DOMLinkHandler.d.ts +260 -0
- package/lib/src/parsers/dom/handlers/DOMPluginHandler.d.ts +212 -0
- package/lib/src/parsers/dom/handlers/DOMVariableHandler.d.ts +171 -0
- package/lib/src/parsers/filters/BaseFilter.d.ts +269 -0
- package/lib/src/parsers/filters/FilterChain.d.ts +320 -0
- package/lib/src/parsers/handlers/BaseSyntaxHandler.d.ts +331 -0
- package/lib/src/parsers/handlers/HandlerRegistry.d.ts +225 -0
- package/lib/src/parsers/handlers/JSPWikiPreprocessor.d.ts +89 -0
- package/lib/src/parsers/handlers/LinkParserHandler.d.ts +80 -0
- package/lib/src/parsers/handlers/PluginSyntaxHandler.d.ts +78 -0
- package/lib/src/parsers/handlers/WikiFormHandler.d.ts +149 -0
- package/lib/src/parsers/handlers/WikiTagHandler.d.ts +125 -0
- package/lib/src/parsers/jspwikiTableRow.d.ts +39 -0
- package/lib/src/parsers/styleBlockSyntax.d.ts +14 -0
- package/lib/src/plugins/types.d.ts +79 -0
- package/lib/src/providers/AgentTokenAuthProvider.d.ts +40 -0
- package/lib/src/providers/AuthentikBearerAuthProvider.d.ts +75 -0
- package/lib/src/providers/BaseAttachmentProvider.d.ts +197 -0
- package/lib/src/providers/BaseAuthProvider.d.ts +220 -0
- package/lib/src/providers/BaseCacheProvider.d.ts +140 -0
- package/lib/src/providers/BaseCredentialsProvider.d.ts +84 -0
- package/lib/src/providers/BaseDatabaseProvider.d.ts +22 -0
- package/lib/src/providers/BaseDatabaseProvider.js +12 -0
- package/lib/src/providers/BaseLoggingProvider.d.ts +68 -0
- package/lib/src/providers/BaseLoggingProvider.js +37 -0
- package/lib/src/providers/BaseMediaProvider.d.ts +308 -0
- package/lib/src/providers/BasePageProvider.d.ts +337 -0
- package/lib/src/providers/BaseProvider.d.ts +98 -0
- package/lib/src/providers/BaseProvider.js +74 -0
- package/lib/src/providers/BaseSearchProvider.d.ts +362 -0
- package/lib/src/providers/BasicAttachmentProvider.d.ts +599 -0
- package/lib/src/providers/CloudflareAccessAuthProvider.d.ts +72 -0
- package/lib/src/providers/FileCredentialsProvider.d.ts +33 -0
- package/lib/src/providers/FileJobStateProvider.d.ts +58 -0
- package/lib/src/providers/FileLoggingProvider.d.ts +43 -0
- package/lib/src/providers/FileLoggingProvider.js +120 -0
- package/lib/src/providers/FileOidcAdapter.d.ts +25 -0
- package/lib/src/providers/FileSystemMediaProvider.d.ts +403 -0
- package/lib/src/providers/LunrSearchProvider.d.ts +280 -0
- package/lib/src/providers/MagicLinkAuthProvider.d.ts +125 -0
- package/lib/src/providers/NullCacheProvider.d.ts +72 -0
- package/lib/src/providers/OidcAuthProvider.d.ts +180 -0
- package/lib/src/providers/OidcBearerAuthProvider.d.ts +30 -0
- package/lib/src/providers/PasskeyAuthProvider.d.ts +58 -0
- package/lib/src/providers/PasswordAuthProvider.d.ts +20 -0
- package/lib/src/providers/SqliteDatabaseProvider.d.ts +55 -0
- package/lib/src/providers/SqliteDatabaseProvider.js +90 -0
- package/lib/src/providers/SqliteJobStateProvider.d.ts +41 -0
- package/lib/src/providers/databaseMigrations.d.ts +8 -0
- package/lib/src/providers/databaseMigrations.js +47 -0
- package/lib/src/providers/jobState.d.ts +99 -0
- package/lib/src/providers/lunrQueryToMiniSearch.d.ts +32 -0
- package/lib/src/providers/mediaFilenameDate.d.ts +22 -0
- package/lib/src/providers/sqliteLocation.d.ts +17 -0
- package/lib/src/providers/sqliteLocation.js +55 -0
- package/lib/src/providers/sqliteMigrations.d.ts +48 -0
- package/lib/src/providers/sqliteMigrations.js +72 -0
- package/lib/src/rendering/githubAlerts.d.ts +22 -0
- package/lib/src/rendering/htmlPolicy.d.ts +76 -0
- package/lib/src/rendering/markdownConverter.d.ts +73 -0
- package/lib/src/security/PolicyDecisionPoint.d.ts +245 -0
- package/lib/src/security/PolicyInformationPoint.d.ts +448 -0
- package/lib/src/security/pageActions.d.ts +40 -0
- package/lib/src/security/permissions.generated.d.ts +78 -0
- package/lib/src/types/Asset.d.ts +414 -0
- package/lib/src/types/Catalog.d.ts +61 -0
- package/lib/src/types/Comment.d.ts +11 -0
- package/lib/src/types/Config.d.ts +388 -0
- package/lib/src/types/Organization.d.ts +78 -0
- package/lib/src/types/OrganizationProvider.d.ts +38 -0
- package/lib/src/types/Page.d.ts +220 -0
- package/lib/src/types/Person.d.ts +56 -0
- package/lib/src/types/PersonProvider.d.ts +25 -0
- package/lib/src/types/Policy.d.ts +139 -0
- package/lib/src/types/Policy.js +17 -0
- package/lib/src/types/Provider.d.ts +810 -0
- package/lib/src/types/Role.d.ts +84 -0
- package/lib/src/types/RoleProvider.d.ts +35 -0
- package/lib/src/types/Schema.d.ts +425 -0
- package/lib/src/types/Share.d.ts +172 -0
- package/lib/src/types/Share.js +81 -0
- package/lib/src/types/User.d.ts +304 -0
- package/lib/src/types/Version.d.ts +189 -0
- package/lib/src/types/WikiEngine.d.ts +128 -0
- package/lib/src/types/express.d.ts +120 -0
- package/lib/src/types/express.js +1 -0
- package/lib/src/types/guards.d.ts +78 -0
- package/lib/src/types/heic-decode.d.ts +16 -0
- package/lib/src/types/index.d.ts +19 -0
- package/lib/src/types/linkedom.d.ts +77 -0
- package/lib/src/types/markdown-it-plugins.d.ts +21 -0
- package/lib/src/utils/DeltaStorage.d.ts +118 -0
- package/lib/src/utils/LocaleUtils.d.ts +105 -0
- package/lib/src/utils/LocaleUtils.js +294 -0
- package/lib/src/utils/PageNameMatcher.d.ts +98 -0
- package/lib/src/utils/PathPreflight.d.ts +38 -0
- package/lib/src/utils/PathPreflight.js +50 -0
- package/lib/src/utils/SectionUtils.d.ts +40 -0
- package/lib/src/utils/addonConfigLayer.d.ts +144 -0
- package/lib/src/utils/addonConfigLayer.js +382 -0
- package/lib/src/utils/addonDatabaseRules.d.ts +25 -0
- package/lib/src/utils/addonDatabaseRules.js +57 -0
- package/lib/src/utils/addonHost.d.ts +51 -0
- package/lib/src/utils/addonHost.js +72 -0
- package/lib/src/utils/addonInstaller.d.ts +109 -0
- package/lib/src/utils/addonLock.d.ts +37 -0
- package/lib/src/utils/addonLock.js +48 -0
- package/lib/src/utils/addonPageSync.d.ts +45 -0
- package/lib/src/utils/addonProvenance.d.ts +48 -0
- package/lib/src/utils/addonTarball.d.ts +41 -0
- package/lib/src/utils/addonsPathResolver.d.ts +76 -0
- package/lib/src/utils/addonsPathResolver.js +129 -0
- package/lib/src/utils/assetMetadataTags.d.ts +66 -0
- package/lib/src/utils/atomicWrite.d.ts +28 -0
- package/lib/src/utils/auditConfigChange.d.ts +57 -0
- package/lib/src/utils/auditEventNames.d.ts +50 -0
- package/lib/src/utils/auditEventNames.generated.d.ts +163 -0
- package/lib/src/utils/auditEventNames.generated.js +168 -0
- package/lib/src/utils/auditEventNames.js +49 -0
- package/lib/src/utils/auditEvents.d.ts +265 -0
- package/lib/src/utils/auditEvents.js +309 -0
- package/lib/src/utils/auditRegistry.d.ts +102 -0
- package/lib/src/utils/auditRegistry.js +168 -0
- package/lib/src/utils/bip39English.d.ts +2 -0
- package/lib/src/utils/configEnvKeys.d.ts +68 -0
- package/lib/src/utils/configFiles.d.ts +74 -0
- package/lib/src/utils/configFiles.js +150 -0
- package/lib/src/utils/delegation.d.ts +48 -0
- package/lib/src/utils/deriveUsername.d.ts +21 -0
- package/lib/src/utils/explainMediaPath.d.ts +123 -0
- package/lib/src/utils/formerTitles.d.ts +69 -0
- package/lib/src/utils/frontmatterAccess.d.ts +54 -0
- package/lib/src/utils/headlessAdminPassword.d.ts +55 -0
- package/lib/src/utils/imageTransform.d.ts +52 -0
- package/lib/src/utils/instanceEnvSecret.d.ts +51 -0
- package/lib/src/utils/jobSlots.d.ts +43 -0
- package/lib/src/utils/keywordNormalizer.d.ts +127 -0
- package/lib/src/utils/logger.d.ts +70 -0
- package/lib/src/utils/logger.js +106 -0
- package/lib/src/utils/magicLinkDeviceState.d.ts +95 -0
- package/lib/src/utils/managerUtils.d.ts +40 -0
- package/lib/src/utils/migrateLegacyPrivateAttachments.d.ts +15 -0
- package/lib/src/utils/orgFilename.d.ts +22 -0
- package/lib/src/utils/pageFeature.d.ts +27 -0
- package/lib/src/utils/pageFrontmatter.d.ts +21 -0
- package/lib/src/utils/pageNotes.d.ts +150 -0
- package/lib/src/utils/pageTitleRule.d.ts +37 -0
- package/lib/src/utils/pageToArticle.d.ts +59 -0
- package/lib/src/utils/pageUrl.d.ts +18 -0
- package/lib/src/utils/passwordChange.d.ts +12 -0
- package/lib/src/utils/passwordHash.d.ts +60 -0
- package/lib/src/utils/permissionCatalog.d.ts +52 -0
- package/lib/src/utils/pluginFormatters.d.ts +452 -0
- package/lib/src/utils/pluginFormatters.js +714 -0
- package/lib/src/utils/privateLinkRewrite.d.ts +42 -0
- package/lib/src/utils/privateStoreAccess.d.ts +57 -0
- package/lib/src/utils/privateStoreAccess.js +65 -0
- package/lib/src/utils/privateStoreCatalogs.d.ts +40 -0
- package/lib/src/utils/privateStoreCrypto.d.ts +127 -0
- package/lib/src/utils/privateStoreDoor.d.ts +181 -0
- package/lib/src/utils/privateStoreExport.d.ts +72 -0
- package/lib/src/utils/privateStoreFiles.d.ts +120 -0
- package/lib/src/utils/privateStoreMeta.d.ts +64 -0
- package/lib/src/utils/privateStoreMigrations.d.ts +37 -0
- package/lib/src/utils/privateStorePath.d.ts +259 -0
- package/lib/src/utils/privateStorePath.js +436 -0
- package/lib/src/utils/privateStoreTakeout.d.ts +76 -0
- package/lib/src/utils/privateStoreUnlock.d.ts +175 -0
- package/lib/src/utils/proxyClaim.d.ts +59 -0
- package/lib/src/utils/proxyClaim.js +30 -0
- package/lib/src/utils/redactPrivateNames.d.ts +21 -0
- package/lib/src/utils/redactPrivateNames.js +89 -0
- package/lib/src/utils/redactSecrets.d.ts +58 -0
- package/lib/src/utils/redactSecrets.js +171 -0
- package/lib/src/utils/renameLinkRewrite.d.ts +112 -0
- package/lib/src/utils/roleGrants.d.ts +35 -0
- package/lib/src/utils/safeRedirect.d.ts +32 -0
- package/lib/src/utils/schedule.d.ts +54 -0
- package/lib/src/utils/secretFileMode.d.ts +17 -0
- package/lib/src/utils/seededShippedPages.d.ts +45 -0
- package/lib/src/utils/sensitiveValues.d.ts +59 -0
- package/lib/src/utils/sensitiveValues.js +106 -0
- package/lib/src/utils/sessionEnd.d.ts +12 -0
- package/lib/src/utils/sessionGeneration.d.ts +24 -0
- package/lib/src/utils/sessionIdle.d.ts +41 -0
- package/lib/src/utils/sessionLimits.d.ts +68 -0
- package/lib/src/utils/shareLockbox.d.ts +64 -0
- package/lib/src/utils/sigstoreTrustedRoot.d.ts +33 -0
- package/lib/src/utils/sniffMime.d.ts +21 -0
- package/lib/src/utils/storeSearchIndex.d.ts +75 -0
- package/lib/src/utils/subjectMayDo.d.ts +21 -0
- package/lib/src/utils/systemCategoryRules.d.ts +30 -0
- package/lib/src/utils/systemCategoryRules.js +41 -0
- package/lib/src/utils/userCreateError.d.ts +62 -0
- package/lib/src/utils/username.d.ts +53 -0
- package/lib/src/utils/vaultUrlRewrite.d.ts +27 -0
- package/lib/src/utils/version.d.ts +84 -0
- package/lib/src/utils/videoFrame.d.ts +21 -0
- package/package.json +54 -3
|
@@ -0,0 +1,747 @@
|
|
|
1
|
+
import { type ActorContext } from '../context/ActorContext.js';
|
|
2
|
+
import { type EnvKeyMap, type PropertyDescription } from '../utils/configEnvKeys.js';
|
|
3
|
+
import { WikiConfig } from '../types/Config.js';
|
|
4
|
+
import BaseManager, { BackupData } from './BaseManager.js';
|
|
5
|
+
import type { AddonDatabaseDeclaration } from '../utils/addonDatabaseRules.js';
|
|
6
|
+
import type { WikiEngine } from '../types/WikiEngine.js';
|
|
7
|
+
interface ConfigManagerBackupData extends BackupData {
|
|
8
|
+
customConfig: Partial<WikiConfig> | null;
|
|
9
|
+
environment?: string;
|
|
10
|
+
defaultConfig?: Partial<WikiConfig> | null;
|
|
11
|
+
mergedConfig?: Partial<WikiConfig> | null;
|
|
12
|
+
paths?: {
|
|
13
|
+
defaultConfigPath: string;
|
|
14
|
+
customConfigPath: string;
|
|
15
|
+
};
|
|
16
|
+
statistics?: {
|
|
17
|
+
defaultPropertiesCount: number;
|
|
18
|
+
customPropertiesCount: number;
|
|
19
|
+
mergedPropertiesCount: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* ConfigurationManager - Handles JSPWiki-compatible configuration management
|
|
24
|
+
*
|
|
25
|
+
* Implements a two-tier configuration system that merges default settings with
|
|
26
|
+
* instance-specific overrides. This allows for flexible deployment configurations
|
|
27
|
+
* while maintaining sensible defaults.
|
|
28
|
+
*
|
|
29
|
+
* Configuration merge order (later overrides earlier):
|
|
30
|
+
* 1. config/app-default-config.json (base defaults - required, read-only)
|
|
31
|
+
* 2. INSTANCE_DATA_FOLDER/config/app-custom-config.json (instance overrides - optional)
|
|
32
|
+
*
|
|
33
|
+
* INSTANCE_DATA_FOLDER defaults to './data' but can be set via environment variable
|
|
34
|
+
* for Docker/Kubernetes deployments (typically '/app/data').
|
|
35
|
+
*
|
|
36
|
+
* @class ConfigurationManager
|
|
37
|
+
*
|
|
38
|
+
* @property {WikiEngine} engine - Reference to the wiki engine
|
|
39
|
+
* @property {WikiConfig|null} defaultConfig - Default configuration (required)
|
|
40
|
+
* @property {Partial<WikiConfig>|null} customConfig - Custom local overrides (optional)
|
|
41
|
+
* @property {WikiConfig|null} mergedConfig - Final merged configuration
|
|
42
|
+
* @property {string} environment - Current environment (from NODE_ENV)
|
|
43
|
+
* @property {string} defaultConfigPath - Path to default config file
|
|
44
|
+
* @property {string} customConfigPath - Path to custom config file
|
|
45
|
+
*
|
|
46
|
+
* @see {@link BaseManager} for base functionality
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* const configManager = engine.getManager('ConfigurationManager');
|
|
50
|
+
* const appName = configManager.getApplicationName();
|
|
51
|
+
* const port = configManager.getServerPort();
|
|
52
|
+
*/
|
|
53
|
+
declare class ConfigurationManager extends BaseManager {
|
|
54
|
+
private defaultConfig;
|
|
55
|
+
private customConfig;
|
|
56
|
+
private mergedConfig;
|
|
57
|
+
/** #1638: shipped ⊕ enabled addons, before the operator's file — what the build declares. */
|
|
58
|
+
private declaredConfig;
|
|
59
|
+
/** #1813: each enabled addon's own default-config.json, as folded into the merge. */
|
|
60
|
+
private addonLayers;
|
|
61
|
+
/** #1559: add-on system-categories refused, and operator values an owner's declaration overrode; #1860: database declarations refused or overridden. */
|
|
62
|
+
private systemCategoryProblems;
|
|
63
|
+
/** #1559: add-ons that must not load because an entry they declare was refused, by slug, with why; #1860: or their database declaration. */
|
|
64
|
+
private refusedAddons;
|
|
65
|
+
/** #1860: every installed add-on's sound database declaration, on or off. */
|
|
66
|
+
private addonDatabases;
|
|
67
|
+
private environment;
|
|
68
|
+
private defaultConfigPath;
|
|
69
|
+
private customConfigPath;
|
|
70
|
+
private instanceDataFolder;
|
|
71
|
+
/**
|
|
72
|
+
* Creates a new ConfigurationManager instance
|
|
73
|
+
*
|
|
74
|
+
* @constructor
|
|
75
|
+
* @param {any} engine - The wiki engine instance
|
|
76
|
+
*/
|
|
77
|
+
constructor(engine: WikiEngine);
|
|
78
|
+
/**
|
|
79
|
+
* Initialize the configuration manager
|
|
80
|
+
*
|
|
81
|
+
* Loads and merges all configuration files in the correct priority order.
|
|
82
|
+
*
|
|
83
|
+
* @async
|
|
84
|
+
* @returns {Promise<void>}
|
|
85
|
+
* @throws {Error} If default configuration file is not found
|
|
86
|
+
*/
|
|
87
|
+
initialize(config?: Record<string, unknown>): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* #642: returns true if `ngdpbase.application.base-url` was explicitly
|
|
90
|
+
* configured (in customConfig or via the NGDPBASE_BASE_URL env var), as
|
|
91
|
+
* opposed to falling through to the default. Consumers that need to emit
|
|
92
|
+
* absolute URLs to outside parties (magic-link auth, schema.org @ids,
|
|
93
|
+
* email templates) read this to decide whether the configured base URL
|
|
94
|
+
* is trustworthy or whether they should bail out / disable themselves.
|
|
95
|
+
*
|
|
96
|
+
* The migration shim in `migrateLegacyBaseUrl()` writes the canonical key
|
|
97
|
+
* into customConfig before this is called, so legacy `ngdpbase.base-url`
|
|
98
|
+
* and `ngdpbase.baseURL` configs return true here too.
|
|
99
|
+
*/
|
|
100
|
+
isBaseUrlExplicit(): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* #642: post-install startup invariant. Once `.install-complete` exists,
|
|
103
|
+
* the operator must have explicitly configured `ngdpbase.application.base-url`.
|
|
104
|
+
* Falling back to the default localhost URL silently emits broken
|
|
105
|
+
* absolute URLs (template variables, magic-link emails, org @ids), so we
|
|
106
|
+
* refuse to start instead.
|
|
107
|
+
*
|
|
108
|
+
* Pre-install (`.install-complete` absent), the default is fine — the
|
|
109
|
+
* install flow will set the value before completing.
|
|
110
|
+
*/
|
|
111
|
+
private assertBaseUrlConfigured;
|
|
112
|
+
/**
|
|
113
|
+
* #658: refuse to start if `ngdpbase.application.contact.page` is set to
|
|
114
|
+
* `"contact"` — that would make /contact 302-redirect to /view/contact,
|
|
115
|
+
* which (because /view/contact does not exist) ends as a 404 anyway, but
|
|
116
|
+
* earlier intermediate routing or future renames could turn it into an
|
|
117
|
+
* actual redirect loop. Reject explicitly so operators see a clear error
|
|
118
|
+
* instead of a runtime surprise.
|
|
119
|
+
*/
|
|
120
|
+
private assertContactPageNotLoop;
|
|
121
|
+
/**
|
|
122
|
+
* #670 Phase D: refuse to start if `ngdpbase.application.contact.recipient`
|
|
123
|
+
* contains a malformed address. The string accepts two patterns:
|
|
124
|
+
*
|
|
125
|
+
* inline CSV "alice@example.com, bob@example.com"
|
|
126
|
+
* distribution list "admins@example.com"
|
|
127
|
+
*
|
|
128
|
+
* The single-address form is just a degenerate CSV. We split on `,`, trim
|
|
129
|
+
* each segment, regex-check the shape, and throw if any segment fails. The
|
|
130
|
+
* regex is the same pragmatic shape check the form uses post-validation —
|
|
131
|
+
* not RFC-perfect; SMTP verifies the rest on send.
|
|
132
|
+
*
|
|
133
|
+
* Empty config is fine (recipient resolves at request time from the admin
|
|
134
|
+
* list — see UserManager.getContactRecipient). Whitespace-only segments
|
|
135
|
+
* (e.g., trailing comma "a@b, ") are treated as malformed because they
|
|
136
|
+
* usually indicate a typo.
|
|
137
|
+
*/
|
|
138
|
+
private assertContactRecipientWellFormed;
|
|
139
|
+
/**
|
|
140
|
+
* #672: refuse to start if any `ngdpbase.addons.<id>.enabled = true` key
|
|
141
|
+
* references an `<id>` that has no matching addon in any configured
|
|
142
|
+
* `addons-path` entry — either a directory (bundled/drop-in) or, per
|
|
143
|
+
* #673/#924, an npm package matched by a `node_modules:<glob>` entry.
|
|
144
|
+
* The discovery logic mirrors what `AddonsManager` does at runtime —
|
|
145
|
+
* directory/package present with `index.js` or `index.ts` — but without
|
|
146
|
+
* importing the modules (boot-time speed; `ConfigurationManager.initialize()`
|
|
147
|
+
* runs before any managers). The directory-vs-npm-pattern split, npm glob
|
|
148
|
+
* matching, AND the canonical-identity resolution are all shared with
|
|
149
|
+
* `AddonsManager` via `utils/addonsPathResolver.ts` so the two can no
|
|
150
|
+
* longer drift out of sync (#924: they had, and packaged addons could
|
|
151
|
+
* never boot as a result).
|
|
152
|
+
*
|
|
153
|
+
* Catches the failure mode that caused the 2026-05-10 geohazardwatch.com
|
|
154
|
+
* outage: the deploy configmap had `ngdpbase.addons.ve-geology.enabled =
|
|
155
|
+
* true` but the on-disk addon was renamed to `geohazardwatch`, so
|
|
156
|
+
* `AddonsManager` silently treated the addon as disabled and registered
|
|
157
|
+
* none of its plugins/managers.
|
|
158
|
+
*
|
|
159
|
+
* #927: identity here is the canonical slug — `package.json`
|
|
160
|
+
* `ngdpbase.slug`, else the folder name minus a conventional trailing
|
|
161
|
+
* `-addon` (`resolvePackagedAddonSlug`). This is the EXACT same import-free
|
|
162
|
+
* resolution `AddonsManager.registerAddonFromDir()` uses as its registry
|
|
163
|
+
* key and `isEnabled` lookup, so this check is now precise rather than a
|
|
164
|
+
* guess: an enabled `<id>` is known iff the runtime would register under
|
|
165
|
+
* that same `<id>`. The only residual imprecision is a module whose
|
|
166
|
+
* exported `name` disagrees with its slug — but since #927 makes the slug
|
|
167
|
+
* (not `name`) the runtime identity too, that disagreement no longer
|
|
168
|
+
* affects either layer's `<id>`; it only earns a load-time warning.
|
|
169
|
+
*/
|
|
170
|
+
private assertConfiguredAddonsExist;
|
|
171
|
+
/**
|
|
172
|
+
* Levenshtein-distance-based suggestion. Returns the closest candidate
|
|
173
|
+
* within edit distance 2, or null if no candidate is close enough.
|
|
174
|
+
* Used by `assertConfiguredAddonsExist` for did-you-mean error hints
|
|
175
|
+
* on typo-class misconfigs (rename-class misconfigs like
|
|
176
|
+
* "ve-geology" → "geohazardwatch" are too far apart and will return
|
|
177
|
+
* null, which is fine — the error message still lists every available
|
|
178
|
+
* addon so the operator can pick the right one).
|
|
179
|
+
*/
|
|
180
|
+
private findClosestAddonName;
|
|
181
|
+
/**
|
|
182
|
+
* Reload configuration from disk
|
|
183
|
+
*
|
|
184
|
+
* @returns {Promise<void>}
|
|
185
|
+
*/
|
|
186
|
+
reload(): Promise<void>;
|
|
187
|
+
/**
|
|
188
|
+
* Load and merge configurations from all sources
|
|
189
|
+
*
|
|
190
|
+
* Loads configurations in priority order and merges them into a single
|
|
191
|
+
* configuration object. Fields starting with '_' are treated as comments
|
|
192
|
+
* and excluded from the final configuration.
|
|
193
|
+
*
|
|
194
|
+
* Priority: default < custom (highest)
|
|
195
|
+
*
|
|
196
|
+
* @async
|
|
197
|
+
* @private
|
|
198
|
+
* @returns {Promise<void>}
|
|
199
|
+
* @throws {Error} If default configuration file cannot be loaded
|
|
200
|
+
*/
|
|
201
|
+
private loadConfigurations;
|
|
202
|
+
/**
|
|
203
|
+
* #642: One-shot migration shim. If the custom config sets either of the
|
|
204
|
+
* legacy keys `ngdpbase.base-url` or `ngdpbase.baseURL`, copy the value
|
|
205
|
+
* into the canonical `ngdpbase.application.base-url` (unless that key is
|
|
206
|
+
* already set explicitly), then drop the legacy keys. Logs a deprecation
|
|
207
|
+
* warning so operators see they should update their custom config.
|
|
208
|
+
*
|
|
209
|
+
* Precedence when multiple legacy keys are present:
|
|
210
|
+
* custom application.base-url > custom base-url > custom baseURL
|
|
211
|
+
*/
|
|
212
|
+
private migrateLegacyBaseUrl;
|
|
213
|
+
/**
|
|
214
|
+
* #1117 slice 2: migration shim for the filter namespace. The old
|
|
215
|
+
* `ngdpbase.markup.filters.*` prefix described one consumer (markup
|
|
216
|
+
* rendering) of a capability that also gates saves —
|
|
217
|
+
* `…security.block-on-save` refuses content at the door, and an operator
|
|
218
|
+
* disabling "markup filters" to fix a rendering glitch would not expect to
|
|
219
|
+
* change what the system accepts. Keys now live under `ngdpbase.filters.*`.
|
|
220
|
+
*
|
|
221
|
+
* Every legacy key found in the CUSTOM config is copied to its new name
|
|
222
|
+
* (unless the new name is itself set explicitly — an explicit new key
|
|
223
|
+
* wins), then dropped, with one deprecation warning naming the count.
|
|
224
|
+
* Operating on customConfig before the merge means an operator's explicit
|
|
225
|
+
* legacy setting still overrides the shipped default under the new name —
|
|
226
|
+
* the case that must not silently break is a custom
|
|
227
|
+
* `…security.enabled=true` on an open-registration instance.
|
|
228
|
+
*/
|
|
229
|
+
private migrateLegacyFilterNamespace;
|
|
230
|
+
/**
|
|
231
|
+
* Get a configuration property value
|
|
232
|
+
*
|
|
233
|
+
* Retrieves a property from the merged configuration with optional default value.
|
|
234
|
+
* Checks environment variables first for specific keys (Docker/Traefik support).
|
|
235
|
+
*
|
|
236
|
+
* Priority order:
|
|
237
|
+
* 1. Environment variables (for Docker/Traefik deployments)
|
|
238
|
+
* 2. Merged configuration (from config files)
|
|
239
|
+
* 3. Default value parameter
|
|
240
|
+
*
|
|
241
|
+
* @param {string} key - Configuration property key
|
|
242
|
+
* @param {*} [defaultValue=null] - Default value if property not found
|
|
243
|
+
* @returns {*} Configuration value or default
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* const appName = configManager.getProperty('ngdpbase.application-name', 'MyWiki');
|
|
247
|
+
*/
|
|
248
|
+
getProperty(key: string, defaultValue?: unknown): unknown;
|
|
249
|
+
/**
|
|
250
|
+
* #896: read a property from the SHIPPED defaults only, ignoring instance
|
|
251
|
+
* custom-config overrides. Used by vocabulary providers whose seed must not
|
|
252
|
+
* be shadowed by legacy whole-catalog snapshots in instance config (the
|
|
253
|
+
* #895 propagation bug). No env-override or env-ref resolution — defaults
|
|
254
|
+
* are repo-shipped literals.
|
|
255
|
+
*/
|
|
256
|
+
getDefaultProperty(key: string, defaultValue?: unknown): unknown;
|
|
257
|
+
/**
|
|
258
|
+
* #1638: read a property as the build declares it — the shipped defaults
|
|
259
|
+
* with every ENABLED addon's default-config.json folded in — ignoring the
|
|
260
|
+
* operator's custom file. A registry check asks this when it must tell an
|
|
261
|
+
* entry the code can act on (shipped, or an enabled addon's) from one only
|
|
262
|
+
* the operator's file names. No env-override or env-ref resolution.
|
|
263
|
+
*/
|
|
264
|
+
getDeclaredProperty(key: string, defaultValue?: unknown): unknown;
|
|
265
|
+
/**
|
|
266
|
+
* #1559: what was wrong with the system-categories add-ons declare — each
|
|
267
|
+
* entry refused, and each operator value an owner's declaration overrode —
|
|
268
|
+
* one line per problem, naming the entry and the field. #1860: the same for
|
|
269
|
+
* add-on database declarations.
|
|
270
|
+
*/
|
|
271
|
+
getSystemCategoryProblems(): readonly string[];
|
|
272
|
+
/**
|
|
273
|
+
* #1559: why this add-on must not load — an entry its default-config.json
|
|
274
|
+
* declares under `ngdpbase.system-category` was refused, or its database
|
|
275
|
+
* declaration was (#1860) — or null. None of its other keys were merged.
|
|
276
|
+
*/
|
|
277
|
+
getAddonRefusal(slug: string): string | null;
|
|
278
|
+
/**
|
|
279
|
+
* #1860: the database each installed add-on declares in its
|
|
280
|
+
* default-config.json (`ngdpbase.addons.<slug>.database`), whether or not it
|
|
281
|
+
* is turned on. A refused declaration is not here; its add-on is refused
|
|
282
|
+
* ({@link getAddonRefusal}). DatabaseManager is the reader.
|
|
283
|
+
*/
|
|
284
|
+
getAddonDatabaseDeclarations(): readonly AddonDatabaseDeclaration[];
|
|
285
|
+
/**
|
|
286
|
+
* #1813: what one enabled addon's own `config/default-config.json` declares,
|
|
287
|
+
* exactly as it was folded into the merge — not the merged view, so the
|
|
288
|
+
* caller can tell what THIS addon said from what core or another addon said.
|
|
289
|
+
* Empty for an addon that ships no file, is disabled, or is unknown.
|
|
290
|
+
*/
|
|
291
|
+
getAddonDeclaredDefaults(slug: string): Record<string, unknown>;
|
|
292
|
+
/**
|
|
293
|
+
* Resolve environment-variable references in a string config value.
|
|
294
|
+
*
|
|
295
|
+
* Two forms supported (#775):
|
|
296
|
+
*
|
|
297
|
+
* **`${VAR}` brace form** — embedded references, suitable for path templates
|
|
298
|
+
* like `"${FAST_STORAGE}/sessions"`. Silent on missing: leaves the
|
|
299
|
+
* unresolved placeholder intact (the value flows through to the caller,
|
|
300
|
+
* which typically fails later at point-of-use). Multiple embedded refs in
|
|
301
|
+
* one string work; partial-string refs work. **Use for paths and
|
|
302
|
+
* prefix-based templates.**
|
|
303
|
+
*
|
|
304
|
+
* **`$VAR` bare-whole-value form** — the ENTIRE config value is a single
|
|
305
|
+
* env-var reference. Strict on missing: throws with a clear message so
|
|
306
|
+
* the operator notices immediately at startup or first read. **Use for
|
|
307
|
+
* secrets** (API keys, SMTP passwords, etc.). Operators set these in
|
|
308
|
+
* `.env` alongside `FAST_STORAGE` / `SLOW_STORAGE` / `PORT`.
|
|
309
|
+
*
|
|
310
|
+
* **`$$literal` escape** — for the rare config value that genuinely
|
|
311
|
+
* starts with `$`. `"$$abc"` resolves to `"$abc"`.
|
|
312
|
+
*
|
|
313
|
+
* Non-string values pass through unchanged. Resolution happens at lookup
|
|
314
|
+
* time (per-`getProperty()` call), not at config load — so tests that
|
|
315
|
+
* mutate `process.env` mid-run see the new value on the next read.
|
|
316
|
+
*
|
|
317
|
+
* @param value - The raw config value (any type; only strings are processed)
|
|
318
|
+
* @param key - The config key being looked up; included in error messages
|
|
319
|
+
* so operators can find the offending entry.
|
|
320
|
+
* @returns The resolved value, or the input unchanged for non-strings /
|
|
321
|
+
* non-refs.
|
|
322
|
+
* @throws When the bare `$VAR` form references an unset env var.
|
|
323
|
+
*/
|
|
324
|
+
private resolveEnvRef;
|
|
325
|
+
/** Audit counters for the boot-time env-ref summary log (#775). */
|
|
326
|
+
private _envRefHitCount;
|
|
327
|
+
private _envRefMissCount;
|
|
328
|
+
private _envRefBraceMissCount;
|
|
329
|
+
/**
|
|
330
|
+
* Get a config property with secrets masked to `"***"` for safe logging
|
|
331
|
+
* (#775). Returns the unmasked value for plain literals and brace-form
|
|
332
|
+
* resolved values; only the bare-form `$VAR` secrets return the mask.
|
|
333
|
+
*
|
|
334
|
+
* Use this on any log path that may print a config value. Boot banners,
|
|
335
|
+
* admin /config endpoint listings, debug-level config dumps.
|
|
336
|
+
*
|
|
337
|
+
* @param key - Config key
|
|
338
|
+
* @param defaultValue - Default when key absent
|
|
339
|
+
* @returns The unmasked value, OR `"***"` if the raw config value was a
|
|
340
|
+
* bare-form `$VAR` reference (indicating it carries a secret).
|
|
341
|
+
*/
|
|
342
|
+
getMaskedProperty(key: string, defaultValue?: unknown): unknown;
|
|
343
|
+
/**
|
|
344
|
+
* Set a configuration property (updates custom config)
|
|
345
|
+
*
|
|
346
|
+
* Sets a property value and persists it to the custom configuration file.
|
|
347
|
+
* This allows runtime configuration changes that survive restarts.
|
|
348
|
+
*
|
|
349
|
+
* @async
|
|
350
|
+
* @param {string} key - Configuration property key
|
|
351
|
+
* @param {*} value - Configuration value to set
|
|
352
|
+
* @param ctx - Who is changing it (#1179): the request's subject, or a
|
|
353
|
+
* JobContext for a change no request drove. Mandatory and positional — a
|
|
354
|
+
* config change is a security event and its record is read from this.
|
|
355
|
+
* @returns {Promise<void>}
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* await configManager.setProperty('ngdpbase.application-name', 'My Custom Wiki', wikiContext.userContext);
|
|
359
|
+
*/
|
|
360
|
+
setProperty(key: string, value: unknown, ctx: ActorContext): Promise<void>;
|
|
361
|
+
/**
|
|
362
|
+
* Record a configuration change in the audit log (#1150).
|
|
363
|
+
*
|
|
364
|
+
* Emitted here rather than from the routes because this is the single write
|
|
365
|
+
* path — every deliberate change goes through it, and a producer that has to
|
|
366
|
+
* remember to call something is exactly what the #1120 registry exists to
|
|
367
|
+
* stop. The migration code inside this class writes `customConfig` directly
|
|
368
|
+
* and so is correctly not audited: it is not a decision anybody made.
|
|
369
|
+
*
|
|
370
|
+
* Deliberately AFTER the save rather than before. A change refused because
|
|
371
|
+
* its audit record could not be written would leave an operator unable to
|
|
372
|
+
* repair a broken audit configuration through the admin UI — a deadlock that
|
|
373
|
+
* costs more than the missing record. on-failure: continue for the same reason:
|
|
374
|
+
* the drop is counted and surfaced by recordAuditEvent, not fatal.
|
|
375
|
+
*/
|
|
376
|
+
private recordConfigChange;
|
|
377
|
+
/**
|
|
378
|
+
* Apply a runtime-only config value (not persisted to custom config).
|
|
379
|
+
*
|
|
380
|
+
* Used by AddonsManager to inject domainDefaults without polluting
|
|
381
|
+
* the operator's app-custom-config.json. Because this only updates
|
|
382
|
+
* mergedConfig, the value disappears on next restart unless the addon
|
|
383
|
+
* is still loaded and re-injects it.
|
|
384
|
+
*
|
|
385
|
+
* @param key Configuration property key
|
|
386
|
+
* @param value Value to apply
|
|
387
|
+
*/
|
|
388
|
+
setRuntimeProperty(key: string, value: unknown): void;
|
|
389
|
+
/**
|
|
390
|
+
* Save custom configuration to file
|
|
391
|
+
*
|
|
392
|
+
* Persists the current custom configuration to disk with proper formatting.
|
|
393
|
+
*
|
|
394
|
+
* @async
|
|
395
|
+
* @private
|
|
396
|
+
* @returns {Promise<void>}
|
|
397
|
+
*/
|
|
398
|
+
private saveCustomConfiguration;
|
|
399
|
+
/**
|
|
400
|
+
* Get all configuration properties
|
|
401
|
+
*
|
|
402
|
+
* Returns a copy of the entire merged configuration object.
|
|
403
|
+
*
|
|
404
|
+
* @returns {WikiConfig} All merged configuration properties
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
407
|
+
* const allConfig = configManager.getAllProperties();
|
|
408
|
+
* console.log(JSON.stringify(allConfig, null, 2));
|
|
409
|
+
*/
|
|
410
|
+
/**
|
|
411
|
+
* The declared map of environment-owned config keys (#1089).
|
|
412
|
+
*
|
|
413
|
+
* Read straight from `mergedConfig` rather than through `getProperty`, which
|
|
414
|
+
* would recurse — `getProperty` calls this to decide whether the key it was
|
|
415
|
+
* asked for is env-owned.
|
|
416
|
+
*/
|
|
417
|
+
private getEnvKeyMap;
|
|
418
|
+
/**
|
|
419
|
+
* Which keys the environment owns, and the variable that supplies each (#1089).
|
|
420
|
+
*
|
|
421
|
+
* Exposed so the admin configuration screen can render those keys read-only
|
|
422
|
+
* instead of accepting a write that cannot take effect.
|
|
423
|
+
*/
|
|
424
|
+
getEnvControlledKeys(): EnvKeyMap;
|
|
425
|
+
/**
|
|
426
|
+
* Describe where a key's value actually comes from (#1089).
|
|
427
|
+
*
|
|
428
|
+
* The admin screen needs three separate facts that `getProperty` alone cannot
|
|
429
|
+
* express: the effective value, whether the environment owns the key, and
|
|
430
|
+
* which variable does. Without this it displayed `mergedConfig` — the raw JSON
|
|
431
|
+
* — while `getProperty` returned something else entirely, so the *read* side
|
|
432
|
+
* was wrong before anyone edited anything.
|
|
433
|
+
*/
|
|
434
|
+
describeProperty(key: string): PropertyDescription;
|
|
435
|
+
getAllProperties(): WikiConfig;
|
|
436
|
+
/**
|
|
437
|
+
* Get a property value only if it was explicitly set in the custom config
|
|
438
|
+
* (i.e. not inherited from app-default-config.json).
|
|
439
|
+
* Returns null if the key is not present in the custom config.
|
|
440
|
+
*
|
|
441
|
+
* Use this when a theme or other subsystem should own a value by default and
|
|
442
|
+
* the config should only override it when the operator has explicitly said so.
|
|
443
|
+
*
|
|
444
|
+
* @param {string} key - Configuration key
|
|
445
|
+
* @returns {unknown} Custom config value, or null if not explicitly set
|
|
446
|
+
*/
|
|
447
|
+
getCustomProperty(key: string): unknown;
|
|
448
|
+
/**
|
|
449
|
+
* Get application name
|
|
450
|
+
*
|
|
451
|
+
* @returns {string} Application name (defaults to 'ngdpbase')
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* const name = configManager.getApplicationName(); // 'ngdpbase'
|
|
455
|
+
*/
|
|
456
|
+
getApplicationName(): string;
|
|
457
|
+
/**
|
|
458
|
+
* Get base URL for the wiki
|
|
459
|
+
*
|
|
460
|
+
* @returns {string} Base URL (defaults to 'http://localhost:3000')
|
|
461
|
+
*/
|
|
462
|
+
getBaseURL(): string;
|
|
463
|
+
/**
|
|
464
|
+
* Get front page name
|
|
465
|
+
*
|
|
466
|
+
* @returns {string} Front page name (defaults to 'Welcome')
|
|
467
|
+
*/
|
|
468
|
+
getFrontPage(): string;
|
|
469
|
+
/**
|
|
470
|
+
* Get encoding
|
|
471
|
+
* @returns {string} Encoding
|
|
472
|
+
*/
|
|
473
|
+
getEncoding(): string;
|
|
474
|
+
/**
|
|
475
|
+
* Get server port
|
|
476
|
+
* @returns {number} Server port
|
|
477
|
+
*/
|
|
478
|
+
getServerPort(): number;
|
|
479
|
+
/**
|
|
480
|
+
* Get the set of recognised fenced code block language tags.
|
|
481
|
+
* Tags not in this set should be flagged as unknown on page save.
|
|
482
|
+
* @returns {Set<string>} Lower-cased tag names
|
|
483
|
+
*/
|
|
484
|
+
getFencedCodeTags(): Set<string>;
|
|
485
|
+
/**
|
|
486
|
+
* Get server host
|
|
487
|
+
* @returns {string} Server host
|
|
488
|
+
*/
|
|
489
|
+
getServerHost(): string;
|
|
490
|
+
/**
|
|
491
|
+
* Get session secret.
|
|
492
|
+
*
|
|
493
|
+
* #1194: no literal fallback. `ngdpbase.session.secret` is env-owned and
|
|
494
|
+
* `src/bootstrap-env.ts` guarantees `NGDPBASE_SESSION_SECRET` is set (or
|
|
495
|
+
* exits) before this class loads, so the env-keys path in getProperty()
|
|
496
|
+
* always answers. The shipped config value is a public string and must
|
|
497
|
+
* never be what this returns; an empty string is the honest answer if the
|
|
498
|
+
* guarantee is somehow broken. `app.ts` does not call this — it reads
|
|
499
|
+
* `resolveSessionSecret(process.env)` directly — and nothing else does.
|
|
500
|
+
*
|
|
501
|
+
* @returns {string} Session secret
|
|
502
|
+
*/
|
|
503
|
+
getSessionSecret(): string;
|
|
504
|
+
/**
|
|
505
|
+
* Get session max age in milliseconds
|
|
506
|
+
* @returns {number} Session max age
|
|
507
|
+
*/
|
|
508
|
+
getSessionMaxAge(): number;
|
|
509
|
+
/**
|
|
510
|
+
* Get session secure flag.
|
|
511
|
+
*
|
|
512
|
+
* #1043: these two compared against the STRING `'true'` while the config
|
|
513
|
+
* values are real booleans, so `getSessionSecure()` returned false even when
|
|
514
|
+
* the key was set to `true`. Nothing called either one — the session cookie
|
|
515
|
+
* is configured in `app.ts`, which reads the keys directly — so the bug was
|
|
516
|
+
* invisible until someone tried to use the accessor the config key advertises.
|
|
517
|
+
*
|
|
518
|
+
* Kept (public API, an embedder may call them) and made boolean-aware, so the
|
|
519
|
+
* next caller gets the answer the config actually holds.
|
|
520
|
+
*
|
|
521
|
+
* @returns {boolean} Session secure flag
|
|
522
|
+
*/
|
|
523
|
+
getSessionSecure(): boolean;
|
|
524
|
+
/**
|
|
525
|
+
* Get session httpOnly flag. Defaults to true — the safe direction.
|
|
526
|
+
* @returns {boolean} Session httpOnly flag
|
|
527
|
+
*/
|
|
528
|
+
getSessionHttpOnly(): boolean;
|
|
529
|
+
/**
|
|
530
|
+
* Get directory paths
|
|
531
|
+
* @returns {Object} Directory configuration
|
|
532
|
+
*/
|
|
533
|
+
getDirectories(): {
|
|
534
|
+
pages: unknown;
|
|
535
|
+
templates: unknown;
|
|
536
|
+
resources: unknown;
|
|
537
|
+
data: unknown;
|
|
538
|
+
work: unknown;
|
|
539
|
+
};
|
|
540
|
+
/**
|
|
541
|
+
* Get the instance data folder path
|
|
542
|
+
*
|
|
543
|
+
* Returns the base folder for all instance-specific data (pages, users,
|
|
544
|
+
* attachments, logs, etc.). This can be configured via the INSTANCE_DATA_FOLDER
|
|
545
|
+
* environment variable, allowing instance data to be stored anywhere on the
|
|
546
|
+
* filesystem.
|
|
547
|
+
*
|
|
548
|
+
* @returns {string} Absolute path to the instance data folder
|
|
549
|
+
*
|
|
550
|
+
* @example
|
|
551
|
+
* const dataFolder = configManager.getInstanceDataFolder();
|
|
552
|
+
* // Returns '/var/lib/ngdpbase/data' if INSTANCE_DATA_FOLDER=/var/lib/ngdpbase/data
|
|
553
|
+
* // Returns resolved './data' path if not set
|
|
554
|
+
*/
|
|
555
|
+
getInstanceDataFolder(): string;
|
|
556
|
+
/** This site's install marker (see {@link installCompletePath}). */
|
|
557
|
+
getInstallCompletePath(): string;
|
|
558
|
+
/** This site's custom config file: `<instance data folder>/config/<INSTANCE_CONFIG_FILE or app-custom-config.json>`. */
|
|
559
|
+
getCustomConfigPath(): string;
|
|
560
|
+
/**
|
|
561
|
+
* Resolve a data path relative to the instance data folder
|
|
562
|
+
*
|
|
563
|
+
* Takes a path that may contain './data/' prefix and resolves it relative
|
|
564
|
+
* to the configured INSTANCE_DATA_FOLDER. This allows all data paths in
|
|
565
|
+
* configuration to work correctly regardless of where instance data is stored.
|
|
566
|
+
*
|
|
567
|
+
* @param {string} relativePath - Path to resolve (may include './data/' prefix)
|
|
568
|
+
* @returns {string} Absolute resolved path under instance data folder
|
|
569
|
+
*
|
|
570
|
+
* @example
|
|
571
|
+
* // With INSTANCE_DATA_FOLDER=/var/lib/ngdpbase/data
|
|
572
|
+
* configManager.resolveDataPath('./data/pages'); // '/var/lib/ngdpbase/data/pages'
|
|
573
|
+
* configManager.resolveDataPath('data/users'); // '/var/lib/ngdpbase/data/users'
|
|
574
|
+
* configManager.resolveDataPath('./data/logs/audit.log'); // '/var/lib/ngdpbase/data/logs/audit.log'
|
|
575
|
+
* configManager.resolveDataPath('pages'); // '/var/lib/ngdpbase/data/pages'
|
|
576
|
+
*/
|
|
577
|
+
resolveDataPath(relativePath: string): string;
|
|
578
|
+
/**
|
|
579
|
+
* Get a resolved configuration property for data paths
|
|
580
|
+
*
|
|
581
|
+
* Convenience method that gets a configuration property and resolves it
|
|
582
|
+
* if it appears to be a data path (starts with './data' or 'data/').
|
|
583
|
+
*
|
|
584
|
+
* @param {string} key - Configuration property key
|
|
585
|
+
* @param {string} defaultValue - Default value if property not found
|
|
586
|
+
* @returns {string} Resolved path or original value
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* const pagesDir = configManager.getResolvedDataPath(
|
|
590
|
+
* 'ngdpbase.page.provider.filesystem.storagedir',
|
|
591
|
+
* './data/pages'
|
|
592
|
+
* );
|
|
593
|
+
*/
|
|
594
|
+
getResolvedDataPath(key: string, defaultValue: string): string;
|
|
595
|
+
/**
|
|
596
|
+
* Get manager-specific configuration
|
|
597
|
+
*
|
|
598
|
+
* Retrieves all configuration properties for a specific manager,
|
|
599
|
+
* including enabled status and manager-specific settings.
|
|
600
|
+
*
|
|
601
|
+
* @param {string} managerName - Name of the manager
|
|
602
|
+
* @returns {Object} Manager configuration object with enabled flag and settings
|
|
603
|
+
* @returns {boolean} config.enabled - Whether the manager is enabled
|
|
604
|
+
*
|
|
605
|
+
* @example
|
|
606
|
+
* const searchConfig = configManager.getManagerConfig('SearchManager');
|
|
607
|
+
* if (searchConfig.enabled) {
|
|
608
|
+
* // Use search manager
|
|
609
|
+
* }
|
|
610
|
+
*/
|
|
611
|
+
getManagerConfig(managerName: string): {
|
|
612
|
+
enabled: boolean;
|
|
613
|
+
[key: string]: unknown;
|
|
614
|
+
};
|
|
615
|
+
/**
|
|
616
|
+
* Get feature configuration
|
|
617
|
+
* @param {string} featureName - Name of feature
|
|
618
|
+
* @returns {Object} Feature configuration
|
|
619
|
+
*/
|
|
620
|
+
getFeatureConfig(featureName: string): {
|
|
621
|
+
enabled: boolean;
|
|
622
|
+
[key: string]: unknown;
|
|
623
|
+
};
|
|
624
|
+
/**
|
|
625
|
+
* Get logging configuration
|
|
626
|
+
* @returns {Object} Logging configuration
|
|
627
|
+
*/
|
|
628
|
+
getLoggingConfig(): {
|
|
629
|
+
level: unknown;
|
|
630
|
+
dir: unknown;
|
|
631
|
+
maxSize: unknown;
|
|
632
|
+
maxFiles: number;
|
|
633
|
+
};
|
|
634
|
+
/**
|
|
635
|
+
* Get search configuration
|
|
636
|
+
* @returns {Object} Search configuration
|
|
637
|
+
*/
|
|
638
|
+
getSearchConfig(): {
|
|
639
|
+
indexDir: unknown;
|
|
640
|
+
enabled: boolean;
|
|
641
|
+
};
|
|
642
|
+
/**
|
|
643
|
+
* Get access control configuration
|
|
644
|
+
* @returns {Object} Access control configuration
|
|
645
|
+
*/
|
|
646
|
+
getAccessControlConfig(): {
|
|
647
|
+
contextAware: {
|
|
648
|
+
enabled: boolean;
|
|
649
|
+
timeZone: unknown;
|
|
650
|
+
};
|
|
651
|
+
businessHours: {
|
|
652
|
+
enabled: boolean;
|
|
653
|
+
start: unknown;
|
|
654
|
+
end: unknown;
|
|
655
|
+
days: unknown;
|
|
656
|
+
};
|
|
657
|
+
};
|
|
658
|
+
/**
|
|
659
|
+
* Get audit configuration
|
|
660
|
+
* @returns {Object} Audit configuration
|
|
661
|
+
*/
|
|
662
|
+
getAuditConfig(): {
|
|
663
|
+
enabled: boolean;
|
|
664
|
+
logDirectory: unknown;
|
|
665
|
+
logFile: unknown;
|
|
666
|
+
retention: {
|
|
667
|
+
maxFiles: number;
|
|
668
|
+
maxAge: unknown;
|
|
669
|
+
};
|
|
670
|
+
includeContext: {
|
|
671
|
+
ip: boolean;
|
|
672
|
+
userAgent: boolean;
|
|
673
|
+
timestamp: boolean;
|
|
674
|
+
decision: boolean;
|
|
675
|
+
reason: boolean;
|
|
676
|
+
};
|
|
677
|
+
};
|
|
678
|
+
/**
|
|
679
|
+
* Get RSS settings
|
|
680
|
+
* @returns {Object} RSS configuration
|
|
681
|
+
*/
|
|
682
|
+
getRSSConfig(): {
|
|
683
|
+
generate: unknown;
|
|
684
|
+
fileName: unknown;
|
|
685
|
+
interval: unknown;
|
|
686
|
+
channelTitle: unknown;
|
|
687
|
+
channelDescription: unknown;
|
|
688
|
+
};
|
|
689
|
+
/**
|
|
690
|
+
* Reset configuration to defaults (admin only)
|
|
691
|
+
*
|
|
692
|
+
* Clears all custom configuration and resets to default values.
|
|
693
|
+
* This operation persists the empty custom configuration to disk.
|
|
694
|
+
*
|
|
695
|
+
* @async
|
|
696
|
+
* @returns {Promise<void>}
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* await configManager.resetToDefaults();
|
|
700
|
+
* console.log('Configuration reset to defaults');
|
|
701
|
+
*/
|
|
702
|
+
resetToDefaults(ctx: ActorContext): Promise<void>;
|
|
703
|
+
/**
|
|
704
|
+
* Get custom configuration for admin UI
|
|
705
|
+
*
|
|
706
|
+
* Returns only the custom overrides, useful for displaying
|
|
707
|
+
* which settings have been customized.
|
|
708
|
+
*
|
|
709
|
+
* @returns {Object} Custom configuration properties only
|
|
710
|
+
*
|
|
711
|
+
* @example
|
|
712
|
+
* const customSettings = configManager.getCustomProperties();
|
|
713
|
+
* console.log('Customized settings:', Object.keys(customSettings));
|
|
714
|
+
*/
|
|
715
|
+
getCustomProperties(): Partial<WikiConfig>;
|
|
716
|
+
/**
|
|
717
|
+
* Get default configuration for comparison
|
|
718
|
+
*
|
|
719
|
+
* Returns the base default configuration, useful for comparison
|
|
720
|
+
* with current settings or resetting individual properties.
|
|
721
|
+
*
|
|
722
|
+
* @returns {WikiConfig} Default configuration properties
|
|
723
|
+
*/
|
|
724
|
+
getDefaultProperties(): WikiConfig;
|
|
725
|
+
/**
|
|
726
|
+
* Backup configuration data
|
|
727
|
+
*
|
|
728
|
+
* Backs up the custom configuration (user overrides) which can be restored
|
|
729
|
+
* to recreate the user's configuration settings. We don't backup default or
|
|
730
|
+
* environment configs as those are part of the codebase.
|
|
731
|
+
*
|
|
732
|
+
* @returns {Promise<BackupData>} Backup data containing custom configuration
|
|
733
|
+
*/
|
|
734
|
+
backup(): Promise<ConfigManagerBackupData>;
|
|
735
|
+
/**
|
|
736
|
+
* Restore configuration from backup data
|
|
737
|
+
*
|
|
738
|
+
* Restores the custom configuration (user overrides) from backup data.
|
|
739
|
+
* This will overwrite the current custom configuration file and reload
|
|
740
|
+
* all configurations to rebuild the merged config.
|
|
741
|
+
*
|
|
742
|
+
* @param {BackupData} backupData - Backup data from backup() method
|
|
743
|
+
* @returns {Promise<void>}
|
|
744
|
+
*/
|
|
745
|
+
restore(backupData: ConfigManagerBackupData): Promise<void>;
|
|
746
|
+
}
|
|
747
|
+
export default ConfigurationManager;
|