@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.
Files changed (302) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +16 -2
  3. package/lib/packages/ngdpbase-types/index.d.ts +32 -0
  4. package/lib/packages/ngdpbase-types/testing.d.ts +43 -0
  5. package/lib/packages/ngdpbase-types/testing.js +53 -0
  6. package/lib/src/cache/CacheDependencies.d.ts +50 -0
  7. package/lib/src/cache/CacheDependencies.js +50 -0
  8. package/lib/src/cache/ICacheAdapter.d.ts +86 -0
  9. package/lib/src/cache/RegionCache.d.ts +171 -0
  10. package/lib/src/context/ActorContext.d.ts +48 -0
  11. package/lib/src/context/ActorContext.js +33 -0
  12. package/lib/src/context/ApiContext.d.ts +194 -0
  13. package/lib/src/context/ApiContext.js +273 -0
  14. package/lib/src/context/BaseContext.d.ts +110 -0
  15. package/lib/src/context/BaseContext.js +143 -0
  16. package/lib/src/context/JobContext.d.ts +153 -0
  17. package/lib/src/context/JobContext.js +144 -0
  18. package/lib/src/context/WikiContext.d.ts +404 -0
  19. package/lib/src/context/bootActions.d.ts +64 -0
  20. package/lib/src/context/bootActions.js +111 -0
  21. package/lib/src/converters/HtmlConverter.d.ts +70 -0
  22. package/lib/src/converters/IContentConverter.d.ts +94 -0
  23. package/lib/src/converters/JSPWikiConverter.d.ts +117 -0
  24. package/lib/src/converters/conversionWarning.d.ts +15 -0
  25. package/lib/src/converters/ncm/bridge.d.ts +22 -0
  26. package/lib/src/converters/ncm/existing.d.ts +23 -0
  27. package/lib/src/converters/ncm/fix/blocks.d.ts +89 -0
  28. package/lib/src/converters/ncm/fix/bulletMarkers.d.ts +21 -0
  29. package/lib/src/converters/ncm/fix/index.d.ts +36 -0
  30. package/lib/src/converters/ncm/fix/jspwikiBullets.d.ts +20 -0
  31. package/lib/src/converters/ncm/fix/jspwikiCodeMarkers.d.ts +38 -0
  32. package/lib/src/converters/ncm/fix/jspwikiHeadings.d.ts +25 -0
  33. package/lib/src/converters/ncm/fix/jspwikiIndent.d.ts +24 -0
  34. package/lib/src/converters/ncm/fix/jspwikiInsert.d.ts +21 -0
  35. package/lib/src/converters/ncm/fix/jspwikiItalic.d.ts +29 -0
  36. package/lib/src/converters/ncm/fix/jspwikiLinkLeftovers.d.ts +27 -0
  37. package/lib/src/converters/ncm/fix/moreInformationFooter.d.ts +25 -0
  38. package/lib/src/converters/ncm/fix/styleClosers.d.ts +25 -0
  39. package/lib/src/converters/ncm/fix/tightenLists.d.ts +30 -0
  40. package/lib/src/converters/ncm/fix/types.d.ts +33 -0
  41. package/lib/src/converters/ncm/footnotes.d.ts +39 -0
  42. package/lib/src/converters/ncm/images.d.ts +49 -0
  43. package/lib/src/converters/ncm/index.d.ts +20 -0
  44. package/lib/src/converters/ncm/links.d.ts +21 -0
  45. package/lib/src/converters/ncm/normalize.d.ts +39 -0
  46. package/lib/src/converters/ncm/placeholder.d.ts +25 -0
  47. package/lib/src/converters/ncm/tables.d.ts +36 -0
  48. package/lib/src/converters/ncm/types.d.ts +42 -0
  49. package/lib/src/http/egressPolicy.d.ts +52 -0
  50. package/lib/src/http/guardedFetch.d.ts +89 -0
  51. package/lib/src/http/guardedFetch.js +113 -0
  52. package/lib/src/http/guardedLookup.d.ts +48 -0
  53. package/lib/src/http/guardedLookup.js +73 -0
  54. package/lib/src/http/ssrf.d.ts +83 -0
  55. package/lib/src/http/ssrf.js +311 -0
  56. package/lib/src/mail/MailProvider.d.ts +36 -0
  57. package/lib/src/mail/NodemailerMailProvider.d.ts +26 -0
  58. package/lib/src/managers/AddonsManager.d.ts +691 -0
  59. package/lib/src/managers/AgentTokenManager.d.ts +269 -0
  60. package/lib/src/managers/AssetManager.d.ts +116 -0
  61. package/lib/src/managers/AttachmentManager.d.ts +1032 -0
  62. package/lib/src/managers/AuthManager.d.ts +1257 -0
  63. package/lib/src/managers/BackgroundJobManager.d.ts +434 -0
  64. package/lib/src/managers/BaseManager.d.ts +391 -0
  65. package/lib/src/managers/BaseManager.js +415 -0
  66. package/lib/src/managers/CacheManager.d.ts +159 -0
  67. package/lib/src/managers/CatalogManager.d.ts +235 -0
  68. package/lib/src/managers/CommentManager.d.ts +75 -0
  69. package/lib/src/managers/ConfigurationManager.d.ts +747 -0
  70. package/lib/src/managers/DatabaseManager.d.ts +89 -0
  71. package/lib/src/managers/DatabaseManager.js +236 -0
  72. package/lib/src/managers/EmailManager.d.ts +47 -0
  73. package/lib/src/managers/ExportManager.d.ts +129 -0
  74. package/lib/src/managers/ExportManager.js +420 -0
  75. package/lib/src/managers/FootnoteManager.d.ts +118 -0
  76. package/lib/src/managers/MediaManager.d.ts +279 -0
  77. package/lib/src/managers/MetricsManager.d.ts +89 -0
  78. package/lib/src/managers/NotificationManager.d.ts +165 -0
  79. package/lib/src/managers/OidcManager.d.ts +210 -0
  80. package/lib/src/managers/OrganizationManager.d.ts +107 -0
  81. package/lib/src/managers/PageManager.d.ts +1645 -0
  82. package/lib/src/managers/PersonManager.d.ts +48 -0
  83. package/lib/src/managers/PluginManager.d.ts +179 -0
  84. package/lib/src/managers/PluginManager.js +393 -0
  85. package/lib/src/managers/PolicyEvaluator.d.ts +213 -0
  86. package/lib/src/managers/RenderingManager.d.ts +358 -0
  87. package/lib/src/managers/RoleManager.d.ts +134 -0
  88. package/lib/src/managers/SearchManager.d.ts +402 -0
  89. package/lib/src/managers/ShareManager.d.ts +251 -0
  90. package/lib/src/managers/TemplateManager.d.ts +176 -0
  91. package/lib/src/managers/ThemeManager.d.ts +56 -0
  92. package/lib/src/managers/UserManager.d.ts +480 -0
  93. package/lib/src/managers/ValidationManager.d.ts +426 -0
  94. package/lib/src/managers/VariableManager.d.ts +145 -0
  95. package/lib/src/middleware/csrf.d.ts +3 -0
  96. package/lib/src/parsers/LinkParser.d.ts +457 -0
  97. package/lib/src/parsers/MarkupParser.d.ts +769 -0
  98. package/lib/src/parsers/context/ParseContext.d.ts +314 -0
  99. package/lib/src/parsers/data/emoji-map.d.ts +18 -0
  100. package/lib/src/parsers/dom/DOMBuilder.d.ts +210 -0
  101. package/lib/src/parsers/dom/DOMParser.d.ts +252 -0
  102. package/lib/src/parsers/dom/Tokenizer.d.ts +358 -0
  103. package/lib/src/parsers/dom/WikiDocument.d.ts +272 -0
  104. package/lib/src/parsers/dom/handlers/DOMLinkHandler.d.ts +260 -0
  105. package/lib/src/parsers/dom/handlers/DOMPluginHandler.d.ts +212 -0
  106. package/lib/src/parsers/dom/handlers/DOMVariableHandler.d.ts +171 -0
  107. package/lib/src/parsers/filters/BaseFilter.d.ts +269 -0
  108. package/lib/src/parsers/filters/FilterChain.d.ts +320 -0
  109. package/lib/src/parsers/handlers/BaseSyntaxHandler.d.ts +331 -0
  110. package/lib/src/parsers/handlers/HandlerRegistry.d.ts +225 -0
  111. package/lib/src/parsers/handlers/JSPWikiPreprocessor.d.ts +89 -0
  112. package/lib/src/parsers/handlers/LinkParserHandler.d.ts +80 -0
  113. package/lib/src/parsers/handlers/PluginSyntaxHandler.d.ts +78 -0
  114. package/lib/src/parsers/handlers/WikiFormHandler.d.ts +149 -0
  115. package/lib/src/parsers/handlers/WikiTagHandler.d.ts +125 -0
  116. package/lib/src/parsers/jspwikiTableRow.d.ts +39 -0
  117. package/lib/src/parsers/styleBlockSyntax.d.ts +14 -0
  118. package/lib/src/plugins/types.d.ts +79 -0
  119. package/lib/src/providers/AgentTokenAuthProvider.d.ts +40 -0
  120. package/lib/src/providers/AuthentikBearerAuthProvider.d.ts +75 -0
  121. package/lib/src/providers/BaseAttachmentProvider.d.ts +197 -0
  122. package/lib/src/providers/BaseAuthProvider.d.ts +220 -0
  123. package/lib/src/providers/BaseCacheProvider.d.ts +140 -0
  124. package/lib/src/providers/BaseCredentialsProvider.d.ts +84 -0
  125. package/lib/src/providers/BaseDatabaseProvider.d.ts +22 -0
  126. package/lib/src/providers/BaseDatabaseProvider.js +12 -0
  127. package/lib/src/providers/BaseLoggingProvider.d.ts +68 -0
  128. package/lib/src/providers/BaseLoggingProvider.js +37 -0
  129. package/lib/src/providers/BaseMediaProvider.d.ts +308 -0
  130. package/lib/src/providers/BasePageProvider.d.ts +337 -0
  131. package/lib/src/providers/BaseProvider.d.ts +98 -0
  132. package/lib/src/providers/BaseProvider.js +74 -0
  133. package/lib/src/providers/BaseSearchProvider.d.ts +362 -0
  134. package/lib/src/providers/BasicAttachmentProvider.d.ts +599 -0
  135. package/lib/src/providers/CloudflareAccessAuthProvider.d.ts +72 -0
  136. package/lib/src/providers/FileCredentialsProvider.d.ts +33 -0
  137. package/lib/src/providers/FileJobStateProvider.d.ts +58 -0
  138. package/lib/src/providers/FileLoggingProvider.d.ts +43 -0
  139. package/lib/src/providers/FileLoggingProvider.js +120 -0
  140. package/lib/src/providers/FileOidcAdapter.d.ts +25 -0
  141. package/lib/src/providers/FileSystemMediaProvider.d.ts +403 -0
  142. package/lib/src/providers/LunrSearchProvider.d.ts +280 -0
  143. package/lib/src/providers/MagicLinkAuthProvider.d.ts +125 -0
  144. package/lib/src/providers/NullCacheProvider.d.ts +72 -0
  145. package/lib/src/providers/OidcAuthProvider.d.ts +180 -0
  146. package/lib/src/providers/OidcBearerAuthProvider.d.ts +30 -0
  147. package/lib/src/providers/PasskeyAuthProvider.d.ts +58 -0
  148. package/lib/src/providers/PasswordAuthProvider.d.ts +20 -0
  149. package/lib/src/providers/SqliteDatabaseProvider.d.ts +55 -0
  150. package/lib/src/providers/SqliteDatabaseProvider.js +90 -0
  151. package/lib/src/providers/SqliteJobStateProvider.d.ts +41 -0
  152. package/lib/src/providers/databaseMigrations.d.ts +8 -0
  153. package/lib/src/providers/databaseMigrations.js +47 -0
  154. package/lib/src/providers/jobState.d.ts +99 -0
  155. package/lib/src/providers/lunrQueryToMiniSearch.d.ts +32 -0
  156. package/lib/src/providers/mediaFilenameDate.d.ts +22 -0
  157. package/lib/src/providers/sqliteLocation.d.ts +17 -0
  158. package/lib/src/providers/sqliteLocation.js +55 -0
  159. package/lib/src/providers/sqliteMigrations.d.ts +48 -0
  160. package/lib/src/providers/sqliteMigrations.js +72 -0
  161. package/lib/src/rendering/githubAlerts.d.ts +22 -0
  162. package/lib/src/rendering/htmlPolicy.d.ts +76 -0
  163. package/lib/src/rendering/markdownConverter.d.ts +73 -0
  164. package/lib/src/security/PolicyDecisionPoint.d.ts +245 -0
  165. package/lib/src/security/PolicyInformationPoint.d.ts +448 -0
  166. package/lib/src/security/pageActions.d.ts +40 -0
  167. package/lib/src/security/permissions.generated.d.ts +78 -0
  168. package/lib/src/types/Asset.d.ts +414 -0
  169. package/lib/src/types/Catalog.d.ts +61 -0
  170. package/lib/src/types/Comment.d.ts +11 -0
  171. package/lib/src/types/Config.d.ts +388 -0
  172. package/lib/src/types/Organization.d.ts +78 -0
  173. package/lib/src/types/OrganizationProvider.d.ts +38 -0
  174. package/lib/src/types/Page.d.ts +220 -0
  175. package/lib/src/types/Person.d.ts +56 -0
  176. package/lib/src/types/PersonProvider.d.ts +25 -0
  177. package/lib/src/types/Policy.d.ts +139 -0
  178. package/lib/src/types/Policy.js +17 -0
  179. package/lib/src/types/Provider.d.ts +810 -0
  180. package/lib/src/types/Role.d.ts +84 -0
  181. package/lib/src/types/RoleProvider.d.ts +35 -0
  182. package/lib/src/types/Schema.d.ts +425 -0
  183. package/lib/src/types/Share.d.ts +172 -0
  184. package/lib/src/types/Share.js +81 -0
  185. package/lib/src/types/User.d.ts +304 -0
  186. package/lib/src/types/Version.d.ts +189 -0
  187. package/lib/src/types/WikiEngine.d.ts +128 -0
  188. package/lib/src/types/express.d.ts +120 -0
  189. package/lib/src/types/express.js +1 -0
  190. package/lib/src/types/guards.d.ts +78 -0
  191. package/lib/src/types/heic-decode.d.ts +16 -0
  192. package/lib/src/types/index.d.ts +19 -0
  193. package/lib/src/types/linkedom.d.ts +77 -0
  194. package/lib/src/types/markdown-it-plugins.d.ts +21 -0
  195. package/lib/src/utils/DeltaStorage.d.ts +118 -0
  196. package/lib/src/utils/LocaleUtils.d.ts +105 -0
  197. package/lib/src/utils/LocaleUtils.js +294 -0
  198. package/lib/src/utils/PageNameMatcher.d.ts +98 -0
  199. package/lib/src/utils/PathPreflight.d.ts +38 -0
  200. package/lib/src/utils/PathPreflight.js +50 -0
  201. package/lib/src/utils/SectionUtils.d.ts +40 -0
  202. package/lib/src/utils/addonConfigLayer.d.ts +144 -0
  203. package/lib/src/utils/addonConfigLayer.js +382 -0
  204. package/lib/src/utils/addonDatabaseRules.d.ts +25 -0
  205. package/lib/src/utils/addonDatabaseRules.js +57 -0
  206. package/lib/src/utils/addonHost.d.ts +51 -0
  207. package/lib/src/utils/addonHost.js +72 -0
  208. package/lib/src/utils/addonInstaller.d.ts +109 -0
  209. package/lib/src/utils/addonLock.d.ts +37 -0
  210. package/lib/src/utils/addonLock.js +48 -0
  211. package/lib/src/utils/addonPageSync.d.ts +45 -0
  212. package/lib/src/utils/addonProvenance.d.ts +48 -0
  213. package/lib/src/utils/addonTarball.d.ts +41 -0
  214. package/lib/src/utils/addonsPathResolver.d.ts +76 -0
  215. package/lib/src/utils/addonsPathResolver.js +129 -0
  216. package/lib/src/utils/assetMetadataTags.d.ts +66 -0
  217. package/lib/src/utils/atomicWrite.d.ts +28 -0
  218. package/lib/src/utils/auditConfigChange.d.ts +57 -0
  219. package/lib/src/utils/auditEventNames.d.ts +50 -0
  220. package/lib/src/utils/auditEventNames.generated.d.ts +163 -0
  221. package/lib/src/utils/auditEventNames.generated.js +168 -0
  222. package/lib/src/utils/auditEventNames.js +49 -0
  223. package/lib/src/utils/auditEvents.d.ts +265 -0
  224. package/lib/src/utils/auditEvents.js +309 -0
  225. package/lib/src/utils/auditRegistry.d.ts +102 -0
  226. package/lib/src/utils/auditRegistry.js +168 -0
  227. package/lib/src/utils/bip39English.d.ts +2 -0
  228. package/lib/src/utils/configEnvKeys.d.ts +68 -0
  229. package/lib/src/utils/configFiles.d.ts +74 -0
  230. package/lib/src/utils/configFiles.js +150 -0
  231. package/lib/src/utils/delegation.d.ts +48 -0
  232. package/lib/src/utils/deriveUsername.d.ts +21 -0
  233. package/lib/src/utils/explainMediaPath.d.ts +123 -0
  234. package/lib/src/utils/formerTitles.d.ts +69 -0
  235. package/lib/src/utils/frontmatterAccess.d.ts +54 -0
  236. package/lib/src/utils/headlessAdminPassword.d.ts +55 -0
  237. package/lib/src/utils/imageTransform.d.ts +52 -0
  238. package/lib/src/utils/instanceEnvSecret.d.ts +51 -0
  239. package/lib/src/utils/jobSlots.d.ts +43 -0
  240. package/lib/src/utils/keywordNormalizer.d.ts +127 -0
  241. package/lib/src/utils/logger.d.ts +70 -0
  242. package/lib/src/utils/logger.js +106 -0
  243. package/lib/src/utils/magicLinkDeviceState.d.ts +95 -0
  244. package/lib/src/utils/managerUtils.d.ts +40 -0
  245. package/lib/src/utils/migrateLegacyPrivateAttachments.d.ts +15 -0
  246. package/lib/src/utils/orgFilename.d.ts +22 -0
  247. package/lib/src/utils/pageFeature.d.ts +27 -0
  248. package/lib/src/utils/pageFrontmatter.d.ts +21 -0
  249. package/lib/src/utils/pageNotes.d.ts +150 -0
  250. package/lib/src/utils/pageTitleRule.d.ts +37 -0
  251. package/lib/src/utils/pageToArticle.d.ts +59 -0
  252. package/lib/src/utils/pageUrl.d.ts +18 -0
  253. package/lib/src/utils/passwordChange.d.ts +12 -0
  254. package/lib/src/utils/passwordHash.d.ts +60 -0
  255. package/lib/src/utils/permissionCatalog.d.ts +52 -0
  256. package/lib/src/utils/pluginFormatters.d.ts +452 -0
  257. package/lib/src/utils/pluginFormatters.js +714 -0
  258. package/lib/src/utils/privateLinkRewrite.d.ts +42 -0
  259. package/lib/src/utils/privateStoreAccess.d.ts +57 -0
  260. package/lib/src/utils/privateStoreAccess.js +65 -0
  261. package/lib/src/utils/privateStoreCatalogs.d.ts +40 -0
  262. package/lib/src/utils/privateStoreCrypto.d.ts +127 -0
  263. package/lib/src/utils/privateStoreDoor.d.ts +181 -0
  264. package/lib/src/utils/privateStoreExport.d.ts +72 -0
  265. package/lib/src/utils/privateStoreFiles.d.ts +120 -0
  266. package/lib/src/utils/privateStoreMeta.d.ts +64 -0
  267. package/lib/src/utils/privateStoreMigrations.d.ts +37 -0
  268. package/lib/src/utils/privateStorePath.d.ts +259 -0
  269. package/lib/src/utils/privateStorePath.js +436 -0
  270. package/lib/src/utils/privateStoreTakeout.d.ts +76 -0
  271. package/lib/src/utils/privateStoreUnlock.d.ts +175 -0
  272. package/lib/src/utils/proxyClaim.d.ts +59 -0
  273. package/lib/src/utils/proxyClaim.js +30 -0
  274. package/lib/src/utils/redactPrivateNames.d.ts +21 -0
  275. package/lib/src/utils/redactPrivateNames.js +89 -0
  276. package/lib/src/utils/redactSecrets.d.ts +58 -0
  277. package/lib/src/utils/redactSecrets.js +171 -0
  278. package/lib/src/utils/renameLinkRewrite.d.ts +112 -0
  279. package/lib/src/utils/roleGrants.d.ts +35 -0
  280. package/lib/src/utils/safeRedirect.d.ts +32 -0
  281. package/lib/src/utils/schedule.d.ts +54 -0
  282. package/lib/src/utils/secretFileMode.d.ts +17 -0
  283. package/lib/src/utils/seededShippedPages.d.ts +45 -0
  284. package/lib/src/utils/sensitiveValues.d.ts +59 -0
  285. package/lib/src/utils/sensitiveValues.js +106 -0
  286. package/lib/src/utils/sessionEnd.d.ts +12 -0
  287. package/lib/src/utils/sessionGeneration.d.ts +24 -0
  288. package/lib/src/utils/sessionIdle.d.ts +41 -0
  289. package/lib/src/utils/sessionLimits.d.ts +68 -0
  290. package/lib/src/utils/shareLockbox.d.ts +64 -0
  291. package/lib/src/utils/sigstoreTrustedRoot.d.ts +33 -0
  292. package/lib/src/utils/sniffMime.d.ts +21 -0
  293. package/lib/src/utils/storeSearchIndex.d.ts +75 -0
  294. package/lib/src/utils/subjectMayDo.d.ts +21 -0
  295. package/lib/src/utils/systemCategoryRules.d.ts +30 -0
  296. package/lib/src/utils/systemCategoryRules.js +41 -0
  297. package/lib/src/utils/userCreateError.d.ts +62 -0
  298. package/lib/src/utils/username.d.ts +53 -0
  299. package/lib/src/utils/vaultUrlRewrite.d.ts +27 -0
  300. package/lib/src/utils/version.d.ts +84 -0
  301. package/lib/src/utils/videoFrame.d.ts +21 -0
  302. package/package.json +54 -3
