@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,168 @@
1
+ // GENERATED FILE — do not edit.
2
+ // Source: config/app-default-config.json → ngdpbase.audit.events and ngdpbase.permissions.definitions.*.audit
3
+ // Regenerate: npm run generate:permissions
4
+ //
5
+ // Every audit event core declares, as code (#1201, #1638). An emitter names
6
+ // one as AUDIT_EVENT.KEY, so a typo is a compile error. Import from
7
+ // ./auditEventNames.js, not from this file.
8
+ /** The `{target}-{action}` convention: target first, hyphens only (#1201). */
9
+ export const AUDIT_EVENT_NAME_PATTERN = /^[a-z]+(-[a-z]+)+$/;
10
+ /** Every audit event core declares, keyed by the name upper-cased with underscores. */
11
+ export const AUDIT_EVENT = {
12
+ /** An add-on named in ngdpbase.addons.install installed into the data folder: package, version, sha512 and the repository its provenance names; recorded before it is written, which cannot proceed without it (#1830) */
13
+ ADDON_INSTALL: 'addon-install',
14
+ /** An installed add-on moved to another version by an administrator's Update: who, and from which version to which (#1830; the Update action is not built yet) */
15
+ ADDON_UPDATE: 'addon-update',
16
+ /** An add-on refused or set aside by a check: its sha512, provenance, tarball contents, package.json, the lock file, or a changed installed folder (#1830) */
17
+ ADDON_VERIFY_FAILED: 'addon-verify-failed',
18
+ /** Admin dashboard read; not recorded, read volume */
19
+ ADMIN_READ: 'admin-read',
20
+ /** File deleted; destruction */
21
+ ASSET_DELETE: 'asset-delete',
22
+ /** Attachment metadata edited; EXIF/IPTC and catalog fields change provenance */
23
+ ASSET_EDIT: 'asset-edit',
24
+ /** Attachment read; not recorded, read volume */
25
+ ASSET_READ: 'asset-read',
26
+ /** File uploaded */
27
+ ASSET_UPLOAD: 'asset-upload',
28
+ /** Hash chain restarted, with the reason; the marker is the action and cannot half-complete */
29
+ AUDIT_CHAIN_RESTART: 'audit-chain-restart',
30
+ /** The audit trail exported to a file; who took a copy, in what format, with what filter */
31
+ AUDIT_EXPORT: 'audit-export',
32
+ /** Sign-in failed */
33
+ AUTHENTICATION_FAILED: 'authentication-failed',
34
+ /** User signed out */
35
+ AUTHENTICATION_LOGOUT: 'authentication-logout',
36
+ /** Sign-in succeeded */
37
+ AUTHENTICATION_SUCCESS: 'authentication-success',
38
+ /** Access granted; emitter exists, nothing in production calls it */
39
+ AUTHORIZATION_ALLOW: 'authorization-allow',
40
+ /** Access denied */
41
+ AUTHORIZATION_DENY: 'authorization-deny',
42
+ /** A full backup written; where it went and who asked */
43
+ BACKUP_CREATE: 'backup-create',
44
+ /** Comment added to a page — user content written on someone's behalf, the page-edit class (#1232) */
45
+ COMMENT_CREATE: 'comment-create',
46
+ /** Comment marked deleted; who removed it and whose it was (#1232) */
47
+ COMMENT_DELETE: 'comment-delete',
48
+ /** Configuration changed by an administrator; standard so a broken audit configuration can still be repaired from the UI */
49
+ CONFIG_CHANGE: 'config-change',
50
+ /** Every custom configuration value discarded; recorded before the reset, which cannot proceed without it */
51
+ CONFIG_RESET: 'config-reset',
52
+ /** A page's footnote list changed — action add, import, transfer, update or delete; page content written on someone's behalf (#1233) */
53
+ FOOTNOTE_EDIT: 'footnote-edit',
54
+ /** A background job finished successfully */
55
+ JOB_COMPLETED: 'job-completed',
56
+ /** A background job failed */
57
+ JOB_FAILED: 'job-failed',
58
+ /** A scheduled run stopped by shutdown and handed to the next start, which resumes it */
59
+ JOB_INTERRUPTED: 'job-interrupted',
60
+ /** An administrator retried a scheduled run now instead of at its retry time */
61
+ JOB_RETRY: 'job-retry',
62
+ /** A scheduled job's rule changed; its slots are counted again from then */
63
+ JOB_SCHEDULE_CHANGE: 'job-schedule-change',
64
+ /** Scheduled slots a job passed over, by its catch-up or overlap rule */
65
+ JOB_SKIPPED: 'job-skipped',
66
+ /** A background job started, and who asked for it */
67
+ JOB_STARTED: 'job-started',
68
+ /** A manager changed state: degraded, disabled, failed or recovered */
69
+ MANAGER_STATE_CHANGE: 'manager-state-change',
70
+ /** OpenID Connect: an app's sign-in request was allowed and a code issued (#1575) */
71
+ OIDCAUTHORIZE_ALLOW: 'oidcauthorize-allow',
72
+ /** OpenID Connect: an app's sign-in request was refused (denied consent, sign-in required, bad request) */
73
+ OIDCAUTHORIZE_DENY: 'oidcauthorize-deny',
74
+ /** OpenID Connect: an app's grant and every token under it were revoked */
75
+ OIDCGRANT_REVOKE: 'oidcgrant-revoke',
76
+ /** OpenID Connect: the provider failed while handling a request */
77
+ OIDCSERVER_ERROR: 'oidcserver-error',
78
+ /** OpenID Connect: the token endpoint refused an app's request */
79
+ OIDCTOKEN_ERROR: 'oidctoken-error',
80
+ /** OpenID Connect: tokens issued to an app, with the grant type that earned them */
81
+ OIDCTOKEN_ISSUE: 'oidctoken-issue',
82
+ /** OpenID Connect: a used code or refresh token was presented again; its grant was revoked (possible replay) */
83
+ OIDCTOKEN_REUSE: 'oidctoken-reuse',
84
+ /** OpenID Connect: an access or refresh token was destroyed */
85
+ OIDCTOKEN_REVOKE: 'oidctoken-revoke',
86
+ /** OpenID Connect: UserInfo refused a request (bad, expired or revoked token, unknown account) */
87
+ OIDCUSERINFO_ERROR: 'oidcuserinfo-error',
88
+ /** Page created */
89
+ PAGE_CREATE: 'page-create',
90
+ /** Page deleted; destruction, so the record must outlive the page */
91
+ PAGE_DELETE: 'page-delete',
92
+ /** Page edited */
93
+ PAGE_EDIT: 'page-edit',
94
+ /** Page exported to a file; bulk extraction of content, gated on read until a bulk surface exists */
95
+ PAGE_EXPORT: 'page-export',
96
+ /** Inbound links rewritten after a rename */
97
+ PAGE_LINK_REWRITE: 'page-link-rewrite',
98
+ /** Page edited through the admin raw editor */
99
+ PAGE_RAW_EDIT: 'page-raw-edit',
100
+ /** Page read; off by default so a general-purpose deployment does not drown its log in reads. On, a records-style deployment gets who looked at what (#1129) */
101
+ PAGE_READ: 'page-read',
102
+ /** Page renamed */
103
+ PAGE_RENAME: 'page-rename',
104
+ /** Security policy evaluated; emitter exists, nothing in production calls it */
105
+ POLICY_EVALUATE: 'policy-evaluate',
106
+ /** Security posture at startup, compared against the previous start */
107
+ POSTURE_RECORDED: 'posture-recorded',
108
+ /** Proxy grant made: someone may act for the person named in user; actor is who made it (#1762) */
109
+ PROXY_GRANT: 'proxy-grant',
110
+ /** Proxy grant ended: revoked, or the account closed; user is the person represented, actor who ended it (#1762) */
111
+ PROXY_REVOKE: 'proxy-revoke',
112
+ /** A signed-in session started or stopped acting for someone under a proxy grant, or opens their private store: chosen, switched-back, ended because the grant no longer allows it (grant-ended, proxy-access-off), or vault-opened; user is the person represented, actor the person signed in (#1762) */
113
+ PROXY_SWITCH: 'proxy-switch',
114
+ /** Step-up: a re-authentication failed (wrong password, another person's passkey, throttled) */
115
+ REAUTH_FAILURE: 'reauth-failure',
116
+ /** Step-up: an action asked for a fresh sign-in (#1525) — or refused a delegated credential that cannot give one */
117
+ REAUTH_PROMPT: 'reauth-prompt',
118
+ /** Step-up: the person re-authenticated, with the factor used */
119
+ REAUTH_SUCCESS: 'reauth-success',
120
+ /** Page search; not recorded, read volume */
121
+ SEARCH_PAGE: 'search-page',
122
+ /** People searched for; enumerating people is disclosive in a way searching pages is not. Off by default as read volume */
123
+ SEARCH_USER: 'search-user',
124
+ /** A masked configuration value shown to an administrator; the key is recorded, never the value */
125
+ SECRET_REVEAL: 'secret-reveal',
126
+ /** Security violation detected; the kind is in metadata.securityEventType */
127
+ SECURITY_EVENT: 'security-event',
128
+ /** Anonymous sessions cleared */
129
+ SESSION_CLEAR_ANONYMOUS: 'session-clear-anonymous',
130
+ /** Session revoked by an administrator */
131
+ SESSION_REVOKE: 'session-revoke',
132
+ /** Share link used; batched counts for keyword links, one record per page or file opened through a vault link (#1388) */
133
+ SHARE_ACCESS: 'share-access',
134
+ /** Share link created; mints an anonymous-access credential, the same shape as token-mint */
135
+ SHARE_CREATE: 'share-create',
136
+ /** Share link's lifetime extended by its issuer, by up to 24 hours (#1388) */
137
+ SHARE_EXTEND: 'share-extend',
138
+ /** Share link revoked; pairs with token-revoke */
139
+ SHARE_REVOKE: 'share-revoke',
140
+ /** A user's private store copy created at its door (#1414) — with key material when sealed; never the words or a key in the record */
141
+ STORE_CREATE: 'store-create',
142
+ /** A takeout imported into its owner's private store; a bulk write — who, which store, pages and files written or skipped */
143
+ STORE_IMPORT: 'store-import',
144
+ /** A whole private store downloaded by its owner, DECRYPTED; who took it, which store, and how much left */
145
+ STORE_TAKEOUT: 'store-takeout',
146
+ /** Instance shut down cleanly; its absence before the next start is the signal */
147
+ SYSTEM_SHUTDOWN: 'system-shutdown',
148
+ /** Instance started; reports whether the previous run ended cleanly */
149
+ SYSTEM_START: 'system-start',
150
+ /** Agent token's expiry moved later by its owner; carries the old and new expiry (#1734) */
151
+ TOKEN_EXTEND: 'token-extend',
152
+ /** Agent token minted; a credential nobody knows exists is the worst case */
153
+ TOKEN_MINT: 'token-mint',
154
+ /** Agent token revoked */
155
+ TOKEN_REVOKE: 'token-revoke',
156
+ /** Account created; by an administrator, by self-registration, or provisioned by an identity provider */
157
+ USER_CREATE: 'user-create',
158
+ /** Account deleted; destruction of an identity and its attribution, recorded before the delete */
159
+ USER_DELETE: 'user-delete',
160
+ /** Account changed in a way that alters what it may do or who holds it: roles, password, active, external, email, profile lock. Preference edits are not recorded */
161
+ USER_EDIT: 'user-edit',
162
+ /** User profile read; not recorded, read volume */
163
+ USER_READ: 'user-read',
164
+ /** Not an action: read from a proxy grant at the vault door; the grant itself is recorded as proxy-grant */
165
+ VAULT_PROXY: 'vault-proxy',
166
+ /** A vault page's leftovers moved into its vault (#1842): its shared-pool files (moved, or copied where other public pages use them) and its footnotes and comments from the public folders. Names the owner, vault and page uuid and the counts, never a title or file name. Run by the vault's owner, or for a vault that isn't sealed by someone holding admin-system */
167
+ VAULT_REPAIR: 'vault-repair'
168
+ };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Every audit event name, in code (#1201, #1638, epic #1208).
3
+ *
4
+ * Configuration declares the names (`ngdpbase.audit.events`). Core's names are
5
+ * generated from `config/app-default-config.json` into
6
+ * `auditEventNames.generated.ts` by `npm run generate:permissions`, and
7
+ * `npm run lint:permissions` fails when that file is stale, so there is one
8
+ * declaration and no hand-kept list. `AuditEvent.eventType` is typed, so a
9
+ * core emitter cannot compile with a name configuration does not declare; a
10
+ * rename is one edit in configuration plus a regeneration, and the compiler
11
+ * finds every call site.
12
+ *
13
+ * An addon declares its own events in its `config/default-config.json`; they
14
+ * reach the registry through the configuration merge while the addon is
15
+ * enabled (addonConfigLayer.ts). The generated union cannot name them, and
16
+ * widening it to `string` would let a core typo compile again. So an addon
17
+ * names its event through {@link addonAuditEventName}, which brands a checked
18
+ * string, and `recordAuditEvent` refuses — throws — a branded name the merged
19
+ * registry does not declare. Core typing stays exactly as strict as before.
20
+ *
21
+ * Convention: `{target}-{action}`, hyphens only, URL-safe, sharing the slug of
22
+ * the permission whose action it records (`page-read` authorizes; `page-read`
23
+ * records). The containing map says which is meant.
24
+ */
25
+ import { AUDIT_EVENT, AUDIT_EVENT_NAME_PATTERN } from './auditEventNames.generated.js';
26
+ export { AUDIT_EVENT, AUDIT_EVENT_NAME_PATTERN };
27
+ /** Every core name, sorted, for tests and tooling. */
28
+ export function auditEventNames() {
29
+ return Object.values(AUDIT_EVENT).sort();
30
+ }
31
+ const CORE_NAMES = new Set(Object.values(AUDIT_EVENT));
32
+ /** Is this one of the names core declares (and so one the generated union admits)? */
33
+ export function isCoreAuditEventName(name) {
34
+ return CORE_NAMES.has(name);
35
+ }
36
+ /**
37
+ * Name an addon's audit event. Throws on a name outside `{target}-{action}`.
38
+ *
39
+ * Whether the name is declared is checked when the event is recorded, not
40
+ * here: the registry is bound when AuditManager initialises, which may be
41
+ * after the addon module loads. `lint:audit` reads the literal passed here as
42
+ * the addon's emitter, so pass a string literal.
43
+ */
44
+ export function addonAuditEventName(name) {
45
+ if (!AUDIT_EVENT_NAME_PATTERN.test(name)) {
46
+ throw new Error(`Audit event '${name}' is not a {target}-{action} name (hyphens only).`);
47
+ }
48
+ return name;
49
+ }
@@ -0,0 +1,265 @@
1
+ /**
2
+ * Audit event builders for content mutations (#1080).
3
+ *
4
+ * `AuditManager` was already mature — file provider with rotation, 90-day
5
+ * retention, search, stats, export, and an admin UI — but almost nothing
6
+ * called it. Outside the manager the only `logAuditEvent` call sites were
7
+ * `page-delete`, admin raw-edit, two session operations, and share
8
+ * issue/revoke. Ordinary page create, edit, and rename, and every attachment
9
+ * upload and delete, produced no audit record at all.
10
+ *
11
+ * That left "who changed this page, when, and through what?" answerable only
12
+ * from a version manifest: per-page, not queryable across pages, and present
13
+ * only when the deployment runs `versioningfileprovider` (the shipped default
14
+ * is `filesystemprovider`, which keeps no versions). There was no way to ask
15
+ * "everything this agent token wrote last Tuesday" — which is exactly the
16
+ * question agent tokens (#946) make worth asking, since a token writes
17
+ * unattended and the version manifest records only a username.
18
+ *
19
+ * These are pure builders so the event *shape* can be tested without an
20
+ * engine, a request, or a manager. The shape is the contract: `#1082` reads
21
+ * `page-rename`'s `fromPageName`/`pageName` pair to resolve a link that
22
+ * points at a page's former title, so those two fields are load-bearing
23
+ * rather than descriptive.
24
+ */
25
+ import { type RecordableAuditEventName } from './auditEventNames.js';
26
+ import type { ProxyClaim } from '../managers/UserManager.js';
27
+ /** Agent-token identity attached to a request that authenticated with one. */
28
+ export interface AuditViaToken {
29
+ id?: string;
30
+ name?: string;
31
+ }
32
+ /** The subset of `AuditManager` these helpers need. */
33
+ export interface AuditEventSink {
34
+ logAuditEvent?: (event: Record<string, unknown>) => Promise<string>;
35
+ /**
36
+ * Force queued records to storage (#1121).
37
+ *
38
+ * Named for the method AuditManager actually has. An earlier draft called it
39
+ * `flush`, which nothing implements — so every critical event would have
40
+ * refused in production while the tests passed. Third time this exact
41
+ * mismatch has bitten in this issue chain.
42
+ *
43
+ * Optional because not every sink batches, but a sink WITHOUT it cannot
44
+ * promise durability, so a critical event refuses rather than reporting a
45
+ * guarantee the system does not have.
46
+ */
47
+ flushAuditQueue?: () => Promise<void>;
48
+ }
49
+ export type AuditSeverity = 'low' | 'medium' | 'high';
50
+ /**
51
+ * The result vocabulary, as a runtime value (#1237).
52
+ *
53
+ * The type alone could not be offered as filter options, so the audit page
54
+ * hand-kept its own list — and it offered `allow`, `deny`, `error` while the
55
+ * log holds `success` (5,859), `deny` (896) and `failure` (79). Two of the
56
+ * three options matched zero records and the largest value was unfilterable.
57
+ * Exactly the #1115 failure, one field over.
58
+ */
59
+ export declare const AUDIT_RESULTS: readonly ["success", "failure", "allow", "deny", "error", "logout"];
60
+ export type AuditResult = typeof AUDIT_RESULTS[number];
61
+ export interface AuditEvent {
62
+ /** A core name (`AUDIT_EVENT.KEY`), or an addon's name from `addonAuditEventName` (#1638). */
63
+ eventType: RecordableAuditEventName;
64
+ user: string;
65
+ /**
66
+ * Who actually did it, when that is not `user` (#1762): `user` is the
67
+ * account acted on — the person represented — and `actor` the person
68
+ * signed in. Absent on a row with no proxy claim, never a copy of `user`.
69
+ * Comes from `actorOf` / `proxyAttribution` (slice 3); the proxy-grant
70
+ * events also set it for the person who made or ended the grant (slice 1).
71
+ * The audit search filters on it (`?actor=`).
72
+ */
73
+ actor?: string;
74
+ ipAddress: string | undefined;
75
+ action: string;
76
+ /** How it went. Mutations record `success`; decisions record `allow` / `deny`; sign-in records `failure` / `logout`. */
77
+ result: AuditResult;
78
+ severity: AuditSeverity;
79
+ metadata: Record<string, unknown>;
80
+ /** What the action was about, where there is a single subject (a share id, a page). */
81
+ resource?: string;
82
+ resourceType?: string;
83
+ /** Why, for a decision or a refusal. */
84
+ reason?: string;
85
+ /** The session the action ran in, where one is known. */
86
+ sessionId?: string;
87
+ }
88
+ /**
89
+ * `link-rewrite` is a machine write, not a human one (#1094): when a page is
90
+ * renamed, the referring pages have their `[Old Title]` links rewritten. It is
91
+ * a distinct op so a reader of the history can tell why a page they did not
92
+ * edit changed, and so those writes can be excluded from "who is editing what"
93
+ * queries without having to guess from the content.
94
+ */
95
+ export type PageMutationOp = 'create' | 'edit' | 'rename' | 'link-rewrite';
96
+ export type AttachmentOp = 'upload' | 'delete';
97
+ export type TokenOp = 'mint' | 'revoke' | 'extend';
98
+ interface CommonInput {
99
+ username: string | undefined;
100
+ ipAddress: string | undefined;
101
+ viaToken?: AuditViaToken | null;
102
+ /**
103
+ * The proxy grant the request acted under (#1762 slice 3). Forwarded from the
104
+ * caller's context beside `viaToken`, never rebuilt: the row then names the
105
+ * represented person in `user` and the person who acted in `actor`.
106
+ */
107
+ viaProxy?: ProxyClaim | null;
108
+ }
109
+ export interface PageMutationInput extends CommonInput {
110
+ op: PageMutationOp;
111
+ pageName: string;
112
+ uuid: string | null | undefined;
113
+ /** Previous title. Only meaningful for `rename`; ignored otherwise. */
114
+ fromPageName?: string | null;
115
+ /**
116
+ * The rename that caused a `link-rewrite`. Ignored for every other op — the
117
+ * page being rewritten did not itself change title, so `fromPageName` would
118
+ * be the wrong field to carry it.
119
+ */
120
+ rewriteOf?: {
121
+ from: string;
122
+ to: string;
123
+ } | null;
124
+ }
125
+ export interface TokenInput extends CommonInput {
126
+ op: TokenOp;
127
+ /** Token id — the handle every later question about this credential uses. */
128
+ id: string;
129
+ /** Whose token it is, which is not always who acted: an admin may revoke. */
130
+ owner: string;
131
+ /** Operator-supplied label. Optional; a token need not be named. */
132
+ name?: string | null;
133
+ /** Only meaningful for `mint`; ignored otherwise. */
134
+ scopes?: readonly string[];
135
+ /** The expiry granted: meaningful for `mint` and `extend`; ignored otherwise. */
136
+ expiresAt?: string;
137
+ /** The expiry before an `extend` (#1734); ignored otherwise. */
138
+ previousExpiresAt?: string;
139
+ /** Only meaningful for `revoke`; ignored otherwise. */
140
+ revokedBy?: string;
141
+ }
142
+ export interface AttachmentInput extends CommonInput {
143
+ op: AttachmentOp;
144
+ attachmentId: string;
145
+ filename: string;
146
+ pageName?: string | null;
147
+ sizeBytes?: number | null;
148
+ }
149
+ /**
150
+ * Build the audit event for a page create, edit, rename, or link rewrite.
151
+ *
152
+ * `result` is always `success`: these are recorded *after* the write lands,
153
+ * unlike `page-delete`, which logs `attempted` before unlinking so that a
154
+ * crash mid-delete still leaves a trace. A create or edit has the page file
155
+ * and its version history as its own record, so recording the attempt buys
156
+ * nothing the file does not already say.
157
+ */
158
+ export declare function buildPageMutationAuditEvent(input: PageMutationInput): AuditEvent;
159
+ export interface PageViewInput extends CommonInput {
160
+ pageName: string;
161
+ uuid: string | null | undefined;
162
+ }
163
+ /**
164
+ * Build the audit event for a page view (#1129).
165
+ *
166
+ * Emission is a deployment posture: `page-read` ships `enabled: false` in
167
+ * `ngdpbase.audit.events` (#1203), and `recordAuditEvent` honours the switch.
168
+ * Off, a general-purpose deployment does not drown its log in reads; on, a
169
+ * records-style deployment gets the access accounting — who looked at what —
170
+ * that read auditing exists for.
171
+ */
172
+ export declare function buildPageViewAuditEvent(input: PageViewInput): AuditEvent;
173
+ /**
174
+ * Build the audit event for an attachment upload or delete.
175
+ *
176
+ * A delete outranks an upload because it is the one that loses data, and a
177
+ * token-driven delete matches `page-delete`'s `high` for the same reason:
178
+ * unattended destruction is the case someone reviewing the log is looking for.
179
+ */
180
+ export declare function buildAttachmentAuditEvent(input: AttachmentInput): AuditEvent;
181
+ /**
182
+ * Send an event to the audit sink, best-effort.
183
+ *
184
+ * Never throws and never rejects. By the time this runs the mutation it
185
+ * describes has already committed, so surfacing a logging failure would turn
186
+ * a successful save into an error response and invite a destructive retry.
187
+ * A missing or unconfigured `AuditManager` is a no-op for the same reason.
188
+ */
189
+ /**
190
+ * Audit writes that were attempted and lost (#1109).
191
+ *
192
+ * Every audit write here is fire-and-forget with a caught error, deliberately:
193
+ * losing the log is bad, but refusing a page save or a token mint because the
194
+ * log failed is worse. The consequence is that a request can land its write and
195
+ * lose its audit entry — a page edited with no history, or a credential minted
196
+ * with no record it exists.
197
+ *
198
+ * That trade is defensible. What is not is leaving its only trace in a
199
+ * `logger.warn` nobody reads: an accepted risk nobody can see is
200
+ * indistinguishable from an unnoticed bug. So the drops are counted, the last
201
+ * one is described, and the count is surfaced where an operator already looks.
202
+ */
203
+ export interface AuditDropStats {
204
+ /** Audit writes attempted and lost since boot. */
205
+ dropped: number;
206
+ /** `eventType` of the most recent loss, or null. */
207
+ lastEventType: string | null;
208
+ /** Message of the most recent failure, or null. */
209
+ lastError: string | null;
210
+ /** ISO timestamp of the most recent loss, or null. */
211
+ lastAt: string | null;
212
+ }
213
+ /** Audit writes lost since boot. Read-only snapshot. */
214
+ export declare function getAuditDropStats(): AuditDropStats;
215
+ /** Reset the counter. For tests; nothing in the running app calls this. */
216
+ export declare function resetAuditDropStats(): void;
217
+ /**
218
+ * Record an audit event, honouring its on-failure rule (#1121, #1218).
219
+ *
220
+ * __Standard__ events are fire-and-forget with a caught error, per the #1109
221
+ * decision: losing the log is bad, but refusing a page save because the log
222
+ * failed is worse.
223
+ *
224
+ * __Critical__ events reverse that. The record IS the evidence — a credential
225
+ * minted with nothing saying it exists is the case this exists for — so the
226
+ * write is flushed to storage and a failure REJECTS, letting the caller
227
+ * abandon the action. "Durable before the action completes" is not satisfied by
228
+ * a queue that flushes on a timer, because the process can die in between.
229
+ */
230
+ /**
231
+ * What became of a record (#1205). Never silent: a caller can tell "recorded"
232
+ * from "switched off in configuration" from "no sink on this instance".
233
+ *
234
+ * - `recorded` — the sink accepted it (and, for a refuse-on-failure event, flushed it)
235
+ * - `not-enabled` — `enabled: false` in `ngdpbase.audit.events`; a decision on the record
236
+ * - `no-sink` — auditing is off or not yet initialised; visible through #1118's posture
237
+ * - `dropped` — the sink failed on a continue-on-failure event; counted in the drop statistics
238
+ *
239
+ * An event declared on-failure: refuse that cannot be recorded does not
240
+ * return: it throws, so the caller abandons the action.
241
+ */
242
+ export type AuditRecordOutcome = 'recorded' | 'not-enabled' | 'no-sink' | 'dropped';
243
+ export declare function recordAuditEvent(sink: AuditEventSink | null | undefined, event: AuditEvent, onError?: (err: unknown) => void): Promise<AuditRecordOutcome>;
244
+ /**
245
+ * Build the audit event for an agent token mint, extend or revoke (#1111, #1734).
246
+ *
247
+ * Before this, the token store was the only record that a credential had ever
248
+ * existed — and `purgeExpired()` claimed otherwise in a comment ("Audit is
249
+ * unaffected") while nothing emitted anything. That made `retention-days`
250
+ * load-bearing by accident: hash-bearing records were kept a month past
251
+ * usefulness purely so somebody could answer "what could this token do, and
252
+ * who stopped it?" With the lifecycle audited, the store can keep only what it
253
+ * needs to authenticate.
254
+ *
255
+ * Emitted from the manager rather than the route, unlike `page.*`. A page
256
+ * mutation logged at the HTTP layer misses an internal caller and that is
257
+ * survivable; an unaudited mint is a credential nobody knows exists.
258
+ *
259
+ * `scopes` appear on a mint only, `expiresAt` on a mint and an extend (with
260
+ * `previousExpiresAt` on an extend, #1734), and `revokedBy` on a revoke only —
261
+ * the same rule `page-rename` follows for `fromPageName`. A field present on
262
+ * every event is useless as a filter.
263
+ */
264
+ export declare function buildTokenAuditEvent(input: TokenInput): AuditEvent;
265
+ export {};