@jwilleke/ngdpbase-types 0.0.0 → 5.19.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 (304) 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 +427 -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 +188 -0
  71. package/lib/src/managers/DatabaseManager.js +590 -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/sqliteBackup.d.ts +128 -0
  158. package/lib/src/providers/sqliteBackup.js +365 -0
  159. package/lib/src/providers/sqliteLocation.d.ts +17 -0
  160. package/lib/src/providers/sqliteLocation.js +55 -0
  161. package/lib/src/providers/sqliteMigrations.d.ts +48 -0
  162. package/lib/src/providers/sqliteMigrations.js +72 -0
  163. package/lib/src/rendering/githubAlerts.d.ts +22 -0
  164. package/lib/src/rendering/htmlPolicy.d.ts +76 -0
  165. package/lib/src/rendering/markdownConverter.d.ts +73 -0
  166. package/lib/src/security/PolicyDecisionPoint.d.ts +245 -0
  167. package/lib/src/security/PolicyInformationPoint.d.ts +448 -0
  168. package/lib/src/security/pageActions.d.ts +40 -0
  169. package/lib/src/security/permissions.generated.d.ts +78 -0
  170. package/lib/src/types/Asset.d.ts +414 -0
  171. package/lib/src/types/Catalog.d.ts +61 -0
  172. package/lib/src/types/Comment.d.ts +11 -0
  173. package/lib/src/types/Config.d.ts +388 -0
  174. package/lib/src/types/Organization.d.ts +78 -0
  175. package/lib/src/types/OrganizationProvider.d.ts +38 -0
  176. package/lib/src/types/Page.d.ts +220 -0
  177. package/lib/src/types/Person.d.ts +56 -0
  178. package/lib/src/types/PersonProvider.d.ts +25 -0
  179. package/lib/src/types/Policy.d.ts +139 -0
  180. package/lib/src/types/Policy.js +17 -0
  181. package/lib/src/types/Provider.d.ts +810 -0
  182. package/lib/src/types/Role.d.ts +84 -0
  183. package/lib/src/types/RoleProvider.d.ts +35 -0
  184. package/lib/src/types/Schema.d.ts +425 -0
  185. package/lib/src/types/Share.d.ts +172 -0
  186. package/lib/src/types/Share.js +81 -0
  187. package/lib/src/types/User.d.ts +304 -0
  188. package/lib/src/types/Version.d.ts +189 -0
  189. package/lib/src/types/WikiEngine.d.ts +128 -0
  190. package/lib/src/types/express.d.ts +120 -0
  191. package/lib/src/types/express.js +1 -0
  192. package/lib/src/types/guards.d.ts +78 -0
  193. package/lib/src/types/heic-decode.d.ts +16 -0
  194. package/lib/src/types/index.d.ts +19 -0
  195. package/lib/src/types/linkedom.d.ts +77 -0
  196. package/lib/src/types/markdown-it-plugins.d.ts +21 -0
  197. package/lib/src/utils/DeltaStorage.d.ts +118 -0
  198. package/lib/src/utils/LocaleUtils.d.ts +105 -0
  199. package/lib/src/utils/LocaleUtils.js +294 -0
  200. package/lib/src/utils/PageNameMatcher.d.ts +98 -0
  201. package/lib/src/utils/PathPreflight.d.ts +38 -0
  202. package/lib/src/utils/PathPreflight.js +50 -0
  203. package/lib/src/utils/SectionUtils.d.ts +40 -0
  204. package/lib/src/utils/addonConfigLayer.d.ts +144 -0
  205. package/lib/src/utils/addonConfigLayer.js +382 -0
  206. package/lib/src/utils/addonDatabaseRules.d.ts +25 -0
  207. package/lib/src/utils/addonDatabaseRules.js +57 -0
  208. package/lib/src/utils/addonHost.d.ts +51 -0
  209. package/lib/src/utils/addonHost.js +72 -0
  210. package/lib/src/utils/addonInstaller.d.ts +109 -0
  211. package/lib/src/utils/addonLock.d.ts +37 -0
  212. package/lib/src/utils/addonLock.js +48 -0
  213. package/lib/src/utils/addonPageSync.d.ts +45 -0
  214. package/lib/src/utils/addonProvenance.d.ts +48 -0
  215. package/lib/src/utils/addonTarball.d.ts +41 -0
  216. package/lib/src/utils/addonsPathResolver.d.ts +76 -0
  217. package/lib/src/utils/addonsPathResolver.js +129 -0
  218. package/lib/src/utils/assetMetadataTags.d.ts +66 -0
  219. package/lib/src/utils/atomicWrite.d.ts +28 -0
  220. package/lib/src/utils/auditConfigChange.d.ts +57 -0
  221. package/lib/src/utils/auditEventNames.d.ts +50 -0
  222. package/lib/src/utils/auditEventNames.generated.d.ts +169 -0
  223. package/lib/src/utils/auditEventNames.generated.js +174 -0
  224. package/lib/src/utils/auditEventNames.js +49 -0
  225. package/lib/src/utils/auditEvents.d.ts +265 -0
  226. package/lib/src/utils/auditEvents.js +309 -0
  227. package/lib/src/utils/auditRegistry.d.ts +102 -0
  228. package/lib/src/utils/auditRegistry.js +168 -0
  229. package/lib/src/utils/bip39English.d.ts +2 -0
  230. package/lib/src/utils/configEnvKeys.d.ts +68 -0
  231. package/lib/src/utils/configFiles.d.ts +74 -0
  232. package/lib/src/utils/configFiles.js +150 -0
  233. package/lib/src/utils/delegation.d.ts +48 -0
  234. package/lib/src/utils/deriveUsername.d.ts +21 -0
  235. package/lib/src/utils/explainMediaPath.d.ts +123 -0
  236. package/lib/src/utils/formerTitles.d.ts +69 -0
  237. package/lib/src/utils/frontmatterAccess.d.ts +54 -0
  238. package/lib/src/utils/headlessAdminPassword.d.ts +55 -0
  239. package/lib/src/utils/imageTransform.d.ts +52 -0
  240. package/lib/src/utils/instanceEnvSecret.d.ts +51 -0
  241. package/lib/src/utils/jobSlots.d.ts +43 -0
  242. package/lib/src/utils/keywordNormalizer.d.ts +127 -0
  243. package/lib/src/utils/logger.d.ts +70 -0
  244. package/lib/src/utils/logger.js +106 -0
  245. package/lib/src/utils/magicLinkDeviceState.d.ts +95 -0
  246. package/lib/src/utils/managerUtils.d.ts +40 -0
  247. package/lib/src/utils/migrateLegacyPrivateAttachments.d.ts +15 -0
  248. package/lib/src/utils/orgFilename.d.ts +22 -0
  249. package/lib/src/utils/pageFeature.d.ts +27 -0
  250. package/lib/src/utils/pageFrontmatter.d.ts +21 -0
  251. package/lib/src/utils/pageNotes.d.ts +150 -0
  252. package/lib/src/utils/pageTitleRule.d.ts +37 -0
  253. package/lib/src/utils/pageToArticle.d.ts +59 -0
  254. package/lib/src/utils/pageUrl.d.ts +18 -0
  255. package/lib/src/utils/passwordChange.d.ts +12 -0
  256. package/lib/src/utils/passwordHash.d.ts +60 -0
  257. package/lib/src/utils/permissionCatalog.d.ts +52 -0
  258. package/lib/src/utils/pluginFormatters.d.ts +452 -0
  259. package/lib/src/utils/pluginFormatters.js +714 -0
  260. package/lib/src/utils/privateLinkRewrite.d.ts +42 -0
  261. package/lib/src/utils/privateStoreAccess.d.ts +57 -0
  262. package/lib/src/utils/privateStoreAccess.js +65 -0
  263. package/lib/src/utils/privateStoreCatalogs.d.ts +40 -0
  264. package/lib/src/utils/privateStoreCrypto.d.ts +127 -0
  265. package/lib/src/utils/privateStoreDoor.d.ts +181 -0
  266. package/lib/src/utils/privateStoreExport.d.ts +72 -0
  267. package/lib/src/utils/privateStoreFiles.d.ts +120 -0
  268. package/lib/src/utils/privateStoreMeta.d.ts +64 -0
  269. package/lib/src/utils/privateStoreMigrations.d.ts +37 -0
  270. package/lib/src/utils/privateStorePath.d.ts +259 -0
  271. package/lib/src/utils/privateStorePath.js +436 -0
  272. package/lib/src/utils/privateStoreTakeout.d.ts +76 -0
  273. package/lib/src/utils/privateStoreUnlock.d.ts +175 -0
  274. package/lib/src/utils/proxyClaim.d.ts +59 -0
  275. package/lib/src/utils/proxyClaim.js +30 -0
  276. package/lib/src/utils/redactPrivateNames.d.ts +21 -0
  277. package/lib/src/utils/redactPrivateNames.js +89 -0
  278. package/lib/src/utils/redactSecrets.d.ts +58 -0
  279. package/lib/src/utils/redactSecrets.js +171 -0
  280. package/lib/src/utils/renameLinkRewrite.d.ts +112 -0
  281. package/lib/src/utils/roleGrants.d.ts +35 -0
  282. package/lib/src/utils/safeRedirect.d.ts +32 -0
  283. package/lib/src/utils/schedule.d.ts +54 -0
  284. package/lib/src/utils/secretFileMode.d.ts +17 -0
  285. package/lib/src/utils/seededShippedPages.d.ts +45 -0
  286. package/lib/src/utils/sensitiveValues.d.ts +59 -0
  287. package/lib/src/utils/sensitiveValues.js +106 -0
  288. package/lib/src/utils/sessionEnd.d.ts +12 -0
  289. package/lib/src/utils/sessionGeneration.d.ts +24 -0
  290. package/lib/src/utils/sessionIdle.d.ts +41 -0
  291. package/lib/src/utils/sessionLimits.d.ts +68 -0
  292. package/lib/src/utils/shareLockbox.d.ts +64 -0
  293. package/lib/src/utils/sigstoreTrustedRoot.d.ts +33 -0
  294. package/lib/src/utils/sniffMime.d.ts +21 -0
  295. package/lib/src/utils/storeSearchIndex.d.ts +75 -0
  296. package/lib/src/utils/subjectMayDo.d.ts +21 -0
  297. package/lib/src/utils/systemCategoryRules.d.ts +30 -0
  298. package/lib/src/utils/systemCategoryRules.js +41 -0
  299. package/lib/src/utils/userCreateError.d.ts +62 -0
  300. package/lib/src/utils/username.d.ts +53 -0
  301. package/lib/src/utils/vaultUrlRewrite.d.ts +27 -0
  302. package/lib/src/utils/version.d.ts +84 -0
  303. package/lib/src/utils/videoFrame.d.ts +21 -0
  304. package/package.json +54 -3
