@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,415 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Manager class - All managers should extend this
|
|
3
|
+
*
|
|
4
|
+
* Following JSPWiki's modular manager pattern, this abstract base class
|
|
5
|
+
* provides common functionality for all managers including initialization,
|
|
6
|
+
* lifecycle management, and backup/restore operations.
|
|
7
|
+
*
|
|
8
|
+
* @class BaseManager
|
|
9
|
+
* @abstract
|
|
10
|
+
*
|
|
11
|
+
* @property {WikiEngine} engine - Reference to the wiki engine
|
|
12
|
+
* @property {boolean} initialized - Flag indicating initialization status
|
|
13
|
+
* @property {Record<string, unknown>} config - Configuration object passed during initialization
|
|
14
|
+
*
|
|
15
|
+
* @see {@link WikiEngine} for the main engine
|
|
16
|
+
*/
|
|
17
|
+
import logger from '../utils/logger.js';
|
|
18
|
+
import { checkConfiguredPath } from '../utils/PathPreflight.js';
|
|
19
|
+
import { recordAuditEvent } from '../utils/auditEvents.js';
|
|
20
|
+
import { AUDIT_EVENT } from '../utils/auditEventNames.js';
|
|
21
|
+
class BaseManager {
|
|
22
|
+
/** Reference to the wiki engine */
|
|
23
|
+
engine;
|
|
24
|
+
/** Initialization status flag */
|
|
25
|
+
initialized;
|
|
26
|
+
/** Configuration passed during initialization */
|
|
27
|
+
config;
|
|
28
|
+
/** What this manager is doing (#1155). Ready until something says otherwise. */
|
|
29
|
+
status = { state: 'ready' };
|
|
30
|
+
/**
|
|
31
|
+
* Short description of what this manager does.
|
|
32
|
+
* Used by admin UIs, addon registries, and introspection tools.
|
|
33
|
+
* Override in subclasses to provide a human-readable description.
|
|
34
|
+
*/
|
|
35
|
+
description;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new BaseManager instance
|
|
38
|
+
*
|
|
39
|
+
* @param engine - The wiki engine instance
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* class MyManager extends BaseManager {
|
|
43
|
+
* constructor(engine: WikiEngine) {
|
|
44
|
+
* super(engine);
|
|
45
|
+
* this.myData = new Map();
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
*/
|
|
49
|
+
constructor(engine) {
|
|
50
|
+
this.engine = engine;
|
|
51
|
+
this.initialized = false;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Initialize the manager with configuration
|
|
55
|
+
*
|
|
56
|
+
* Override this method in subclasses to perform initialization logic.
|
|
57
|
+
* Always call super.initialize() first in overridden implementations.
|
|
58
|
+
*
|
|
59
|
+
* @param config - Configuration object
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* async initialize(config: Record<string, any> = {}): Promise<void> {
|
|
63
|
+
* await super.initialize(config);
|
|
64
|
+
* // Your initialization logic here
|
|
65
|
+
* console.log('MyManager initialized');
|
|
66
|
+
* }
|
|
67
|
+
*/
|
|
68
|
+
async initialize(config = {}) {
|
|
69
|
+
this.config = config;
|
|
70
|
+
this.initialized = true;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Check if manager has been initialized
|
|
74
|
+
*
|
|
75
|
+
* @returns True if manager is initialized
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* if (manager.isInitialized()) {
|
|
79
|
+
* // Safe to use manager
|
|
80
|
+
* }
|
|
81
|
+
*/
|
|
82
|
+
isInitialized() {
|
|
83
|
+
return this.initialized;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get the wiki engine instance
|
|
87
|
+
*
|
|
88
|
+
* @returns The wiki engine instance
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* const config = this.getEngine().getConfig();
|
|
92
|
+
*/
|
|
93
|
+
getEngine() {
|
|
94
|
+
return this.engine;
|
|
95
|
+
}
|
|
96
|
+
/** A page's data changed outside savePage: its cached content goes, and every cached render re-renders (#1751). */
|
|
97
|
+
invalidateHandlerCache(pageUuid) {
|
|
98
|
+
this.engine.getManager('PageManager')?.invalidatePageCache(pageUuid);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Preflight a configured filesystem path before any mkdir/write happens.
|
|
102
|
+
*
|
|
103
|
+
* Wraps `checkConfiguredPath()` with a standardized warning log that names
|
|
104
|
+
* the manager (`this.constructor.name`) and the originating config key.
|
|
105
|
+
* Useful for paths that may live on volumes the OS has unmounted (notably
|
|
106
|
+
* macOS `/Volumes/<X>/...`), where `fs.ensureDir` would otherwise crash
|
|
107
|
+
* the engine with an opaque `EACCES`.
|
|
108
|
+
*
|
|
109
|
+
* The caller decides what to do on failure (degrade, fall back to a
|
|
110
|
+
* default, or treat as fatal).
|
|
111
|
+
*
|
|
112
|
+
* @param configKey The config key that supplied this path — included in
|
|
113
|
+
* the warning so operators know what to fix.
|
|
114
|
+
* @param path The resolved path to check.
|
|
115
|
+
* @returns The preflight result. `result.ok === true` means safe
|
|
116
|
+
* to proceed.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* const preflight = this.preflightConfiguredPath(
|
|
120
|
+
* 'ngdpbase.backup.directory',
|
|
121
|
+
* this.backupDirectory
|
|
122
|
+
* );
|
|
123
|
+
* if (!preflight.ok) {
|
|
124
|
+
* // degrade — disable feature, fall back to default, etc.
|
|
125
|
+
* return;
|
|
126
|
+
* }
|
|
127
|
+
*/
|
|
128
|
+
preflightConfiguredPath(configKey, path, options = {}) {
|
|
129
|
+
// `options` carries only test seams (see PathPreflight). It is threaded
|
|
130
|
+
// through so the degraded-state path can be exercised on any platform:
|
|
131
|
+
// the underlying check runs on darwin alone, so on Linux CI this branch
|
|
132
|
+
// was unreachable and the test asserting it failed on every run.
|
|
133
|
+
const result = checkConfiguredPath(path, options);
|
|
134
|
+
if (!result.ok) {
|
|
135
|
+
logger.warn(`⚠️ ${this.constructor.name}: ${result.message} ` +
|
|
136
|
+
`(config key: ${configKey}).`);
|
|
137
|
+
// #1155: recorded, not only logged. This is the common entry point every
|
|
138
|
+
// degrading manager already goes through, so setting the state here is
|
|
139
|
+
// what makes twelve invisible degradations visible without each caller
|
|
140
|
+
// remembering to say so.
|
|
141
|
+
this.markDegraded(result.message ?? 'the configured path could not be used', configKey);
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* What this manager is doing (#1155).
|
|
147
|
+
*
|
|
148
|
+
* Not `getStatus()`: that name is already taken by `AddonsManager` and
|
|
149
|
+
* `BackgroundJobManager` for entirely different things, and a base-class
|
|
150
|
+
* method silently overridden by two subclasses would be worse than a longer
|
|
151
|
+
* name.
|
|
152
|
+
*/
|
|
153
|
+
getManagerStatus() {
|
|
154
|
+
return { ...this.status };
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Record that this manager is configured, wanted, and not working.
|
|
158
|
+
*
|
|
159
|
+
* @returns true when this is a TRANSITION — a state or reason that differs
|
|
160
|
+
* from the current one. Only a transition is an event: a manager that
|
|
161
|
+
* starts degraded and stays degraded must not re-emit on every boot, or
|
|
162
|
+
* the signal is buried in its own noise.
|
|
163
|
+
*/
|
|
164
|
+
markDegraded(reason, configKey) {
|
|
165
|
+
return this.transition({ state: 'degraded', reason, configKey });
|
|
166
|
+
}
|
|
167
|
+
/** Record that this manager is deliberately off. Not a problem (#1155). */
|
|
168
|
+
markDisabled(reason) {
|
|
169
|
+
return this.transition({ state: 'disabled', reason });
|
|
170
|
+
}
|
|
171
|
+
/** Record that this manager could not initialise at all (#1155). */
|
|
172
|
+
markFailed(reason, configKey) {
|
|
173
|
+
return this.transition({ state: 'failed', reason, configKey });
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Record that this manager is working.
|
|
177
|
+
*
|
|
178
|
+
* Clears the reason rather than leaving a stale one behind — a recovered
|
|
179
|
+
* manager still carrying "the directory is not writable" is a worse lie than
|
|
180
|
+
* no reason at all.
|
|
181
|
+
*/
|
|
182
|
+
markReady() {
|
|
183
|
+
return this.transition({ state: 'ready' });
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Record that this manager is working again, but only while it is still
|
|
187
|
+
* degraded for `reason` — the one a check set, now cleared by re-running
|
|
188
|
+
* it (#1842). A different fault set since stays reported.
|
|
189
|
+
*/
|
|
190
|
+
markReadyIfDegradedBy(reason) {
|
|
191
|
+
if (this.status.state !== 'degraded' || this.status.reason !== reason)
|
|
192
|
+
return false;
|
|
193
|
+
return this.markReady();
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Apply a state and audit it if it CHANGED.
|
|
197
|
+
*
|
|
198
|
+
* Only a transition is an event. A manager that starts degraded and stays
|
|
199
|
+
* degraded must not re-emit on every boot, or the signal is buried in its
|
|
200
|
+
* own noise — and the at-boot picture is already carried by #1149's
|
|
201
|
+
* `system-start` record.
|
|
202
|
+
*
|
|
203
|
+
* Emitted from here rather than each manager, per the #1120 rule: a producer
|
|
204
|
+
* that has to remember to call something can be correct, but can never be
|
|
205
|
+
* PROVABLE.
|
|
206
|
+
*/
|
|
207
|
+
transition(next) {
|
|
208
|
+
const changed = this.status.state !== next.state || this.status.reason !== next.reason;
|
|
209
|
+
this.status = next;
|
|
210
|
+
if (!changed)
|
|
211
|
+
return false;
|
|
212
|
+
// Fire-and-forget. Refusing to degrade because the record could not be
|
|
213
|
+
// written would take an instance down over a feature that is already
|
|
214
|
+
// broken, which is the wrong way round.
|
|
215
|
+
void recordAuditEvent(this.engine?.getManager?.('AuditManager'), {
|
|
216
|
+
eventType: AUDIT_EVENT.MANAGER_STATE_CHANGE,
|
|
217
|
+
user: 'system',
|
|
218
|
+
ipAddress: undefined,
|
|
219
|
+
action: 'manager-state-change',
|
|
220
|
+
result: 'success',
|
|
221
|
+
severity: next.state === 'degraded' || next.state === 'failed' ? 'high' : 'low',
|
|
222
|
+
metadata: {
|
|
223
|
+
manager: this.constructor.name,
|
|
224
|
+
state: next.state,
|
|
225
|
+
...(next.reason ? { reason: next.reason } : {}),
|
|
226
|
+
...(next.configKey ? { configKey: next.configKey } : {})
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Shutdown the manager and cleanup resources
|
|
233
|
+
*
|
|
234
|
+
* Override this method in subclasses to perform cleanup logic.
|
|
235
|
+
* Always call super.shutdown() at the end of overridden implementations.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* async shutdown(): Promise<void> {
|
|
239
|
+
* // Your cleanup logic here
|
|
240
|
+
* await this.closeConnections();
|
|
241
|
+
* await super.shutdown();
|
|
242
|
+
* }
|
|
243
|
+
*/
|
|
244
|
+
async shutdown() {
|
|
245
|
+
this.initialized = false;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Backup manager data
|
|
249
|
+
*
|
|
250
|
+
* MUST be overridden by all managers that manage persistent data.
|
|
251
|
+
* Default implementation returns an empty backup object.
|
|
252
|
+
*
|
|
253
|
+
* @returns Backup data object containing all manager state
|
|
254
|
+
* @throws {Error} If backup operation fails
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* async backup(): Promise<BackupData> {
|
|
258
|
+
* return {
|
|
259
|
+
* managerName: this.constructor.name,
|
|
260
|
+
* timestamp: new Date().toISOString(),
|
|
261
|
+
* data: {
|
|
262
|
+
* users: Array.from(this.users.values()),
|
|
263
|
+
* settings: this.settings
|
|
264
|
+
* }
|
|
265
|
+
* };
|
|
266
|
+
* }
|
|
267
|
+
*/
|
|
268
|
+
async backup() {
|
|
269
|
+
// Default implementation returns empty object
|
|
270
|
+
// Managers with data MUST override this method
|
|
271
|
+
return {
|
|
272
|
+
managerName: this.constructor.name,
|
|
273
|
+
timestamp: new Date().toISOString(),
|
|
274
|
+
data: null
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Restore manager data from backup
|
|
279
|
+
*
|
|
280
|
+
* MUST be overridden by all managers that manage persistent data.
|
|
281
|
+
* Default implementation only validates that backup data is provided.
|
|
282
|
+
*
|
|
283
|
+
* @param backupData - Backup data object from backup() method
|
|
284
|
+
* @throws {Error} If restore operation fails or backup data is missing
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* async restore(backupData: BackupData): Promise<void> {
|
|
288
|
+
* if (!backupData || !backupData.data) {
|
|
289
|
+
* throw new Error('Invalid backup data');
|
|
290
|
+
* }
|
|
291
|
+
* this.users = new Map(backupData.data.users.map(u => [u.id, u]));
|
|
292
|
+
* this.settings = backupData.data.settings;
|
|
293
|
+
* }
|
|
294
|
+
*/
|
|
295
|
+
async restore(backupData) {
|
|
296
|
+
// Default implementation does nothing
|
|
297
|
+
// Managers with data MUST override this method
|
|
298
|
+
if (!backupData) {
|
|
299
|
+
throw new Error(`${this.constructor.name}: No backup data provided for restore`);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Return a plain-text string suitable for use as MarqueePlugin banner text.
|
|
304
|
+
*
|
|
305
|
+
* Override in subclasses to expose live manager data as a scrolling banner:
|
|
306
|
+
*
|
|
307
|
+
* [{MarqueePlugin fetch='PageManager.toMarqueeText()'}]
|
|
308
|
+
* [{MarqueePlugin fetch='PageManager.toMarqueeText(limit=5,sort=date-desc)'}]
|
|
309
|
+
*
|
|
310
|
+
* The default returns '' (no output). Subclasses should return a concise,
|
|
311
|
+
* single-line summary. Common options (limit, sortBy, sortOrder, since, before)
|
|
312
|
+
* are available via ManagerFetchOptions; domain-specific keys are read directly
|
|
313
|
+
* from the raw options object passed by the caller.
|
|
314
|
+
*
|
|
315
|
+
* @param _options Parsed fetch args from the plugin invocation.
|
|
316
|
+
* @param _viewer The viewer's context (#1556): show only what they may see.
|
|
317
|
+
* Page text reaches this method, and only this method, on
|
|
318
|
+
* every render for every viewer.
|
|
319
|
+
* @returns Plain text, or '' if this manager has nothing to display.
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* async toMarqueeText(options: ManagerFetchOptions = {}): Promise<string> {
|
|
323
|
+
* const pages = await this.getRecentChanges(options.limit ?? 5);
|
|
324
|
+
* return 'Recent: ' + pages.map(p => p.name).join(' • ');
|
|
325
|
+
* }
|
|
326
|
+
*/
|
|
327
|
+
async toMarqueeText(_options = {}, _viewer) {
|
|
328
|
+
return '';
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Return the choices for a form dropdown, for the forms add-on's
|
|
332
|
+
* `"optionsSource": "fetch:ManagerName.toFormOptions(list=funds)"`.
|
|
333
|
+
*
|
|
334
|
+
* The same convention and the same safety rules as `toMarqueeText()`: it is
|
|
335
|
+
* the one other method page content may reach (`resolveManagerOptions`), it
|
|
336
|
+
* runs on every render for every viewer, and it must have no side effect.
|
|
337
|
+
* Offer only what `_viewer` may see. The forms add-on calls it again when the
|
|
338
|
+
* form is submitted and refuses a value that is not among the choices.
|
|
339
|
+
*
|
|
340
|
+
* @param _options Parsed args from the spec, as raw `{ key: value }` strings.
|
|
341
|
+
* @param _viewer The viewer's context.
|
|
342
|
+
* @returns `{ value, label }` choices (plain strings are accepted too), or `[]`.
|
|
343
|
+
*/
|
|
344
|
+
async toFormOptions(_options = {}, _viewer) {
|
|
345
|
+
return [];
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* What this manager holds (#1006).
|
|
349
|
+
*
|
|
350
|
+
* __Counts and health only — never item contents.__ That is the whole safety
|
|
351
|
+
* property, and it is why this is not the `getAll()` the question originally
|
|
352
|
+
* asked for. `AgentTokenManager` holds bearer credentials, `UserManager`
|
|
353
|
+
* holds users, `ShareManager` holds capability tokens; a generic enumeration
|
|
354
|
+
* on the base class means the first generic caller — an admin dump panel, a
|
|
355
|
+
* search indexer, a debug route — reaches all of it by default. A count
|
|
356
|
+
* cannot leak what it counts.
|
|
357
|
+
*
|
|
358
|
+
* Optional by override, with a safe default, exactly like `backup()` and
|
|
359
|
+
* `toMarqueeText()` above. A manager holding no countable collection omits
|
|
360
|
+
* `count` rather than reporting `0`, because "nothing to count" and "none"
|
|
361
|
+
* are different answers and an admin row that shows `0` for
|
|
362
|
+
* `RenderingManager` is noise.
|
|
363
|
+
*
|
|
364
|
+
* __Never throws.__ A broken manager reports `healthy: false`; it does not
|
|
365
|
+
* take down the page rendering every other manager. The base wraps nothing,
|
|
366
|
+
* so an override that can fail must catch its own errors — see the note on
|
|
367
|
+
* `safeGetManagerStats()`.
|
|
368
|
+
*
|
|
369
|
+
* __Named `getManagerStats`, not `getStats`.__ Two managers already have a
|
|
370
|
+
* `getStats()` returning their own domain shape — `FilterManager` (pipeline
|
|
371
|
+
* statistics, #615) and `NotificationManager` (`NotificationStats`, read by
|
|
372
|
+
* a live route). Both are correct for what they do, and taking the name from
|
|
373
|
+
* them would either break those callers or leave `getStats()` meaning two
|
|
374
|
+
* different things depending on the manager, which is the exact confusion
|
|
375
|
+
* this contract exists to remove. A generic caller needs a name that means
|
|
376
|
+
* one thing everywhere.
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* async getManagerStats(): Promise<ManagerStats> {
|
|
380
|
+
* const active = this.list('').filter((r) => !r.revokedAt);
|
|
381
|
+
* return { ...await super.getManagerStats(), count: active.length };
|
|
382
|
+
* }
|
|
383
|
+
*/
|
|
384
|
+
async getManagerStats() {
|
|
385
|
+
return {
|
|
386
|
+
// #1155 already answers "is this manager working", with four states and
|
|
387
|
+
// a reason. Re-deriving health from `isInitialized()` here would put a
|
|
388
|
+
// second, weaker source of truth next to it — a manager could be
|
|
389
|
+
// initialised and degraded, and the two answers would disagree with
|
|
390
|
+
// nothing to reconcile them. So this is the SAME fact, narrowed for a
|
|
391
|
+
// one-line admin row; a caller wanting why asks getManagerStatus().
|
|
392
|
+
healthy: this.getManagerStatus().state === 'ready'
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* `getManagerStats()` that cannot break the page it is rendered on.
|
|
397
|
+
*
|
|
398
|
+
* The contract says an override must not throw, and saying so does not make
|
|
399
|
+
* it true — an override reads a store, and a store can fail. This is what an
|
|
400
|
+
* admin surface iterating every manager should call: one manager throwing
|
|
401
|
+
* becomes one unhealthy row rather than a 500 for all of them.
|
|
402
|
+
*/
|
|
403
|
+
async safeGetManagerStats() {
|
|
404
|
+
try {
|
|
405
|
+
return await this.getManagerStats();
|
|
406
|
+
}
|
|
407
|
+
catch (err) {
|
|
408
|
+
return {
|
|
409
|
+
healthy: false,
|
|
410
|
+
summary: `stats unavailable: ${err instanceof Error ? err.message : String(err)}`
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
export default BaseManager;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import BaseManager from './BaseManager.js';
|
|
2
|
+
import RegionCache from '../cache/RegionCache.js';
|
|
3
|
+
import type { WikiEngine } from '../types/WikiEngine.js';
|
|
4
|
+
/**
|
|
5
|
+
* Cache options for set operations
|
|
6
|
+
*/
|
|
7
|
+
export interface CacheOptions {
|
|
8
|
+
ttl?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Cache configuration
|
|
12
|
+
*/
|
|
13
|
+
export interface CacheConfig {
|
|
14
|
+
provider: string | null;
|
|
15
|
+
defaultTTL: number;
|
|
16
|
+
maxKeys: number;
|
|
17
|
+
checkPeriod: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Cache statistics
|
|
21
|
+
*/
|
|
22
|
+
export interface CacheStats {
|
|
23
|
+
global?: unknown;
|
|
24
|
+
regions?: string[];
|
|
25
|
+
provider?: string | null;
|
|
26
|
+
config?: CacheConfig;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
declare class CacheManager extends BaseManager {
|
|
30
|
+
private provider;
|
|
31
|
+
private providerClass;
|
|
32
|
+
private regions;
|
|
33
|
+
private defaultTTL;
|
|
34
|
+
private maxKeys;
|
|
35
|
+
private checkPeriod;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new CacheManager instance
|
|
38
|
+
*
|
|
39
|
+
* @constructor
|
|
40
|
+
* @param {any} engine - The wiki engine instance
|
|
41
|
+
*/
|
|
42
|
+
constructor(engine: WikiEngine);
|
|
43
|
+
/**
|
|
44
|
+
* Initialize the CacheManager and load the configured provider
|
|
45
|
+
*
|
|
46
|
+
* @async
|
|
47
|
+
* @param {Record<string, unknown>} [config={}] - Configuration object (unused, reads from ConfigurationManager)
|
|
48
|
+
* @returns {Promise<void>}
|
|
49
|
+
* @throws {Error} If ConfigurationManager is not available
|
|
50
|
+
*/
|
|
51
|
+
initialize(config?: Record<string, unknown>): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Load the cache provider dynamically
|
|
54
|
+
* @private
|
|
55
|
+
* @returns {Promise<void>}
|
|
56
|
+
*/
|
|
57
|
+
private loadProvider;
|
|
58
|
+
/**
|
|
59
|
+
* Normalize provider name to PascalCase class name
|
|
60
|
+
* @param {string} providerName - Lowercase provider name (e.g., 'nodecacheprovider')
|
|
61
|
+
* @returns {string} PascalCase class name (e.g., 'NodeCacheProvider')
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
private normalizeProviderName;
|
|
65
|
+
/**
|
|
66
|
+
* Get a cache region for a specific namespace
|
|
67
|
+
* @param {string} region - Region name (typically manager name)
|
|
68
|
+
* @returns {RegionCache} Cache instance scoped to the region
|
|
69
|
+
*/
|
|
70
|
+
region(region: string): RegionCache;
|
|
71
|
+
/**
|
|
72
|
+
* The current version of a data topic: by convention a manager's name
|
|
73
|
+
* (`LedgerManager`). A cached render built from the topic is served only
|
|
74
|
+
* while this is unchanged (`RegionCache.getOrSetVersioned`). `'0'` until
|
|
75
|
+
* the topic is first bumped.
|
|
76
|
+
*/
|
|
77
|
+
version(topic: string): Promise<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Say that a topic's data changed: every cached render that read it is
|
|
80
|
+
* re-rendered on its next read. A manager calls this after each write, at
|
|
81
|
+
* its one door. Versions never expire (TTL 0); each bump is a new unique
|
|
82
|
+
* value, so two instances sharing a cache cannot collide on a count.
|
|
83
|
+
*/
|
|
84
|
+
bump(topic: string): Promise<string>;
|
|
85
|
+
/**
|
|
86
|
+
* Get a value from the cache (global scope)
|
|
87
|
+
* @param {string} key - The cache key
|
|
88
|
+
* @returns {Promise<unknown>} The cached value or undefined if not found
|
|
89
|
+
*/
|
|
90
|
+
get(key: string): Promise<unknown>;
|
|
91
|
+
/**
|
|
92
|
+
* Set a value in the cache (global scope)
|
|
93
|
+
* @param {string} key - The cache key
|
|
94
|
+
* @param {unknown} value - The value to cache
|
|
95
|
+
* @param {CacheOptions} [options] - Cache options
|
|
96
|
+
* @param {number} [options.ttl] - Time to live in seconds
|
|
97
|
+
* @returns {Promise<void>}
|
|
98
|
+
*/
|
|
99
|
+
set(key: string, value: unknown, options?: CacheOptions): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Delete one or more keys from the cache
|
|
102
|
+
* @param {string|string[]} keys - Single key or array of keys to delete
|
|
103
|
+
* @returns {Promise<void>}
|
|
104
|
+
*/
|
|
105
|
+
del(keys: string | string[]): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Clear cache entries
|
|
108
|
+
* @param {string} [region] - Optional region to clear (if not specified, clears all)
|
|
109
|
+
* @param {string} [pattern] - Optional pattern to match keys
|
|
110
|
+
* @returns {Promise<void>}
|
|
111
|
+
*/
|
|
112
|
+
clear(region?: string, pattern?: string): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Get keys matching a pattern
|
|
115
|
+
* @param {string} [pattern='*'] - Pattern to match
|
|
116
|
+
* @returns {Promise<string[]>} Array of matching keys
|
|
117
|
+
*/
|
|
118
|
+
keys(pattern?: string): Promise<string[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Get cache statistics
|
|
121
|
+
* @param {string} [region] - Optional region to get stats for
|
|
122
|
+
* @returns {Promise<CacheStats>} Cache statistics
|
|
123
|
+
*/
|
|
124
|
+
stats(region?: string): Promise<CacheStats>;
|
|
125
|
+
/**
|
|
126
|
+
* Check if the cache is healthy
|
|
127
|
+
* @returns {Promise<boolean>} True if cache is healthy
|
|
128
|
+
*/
|
|
129
|
+
isHealthy(): Promise<boolean>;
|
|
130
|
+
/**
|
|
131
|
+
* Get cache configuration
|
|
132
|
+
* @returns {CacheConfig} Cache configuration
|
|
133
|
+
*/
|
|
134
|
+
getConfig(): CacheConfig;
|
|
135
|
+
/**
|
|
136
|
+
* Get all active regions
|
|
137
|
+
* @returns {string[]} Array of region names
|
|
138
|
+
*/
|
|
139
|
+
getRegions(): string[];
|
|
140
|
+
/**
|
|
141
|
+
* Flush all caches (dangerous operation)
|
|
142
|
+
* @returns {Promise<void>}
|
|
143
|
+
*/
|
|
144
|
+
flushAll(): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Close and cleanup cache resources
|
|
147
|
+
* @returns {Promise<void>}
|
|
148
|
+
*/
|
|
149
|
+
shutdown(): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Helper method to add cache support to BaseManager
|
|
152
|
+
* Can be called from any manager to get a cache region
|
|
153
|
+
* @param {any} engine - WikiEngine instance
|
|
154
|
+
* @param {string} [region] - Region name (defaults to calling class name)
|
|
155
|
+
* @returns {RegionCache} Cache instance scoped to the region
|
|
156
|
+
*/
|
|
157
|
+
static getCacheForManager(engine: WikiEngine, region?: string): RegionCache;
|
|
158
|
+
}
|
|
159
|
+
export default CacheManager;
|