@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,308 @@
1
+ /**
2
+ * BaseMediaProvider - Abstract base class for media providers
3
+ *
4
+ * Defines the interface that all media providers must implement.
5
+ * MediaManager uses this interface to interact with the underlying
6
+ * media storage / scanning implementation.
7
+ *
8
+ * Implements AssetProvider (Epic #405 Phase 1) so the AssetManager can
9
+ * consume any media backend through a single interface.
10
+ *
11
+ * @module BaseMediaProvider
12
+ */
13
+ import type { AssetProvider, AssetRecord, AssetQuery, AssetPage, AssetInput, AssetMetadata, AssetMetadataPatch } from '../types/Asset.js';
14
+ import type { CreativeWork } from '../types/Schema.js';
15
+ import BaseProvider from './BaseProvider.js';
16
+ /**
17
+ * Represents a single media item in the index.
18
+ */
19
+ export interface MediaItem {
20
+ /** Unique identifier for this item (e.g. SHA-256 of file path) */
21
+ id: string;
22
+ /** Absolute path to the source file on disk */
23
+ filePath: string;
24
+ /** Original filename (basename) */
25
+ filename: string;
26
+ /** MIME type (e.g. "image/jpeg") */
27
+ mimeType: string;
28
+ /** Year extracted from EXIF DateTimeOriginal or path/filename fallback */
29
+ year?: number;
30
+ /** Source directory path (for display purposes) */
31
+ dirPath?: string;
32
+ /** Username of the content creator */
33
+ creator?: string;
34
+ /** File modification time in epoch milliseconds — used as a sort fallback when EXIF DateTimeOriginal is absent (#606). */
35
+ mtime?: number;
36
+ /** Structured metadata bag — EXIF, IPTC, XMP and custom fields */
37
+ metadata?: AssetMetadata;
38
+ /** Alternate-format paths for the same photo (e.g. the HEIC original when JPEG is primary) */
39
+ alternates?: string[];
40
+ }
41
+ /**
42
+ * Summary of a scan operation.
43
+ */
44
+ export interface ScanResult {
45
+ /** Total number of files examined */
46
+ scanned: number;
47
+ /** Number of new items added to the index */
48
+ added: number;
49
+ /** Number of existing items updated in the index */
50
+ updated: number;
51
+ /** Number of files that could not be processed */
52
+ errors: number;
53
+ /** Number of files skipped by .ngdpbaseignore patterns or the ngdpbaseignore EXIF keyword */
54
+ excluded?: number;
55
+ /**
56
+ * WHICH files were skipped and why (#1056).
57
+ *
58
+ * `excluded` alone cannot answer "where did my file go", and before #1056 it
59
+ * did not even count four of the skip reasons — an ignored directory, a
60
+ * .ngdpbaseignore directory match, a dotfile and an unsupported extension
61
+ * all passed silently, so a file could be absent while the counter read 0.
62
+ *
63
+ * Capped at SKIPPED_REPORT_CAP entries; `skippedTruncated` says when the cap
64
+ * was reached, because a silently shortened list reads as a complete one.
65
+ */
66
+ skipped?: import('../utils/explainMediaPath.js').SkippedEntry[];
67
+ /** True when `skipped` was capped and does not list every skip. */
68
+ skippedTruncated?: boolean;
69
+ /** Number of indexed items with no usable capture date (EXIF/QuickTime) — they sort by file mtime (#807) */
70
+ noCaptureDate?: number;
71
+ /** Number of indexed items with a partial (year-only / year+month) EXIF date, defaulted to Jan 1 (#808) */
72
+ partialCaptureDate?: number;
73
+ /** Number of stale index entries pruned because their file vanished from a scanned folder (#867) */
74
+ removed?: number;
75
+ /** Total elapsed time in milliseconds */
76
+ elapsedMs?: number;
77
+ /** Folder paths that were configured but not found on disk */
78
+ missingFolders?: string[];
79
+ }
80
+ /**
81
+ * Abstract base class for media providers.
82
+ *
83
+ * Implement this class to add support for a new media storage backend
84
+ * (filesystem, S3, etc.). MediaManager always interacts through this interface.
85
+ */
86
+ declare abstract class BaseMediaProvider extends BaseProvider implements AssetProvider {
87
+ /**
88
+ * Lifecycle method called once after construction to load persisted state.
89
+ * Default implementation is a no-op; override to load an index from disk.
90
+ */
91
+ initialize(): Promise<void>;
92
+ /**
93
+ * Scan configured media folders and update the in-memory/persisted index.
94
+ *
95
+ * @param force - When true, re-scan all files even if mtime is unchanged.
96
+ * @param onProgress - Optional callback invoked periodically with (processed, total).
97
+ * @returns Summary of what was scanned/added/updated/errored.
98
+ */
99
+ abstract scan(force?: boolean, onProgress?: (processed: number, total: number) => void): Promise<ScanResult>;
100
+ /**
101
+ * Return the list of years that have at least one media item, sorted
102
+ * descending (most recent first).
103
+ *
104
+ * @returns Array of four-digit years.
105
+ */
106
+ abstract getYears(): Promise<number[]>;
107
+ /**
108
+ * Retrieve a single media item by its unique identifier.
109
+ *
110
+ * @param id - The item identifier.
111
+ * @returns The MediaItem, or null if not found.
112
+ */
113
+ abstract getItem(id: string): Promise<MediaItem | null>;
114
+ /**
115
+ * Find the first media item whose filename (basename) exactly matches.
116
+ *
117
+ * Used by the `media://` URI scheme so authors can reference items by
118
+ * their original filename rather than an opaque SHA-256 id.
119
+ *
120
+ * Default implementation returns null; override in providers that maintain
121
+ * a filename-keyed index.
122
+ *
123
+ * @param filename - Basename to match (e.g. "IMG_1234.jpg").
124
+ * @returns The first matching MediaItem, or null if not found.
125
+ */
126
+ findByFilename(_filename: string): Promise<MediaItem | null>;
127
+ /**
128
+ * Retrieve all media items for a given year.
129
+ *
130
+ * @param year - Four-digit year (e.g. 2024).
131
+ * @returns Array of matching MediaItem objects (may be empty).
132
+ */
133
+ abstract getItemsByYear(year: number): Promise<MediaItem[]>;
134
+ /**
135
+ * How many items {@link getYears} and {@link getItemsByYear} cover — every
136
+ * item with a year (#1741). The default asks year by year, which is correct
137
+ * for any provider; override it where the count is one pass, because an
138
+ * index with many years makes the default a pass per year.
139
+ */
140
+ getItemCount(): Promise<number>;
141
+ /**
142
+ * Return items whose capture timestamp falls within [after, before], sorted
143
+ * ascending by capture date (#864). Either bound may be omitted. Items with
144
+ * no capture date are excluded. Default implementation returns [] so
145
+ * providers without date support degrade gracefully.
146
+ */
147
+ getItemsByDateRange(_after?: string, _before?: string): Promise<MediaItem[]>;
148
+ /**
149
+ * Generate (or retrieve cached) thumbnail data for an item.
150
+ *
151
+ * @param id - The item identifier.
152
+ * @param size - Requested size string (e.g. "300x300").
153
+ * @returns JPEG buffer, or null if thumbnail cannot be generated.
154
+ */
155
+ abstract getThumbnailBuffer(id: string, size: string): Promise<Buffer | null>;
156
+ /**
157
+ * Retrieve all media items whose EXIF/XMP keywords name a wiki page.
158
+ *
159
+ * @param pageName - The wiki page name to match against each item's keywords.
160
+ * @returns Array of matching MediaItem objects (may be empty).
161
+ */
162
+ getItemsByPage(_pageName: string): Promise<MediaItem[]>;
163
+ /**
164
+ * Retrieve all media items whose EXIF/XMP keyword list contains the given keyword.
165
+ *
166
+ * Performs an exact, case-sensitive match against each entry in
167
+ * `metadata.keywords` (string or string[]). Items with no keywords are excluded.
168
+ *
169
+ * @param keyword - The keyword to match (e.g. "Molly's Cooking").
170
+ * @returns Array of matching MediaItem objects (may be empty).
171
+ */
172
+ getItemsByKeyword(_keyword: string): Promise<MediaItem[]>;
173
+ /**
174
+ * #895: all distinct EXIF/XMP keywords in the media index with item counts.
175
+ * Used by the admin keyword drift report (observed-media side). Default
176
+ * implementation returns an empty map; override in providers with an index.
177
+ */
178
+ getAllKeywordCounts(): Promise<Record<string, number>>;
179
+ /**
180
+ * #917: leaf→path map from hierarchical keyword tags. Default empty; overridden
181
+ * in providers that index `keywordPaths`.
182
+ */
183
+ getKeywordLeafPaths(): Promise<Record<string, string>>;
184
+ /**
185
+ * Rebuild the media index from scratch, discarding all existing entries.
186
+ *
187
+ * Default implementation returns an empty ScanResult; override in providers
188
+ * that maintain a persistent index.
189
+ *
190
+ * @param onProgress - Optional callback invoked periodically with (processed, total).
191
+ */
192
+ rebuild(onProgress?: (processed: number, total: number) => void): Promise<ScanResult>;
193
+ /**
194
+ * Full-text / keyword search across the media index.
195
+ *
196
+ * Renamed from `search` to avoid collision with the AssetProvider interface.
197
+ * MediaManager and all callers use this method name.
198
+ *
199
+ * @param query - Search query string.
200
+ * @returns Array of matching MediaItem objects (may be empty).
201
+ */
202
+ abstract searchItems(query: string): Promise<MediaItem[]>;
203
+ /**
204
+ * Write user-editable descriptive metadata into the source file and refresh
205
+ * the index entry. Only meaningful when 'edit' is in `capabilities`.
206
+ *
207
+ * Named `updateItemMetadata` (returning MediaItem) to avoid a return-type
208
+ * collision with AssetProvider.updateMetadata (returning AssetRecord) —
209
+ * same pattern as searchItems vs search.
210
+ *
211
+ * Default implementation rejects; override in providers that support writes.
212
+ *
213
+ * @param id - The item identifier.
214
+ * @param patch - Fields to change (absent = keep, null = clear).
215
+ * @returns The refreshed MediaItem, or null if the id is unknown (or the
216
+ * edit caused the item to leave the index, e.g. an
217
+ * `ngdpbaseignore` keyword).
218
+ */
219
+ updateItemMetadata(_id: string, _patch: AssetMetadataPatch): Promise<MediaItem | null>;
220
+ /**
221
+ * Delegates to `utils/assetMetadataTags` (#999).
222
+ *
223
+ * The mapping moved there so attachments and media share ONE implementation
224
+ * — two copies of the #866 decisions (keywords-only, dual description tags,
225
+ * CreateDate for A/V) would drift, and each of those is subtly wrong in a way
226
+ * that is hard to notice.
227
+ *
228
+ * Original contract, unchanged:
229
+ * Map an AssetMetadataPatch onto the ExifTool tag names to write for a file
230
+ * of the given MIME type. Pure — no I/O; unit-testable without ExifTool.
231
+ *
232
+ * Tag choices mirror what processFile/extractCaptureDate READ back, so a
233
+ * post-write re-extract round-trips every edited field:
234
+ * - title → Title (XMP-dc)
235
+ * - description → Description (XMP-dc) + ImageDescription (EXIF) —
236
+ * the index reads `Description ?? ImageDescription`
237
+ * - keywords → Keywords only — ExifTool's MWG logic mirrors it to
238
+ * XMP-dc Subject; writing both doubles the list
239
+ * - dateTimeOriginal → DateTimeOriginal for images; CreateDate for
240
+ * video/audio containers (QuickTime — see #750)
241
+ *
242
+ * @throws Error if `dateTimeOriginal` is present, non-null, and unparseable.
243
+ */
244
+ protected static buildMetadataWriteTags(patch: AssetMetadataPatch, mimeType: string): Record<string, unknown>;
245
+ /**
246
+ * @deprecated Use `normalizeExifDate` from `utils/assetMetadataTags`.
247
+ * Kept as a thin delegate so existing subclasses and tests keep working.
248
+ */
249
+ protected static normalizeExifDate(input: string): string;
250
+ /**
251
+ * Release any resources held by the provider (open file handles, worker
252
+ * processes, etc.).
253
+ */
254
+ abstract shutdown(): Promise<void>;
255
+ /** Stable provider identifier — override in subclasses. */
256
+ abstract readonly id: string;
257
+ /** Human-readable display name — override in subclasses. */
258
+ abstract readonly displayName: string;
259
+ /** Capabilities — override in subclasses. */
260
+ abstract readonly capabilities: import('../types/Asset.js').ProviderCapability[];
261
+ /**
262
+ * Convert a MediaItem to a schema.org-shaped CreativeWork (Slice 3 of #755).
263
+ *
264
+ * Discriminated by MIME prefix:
265
+ * - image/* → ImageObject
266
+ * - video/* → VideoObject
267
+ * - audio/* → AudioObject
268
+ * - anything else → ImageObject (best-effort; callers should filter
269
+ * by mime upstream if they only want media subtypes)
270
+ *
271
+ * Internal consumers read AssetRecord (see `toAssetRecord` below);
272
+ * this method produces the canonical shape for JSON-LD render (Slice 6)
273
+ * and for CatalogSource.get() / list() fan-out from CatalogManager.
274
+ * Subclasses may override for provider-specific URL schemes.
275
+ *
276
+ * Public so MediaManager (the registered `CatalogSource`) can call it
277
+ * without exposing `toAssetRecord`'s internal projection.
278
+ */
279
+ toCreativeWork(item: MediaItem): CreativeWork;
280
+ /**
281
+ * Convert a MediaItem to a unified AssetRecord.
282
+ * Subclasses may override for provider-specific URL schemes.
283
+ */
284
+ protected toAssetRecord(item: MediaItem): AssetRecord;
285
+ /**
286
+ * AssetProvider.search() — fans out to searchItems() and maps results.
287
+ */
288
+ search(query: AssetQuery): Promise<AssetPage>;
289
+ /**
290
+ * AssetProvider.getById() — delegates to getItem().
291
+ */
292
+ getById(id: string): Promise<AssetRecord | null>;
293
+ /**
294
+ * AssetProvider.getThumbnail() — delegates to getThumbnailBuffer().
295
+ * Default size "300x300" when not specified.
296
+ */
297
+ getThumbnail(id: string, size: string): Promise<Buffer | null>;
298
+ /**
299
+ * AssetProvider.store() — media providers are read-only; always throws.
300
+ * Declared to satisfy the interface typing; runtime guard via capabilities check.
301
+ */
302
+ store(_buffer: Buffer, _info: AssetInput): Promise<AssetRecord>;
303
+ /**
304
+ * AssetProvider.delete() — media providers are read-only; always returns false.
305
+ */
306
+ delete(_id: string): Promise<boolean>;
307
+ }
308
+ export default BaseMediaProvider;
@@ -0,0 +1,337 @@
1
+ import type { ProviderInfo, SavedPage, StoreDeletedEntry, StoreFileLocation, StorePageEntry } from '../types/Provider.js';
2
+ import { WikiPage, PageFrontmatter, PageInfo, PageSaveOptions, PageListOptions } from '../types/index.js';
3
+ import { VersionHistoryEntry, VersionContent, VersionDiff } from '../types/index.js';
4
+ import BaseProvider from './BaseProvider.js';
5
+ import { type PrivateStoreLayout } from '../utils/privateStorePath.js';
6
+ import { type StoreSearchDocument } from '../utils/storeSearchIndex.js';
7
+ import type { ActorContext } from '../context/ActorContext.js';
8
+ /**
9
+ * WikiEngine interface (simplified)
10
+ * TODO: Create full WikiEngine type definition in Phase 4
11
+ */
12
+ interface WikiEngine {
13
+ getManager<T = unknown>(name: string): T | undefined;
14
+ }
15
+ /**
16
+ * BasePageProvider - Abstract interface for page storage providers
17
+ *
18
+ * All page storage providers must extend this class and implement its methods.
19
+ * Providers handle the actual storage and retrieval of wiki pages, whether
20
+ * from filesystem, database, cloud storage, or other backends.
21
+ *
22
+ * This follows JSPWiki's provider pattern for pluggable storage backends.
23
+ *
24
+ * @class BasePageProvider
25
+ * @abstract
26
+ *
27
+ * @property {WikiEngine} engine - Reference to the wiki engine
28
+ * @property {boolean} initialized - Whether provider has been initialized
29
+ *
30
+ * @see {@link FileSystemProvider} for filesystem implementation
31
+ * @see {@link PageManager} for usage
32
+ *
33
+ * @example
34
+ * class MyProvider extends BasePageProvider {
35
+ * async initialize() {
36
+ * const config = this.engine.getManager('ConfigurationManager');
37
+ * this.storagePath = config.getProperty('myProvider.path');
38
+ * }
39
+ * async getPage(identifier: string) {
40
+ * // Implementation
41
+ * }
42
+ * }
43
+ */
44
+ declare abstract class BasePageProvider extends BaseProvider {
45
+ /** Reference to the wiki engine */
46
+ protected engine: WikiEngine;
47
+ /** Whether provider has been initialized */
48
+ protected initialized: boolean;
49
+ /**
50
+ * Private-store folder names (#1382). ConfigurationManager is the only
51
+ * source; {@link applyPrivateStoreLayout} reads them in `initialize()`.
52
+ * Defaults match `config/app-default-config.json`.
53
+ */
54
+ protected privateStoreLayout: PrivateStoreLayout;
55
+ /**
56
+ * Create a new page provider
57
+ *
58
+ * @constructor
59
+ * @param {WikiEngine} engine - The WikiEngine instance
60
+ * @throws {Error} If engine is not provided
61
+ */
62
+ constructor(engine: WikiEngine);
63
+ /**
64
+ * Read the private-store folder names from ConfigurationManager (via
65
+ * getProperty, not getResolvedDataPath — they are segments under the pages
66
+ * storagedir, joined by the helpers in `src/utils/privateStorePath.ts`).
67
+ */
68
+ protected applyPrivateStoreLayout(configManager: {
69
+ getProperty(key: string, defaultValue: unknown): unknown;
70
+ }): void;
71
+ /**
72
+ * Which store a private page is saved into — one rule for every page
73
+ * provider (docs/private-stores.md, Store placement): the store the
74
+ * save names, else the store the page is already in, else the configured
75
+ * default. A store id is a plain slug.
76
+ *
77
+ * A save that names a different store for a page that already exists is
78
+ * refused unless it is an explicit move (#1505: `moveFrom`), which takes
79
+ * the page and its history with it.
80
+ *
81
+ * @param requested - `metadata.store` from the save, if any
82
+ * @param existing - the store the page is in now, when it is an existing private page
83
+ * @param moving - the save is an explicit move to another store
84
+ */
85
+ protected resolvePrivatePageStore(requested: unknown, existing: string | undefined, moving?: boolean): string;
86
+ /**
87
+ * Refuse a write into an encrypted store this caller cannot write (#1394).
88
+ * The one check every page provider calls before writing private bytes; the
89
+ * keys are reached through the caller's context, never ambiently (P1).
90
+ */
91
+ protected assertPrivateStoreWritable(ctx: ActorContext, pagesDirectory: string, owner: string, store: string): Promise<void>;
92
+ /** A store's pages, keyed by uuid. A store with no pages yet has none. */
93
+ protected readStorePages(pagesDirectory: string, location: StoreFileLocation): Promise<Record<string, StorePageEntry>>;
94
+ protected writeStorePages(pagesDirectory: string, location: StoreFileLocation, pages: Record<string, StorePageEntry>): Promise<void>;
95
+ /** Add or replace one page in its store's index. */
96
+ protected putStorePage(pagesDirectory: string, location: StoreFileLocation, entry: StorePageEntry): Promise<void>;
97
+ /** Remove one page from its store's index; false when it was not listed. */
98
+ protected dropStorePage(pagesDirectory: string, location: StoreFileLocation, uuid: string): Promise<boolean>;
99
+ /**
100
+ * A store's pages, read synchronously as `ctx` may: null when the store is
101
+ * encrypted and `ctx` does not hold its key. Page lookups are synchronous,
102
+ * and the index is one small file (#1456).
103
+ */
104
+ protected readStorePagesSync(pagesDirectory: string, owner: string, store: string, ctx: ActorContext | undefined): Record<string, StorePageEntry> | null;
105
+ /** One entry of a store's pages by uuid, title or slug (case-insensitive for the last two). */
106
+ protected static findInStorePages(pages: Record<string, StorePageEntry>, key: string): StorePageEntry | null;
107
+ /**
108
+ * One page of a store, by uuid, title or slug (case-insensitive for the
109
+ * last two) — titles are unique within a store, never across the site.
110
+ */
111
+ protected findStorePage(pagesDirectory: string, location: StoreFileLocation, key: string): Promise<StorePageEntry | null>;
112
+ /** A store's tombstones, keyed by page uuid. A store that has never had a delete has none. */
113
+ protected readStoreDeleted(pagesDirectory: string, location: StoreFileLocation): Promise<Record<string, StoreDeletedEntry>>;
114
+ protected writeStoreDeleted(pagesDirectory: string, location: StoreFileLocation, deleted: Record<string, StoreDeletedEntry>): Promise<void>;
115
+ /** Record one tombstone in its store's trash. */
116
+ protected putStoreDeleted(pagesDirectory: string, location: StoreFileLocation, entry: StoreDeletedEntry): Promise<void>;
117
+ /** Take one tombstone out; the entry it removed, or null when there was none. */
118
+ protected dropStoreDeleted(pagesDirectory: string, location: StoreFileLocation, uuid: string): Promise<StoreDeletedEntry | null>;
119
+ /** Where the store's search index lives — for a caller that must look at the file itself. */
120
+ protected storeSearchFile(pagesDirectory: string, owner: string, store: string): string;
121
+ /** True when this store has a saved search index; false means it must be built. */
122
+ protected storeSearchIndexExists(pagesDirectory: string, owner: string, store: string): Promise<boolean>;
123
+ /** A store's search documents, keyed by page uuid. A store with no index yet has none. */
124
+ protected readStoreSearch(pagesDirectory: string, location: StoreFileLocation): Promise<Record<string, StoreSearchDocument>>;
125
+ protected writeStoreSearch(pagesDirectory: string, location: StoreFileLocation, documents: Record<string, StoreSearchDocument>): Promise<void>;
126
+ /** Add or replace one page's document in its store's search index. */
127
+ protected putStoreSearchDocument(pagesDirectory: string, location: StoreFileLocation, document: StoreSearchDocument): Promise<void>;
128
+ /** Remove one page's document; false when it was not there. */
129
+ protected dropStoreSearchDocument(pagesDirectory: string, location: StoreFileLocation, uuid: string): Promise<boolean>;
130
+ /**
131
+ * Initialize the provider with configuration
132
+ *
133
+ * IMPORTANT: Providers MUST access configuration via ConfigurationManager:
134
+ * const configManager = this.engine.getManager('ConfigurationManager');
135
+ * const value = configManager.getProperty('key', 'default');
136
+ *
137
+ * Do NOT read configuration files directly.
138
+ *
139
+ * @async
140
+ * @abstract
141
+ * @returns {Promise<void>}
142
+ * @throws {Error} Always throws - must be implemented by subclass
143
+ */
144
+ abstract initialize(): Promise<void>;
145
+ /**
146
+ * Get complete page with content and metadata
147
+ *
148
+ * @async
149
+ * @abstract
150
+ * @param {string} identifier - Page UUID, title, or slug
151
+ * @returns {Promise<WikiPage|null>} Page object or null if not found
152
+ * @throws {Error} Always throws - must be implemented by subclass
153
+ */
154
+ abstract getPage(identifier: string, ctx: ActorContext): Promise<WikiPage | null>;
155
+ /**
156
+ * Get only page content (without metadata)
157
+ *
158
+ * @async
159
+ * @abstract
160
+ * @param {string} identifier - Page UUID, title, or slug
161
+ * @returns {Promise<string>} Markdown content
162
+ * @throws {Error} Always throws - must be implemented by subclass
163
+ */
164
+ abstract getPageContent(identifier: string, ctx: ActorContext): Promise<string>;
165
+ /**
166
+ * Get only page metadata (without content)
167
+ *
168
+ * @async
169
+ * @abstract
170
+ * @param {string} identifier - Page UUID, title, or slug
171
+ * @returns {Promise<PageFrontmatter|null>} Metadata object or null if not found
172
+ * @throws {Error} Always throws - must be implemented by subclass
173
+ */
174
+ abstract getPageMetadata(identifier: string, ctx: ActorContext): Promise<PageFrontmatter | null>;
175
+ /**
176
+ * Save page content and metadata
177
+ *
178
+ * @async
179
+ * @abstract
180
+ * @param {string} pageName - Page title
181
+ * @param {string} content - Markdown content
182
+ * @param {Partial<PageFrontmatter>} metadata - Frontmatter metadata
183
+ * @param ctx - Who is writing (#1179): the request's subject, or a JobContext. Mandatory and positional — a store write reaches this caller's keys through it (#1382)
184
+ * @param {PageSaveOptions} options - Save options
185
+ * @returns {Promise<void>}
186
+ * @throws {Error} Always throws - must be implemented by subclass
187
+ */
188
+ abstract savePage(pageName: string, content: string, metadata: Partial<PageFrontmatter> | undefined, ctx: ActorContext, options?: PageSaveOptions): Promise<SavedPage>;
189
+ /**
190
+ * Delete a page
191
+ * @param {string} identifier - Page UUID or title
192
+ * @param ctx - Who is deleting (#1179). Names the deleter on the record and reaches a private store's keys (#1382)
193
+ * @returns {Promise<boolean>} True if deleted, false if not found
194
+ */
195
+ abstract deletePage(identifier: string, ctx: ActorContext): Promise<boolean>;
196
+ invalidatePageCache(_identifier: string): string | null;
197
+ getPageUUID(_identifier: string, _ctx: ActorContext): string | null;
198
+ /**
199
+ * Check if page exists
200
+ * @param {string} identifier - Page UUID or title
201
+ * @returns {boolean}
202
+ */
203
+ abstract pageExists(identifier: string, ctx: ActorContext): boolean;
204
+ /**
205
+ * Get all page titles
206
+ * @returns {Promise<string[]>} Sorted array of page titles
207
+ */
208
+ abstract getAllPages(): Promise<string[]>;
209
+ /**
210
+ * Get all page titles (explicit alias for getAllPages)
211
+ * Prefer this for new code that only needs page names.
212
+ * Use getAllPageInfo() when you need uuid/slug/author etc.
213
+ * @returns {Promise<string[]>} Sorted array of page titles
214
+ */
215
+ getAllPageNames(): Promise<string[]>;
216
+ /**
217
+ * Get all page info objects
218
+ * @param {PageListOptions} options - List options
219
+ * @returns {Promise<PageInfo[]>} Array of page info objects
220
+ */
221
+ abstract getAllPageInfo(options?: PageListOptions): Promise<PageInfo[]>;
222
+ /**
223
+ * Find page by various identifiers
224
+ * @param {string} identifier - UUID, title, or slug
225
+ * @returns {string|null} Canonical page title or null
226
+ */
227
+ abstract findPage(identifier: string): string | null;
228
+ /**
229
+ * Get a page by its UUID
230
+ * @param {string} uuid - Page UUID
231
+ * @returns {Promise<WikiPage | null>} Page or null if not found
232
+ */
233
+ abstract getPageByUUID(uuid: string, ctx: ActorContext): Promise<WikiPage | null>;
234
+ /**
235
+ * Get a page by its slug
236
+ * @param {string} slug - URL-friendly slug
237
+ * @returns {Promise<WikiPage | null>} Page or null if not found
238
+ */
239
+ abstract getPageBySlug(slug: string, ctx: ActorContext): Promise<WikiPage | null>;
240
+ /**
241
+ * Refresh internal cache/index
242
+ * Re-scans storage and rebuilds indexes
243
+ * @returns {Promise<void>}
244
+ */
245
+ abstract refreshPageList(): Promise<void>;
246
+ /**
247
+ * Get version history for a page
248
+ *
249
+ * Returns an array of version metadata entries for the specified page.
250
+ * Providers that don't support versioning should not implement this method.
251
+ *
252
+ * @param {string} identifier - Page UUID or title
253
+ * @param {number} limit - Maximum number of versions to return
254
+ * @returns {Promise<VersionHistoryEntry[]>} Array of version history entries
255
+ * @example
256
+ * // Returns:
257
+ * [
258
+ * {
259
+ * version: 1,
260
+ * timestamp: "2025-01-01T00:00:00.000Z",
261
+ * author: "user@example.com",
262
+ * changeType: "create",
263
+ * message: "Initial version",
264
+ * contentSize: 1234,
265
+ * compressed: false
266
+ * },
267
+ * {
268
+ * version: 2,
269
+ * timestamp: "2025-01-02T10:30:00.000Z",
270
+ * author: "editor@example.com",
271
+ * changeType: "update",
272
+ * message: "Added section",
273
+ * contentSize: 567,
274
+ * compressed: false
275
+ * }
276
+ * ]
277
+ */
278
+ getVersionHistory(_identifier: string, _ctx: ActorContext, _limit?: number): Promise<VersionHistoryEntry[]>;
279
+ /**
280
+ * Get a specific version of a page
281
+ *
282
+ * Retrieves the content and metadata for a specific version number.
283
+ * For delta-based storage, this reconstructs the content by applying diffs.
284
+ *
285
+ * @param {string} identifier - Page UUID or title
286
+ * @param {number} version - Version number to retrieve
287
+ * @returns {Promise<VersionContent>} Version content and metadata
288
+ * @throws {Error} If version does not exist
289
+ */
290
+ getPageVersion(_identifier: string, _version: number, _ctx: ActorContext): Promise<VersionContent>;
291
+ /**
292
+ * Compare two versions of a page
293
+ *
294
+ * Generates a diff between two versions showing what changed.
295
+ * Returns structured diff data suitable for rendering.
296
+ *
297
+ * @param {string} identifier - Page UUID or title
298
+ * @param {number} v1 - First version number (older)
299
+ * @param {number} v2 - Second version number (newer)
300
+ * @returns {Promise<VersionDiff>} Diff data structure
301
+ */
302
+ compareVersions(_identifier: string, _v1: number, _v2: number, _ctx: ActorContext): Promise<VersionDiff>;
303
+ /**
304
+ * Purge old versions based on retention policy
305
+ *
306
+ * Removes old versions according to configuration settings (maxVersions, retentionDays).
307
+ * Always preserves v1 (needed for delta reconstruction) and recent versions.
308
+ *
309
+ * @param {string} identifier - Page UUID or title
310
+ * @param options - Purge options (keepLatest, retentionDays, keepMilestones, dryRun)
311
+ * @returns Purge result with versionsRemoved, versionsPurged, dryRun, spaceFreed, message
312
+ */
313
+ purgeOldVersions(_identifier: string, _options?: {
314
+ keepLatest?: number;
315
+ retentionDays?: number;
316
+ keepMilestones?: boolean;
317
+ dryRun?: boolean;
318
+ }): Promise<{
319
+ versionsRemoved: number;
320
+ versionsPurged: number[];
321
+ dryRun: boolean;
322
+ spaceFreed: number;
323
+ message: string;
324
+ }>;
325
+ /**
326
+ * Get provider information
327
+ * @returns {ProviderInfo} Provider metadata
328
+ */
329
+ getProviderInfo(): ProviderInfo;
330
+ /**
331
+ * Shutdown the provider (cleanup resources)
332
+ * @returns {Promise<void>}
333
+ */
334
+ shutdown(): void;
335
+ }
336
+ export default BasePageProvider;
337
+ export { WikiEngine, ProviderInfo };