@@ -0,0 +1,452 @@
1
+ /**
2
+ * Shared plugin formatting utilities for ngdpbase plugins.
3
+ * Implements the common output formats defined in issue #238 (Code Consolidation).
4
+ *
5
+ * All plugins should use these helpers to ensure consistent behaviour for
6
+ * `max`, `format`, `before`, and `after` parameters across the platform.
7
+ *
8
+ * Owned by PluginManager (#1820). Plugins use `context.formatters`; other
9
+ * callers use `engine.getManager('PluginManager').formatters`. Direct imports
10
+ * of this module are being retired; types stay importable with `import type`.
11
+ */
12
+ /** A renderable page link with href, display text, and optional styling */
13
+ export interface PageLink {
14
+ href: string;
15
+ text: string;
16
+ cssClass?: string;
17
+ style?: string;
18
+ title?: string;
19
+ /**
20
+ * Font Awesome (or any) class for an icon rendered before the text (#1306).
21
+ * A class name, not markup — escaped into the attribute.
22
+ */
23
+ icon?: string;
24
+ /**
25
+ * A value shown at the end of the row — a count, a status (#1306). Escaped:
26
+ * it is data, not markup.
27
+ */
28
+ badge?: string;
29
+ /**
30
+ * Markup appended after the link — a per-item action button, typically.
31
+ * Inserted verbatim, so the CALLER owns escaping anything interpolated into
32
+ * it. This exists because MyLinksPlugin hand-rolled its whole list for one
33
+ * remove button, which is the vocabulary being too small rather than the
34
+ * plugin being wrong.
35
+ */
36
+ trailingHtml?: string;
37
+ }
38
+ /** Options for list/item formatting */
39
+ export interface FormatOptions {
40
+ before?: string;
41
+ after?: string;
42
+ /** Classes for the `<ul>` — a plugin keeping its Bootstrap layout (#1306). */
43
+ listClass?: string;
44
+ /** Classes for each `<li>`. */
45
+ itemClass?: string;
46
+ }
47
+ /**
48
+ * Parse a `max` plugin parameter to an integer.
49
+ * Returns `defaultMax` if the value is missing, empty, or non-numeric.
50
+ * A value of 0 means unlimited.
51
+ */
52
+ export declare function parseMaxParam(value: string | number | undefined, defaultMax?: number): number;
53
+ /**
54
+ * Apply a max limit to an array.
55
+ * max=0 means unlimited (returns all items unchanged).
56
+ */
57
+ export declare function applyMax<T>(items: T[], max: number): T[];
58
+ /**
59
+ * Escape HTML special characters.
60
+ * Accepts any primitive value; null/undefined return an empty string.
61
+ */
62
+ export declare function escapeHtml(text: string | number | boolean | null | undefined): string;
63
+ /**
64
+ * Format a list of page links as an HTML bullet list.
65
+ * Supports optional `before`/`after` markers around each item (JSPWiki-style).
66
+ * Returns an informational message when the list is empty.
67
+ */
68
+ export declare function formatAsList(links: PageLink[], options?: FormatOptions): string;
69
+ /**
70
+ * Format a count with locale-appropriate thousands separators (e.g. 32,227).
71
+ */
72
+ export declare function formatAsCount(n: number): string;
73
+ /**
74
+ * Resolve a plugin parameter that may contain the special token `$currentUser`
75
+ * (case-insensitive) to the authenticated user's username.
76
+ *
77
+ * Rules:
78
+ * - Non-token values are returned unchanged.
79
+ * - `$currentUser` resolves to the username from `context.userContext.username`
80
+ * or `context.userName`, whichever is set first.
81
+ * - Returns `undefined` when the token was used but the visitor is anonymous
82
+ * (username is "anonymous" or absent). The caller can use this
83
+ * to detect the "token present but not logged in" case and show a prompt.
84
+ *
85
+ * @example
86
+ * // In a plugin execute():
87
+ * const author = resolveUserParam(params.author, context);
88
+ * if (params.author?.toLowerCase() === '$currentuser' && !author) {
89
+ * return '<p>Please log in.</p>';
90
+ * }
91
+ */
92
+ export declare function resolveUserParam(value: string | undefined, context: {
93
+ userName?: string;
94
+ userContext?: {
95
+ username?: string;
96
+ [key: string]: unknown;
97
+ };
98
+ [key: string]: unknown;
99
+ }): string | undefined;
100
+ /**
101
+ * Resolve a keyword parameter that may be the special token `current`
102
+ * (case-insensitive) to the page's own keyword.
103
+ *
104
+ * EXIF/media and page keywords follow no single name-vs-slug convention across
105
+ * a library — some content is tagged with the page NAME (`Dining`, `Travel`),
106
+ * some with the SLUG (`2026-trip-west`). `current` therefore adapts: it tries
107
+ * both the page name and its slug and keeps whichever yields more results
108
+ * (tie / both-empty → name form). This gives page-scoped plugins one
109
+ * self-scoping syntax that works regardless of how content was tagged:
110
+ * [{MediaPlugin keyword='current'}] [{Search user-keywords='current'}]
111
+ *
112
+ * Non-`current` values are looked up as-is (single lookup).
113
+ *
114
+ * @param value Raw keyword param — `current` (any case) triggers resolution.
115
+ * @param pageName Current page name (from plugin context).
116
+ * @param slugify Name→slug; pass `ValidationManager.generateSlug` for the
117
+ * canonical algorithm, or a simple slugifier as fallback.
118
+ * @param lookup Fetch results for a keyword (e.g. `listByKeyword`, or an
119
+ * `advancedSearch`-by-keyword closure).
120
+ * @returns The chosen keyword string and its results (results reusable by the
121
+ * caller so `current` costs at most two lookups, not three).
122
+ */
123
+ export declare function resolveCurrentKeyword<T>(value: string, pageName: string, slugify: (name: string) => string, lookup: (keyword: string) => Promise<T[]>): Promise<{
124
+ keyword: string;
125
+ results: T[];
126
+ }>;
127
+ /**
128
+ * Simple ASCII slugify fallback for callers without ValidationManager access.
129
+ * Matches `generateSlug` for the common ASCII case (spaces/punct → single
130
+ * hyphens, lowercased). Non-ASCII transliteration is NOT applied — pass
131
+ * `ValidationManager.generateSlug` when that matters.
132
+ */
133
+ export declare function simpleSlug(name: string): string;
134
+ export type SortOrder = 'asc' | 'desc';
135
+ export interface SortOptions {
136
+ key: string;
137
+ order: SortOrder;
138
+ }
139
+ /**
140
+ * Parse a `sort=` plugin parameter.
141
+ * Accepts "name", "name-asc", "name-desc", "count-asc", "count-desc", etc.
142
+ * validKeys is the list of allowed key names.
143
+ * Falls back to defaultKey/defaultOrder for any unrecognised value.
144
+ */
145
+ export declare function parseSortParam(value: string | undefined, validKeys: string[], defaultKey: string, defaultOrder?: SortOrder): SortOptions;
146
+ export interface TableOptions {
147
+ /** When true, adds the "sortable" CSS class so tableSort.js activates */
148
+ sortable?: boolean;
149
+ /** 0-indexed column that is the initial sort column */
150
+ defaultSortColumn?: number;
151
+ /** Initial sort direction (default: 'asc') */
152
+ defaultSortOrder?: SortOrder;
153
+ /**
154
+ * Per-column callbacks that return a `data-sort` attribute value for a cell.
155
+ * Keyed by column index. Needed when a cell contains HTML (e.g. links) but
156
+ * tableSort.js should sort on the underlying numeric/text value.
157
+ * Receives the cell's row data AND the 0-based row index within `rows`.
158
+ */
159
+ cellDataSort?: Record<number, (row: string[], rowIndex: number) => string>;
160
+ /** Shown instead of the table when there are no rows (plain text). Default: "No pages found." */
161
+ emptyMessage?: string;
162
+ /** A totals row in `<tfoot>`; cells may contain raw HTML, like body cells. */
163
+ footer?: string[];
164
+ }
165
+ /**
166
+ * Format rows of data as an HTML table.
167
+ * Cell values may contain raw HTML (e.g. anchor tags).
168
+ * Header values are plain text and will be HTML-escaped.
169
+ *
170
+ * @param headers - Column header strings (plain text)
171
+ * @param rows - Array of row arrays; each element is a cell value (may be raw HTML)
172
+ * @param options - Optional table rendering options (sortable, pagination hints, etc.)
173
+ */
174
+ export declare function formatAsTable(headers: string[], rows: string[][], options?: TableOptions): string;
175
+ /**
176
+ * Show an amount kept as whole minor units (cents) in its currency:
177
+ * `formatMoney(125050, 'USD')` is `$1,250.50`. The number of decimals is the
178
+ * currency's own (JPY 0, KWD 3); an unlisted code gets two. A malformed code
179
+ * never throws: it is shown after the number. Plain text: escape it when
180
+ * putting it in HTML.
181
+ */
182
+ export declare function formatMoney(minorUnits: number, currency: string, locale?: string): string;
183
+ /**
184
+ * Format a duration in seconds as a human-readable string.
185
+ * Examples: "3d 12h 45m", "5h 30m", "15m"
186
+ */
187
+ export declare function formatDuration(seconds: number): string;
188
+ /**
189
+ * Format a Date as a locale-aware date/time string.
190
+ * Example: "Apr 19, 2026, 10:30 AM"
191
+ */
192
+ export declare function formatDateTime(date: Date, locale?: string): string;
193
+ /**
194
+ * Format a Date as a relative time string.
195
+ * Examples: "just now", "2 hours ago", "3 days ago", "Apr 5, 2026"
196
+ */
197
+ export declare function formatRelativeTime(date: Date, locale?: string): string;
198
+ /**
199
+ * Split a comma-separated plugin parameter into a trimmed, non-empty array.
200
+ * Example: splitParam('a, b, c') → ['a', 'b', 'c']
201
+ */
202
+ export declare function splitParam(value: string | number | boolean | undefined): string[];
203
+ /**
204
+ * Parse a boolean plugin parameter.
205
+ * '0' and 'false' (case-insensitive) → false; '1' and 'true' → true; else → defaultVal.
206
+ */
207
+ export declare function parseBoolParam(value: string | number | boolean | undefined, defaultVal: boolean): boolean;
208
+ /**
209
+ * Where a plugin's rendered output should sit in the page flow.
210
+ *
211
+ * - 'right' — float right; surrounding text wraps on the left (Wikipedia infobox).
212
+ * - 'left' — float left; surrounding text wraps on the right.
213
+ * - 'block' — full-width block element below the caption text. No float.
214
+ * - 'inline' — inline-block; sits next to other inline content.
215
+ *
216
+ * Plugins combine `placementClass(placement)` with their own classes, e.g.
217
+ * `<div class="volcano-infobox plugin-placement-right">…</div>`. The
218
+ * `.plugin-placement-*` CSS lives in ngdpbase core.css so every plugin gets a
219
+ * consistent contract whether or not its addon stylesheet has loaded.
220
+ */
221
+ export type Placement = 'right' | 'left' | 'block' | 'inline';
222
+ /**
223
+ * Parse a `placement=` plugin parameter to a validated `Placement` value.
224
+ * Falls back to `defaultPlacement` for missing or unrecognised values.
225
+ */
226
+ export declare function parsePlacementParam(value: string | undefined, defaultPlacement?: Placement): Placement;
227
+ /**
228
+ * Return the CSS class name for a given placement value.
229
+ * Always returns `plugin-placement-<placement>`.
230
+ */
231
+ export declare function placementClass(placement: Placement): string;
232
+ /**
233
+ * Strip frontmatter, plugin syntax, and markdown decoration from raw page
234
+ * content and return plain text suitable for a card excerpt, truncated at
235
+ * the last word boundary before maxLen characters.
236
+ */
237
+ export declare function extractExcerpt(raw: string, maxLen: number): string;
238
+ /**
239
+ * Fisher-Yates in-place shuffle. Returns the same array reference.
240
+ */
241
+ export declare function shuffleArray<T>(arr: T[]): T[];
242
+ /**
243
+ * Parse a `page=` plugin parameter to an integer (1-based).
244
+ * Returns `defaultPage` if the value is missing, empty, or non-numeric.
245
+ */
246
+ export declare function parsePageParam(value: string | number | undefined, defaultPage?: number): number;
247
+ /**
248
+ * Parse a `pageSize=` plugin parameter to an integer.
249
+ * Returns `defaultSize` (0 = disabled / use max= behaviour) for missing/invalid values.
250
+ */
251
+ export declare function parsePageSizeParam(value: string | number | undefined, defaultSize?: number): number;
252
+ export interface PaginationResult<T> {
253
+ items: T[];
254
+ totalPages: number;
255
+ /** Clamped to 1..totalPages */
256
+ currentPage: number;
257
+ totalItems: number;
258
+ }
259
+ /**
260
+ * Slice `items` to the requested page.
261
+ * When `pageSize` is 0 (disabled), returns all items as page 1 of 1.
262
+ */
263
+ export declare function applyPagination<T>(items: T[], page: number, pageSize: number): PaginationResult<T>;
264
+ /**
265
+ * Render the canonical pagination control (#1300).
266
+ *
267
+ * This is the one pagination markup in the application. `WikiPagination`
268
+ * produces the same shape in the browser and enhances any instance it finds —
269
+ * clicks, arrow keys and swipe — so a surface gets the full control by emitting
270
+ * this and nothing else.
271
+ *
272
+ * The wrapper carries `data-current-page`, `data-total-pages` and the prev/next
273
+ * URLs, which is what lets the enhancer work without being told anything by the
274
+ * page. Everything it needs is in the markup.
275
+ *
276
+ * Returns '' for a single page: a control that can only ever show "1" is noise.
277
+ *
278
+ * @param currentPage - The current page number (1-based)
279
+ * @param totalPages - Total number of pages
280
+ * @param hrefFor - Builds the URL for a given 1-based page number
281
+ * @param ariaLabel - Accessible name for the nav landmark
282
+ * @example
283
+ * formatPaginationNav(3, 12, (p) => `/view/Index?page=${p}`)
284
+ */
285
+ export declare function formatPaginationNav(currentPage: number, totalPages: number, hrefFor: (page: number) => string, ariaLabel?: string): string;
286
+ /** Bootstrap card tones the bar will emit. Anything else falls back to neutral. */
287
+ declare const STAT_TONES: readonly ["primary", "success", "info", "warning", "danger", "secondary"];
288
+ export type StatTone = typeof STAT_TONES[number];
289
+ /** One card in a stat filter bar. */
290
+ export interface StatFilter {
291
+ /** Card heading, e.g. "Active Users". */
292
+ label: string;
293
+ /** The count (or any short value) shown beneath it. */
294
+ value: string | number;
295
+ /**
296
+ * Server-side filter: the card becomes a link to this URL. Use on any
297
+ * surface whose list is paginated — see the note on `match`.
298
+ */
299
+ href?: string;
300
+ /**
301
+ * Client-side filter: `attr=value`, matched against a row's `data-<attr>`.
302
+ * Only correct when every row is already on the page. On a paginated list it
303
+ * would filter the current page while implying it filtered the set, which is
304
+ * the defect #1237 documents in the audit log's DataTables search box — use
305
+ * `href` there instead.
306
+ */
307
+ match?: string;
308
+ /**
309
+ * The card that clears the filter — "Total", and whatever a surface calls
310
+ * its everything card. Clickable, but selects nothing.
311
+ */
312
+ clears?: boolean;
313
+ /** Marks the card whose filter is currently in effect (server-side bars). */
314
+ active?: boolean;
315
+ /** Card colour. */
316
+ tone?: StatTone;
317
+ /** Tooltip / accessible description. */
318
+ title?: string;
319
+ }
320
+ export interface StatFilterOptions {
321
+ /** CSS selector for the rows a client-side filter hides. */
322
+ rowSelector?: string;
323
+ /** Accessible name for the group. */
324
+ ariaLabel?: string;
325
+ /** Bootstrap column class per card (default: four across). */
326
+ columnClass?: string;
327
+ }
328
+ /**
329
+ * Render the canonical summary-stat filter bar (#1303).
330
+ *
331
+ * `/admin/users` had four cards that filter its table when clicked. Nine other
332
+ * surfaces render summary counts in five presentations and none of them filter
333
+ * — `admin-keywords` pixel-identical to the one that works, `admin-audit`
334
+ * defining a `:hover` rule on cards with no click handler. An inconsistent
335
+ * appearance is untidy; an inconsistent affordance is a lie.
336
+ *
337
+ * The markup is the contract, as it is for `formatPaginationNav`: a card is
338
+ * clickable because of what it carries, and `WikiStatFilters.enhance()` wires
339
+ * any bar it finds. That is what lets a plugin an admin wrote offer the same
340
+ * interaction as a core admin page.
341
+ *
342
+ * Three kinds of card, and the difference is the whole design:
343
+ *
344
+ * - `href` — a link. The server filters, so it is correct on a paginated list.
345
+ * - `match` — a client-side row filter. Correct only when every row is loaded.
346
+ * - `clears` — the card that puts everything back.
347
+ * - none of them — a card that reports a number and does not pretend to filter.
348
+ *
349
+ * Returns '' for an empty list.
350
+ *
351
+ * @param stats - The cards, in display order
352
+ * @param options - Row selector, aria label, column class
353
+ * @example
354
+ * formatStatFilters(
355
+ * [{ label: 'Active', value: 9, match: 'status=active', tone: 'success' }],
356
+ * { rowSelector: 'tbody tr[data-username]' }
357
+ * )
358
+ */
359
+ export declare function formatStatFilters(stats: StatFilter[], options?: StatFilterOptions): string;
360
+ /**
361
+ * Build pagination HTML for a plugin result set, addressed by page name.
362
+ *
363
+ * A thin wrapper over `formatPaginationNav` (#1301): it turns a page name and a
364
+ * query parameter into the `/view/{page}?{param}=N` URLs this application uses,
365
+ * and leaves the markup to the canonical control.
366
+ *
367
+ * It previously emitted its own `.plugin-pagination` div — prev/next text links
368
+ * with no page numbers and no styling, since that class had no CSS anywhere in
369
+ * the repo. Its signature and its single-page behaviour are unchanged, so the
370
+ * plugins calling it did not have to change; what they render did.
371
+ *
372
+ * Returns '' when there is only one page (nothing to navigate).
373
+ *
374
+ * @param currentPage - The current page number (1-based)
375
+ * @param totalPages - Total number of pages
376
+ * @param pageName - Wiki page name used to build `/view/{pageName}?page=N`
377
+ * @param queryParam - Query string parameter name (default: 'page')
378
+ */
379
+ export declare function formatPaginationLinks(currentPage: number, totalPages: number, pageName: string, queryParam?: string): string;
380
+ /** Outcome of resolveManagerFetch — lets callers reproduce their own messaging. */
381
+ export type ManagerFetchResult = {
382
+ status: 'ok';
383
+ text: string;
384
+ } | {
385
+ status: 'not-found';
386
+ } | {
387
+ status: 'refused';
388
+ } | {
389
+ status: 'no-spec';
390
+ };
391
+ /** The one manager method page text may reach (#1556). */
392
+ export declare const FETCHABLE_METHOD = "toMarqueeText";
393
+ /**
394
+ * Resolve the `fetch='ManagerName.toMarqueeText(k=v,...)'` plugin convention to text.
395
+ *
396
+ * Extracted from MarqueePlugin (#685 slice 2). Page text names the manager and
397
+ * the method, so this is reachable by anyone who can edit a page and runs on
398
+ * every render, for every viewer (#1556). Two rules make that safe:
399
+ *
400
+ * - __Only `toMarqueeText`.__ Any other method — an index rebuild, a scan,
401
+ * anything with a side effect — is refused, whatever the manager offers.
402
+ * `BaseManager.toMarqueeText()` is the convention, and the only method any
403
+ * shipped page or doc uses.
404
+ * - __The viewer's context goes with it__ (every call carries a context). The
405
+ * manager decides what that viewer may see; nothing runs as the server.
406
+ *
407
+ * The raw `{k: v}` args object is passed as the first argument (the manager
408
+ * owns its own option parsing via `managerUtils.ts`), the viewer second.
409
+ *
410
+ * #1751: the render depends on the manager's data, so the page cache
411
+ * re-renders once that manager bumps its topic (its own name).
412
+ */
413
+ export declare function resolveManagerFetch(spec: string | undefined, context: {
414
+ engine?: {
415
+ getManager(name: string): unknown;
416
+ };
417
+ userContext?: unknown;
418
+ }): Promise<ManagerFetchResult>;
419
+ /** One choice in a form's dropdown: the value submitted, and the text shown. */
420
+ export interface FormOption {
421
+ value: string;
422
+ label: string;
423
+ }
424
+ /** Outcome of resolveManagerOptions; the statuses mean what they mean for resolveManagerFetch. */
425
+ export type ManagerOptionsResult = {
426
+ status: 'ok';
427
+ options: FormOption[];
428
+ } | {
429
+ status: 'not-found';
430
+ } | {
431
+ status: 'refused';
432
+ } | {
433
+ status: 'no-spec';
434
+ };
435
+ /** The one manager method a form's `optionsSource: "fetch:..."` may reach. */
436
+ export declare const FORM_OPTIONS_METHOD = "toFormOptions";
437
+ /**
438
+ * Resolve `ManagerName.toFormOptions(k=v,...)` to the choices of a form
439
+ * dropdown, under the same two rules as resolveManagerFetch: only
440
+ * `toFormOptions` is reachable, and the viewer's context goes with the call,
441
+ * so the manager offers that viewer only what they may see.
442
+ *
443
+ * The manager may answer strings or `{ value, label }` objects; anything
444
+ * else is dropped, and every value comes back as a string.
445
+ */
446
+ export declare function resolveManagerOptions(spec: string | undefined, context: {
447
+ engine?: {
448
+ getManager(name: string): unknown;
449
+ };
450
+ userContext?: unknown;
451
+ }): Promise<ManagerOptionsResult>;
452
+ export {};