@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,98 @@
1
+ /**
2
+ * The root every provider base class inherits from (#1148).
3
+ *
4
+ * It exists for one contract: a provider states what it does with data between
5
+ * accepting it and having it on disk. That question is not specific to
6
+ * auditing — a page provider that buffers its index writes, a search provider
7
+ * that batches, and a logging provider that flushes on a timer all have the
8
+ * same window in which a record can be lost, and an instance should be able to
9
+ * say so uniformly rather than one subsystem at a time.
10
+ *
11
+ * It carries what every provider genuinely shares, and deliberately no more:
12
+ * the durability contract (#1148) and its own identity (#1151).
13
+ *
14
+ * __Identity, not lifecycle.__ `ProviderInfo` was declared nine times across
15
+ * this tree — once canonically and eight times locally — and the copies had
16
+ * already drifted into three different shapes, which is the failure that made
17
+ * consolidating it worth doing. Every provider has a name and a version, so
18
+ * that belongs here.
19
+ *
20
+ * Lifecycle does NOT. `initialize()`, `shutdown()` and `isHealthy()` appear in
21
+ * 8, 4 and 4 of the nine base classes respectively, some abstract and some
22
+ * concrete, and whether a cache provider's lifecycle is genuinely the same
23
+ * shape as a page provider's is a design question rather than a refactor. A
24
+ * uniform lifecycle asserted across providers that do not have one would be
25
+ * the same defect as the `durable` flag #1148 removed: a contract declared for
26
+ * everybody and honoured by some. #1151 keeps that as its own step, undecided.
27
+ */
28
+ /**
29
+ * What a provider does with a record before it is durably stored.
30
+ *
31
+ * Facts rather than a claim. Durability on a single node means write, fsync,
32
+ * then acknowledge — and even that trusts a disk controller's cache, while a
33
+ * failed disk takes the data with it. So a provider reports the window in
34
+ * which a record can still be lost and the reader draws the conclusion.
35
+ *
36
+ * The alternative was a `durable: boolean`, which is what this replaces: it
37
+ * was derived from an unrelated property, was true for every storing provider,
38
+ * and was false in fact for the one that shipped by default (#1148).
39
+ */
40
+ import type { ProviderInfo } from '../types/Provider.js';
41
+ export interface ProviderDurability {
42
+ /** Milliseconds a record may sit in memory before being written. 0 = never buffered. */
43
+ bufferedForMs: number;
44
+ /** Records held before an early write is forced. 0 = no bound. */
45
+ bufferedRecords: number;
46
+ /** Whether EVERY write is flushed to the device before being reported as stored. */
47
+ fsync: boolean;
48
+ /**
49
+ * Classes of write that ARE unbuffered and fsynced even when `fsync` is
50
+ * false, named in the provider's own vocabulary — for auditing, the tier
51
+ * (#1158).
52
+ *
53
+ * A partial guarantee needs somewhere to be stated, or it rounds to a claim
54
+ * that is wrong in one direction or the other: `fsync: true` would promise
55
+ * durability for buffered `standard` events that do not have it, and a bare
56
+ * `fsync: false` hides a guarantee the critical path genuinely provides.
57
+ * Absent when the whole answer is `fsync`.
58
+ */
59
+ fsyncedClasses?: readonly string[];
60
+ }
61
+ declare abstract class BaseProvider {
62
+ /**
63
+ * What this provider calls itself (#1151).
64
+ *
65
+ * `protected`, and set by a subclass in its constructor or field
66
+ * initialisers. A provider that sets nothing reports the class name rather
67
+ * than a placeholder, so the answer is never a lie — it is either what the
68
+ * author chose or what the runtime knows.
69
+ */
70
+ protected providerName?: string;
71
+ /** Version this provider reports. Defaults to `1.0.0` when unset. */
72
+ protected providerVersion?: string;
73
+ /** One line on what it does. Optional, as on the canonical type. */
74
+ protected providerDescription?: string;
75
+ /** Capability strings a manager may log or branch on. */
76
+ protected providerFeatures?: string[];
77
+ /**
78
+ * Identify this provider.
79
+ *
80
+ * Concrete providers may still override this — their name, version and
81
+ * feature list are their own data, not duplication. What moved up here is
82
+ * the SHAPE, so the nine copies of `ProviderInfo` become one, and so a new
83
+ * provider that sets the fields gets a correct answer without writing the
84
+ * method at all.
85
+ */
86
+ getProviderInfo(): ProviderInfo;
87
+ /**
88
+ * What this provider does with a record before it is durably stored.
89
+ *
90
+ * Null means the provider has not stated it — silence rather than a default.
91
+ * A provider that buffers and forgets to declare it must not inherit an
92
+ * assertion that it writes immediately, which is precisely the bug this
93
+ * contract replaces. A reporting layer renders null as "not stated", never
94
+ * as "durable".
95
+ */
96
+ getDurability(): ProviderDurability | null;
97
+ }
98
+ export default BaseProvider;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * The root every provider base class inherits from (#1148).
3
+ *
4
+ * It exists for one contract: a provider states what it does with data between
5
+ * accepting it and having it on disk. That question is not specific to
6
+ * auditing — a page provider that buffers its index writes, a search provider
7
+ * that batches, and a logging provider that flushes on a timer all have the
8
+ * same window in which a record can be lost, and an instance should be able to
9
+ * say so uniformly rather than one subsystem at a time.
10
+ *
11
+ * It carries what every provider genuinely shares, and deliberately no more:
12
+ * the durability contract (#1148) and its own identity (#1151).
13
+ *
14
+ * __Identity, not lifecycle.__ `ProviderInfo` was declared nine times across
15
+ * this tree — once canonically and eight times locally — and the copies had
16
+ * already drifted into three different shapes, which is the failure that made
17
+ * consolidating it worth doing. Every provider has a name and a version, so
18
+ * that belongs here.
19
+ *
20
+ * Lifecycle does NOT. `initialize()`, `shutdown()` and `isHealthy()` appear in
21
+ * 8, 4 and 4 of the nine base classes respectively, some abstract and some
22
+ * concrete, and whether a cache provider's lifecycle is genuinely the same
23
+ * shape as a page provider's is a design question rather than a refactor. A
24
+ * uniform lifecycle asserted across providers that do not have one would be
25
+ * the same defect as the `durable` flag #1148 removed: a contract declared for
26
+ * everybody and honoured by some. #1151 keeps that as its own step, undecided.
27
+ */
28
+ class BaseProvider {
29
+ /**
30
+ * What this provider calls itself (#1151).
31
+ *
32
+ * `protected`, and set by a subclass in its constructor or field
33
+ * initialisers. A provider that sets nothing reports the class name rather
34
+ * than a placeholder, so the answer is never a lie — it is either what the
35
+ * author chose or what the runtime knows.
36
+ */
37
+ providerName;
38
+ /** Version this provider reports. Defaults to `1.0.0` when unset. */
39
+ providerVersion;
40
+ /** One line on what it does. Optional, as on the canonical type. */
41
+ providerDescription;
42
+ /** Capability strings a manager may log or branch on. */
43
+ providerFeatures;
44
+ /**
45
+ * Identify this provider.
46
+ *
47
+ * Concrete providers may still override this — their name, version and
48
+ * feature list are their own data, not duplication. What moved up here is
49
+ * the SHAPE, so the nine copies of `ProviderInfo` become one, and so a new
50
+ * provider that sets the fields gets a correct answer without writing the
51
+ * method at all.
52
+ */
53
+ getProviderInfo() {
54
+ return {
55
+ name: this.providerName ?? this.constructor.name,
56
+ version: this.providerVersion ?? '1.0.0',
57
+ description: this.providerDescription,
58
+ features: this.providerFeatures ?? []
59
+ };
60
+ }
61
+ /**
62
+ * What this provider does with a record before it is durably stored.
63
+ *
64
+ * Null means the provider has not stated it — silence rather than a default.
65
+ * A provider that buffers and forgets to declare it must not inherit an
66
+ * assertion that it writes immediately, which is precisely the bug this
67
+ * contract replaces. A reporting layer renders null as "not stated", never
68
+ * as "durable".
69
+ */
70
+ getDurability() {
71
+ return null;
72
+ }
73
+ }
74
+ export default BaseProvider;
@@ -0,0 +1,362 @@
1
+ /**
2
+ * BaseSearchProvider - Base class for all search providers
3
+ *
4
+ * Provides the interface that all search providers must implement.
5
+ * Follows the provider pattern established in AttachmentManager, PageManager, CacheManager, and AuditManager.
6
+ *
7
+ * Search providers implement different search engines (Lunr.js, Elasticsearch, etc.)
8
+ *
9
+ * @class BaseSearchProvider
10
+ * @abstract
11
+ *
12
+ * @property {WikiEngine} engine - Reference to the wiki engine
13
+ * @property {boolean} initialized - Whether provider has been initialized
14
+ *
15
+ * @see {@link LunrSearchProvider} for Lunr.js implementation
16
+ * @see {@link SearchManager} for usage
17
+ *
18
+ * Related: GitHub Issue #102 - Configuration reorganization
19
+ */
20
+ import type { WikiEngine } from '../types/WikiEngine.js';
21
+ import type { ProviderInfo } from '../types/Provider.js';
22
+ import BaseProvider from './BaseProvider.js';
23
+ /**
24
+ * Search result structure
25
+ */
26
+ export interface SearchResult {
27
+ /** Page name/identifier */
28
+ name: string;
29
+ /** Page title */
30
+ title: string;
31
+ /** Relevance score */
32
+ score: number;
33
+ /** Content snippet with highlights */
34
+ snippet: string;
35
+ /** Additional metadata */
36
+ metadata: Record<string, unknown>;
37
+ }
38
+ /**
39
+ * Minimal WikiContext shape needed by search providers to filter private results.
40
+ * The full WikiContext lives in src/context/WikiContext.ts.
41
+ *
42
+ * Optional method declarations match the real WikiContext API (#625) so providers
43
+ * can call `wikiContext.hasRole(...)` / `getPrincipals()` directly. Optional so
44
+ * non-WikiContext duck-typed callers (older tests, fixtures) still satisfy the type.
45
+ */
46
+ export interface SearchWikiContext {
47
+ userContext?: {
48
+ username?: string;
49
+ roles?: string[];
50
+ authenticated?: boolean;
51
+ [key: string]: unknown;
52
+ };
53
+ hasRole?(...names: string[]): boolean;
54
+ getPrincipals?(): string[];
55
+ [key: string]: unknown;
56
+ }
57
+ /**
58
+ * Search options structure
59
+ */
60
+ export interface SearchOptions {
61
+ /** Maximum number of results to return */
62
+ maxResults?: number;
63
+ /** Fields to search in */
64
+ searchIn?: string[];
65
+ /** Filter by categories */
66
+ categories?: string[];
67
+ /** Filter by user keywords */
68
+ userKeywords?: string[];
69
+ /** WikiContext for the current request — used to filter private search results */
70
+ wikiContext?: SearchWikiContext;
71
+ /**
72
+ * #884: treat the LAST query term as a prefix, for as-you-type search.
73
+ *
74
+ * Opt-in. A user who has typed "volc" wants Volcano; a user who submitted
75
+ * "volc" deliberately does not want every word starting with it, so this is
76
+ * never applied to a completed search.
77
+ *
78
+ * Only the last term is widened — earlier terms are complete words the user
79
+ * has finished typing.
80
+ */
81
+ prefixLastTerm?: boolean;
82
+ }
83
+ /**
84
+ * Advanced search criteria
85
+ */
86
+ export interface SearchCriteria {
87
+ /** Search query */
88
+ query?: string;
89
+ /** Categories to filter by */
90
+ categories?: string[];
91
+ /** #706: knowledge-role values to filter by (source / citation / concept).
92
+ * Pages without a `knowledge-role` set are excluded when this filter has
93
+ * any entries — mirrors how `categories` excludes off-axis pages. */
94
+ knowledgeRoles?: string[];
95
+ /** User keywords to filter by */
96
+ userKeywords?: string[];
97
+ /** System keywords to filter by (auto-tagged or manually set — #507/#509) */
98
+ systemKeywords?: string[];
99
+ /** Editorial lifecycle states to filter by (draft/review/published — #893).
100
+ * Pages without a `status` count as 'published'. */
101
+ statuses?: string[];
102
+ /** Fields to search in (title, content, category, keywords, or all) */
103
+ searchIn?: string[];
104
+ /** Author to filter by (page creator — matches metadata.author) */
105
+ author?: string;
106
+ /** Editor to filter by (last modifier — matches metadata.editor) */
107
+ editor?: string;
108
+ /** Date range */
109
+ dateRange?: {
110
+ from?: string;
111
+ to?: string;
112
+ };
113
+ /** Maximum results to return */
114
+ maxResults?: number;
115
+ /** Additional criteria */
116
+ [key: string]: unknown;
117
+ }
118
+ /**
119
+ * Search statistics
120
+ */
121
+ export interface SearchStatistics {
122
+ /** Total number of indexed documents */
123
+ documentCount: number;
124
+ /** Index size in bytes */
125
+ indexSize?: number;
126
+ /** Last index update timestamp */
127
+ lastIndexUpdate?: string;
128
+ /** Additional statistics */
129
+ [key: string]: unknown;
130
+ }
131
+ /**
132
+ * Backup data structure
133
+ */
134
+ export interface BackupData {
135
+ /** Provider class name */
136
+ provider: string;
137
+ /** Whether provider was initialized */
138
+ initialized: boolean;
139
+ /** Backup timestamp */
140
+ timestamp: string;
141
+ /** Additional backup data */
142
+ [key: string]: unknown;
143
+ }
144
+ /**
145
+ * BaseSearchProvider - Abstract base class for search providers
146
+ *
147
+ * All search providers must extend this class and implement its abstract methods.
148
+ * Provides a consistent interface for different search backend implementations.
149
+ *
150
+ * @abstract
151
+ */
152
+ declare abstract class BaseSearchProvider extends BaseProvider {
153
+ /** Reference to the wiki engine */
154
+ protected engine: WikiEngine;
155
+ /** Whether provider has been initialized */
156
+ protected initialized: boolean;
157
+ /**
158
+ * Creates a new BaseSearchProvider instance
159
+ *
160
+ * @param engine - Reference to the WikiEngine instance
161
+ */
162
+ constructor(engine: WikiEngine);
163
+ /**
164
+ * Initialize the search provider
165
+ *
166
+ * Implementations should load configuration from ConfigurationManager
167
+ * and prepare the search backend for use.
168
+ *
169
+ * @returns Promise that resolves when initialization is complete
170
+ * @abstract
171
+ */
172
+ abstract initialize(): Promise<void>;
173
+ /**
174
+ * Get provider information
175
+ *
176
+ * Returns metadata about this provider implementation including
177
+ * name, version, description, and supported features.
178
+ *
179
+ * @returns Provider metadata
180
+ */
181
+ getProviderInfo(): ProviderInfo;
182
+ /**
183
+ * Build or rebuild the search index from all pages
184
+ *
185
+ * Implementations should iterate through all pages and create
186
+ * a complete search index from scratch.
187
+ *
188
+ * @returns Promise that resolves when index building is complete
189
+ * @abstract
190
+ */
191
+ abstract buildIndex(): Promise<void>;
192
+ /**
193
+ * Search for pages matching the query
194
+ *
195
+ * Performs a search against the index using the provided query
196
+ * and optional search options.
197
+ *
198
+ * @param query - Search query string
199
+ * @param options - Search options for filtering and limiting results
200
+ * @returns Promise resolving to array of search results
201
+ * @abstract
202
+ */
203
+ abstract search(query: string, options?: SearchOptions): Promise<SearchResult[]>;
204
+ /**
205
+ * Advanced search with multiple criteria
206
+ *
207
+ * Performs a more complex search using multiple criteria including
208
+ * query, categories, keywords, author, date range, etc.
209
+ *
210
+ * @param criteria - Search criteria object
211
+ * @returns Promise resolving to array of search results
212
+ * @abstract
213
+ */
214
+ abstract advancedSearch(criteria?: SearchCriteria): Promise<SearchResult[]>;
215
+ /**
216
+ * Get search suggestions for autocomplete
217
+ *
218
+ * Provides search term suggestions based on a partial input,
219
+ * useful for implementing autocomplete functionality.
220
+ *
221
+ * @param partial - Partial search term
222
+ * @returns Promise resolving to array of suggested completions
223
+ * @abstract
224
+ */
225
+ abstract getSuggestions(partial: string): Promise<string[]>;
226
+ /**
227
+ * Suggest similar pages based on content
228
+ *
229
+ * Finds pages similar to the specified page based on content
230
+ * analysis and relevance scoring.
231
+ *
232
+ * @param pageName - Source page name to find similar pages for
233
+ * @param limit - Maximum number of suggestions to return (default: 5)
234
+ * @returns Promise resolving to array of suggested similar pages
235
+ * @abstract
236
+ */
237
+ abstract suggestSimilarPages(pageName: string, limit?: number): Promise<SearchResult[]>;
238
+ /**
239
+ * Add or update a page in the search index
240
+ *
241
+ * Updates the search index with the latest content and metadata
242
+ * for the specified page.
243
+ *
244
+ * @param pageName - Page name to update
245
+ * @param pageData - Page data including content and metadata
246
+ * @returns Promise that resolves when update is complete
247
+ * @abstract
248
+ */
249
+ abstract updatePageInIndex(pageName: string, pageData: Record<string, unknown>): Promise<void>;
250
+ /**
251
+ * Remove a page from the search index
252
+ *
253
+ * Removes all entries for the specified page from the search index.
254
+ *
255
+ * @param pageName - Page name to remove
256
+ * @returns Promise that resolves when removal is complete
257
+ * @abstract
258
+ */
259
+ abstract removePageFromIndex(pageName: string): Promise<void>;
260
+ /**
261
+ * Get all unique categories from indexed documents
262
+ *
263
+ * Extracts and returns a list of all unique categories
264
+ * found in the indexed pages.
265
+ *
266
+ * @returns Promise resolving to array of unique category names
267
+ * @abstract
268
+ */
269
+ abstract getAllCategories(): Promise<string[]>;
270
+ /**
271
+ * Get all unique user keywords from indexed documents
272
+ *
273
+ * Extracts and returns a list of all unique user-defined keywords
274
+ * found in the indexed pages.
275
+ *
276
+ * @returns Promise resolving to array of unique keywords
277
+ * @abstract
278
+ */
279
+ abstract getAllUserKeywords(): Promise<string[]>;
280
+ /**
281
+ * Search by category only
282
+ *
283
+ * Finds all pages that belong to the specified category.
284
+ *
285
+ * @param category - Category name to search for
286
+ * @returns Promise resolving to array of pages in the category
287
+ * @abstract
288
+ */
289
+ abstract searchByCategory(category: string): Promise<SearchResult[]>;
290
+ /**
291
+ * Search by user keywords only
292
+ *
293
+ * Finds all pages that have the specified user keyword.
294
+ *
295
+ * @param keyword - Keyword to search for
296
+ * @returns Promise resolving to array of pages with the keyword
297
+ * @abstract
298
+ */
299
+ abstract searchByUserKeywords(keyword: string): Promise<SearchResult[]>;
300
+ /**
301
+ * Get search statistics
302
+ *
303
+ * Returns statistics about the search index including document count,
304
+ * index size, last update time, and other metrics.
305
+ *
306
+ * @returns Promise resolving to search statistics object
307
+ * @abstract
308
+ */
309
+ abstract getStatistics(): Promise<SearchStatistics>;
310
+ /**
311
+ * Get the total number of indexed documents
312
+ *
313
+ * Returns a count of how many documents are currently in the index.
314
+ *
315
+ * @returns Promise resolving to document count
316
+ * @abstract
317
+ */
318
+ abstract getDocumentCount(): Promise<number>;
319
+ /**
320
+ * Check if the search provider is healthy/functional
321
+ *
322
+ * Performs health checks on the search backend to verify it's
323
+ * operational and responding correctly.
324
+ *
325
+ * @returns Promise resolving to true if healthy, false otherwise
326
+ * @abstract
327
+ */
328
+ abstract isHealthy(): Promise<boolean>;
329
+ /**
330
+ * Close/cleanup the search provider
331
+ *
332
+ * Performs cleanup operations such as closing connections,
333
+ * flushing buffers, and releasing resources.
334
+ *
335
+ * @returns Promise that resolves when cleanup is complete
336
+ * @abstract
337
+ */
338
+ abstract close(): Promise<void>;
339
+ /**
340
+ * Backup search index and configuration (optional)
341
+ *
342
+ * Creates a backup of the search index and configuration data.
343
+ * Default implementation provides basic metadata.
344
+ * Subclasses should override to include actual index data.
345
+ *
346
+ * @returns Promise resolving to backup data object
347
+ */
348
+ backup(): Promise<BackupData>;
349
+ /**
350
+ * Restore search index from backup (optional)
351
+ *
352
+ * Restores the search index from previously created backup data.
353
+ * Default implementation does nothing.
354
+ * Subclasses can override if they support restore functionality.
355
+ *
356
+ * @param _backupData - Backup data to restore from
357
+ * @returns Promise that resolves when restore is complete
358
+ */
359
+ restore(_backupData: BackupData): Promise<void>;
360
+ }
361
+ export default BaseSearchProvider;
362
+ export { WikiEngine, ProviderInfo };