@@ -0,0 +1,426 @@
1
+ /**
2
+ * The VariableManager is an interface responsible for managing variables used in the wiki (for example, constant variables that can be expanded inside pages).
3
+ * The WikiEngine creates and initializes the VariableManager when it is instantiated. It typically instantiates the default implementation called DefaultVariableManager.
4
+ * During the initialization phase of the WikiEngine, it creates instances of its core managers including VariableManager and calls their initialize() method passing context and properties.
5
+ * This setup allows JSPWiki to handle variable substitution and expansion consistently across the wiki pages.
6
+ * The VariableManager is accessible via WikiEngine.getManager('VariableManager') after initialization.
7
+ */
8
+ import type { ActorContext } from '../context/ActorContext.js';
9
+ import BaseManager from './BaseManager.js';
10
+ import type { WikiEngine } from '../types/WikiEngine.js';
11
+ import type ConfigurationManager from './ConfigurationManager.js';
12
+ /**
13
+ * Validation result interface
14
+ */
15
+ export interface ValidationResult {
16
+ success: boolean;
17
+ error: string | null;
18
+ }
19
+ /**
20
+ * Metadata validation result interface
21
+ */
22
+ export interface MetadataValidationResult extends ValidationResult {
23
+ warnings?: string[];
24
+ }
25
+ /**
26
+ * Page validation result interface
27
+ */
28
+ export interface PageValidationResult extends MetadataValidationResult {
29
+ filenameValid: boolean;
30
+ metadataValid: boolean;
31
+ fixes?: FixSuggestions;
32
+ }
33
+ /**
34
+ * Content validation result interface
35
+ */
36
+ export interface ContentValidationResult {
37
+ warnings: string[];
38
+ }
39
+ /**
40
+ * Where a category's pages come from (#1503): made on this site, shipped with
41
+ * the release in required-pages/, or kept in the repository's docs/ and never
42
+ * stored on the site. Replaces the old storageLocation words one for one
43
+ * (regular → site, required → shipped, github → repo).
44
+ */
45
+ /** A new share link's maximum lifetime when a vault's system-category sets none (operator, 2026-09-30, #1388). */
46
+ export declare const DEFAULT_SHARE_MAX_DAYS = 15;
47
+ export type CategorySource = 'site' | 'shipped' | 'repo';
48
+ /**
49
+ * A category entry's source. An entry without a valid one is a site category.
50
+ * The one rule every reader of a category's source goes through.
51
+ */
52
+ export declare function categorySource(cfg: {
53
+ source?: string;
54
+ } | null | undefined): CategorySource;
55
+ /**
56
+ * What is wrong with a `ngdpbase.system-category` map, one line per problem
57
+ * (#1504). Empty when it is sound. Startup refuses a map with problems
58
+ * (operator, 2026-09-28): each one could put a private page in the wrong
59
+ * place, so it must never run.
60
+ *
61
+ * - exactly one entry has `default: true`;
62
+ * - every `storageLocation.privatestore` is `pages/<parent>/{user}/<vault id>/`;
63
+ * - no two entries share a vault;
64
+ * - every vault has the same parent folder.
65
+ */
66
+ export declare function systemCategoryConfigProblems(categories: unknown): string[];
67
+ /** The preference that holds a person's choice for a `defaultPrivate: 'choice'` system-category (#1504). */
68
+ export declare function defaultPrivatePreferenceKey(category: string): string;
69
+ /**
70
+ * System category configuration
71
+ */
72
+ export interface CategoryConfig {
73
+ label: string;
74
+ description?: string;
75
+ default?: boolean;
76
+ source?: CategorySource;
77
+ enabled?: boolean;
78
+ key?: string;
79
+ }
80
+ /**
81
+ * System categories configuration map
82
+ */
83
+ export type SystemCategoriesConfig = Record<string, CategoryConfig>;
84
+ /**
85
+ * Options for generating metadata
86
+ */
87
+ export interface GenerateMetadataOptions {
88
+ uuid?: string;
89
+ slug?: string;
90
+ 'system-category'?: string;
91
+ userKeywords?: string[];
92
+ 'user-keywords'?: string[];
93
+ [key: string]: unknown;
94
+ }
95
+ /**
96
+ * File data from gray-matter
97
+ */
98
+ export interface FileData {
99
+ content: string;
100
+ data: Record<string, unknown>;
101
+ }
102
+ /**
103
+ * Result of a cross-page conflict check
104
+ */
105
+ export interface ConflictCheckResult {
106
+ hasConflict: boolean;
107
+ /** Type of conflict detected, or null if none */
108
+ conflictType: 'uuid-mismatch' | 'slug-duplicate' | 'title-duplicate' | null;
109
+ /** UUID of the conflicting page, if any */
110
+ conflictingUuid?: string;
111
+ /** Human-readable description */
112
+ message?: string;
113
+ }
114
+ /**
115
+ * Fix suggestions for validation issues
116
+ */
117
+ export interface FixSuggestions {
118
+ filename: string | null;
119
+ metadata: Record<string, unknown>;
120
+ }
121
+ /**
122
+ * Page metadata interface
123
+ */
124
+ export interface PageMetadata {
125
+ title: string;
126
+ uuid: string;
127
+ slug: string;
128
+ 'system-category': string;
129
+ 'user-keywords': string[];
130
+ lastModified: string;
131
+ [key: string]: unknown;
132
+ }
133
+ /**
134
+ * ValidationManager - Ensures all files follow UUID naming and metadata conventions
135
+ *
136
+ * Validates page metadata and enforces architectural constraints including UUID-based
137
+ * naming, required metadata fields, valid system categories, and keyword limits.
138
+ *
139
+ * @class ValidationManager
140
+ * @extends BaseManager
141
+ *
142
+ * @property {string[]} requiredMetadataFields - Required metadata fields
143
+ * @property {string[]} validSystemCategories - Valid system category values
144
+ * @property {number} maxCategories - Maximum categories allowed
145
+ *
146
+ * @see {@link BaseManager} for base functionality
147
+ *
148
+ * @example
149
+ * const validationManager = engine.getManager('ValidationManager');
150
+ * const result = validationManager.validatePage(metadata);
151
+ * if (!result.valid) console.error(result.errors);
152
+ */
153
+ declare class ValidationManager extends BaseManager {
154
+ private requiredMetadataFields;
155
+ private validSystemCategories;
156
+ private systemCategoriesConfig;
157
+ private validSystemKeywords;
158
+ private validKnowledgeRoles;
159
+ private validStatuses;
160
+ private defaultStatus;
161
+ /**
162
+ * Creates a new ValidationManager instance
163
+ *
164
+ * @constructor
165
+ * @param {any} engine - The wiki engine instance
166
+ */
167
+ constructor(engine: WikiEngine);
168
+ /**
169
+ * Initialize the ValidationManager
170
+ *
171
+ * @async
172
+ * @param {Record<string, unknown>} [config={}] - Configuration object
173
+ * @returns {Promise<void>}
174
+ */
175
+ initialize(config?: Record<string, unknown>): Promise<void>;
176
+ /**
177
+ * #1559: a mistyped `defaultPrivate` or `encrypt` in the site's own entries
178
+ * reads as false and fails open (pages start public, a vault is created
179
+ * unsealed). Warn, never force (operator, 2026-10-16): the site keeps
180
+ * running, the log says it at error, and admins get the non-dismissible
181
+ * degraded-subsystem banner on the dashboard (#1155) plus a system
182
+ * notification — the same pair UserManager uses for shared emails. Add-on
183
+ * entries never reach here mistyped: the merge refuses them.
184
+ */
185
+ private reportMistypedSiteValues;
186
+ /**
187
+ * Load system categories from ConfigurationManager
188
+ * @param {ConfigurationManager | undefined} configManager - Configuration manager instance
189
+ * @returns {void}
190
+ */
191
+ loadSystemCategories(configManager: ConfigurationManager | undefined): void;
192
+ /**
193
+ * Load system keywords from ConfigurationManager.
194
+ * Mirrors loadSystemCategories() — populates this.validSystemKeywords.
195
+ * @param {ConfigurationManager | undefined} configManager
196
+ */
197
+ loadSystemKeywords(configManager: ConfigurationManager | undefined): void;
198
+ /**
199
+ * Get all valid system keyword strings.
200
+ */
201
+ getValidSystemKeywords(): string[];
202
+ /**
203
+ * Load knowledge-role catalog (#706) from ConfigurationManager.
204
+ * Mirrors loadSystemCategories(). The constructor seeds a hardcoded
205
+ * fallback (`['source','citation','concept']`) so the hard-reject enum
206
+ * check still works if the catalog can't be read.
207
+ */
208
+ loadKnowledgeRoles(configManager: ConfigurationManager | undefined): void;
209
+ /**
210
+ * #893: load the editorial lifecycle catalog from `ngdpbase.status` config.
211
+ * Entries carry label / description / order (ascending rank) / enabled and
212
+ * one default:true entry (the state an absent status field means). Falls
213
+ * back to the hardcoded trio only when config is unavailable.
214
+ */
215
+ loadStatuses(configManager: ConfigurationManager | undefined): void;
216
+ /**
217
+ * #893: valid status labels, ordered ascending by catalog `order`
218
+ * (lowest → highest lifecycle rank). Copy — callers can't mutate state.
219
+ */
220
+ getValidStatuses(): string[];
221
+ /**
222
+ * #893: the status an ABSENT frontmatter field means (catalog default:true
223
+ * entry). This value is never written to frontmatter.
224
+ */
225
+ getDefaultStatus(): string;
226
+ /**
227
+ * Get all valid knowledge-role labels (#706).
228
+ */
229
+ getValidKnowledgeRoles(): string[];
230
+ /**
231
+ * Get system keyword labels marked default:true in ngdpbase.system-keywords config.
232
+ * These are applied automatically to every new page in generateValidMetadata().
233
+ */
234
+ getDefaultSystemKeywords(): string[];
235
+ /**
236
+ * Get system category configuration by label
237
+ * @param {string} label - Category label (e.g., "General", "System")
238
+ * @returns {CategoryConfig | null} Category configuration or null if not found
239
+ */
240
+ getCategoryConfig(label: string): CategoryConfig | null;
241
+ /**
242
+ * Where a category's pages come from (#1503)
243
+ * @param {string} category - Category label
244
+ * @returns {CategorySource} 'site', 'shipped' or 'repo'; an unknown category is 'site'
245
+ */
246
+ getCategorySource(category: string): CategorySource;
247
+ /**
248
+ * How a new page's Private box starts for this system-category and this
249
+ * person (#1504): the entry's `defaultPrivate` — `true`, `false`, or
250
+ * `choice`, where the person's `<system-category>.defaultPrivate`
251
+ * preference decides and someone who has not chosen starts private. No
252
+ * `defaultPrivate`, or an unknown system-category, starts public. It only
253
+ * sets the start: the box on the page always wins.
254
+ *
255
+ * @param category - the system-category's label
256
+ * @param preferences - the person's saved preferences
257
+ */
258
+ getDefaultPrivate(category: string, preferences?: Record<string, unknown>): boolean;
259
+ /**
260
+ * The vault a private page of this system-category goes to (#1505): the
261
+ * vault id its `storageLocation.privatestore` names, or null when it has no
262
+ * vault (its pages can never be private).
263
+ */
264
+ getVaultId(category: string): string | null;
265
+ /**
266
+ * The longest a new share link to this vault may last, in days (#1388): the
267
+ * `shareMaxDays` of the system-category whose `privatestore` names the vault,
268
+ * set by that entry's `owner`. {@link DEFAULT_SHARE_MAX_DAYS} when the entry
269
+ * sets none or no entry names the vault. It limits a link only when it is
270
+ * made; the owner may extend a live link past it.
271
+ */
272
+ getShareMaxDays(vaultId: string): number;
273
+ /** Whether pages of this system-category can be private: it declares a vault (`storageLocation.privatestore`, #1504). */
274
+ canBePrivate(category: string): boolean;
275
+ /** Whether this system-category lets each person choose (`defaultPrivate: 'choice'`), so a preference is shown (#1504). */
276
+ offersDefaultPrivatePreference(category: string): boolean;
277
+ /**
278
+ * Get all enabled system categories
279
+ * @returns {CategoryConfig[]} Array of category configurations
280
+ */
281
+ getAllSystemCategories(): CategoryConfig[];
282
+ /**
283
+ * Get the default system category
284
+ * @returns {string} Default category label
285
+ */
286
+ getDefaultSystemCategory(): string;
287
+ /**
288
+ * Sanitize all string metadata fields before saving.
289
+ *
290
+ * - URL-decodes values so that `%09Illinois` becomes `\tIllinois` before trimming
291
+ * - Trims all leading/trailing Unicode whitespace (spaces, tabs, newlines, NBSP, etc.)
292
+ * - For `user-keywords`: trims each element and removes any that become empty
293
+ *
294
+ * Should be called once at the top of every save path so callers never need
295
+ * to remember to sanitize individually.
296
+ *
297
+ * @param {Record<string, unknown>} metadata - Raw metadata from request or front-matter
298
+ * @returns {Record<string, unknown>} New object with sanitized values (original unchanged)
299
+ */
300
+ sanitizeMetadata(metadata: Record<string, unknown>): Record<string, unknown>;
301
+ /**
302
+ * Validate that a filename follows UUID naming convention
303
+ * @param {string} filename - The filename to validate
304
+ * @returns {ValidationResult} Validation result with success and error properties
305
+ */
306
+ validateFilename(filename: string): ValidationResult;
307
+ /**
308
+ * Validate page metadata contains all required fields with proper values
309
+ * @param {Record<string, unknown>} metadata - The metadata object to validate
310
+ * @returns {MetadataValidationResult} Validation result with success, error, and warnings properties
311
+ */
312
+ validateMetadata(metadata: Record<string, unknown>): MetadataValidationResult;
313
+ /**
314
+ * Validate slug format (URL-safe)
315
+ * @param {string} slug - The slug to validate
316
+ * @returns {boolean} True if valid
317
+ */
318
+ isValidSlug(slug: string): boolean;
319
+ /**
320
+ * Validate a complete page before saving
321
+ * @param {string} filename - The target filename
322
+ * @param {Record<string, unknown>} metadata - The page metadata
323
+ * @param {string | null} content - The page content (optional validation)
324
+ * @returns {PageValidationResult} Comprehensive validation result
325
+ */
326
+ validatePage(filename: string, metadata: Record<string, unknown>, content?: string | null): PageValidationResult;
327
+ /**
328
+ * Validate page content (optional checks)
329
+ * @param {string} content - The page content
330
+ * @returns {ContentValidationResult} Content validation result
331
+ */
332
+ validateContent(content: string): ContentValidationResult;
333
+ /**
334
+ * Collect blocking validation errors for save-time enforcement (#596).
335
+ *
336
+ * Delegates to FilterManager's chain (#1117 — the one owner of the filter
337
+ * capability), which runs each enabled filter's own collectErrors()
338
+ * method. Only `severity: 'error'` rule violations are returned —
339
+ * warnings are surfaced through the render-time annotation path inside
340
+ * MarkupParser, not here.
341
+ *
342
+ * Public surface for the save path: WikiRoutes.savePage calls this and
343
+ * returns 400 with the structured error array if non-empty. Frontend uses
344
+ * each error's `rule`, `message`, and optional `line`/`column` to surface
345
+ * the problem to the editor.
346
+ *
347
+ * Returns an empty array when:
348
+ * - content is empty or not a string
349
+ * - FilterManager is not available (shouldn't happen at runtime)
350
+ * - the pipeline is disabled in config, or no filter implements collectErrors
351
+ *
352
+ * @param content - The page content to validate
353
+ * @param context - Optional context (pageName, userName) passed through to filters
354
+ * @returns Array of blocking validation errors; empty array when content passes
355
+ */
356
+ collectContentErrors(content: string, context?: {
357
+ pageName?: string;
358
+ userName?: string;
359
+ }): Promise<Array<{
360
+ filterId: string;
361
+ rule: string;
362
+ severity: 'error';
363
+ message: string;
364
+ line?: number;
365
+ column?: number;
366
+ }>>;
367
+ /**
368
+ * Generate properly formatted metadata for a new page
369
+ * @param {string} title - Page title
370
+ * @param {GenerateMetadataOptions} options - Additional metadata options
371
+ * @returns {PageMetadata} Complete metadata object with all required fields
372
+ */
373
+ generateValidMetadata(title: string, options?: GenerateMetadataOptions): PageMetadata;
374
+ /**
375
+ * Generate URL-safe slug from title.
376
+ * Unicode characters are transliterated to ASCII equivalents before stripping
377
+ * so that titles like "Aβ" produce "abeta" rather than "a" (#295).
378
+ * @param {string} title - Page title
379
+ * @returns {string} URL-safe slug
380
+ */
381
+ generateSlug(title: string): string;
382
+ /**
383
+ * The slug of a private page (#1456, operator 2026-09-22):
384
+ * `vaults--{owner}-{store}-{title}` (`private--` until #1507). The prefix is reserved —
385
+ * {@link generateSlug} collapses dash runs, so no public slug can contain
386
+ * `--`, and a public save never has to consult private slugs. A clash among
387
+ * one owner's stores is resolved by the caller, in that owner's stores only.
388
+ */
389
+ generatePrivateSlug(owner: string, store: string, title: string): string;
390
+ /** Transliteration table for common non-ASCII characters (#295). */
391
+ private static readonly UNICODE_MAP;
392
+ /**
393
+ * Check for conflicts with existing pages (duplicate title, slug, or UUID mismatch).
394
+ *
395
+ * Used when saving a new page or comparing required-pages sources against live pages.
396
+ * Checks slug first (most precise), then title.
397
+ *
398
+ * @async
399
+ * @param {string} uuid - The UUID of the page being checked
400
+ * @param {string} title - The page title
401
+ * @param {string} slug - The page slug
402
+ * @returns {Promise<ConflictCheckResult>} Conflict result
403
+ */
404
+ checkConflicts(uuid: string, title: string, slug: string, ctx: ActorContext): Promise<ConflictCheckResult>;
405
+ /**
406
+ * Generate UUID-based filename from metadata
407
+ * @param {PageMetadata} metadata - Page metadata containing UUID
408
+ * @returns {string} Filename in UUID.md format
409
+ */
410
+ generateFilename(metadata: PageMetadata): string;
411
+ /**
412
+ * Validate and fix an existing page file
413
+ * @param {string} filePath - Path to the existing file
414
+ * @param {FileData} fileData - Object with content and metadata from gray-matter
415
+ * @returns {PageValidationResult} Validation result with fix suggestions
416
+ */
417
+ validateExistingFile(filePath: string, fileData: FileData): PageValidationResult;
418
+ /**
419
+ * Generate suggestions to fix validation issues
420
+ * @param {string} filename - Current filename
421
+ * @param {Record<string, unknown>} metadata - Current metadata
422
+ * @returns {FixSuggestions} Fix suggestions
423
+ */
424
+ generateFixSuggestions(filename: string, metadata: Record<string, unknown>): FixSuggestions;
425
+ }
426
+ export default ValidationManager;
@@ -0,0 +1,145 @@
1
+ import BaseManager from './BaseManager.js';
2
+ import type { WikiEngine } from '../types/WikiEngine.js';
3
+ /**
4
+ * Variable handler function type
5
+ */
6
+ export type VariableHandler = (context?: VariableContext) => string;
7
+ /**
8
+ * Variable context interface - contains contextual information for variable expansion
9
+ */
10
+ export interface VariableContext {
11
+ pageName?: string;
12
+ userName?: string;
13
+ userContext?: {
14
+ username?: string;
15
+ isAuthenticated?: boolean;
16
+ roles?: string[];
17
+ displayName?: string;
18
+ /** User's preferred locale (e.g., 'en-US') */
19
+ locale?: string;
20
+ /** User's timezone (e.g., 'America/New_York') */
21
+ timezone?: string;
22
+ /** Full user preferences object */
23
+ preferences?: {
24
+ locale?: string;
25
+ timezone?: string;
26
+ dateFormat?: string;
27
+ [key: string]: unknown;
28
+ };
29
+ };
30
+ requestInfo?: {
31
+ userAgent?: string;
32
+ clientIp?: string;
33
+ referer?: string;
34
+ sessionId?: string;
35
+ acceptLanguage?: string;
36
+ };
37
+ [key: string]: unknown;
38
+ }
39
+ /**
40
+ * Debug information about registered variables
41
+ */
42
+ export interface VariableDebugInfo {
43
+ totalVariables: number;
44
+ systemVariables: string[];
45
+ contextualVariables: string[];
46
+ allVariables: string[];
47
+ }
48
+ /**
49
+ * VariableManager - Handles the expansion of JSPWiki-style variables
50
+ *
51
+ * Provides dynamic variable expansion in wiki content. Variables are
52
+ * placeholders like [{$username}], [{$pageName}] that are replaced with
53
+ * actual values during rendering based on the current context.
54
+ *
55
+ * Supported variable categories:
56
+ * - Application info: appName, version, baseURL
57
+ * - Page context: pageName
58
+ * - User context: username, loginStatus, userRoles
59
+ * - Date/Time: date, time, timestamp, year, month, day
60
+ * - System info: uptime
61
+ *
62
+ * @class VariableManager
63
+ * @extends BaseManager
64
+ *
65
+ * @property {Map<string, VariableHandler>} variableHandlers - Variable name to handler function map
66
+ *
67
+ * @see {@link BaseManager} for base functionality
68
+ *
69
+ * @example
70
+ * const variableManager = engine.getManager('VariableManager');
71
+ * const expanded = variableManager.expandVariables('Hello [{$username}]!', context);
72
+ * // Returns: 'Hello admin!'
73
+ */
74
+ declare class VariableManager extends BaseManager {
75
+ private variableHandlers;
76
+ /**
77
+ * Creates a new VariableManager instance
78
+ *
79
+ * @constructor
80
+ * @param {any} engine - The wiki engine instance
81
+ */
82
+ constructor(engine: WikiEngine);
83
+ /**
84
+ * Initialize the VariableManager and register core variables
85
+ *
86
+ * @async
87
+ * @returns {Promise<void>}
88
+ */
89
+ initialize(): Promise<void>;
90
+ /**
91
+ * Registers the default set of JSPWiki-compatible variables.
92
+ */
93
+ private registerCoreVariables;
94
+ /**
95
+ * Get user's preferred locale from context.
96
+ * Priority: 1) preferences.locale, 2) userContext.locale, 3) Accept-Language header, 4) en-US
97
+ */
98
+ /**
99
+ * Resolve the current page provider's self-description, or null when the
100
+ * provider is absent or does not implement getProviderInfo().
101
+ *
102
+ * @private
103
+ * @returns {{ name?: string; description?: string } | null} Provider info or null
104
+ */
105
+ private getPageProviderInfo;
106
+ private getUserLocale;
107
+ /** Get user's preferred date format string (e.g. 'yyyy-MM-dd') from context, or null. */
108
+ private getUserDateFormat;
109
+ /** Get user's preferred time format ('12h' | '24h') from context, or null. */
110
+ private getUserTimeFormat;
111
+ /** Get user's preferred timezone from context, or null. */
112
+ private getUserTimezone;
113
+ /**
114
+ * Get browser information from user agent string
115
+ * @param {string} userAgent - User agent string
116
+ * @returns {string} Browser name and version
117
+ */
118
+ private getBrowserInfo;
119
+ /**
120
+ * Registers a new variable handler.
121
+ * @param {string} name The name of the variable (without brackets/dollar sign).
122
+ * @param {VariableHandler} handler A function that takes the WikiContext and returns the variable's value.
123
+ */
124
+ registerVariable(name: string, handler: VariableHandler): void;
125
+ /**
126
+ * Expands all variables in a given string of content.
127
+ * @param {string} content The content to process.
128
+ * @param {VariableContext} context The WikiContext for the current rendering operation.
129
+ * @returns {string} The content with variables expanded.
130
+ */
131
+ expandVariables(content: string, context?: VariableContext): string;
132
+ /**
133
+ * Get the value of a specific variable
134
+ * @param {string} varName - The variable name (without brackets/dollar sign)
135
+ * @param {VariableContext} context - Optional context for contextual variables
136
+ * @returns {string} The variable value
137
+ */
138
+ getVariable(varName: string, context?: VariableContext): string;
139
+ /**
140
+ * Get debug information about registered variables
141
+ * @returns {VariableDebugInfo} Debug information including system and contextual variables
142
+ */
143
+ getDebugInfo(): VariableDebugInfo;
144
+ }
145
+ export default VariableManager;
@@ -0,0 +1,3 @@
1
+ import type { Request, Response, NextFunction } from 'express';
2
+ export declare function generateCsrfToken(): string;
3
+ export declare function csrfMiddleware(req: Request, res: Response, next: NextFunction): void;