@jwilleke/ngdpbase-types 0.0.0 → 5.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +16 -2
  3. package/lib/packages/ngdpbase-types/index.d.ts +32 -0
  4. package/lib/packages/ngdpbase-types/testing.d.ts +43 -0
  5. package/lib/packages/ngdpbase-types/testing.js +53 -0
  6. package/lib/src/cache/CacheDependencies.d.ts +50 -0
  7. package/lib/src/cache/CacheDependencies.js +50 -0
  8. package/lib/src/cache/ICacheAdapter.d.ts +86 -0
  9. package/lib/src/cache/RegionCache.d.ts +171 -0
  10. package/lib/src/context/ActorContext.d.ts +48 -0
  11. package/lib/src/context/ActorContext.js +33 -0
  12. package/lib/src/context/ApiContext.d.ts +194 -0
  13. package/lib/src/context/ApiContext.js +273 -0
  14. package/lib/src/context/BaseContext.d.ts +110 -0
  15. package/lib/src/context/BaseContext.js +143 -0
  16. package/lib/src/context/JobContext.d.ts +153 -0
  17. package/lib/src/context/JobContext.js +144 -0
  18. package/lib/src/context/WikiContext.d.ts +404 -0
  19. package/lib/src/context/bootActions.d.ts +64 -0
  20. package/lib/src/context/bootActions.js +111 -0
  21. package/lib/src/converters/HtmlConverter.d.ts +70 -0
  22. package/lib/src/converters/IContentConverter.d.ts +94 -0
  23. package/lib/src/converters/JSPWikiConverter.d.ts +117 -0
  24. package/lib/src/converters/conversionWarning.d.ts +15 -0
  25. package/lib/src/converters/ncm/bridge.d.ts +22 -0
  26. package/lib/src/converters/ncm/existing.d.ts +23 -0
  27. package/lib/src/converters/ncm/fix/blocks.d.ts +89 -0
  28. package/lib/src/converters/ncm/fix/bulletMarkers.d.ts +21 -0
  29. package/lib/src/converters/ncm/fix/index.d.ts +36 -0
  30. package/lib/src/converters/ncm/fix/jspwikiBullets.d.ts +20 -0
  31. package/lib/src/converters/ncm/fix/jspwikiCodeMarkers.d.ts +38 -0
  32. package/lib/src/converters/ncm/fix/jspwikiHeadings.d.ts +25 -0
  33. package/lib/src/converters/ncm/fix/jspwikiIndent.d.ts +24 -0
  34. package/lib/src/converters/ncm/fix/jspwikiInsert.d.ts +21 -0
  35. package/lib/src/converters/ncm/fix/jspwikiItalic.d.ts +29 -0
  36. package/lib/src/converters/ncm/fix/jspwikiLinkLeftovers.d.ts +27 -0
  37. package/lib/src/converters/ncm/fix/moreInformationFooter.d.ts +25 -0
  38. package/lib/src/converters/ncm/fix/styleClosers.d.ts +25 -0
  39. package/lib/src/converters/ncm/fix/tightenLists.d.ts +30 -0
  40. package/lib/src/converters/ncm/fix/types.d.ts +33 -0
  41. package/lib/src/converters/ncm/footnotes.d.ts +39 -0
  42. package/lib/src/converters/ncm/images.d.ts +49 -0
  43. package/lib/src/converters/ncm/index.d.ts +20 -0
  44. package/lib/src/converters/ncm/links.d.ts +21 -0
  45. package/lib/src/converters/ncm/normalize.d.ts +39 -0
  46. package/lib/src/converters/ncm/placeholder.d.ts +25 -0
  47. package/lib/src/converters/ncm/tables.d.ts +36 -0
  48. package/lib/src/converters/ncm/types.d.ts +42 -0
  49. package/lib/src/http/egressPolicy.d.ts +52 -0
  50. package/lib/src/http/guardedFetch.d.ts +89 -0
  51. package/lib/src/http/guardedFetch.js +113 -0
  52. package/lib/src/http/guardedLookup.d.ts +48 -0
  53. package/lib/src/http/guardedLookup.js +73 -0
  54. package/lib/src/http/ssrf.d.ts +83 -0
  55. package/lib/src/http/ssrf.js +311 -0
  56. package/lib/src/mail/MailProvider.d.ts +36 -0
  57. package/lib/src/mail/NodemailerMailProvider.d.ts +26 -0
  58. package/lib/src/managers/AddonsManager.d.ts +691 -0
  59. package/lib/src/managers/AgentTokenManager.d.ts +269 -0
  60. package/lib/src/managers/AssetManager.d.ts +116 -0
  61. package/lib/src/managers/AttachmentManager.d.ts +1032 -0
  62. package/lib/src/managers/AuthManager.d.ts +1257 -0
  63. package/lib/src/managers/BackgroundJobManager.d.ts +434 -0
  64. package/lib/src/managers/BaseManager.d.ts +427 -0
  65. package/lib/src/managers/BaseManager.js +415 -0
  66. package/lib/src/managers/CacheManager.d.ts +159 -0
  67. package/lib/src/managers/CatalogManager.d.ts +235 -0
  68. package/lib/src/managers/CommentManager.d.ts +75 -0
  69. package/lib/src/managers/ConfigurationManager.d.ts +747 -0
  70. package/lib/src/managers/DatabaseManager.d.ts +188 -0
  71. package/lib/src/managers/DatabaseManager.js +590 -0
  72. package/lib/src/managers/EmailManager.d.ts +47 -0
  73. package/lib/src/managers/ExportManager.d.ts +129 -0
  74. package/lib/src/managers/ExportManager.js +420 -0
  75. package/lib/src/managers/FootnoteManager.d.ts +118 -0
  76. package/lib/src/managers/MediaManager.d.ts +279 -0
  77. package/lib/src/managers/MetricsManager.d.ts +89 -0
  78. package/lib/src/managers/NotificationManager.d.ts +165 -0
  79. package/lib/src/managers/OidcManager.d.ts +210 -0
  80. package/lib/src/managers/OrganizationManager.d.ts +107 -0
  81. package/lib/src/managers/PageManager.d.ts +1645 -0
  82. package/lib/src/managers/PersonManager.d.ts +48 -0
  83. package/lib/src/managers/PluginManager.d.ts +179 -0
  84. package/lib/src/managers/PluginManager.js +393 -0
  85. package/lib/src/managers/PolicyEvaluator.d.ts +213 -0
  86. package/lib/src/managers/RenderingManager.d.ts +358 -0
  87. package/lib/src/managers/RoleManager.d.ts +134 -0
  88. package/lib/src/managers/SearchManager.d.ts +402 -0
  89. package/lib/src/managers/ShareManager.d.ts +251 -0
  90. package/lib/src/managers/TemplateManager.d.ts +176 -0
  91. package/lib/src/managers/ThemeManager.d.ts +56 -0
  92. package/lib/src/managers/UserManager.d.ts +480 -0
  93. package/lib/src/managers/ValidationManager.d.ts +426 -0
  94. package/lib/src/managers/VariableManager.d.ts +145 -0
  95. package/lib/src/middleware/csrf.d.ts +3 -0
  96. package/lib/src/parsers/LinkParser.d.ts +457 -0
  97. package/lib/src/parsers/MarkupParser.d.ts +769 -0
  98. package/lib/src/parsers/context/ParseContext.d.ts +314 -0
  99. package/lib/src/parsers/data/emoji-map.d.ts +18 -0
  100. package/lib/src/parsers/dom/DOMBuilder.d.ts +210 -0
  101. package/lib/src/parsers/dom/DOMParser.d.ts +252 -0
  102. package/lib/src/parsers/dom/Tokenizer.d.ts +358 -0
  103. package/lib/src/parsers/dom/WikiDocument.d.ts +272 -0
  104. package/lib/src/parsers/dom/handlers/DOMLinkHandler.d.ts +260 -0
  105. package/lib/src/parsers/dom/handlers/DOMPluginHandler.d.ts +212 -0
  106. package/lib/src/parsers/dom/handlers/DOMVariableHandler.d.ts +171 -0
  107. package/lib/src/parsers/filters/BaseFilter.d.ts +269 -0
  108. package/lib/src/parsers/filters/FilterChain.d.ts +320 -0
  109. package/lib/src/parsers/handlers/BaseSyntaxHandler.d.ts +331 -0
  110. package/lib/src/parsers/handlers/HandlerRegistry.d.ts +225 -0
  111. package/lib/src/parsers/handlers/JSPWikiPreprocessor.d.ts +89 -0
  112. package/lib/src/parsers/handlers/LinkParserHandler.d.ts +80 -0
  113. package/lib/src/parsers/handlers/PluginSyntaxHandler.d.ts +78 -0
  114. package/lib/src/parsers/handlers/WikiFormHandler.d.ts +149 -0
  115. package/lib/src/parsers/handlers/WikiTagHandler.d.ts +125 -0
  116. package/lib/src/parsers/jspwikiTableRow.d.ts +39 -0
  117. package/lib/src/parsers/styleBlockSyntax.d.ts +14 -0
  118. package/lib/src/plugins/types.d.ts +79 -0
  119. package/lib/src/providers/AgentTokenAuthProvider.d.ts +40 -0
  120. package/lib/src/providers/AuthentikBearerAuthProvider.d.ts +75 -0
  121. package/lib/src/providers/BaseAttachmentProvider.d.ts +197 -0
  122. package/lib/src/providers/BaseAuthProvider.d.ts +220 -0
  123. package/lib/src/providers/BaseCacheProvider.d.ts +140 -0
  124. package/lib/src/providers/BaseCredentialsProvider.d.ts +84 -0
  125. package/lib/src/providers/BaseDatabaseProvider.d.ts +22 -0
  126. package/lib/src/providers/BaseDatabaseProvider.js +12 -0
  127. package/lib/src/providers/BaseLoggingProvider.d.ts +68 -0
  128. package/lib/src/providers/BaseLoggingProvider.js +37 -0
  129. package/lib/src/providers/BaseMediaProvider.d.ts +308 -0
  130. package/lib/src/providers/BasePageProvider.d.ts +337 -0
  131. package/lib/src/providers/BaseProvider.d.ts +98 -0
  132. package/lib/src/providers/BaseProvider.js +74 -0
  133. package/lib/src/providers/BaseSearchProvider.d.ts +362 -0
  134. package/lib/src/providers/BasicAttachmentProvider.d.ts +599 -0
  135. package/lib/src/providers/CloudflareAccessAuthProvider.d.ts +72 -0
  136. package/lib/src/providers/FileCredentialsProvider.d.ts +33 -0
  137. package/lib/src/providers/FileJobStateProvider.d.ts +58 -0
  138. package/lib/src/providers/FileLoggingProvider.d.ts +43 -0
  139. package/lib/src/providers/FileLoggingProvider.js +120 -0
  140. package/lib/src/providers/FileOidcAdapter.d.ts +25 -0
  141. package/lib/src/providers/FileSystemMediaProvider.d.ts +403 -0
  142. package/lib/src/providers/LunrSearchProvider.d.ts +280 -0
  143. package/lib/src/providers/MagicLinkAuthProvider.d.ts +125 -0
  144. package/lib/src/providers/NullCacheProvider.d.ts +72 -0
  145. package/lib/src/providers/OidcAuthProvider.d.ts +180 -0
  146. package/lib/src/providers/OidcBearerAuthProvider.d.ts +30 -0
  147. package/lib/src/providers/PasskeyAuthProvider.d.ts +58 -0
  148. package/lib/src/providers/PasswordAuthProvider.d.ts +20 -0
  149. package/lib/src/providers/SqliteDatabaseProvider.d.ts +55 -0
  150. package/lib/src/providers/SqliteDatabaseProvider.js +90 -0
  151. package/lib/src/providers/SqliteJobStateProvider.d.ts +41 -0
  152. package/lib/src/providers/databaseMigrations.d.ts +8 -0
  153. package/lib/src/providers/databaseMigrations.js +47 -0
  154. package/lib/src/providers/jobState.d.ts +99 -0
  155. package/lib/src/providers/lunrQueryToMiniSearch.d.ts +32 -0
  156. package/lib/src/providers/mediaFilenameDate.d.ts +22 -0
  157. package/lib/src/providers/sqliteBackup.d.ts +128 -0
  158. package/lib/src/providers/sqliteBackup.js +365 -0
  159. package/lib/src/providers/sqliteLocation.d.ts +17 -0
  160. package/lib/src/providers/sqliteLocation.js +55 -0
  161. package/lib/src/providers/sqliteMigrations.d.ts +48 -0
  162. package/lib/src/providers/sqliteMigrations.js +72 -0
  163. package/lib/src/rendering/githubAlerts.d.ts +22 -0
  164. package/lib/src/rendering/htmlPolicy.d.ts +76 -0
  165. package/lib/src/rendering/markdownConverter.d.ts +73 -0
  166. package/lib/src/security/PolicyDecisionPoint.d.ts +245 -0
  167. package/lib/src/security/PolicyInformationPoint.d.ts +448 -0
  168. package/lib/src/security/pageActions.d.ts +40 -0
  169. package/lib/src/security/permissions.generated.d.ts +78 -0
  170. package/lib/src/types/Asset.d.ts +414 -0
  171. package/lib/src/types/Catalog.d.ts +61 -0
  172. package/lib/src/types/Comment.d.ts +11 -0
  173. package/lib/src/types/Config.d.ts +388 -0
  174. package/lib/src/types/Organization.d.ts +78 -0
  175. package/lib/src/types/OrganizationProvider.d.ts +38 -0
  176. package/lib/src/types/Page.d.ts +220 -0
  177. package/lib/src/types/Person.d.ts +56 -0
  178. package/lib/src/types/PersonProvider.d.ts +25 -0
  179. package/lib/src/types/Policy.d.ts +139 -0
  180. package/lib/src/types/Policy.js +17 -0
  181. package/lib/src/types/Provider.d.ts +810 -0
  182. package/lib/src/types/Role.d.ts +84 -0
  183. package/lib/src/types/RoleProvider.d.ts +35 -0
  184. package/lib/src/types/Schema.d.ts +425 -0
  185. package/lib/src/types/Share.d.ts +172 -0
  186. package/lib/src/types/Share.js +81 -0
  187. package/lib/src/types/User.d.ts +304 -0
  188. package/lib/src/types/Version.d.ts +189 -0
  189. package/lib/src/types/WikiEngine.d.ts +128 -0
  190. package/lib/src/types/express.d.ts +120 -0
  191. package/lib/src/types/express.js +1 -0
  192. package/lib/src/types/guards.d.ts +78 -0
  193. package/lib/src/types/heic-decode.d.ts +16 -0
  194. package/lib/src/types/index.d.ts +19 -0
  195. package/lib/src/types/linkedom.d.ts +77 -0
  196. package/lib/src/types/markdown-it-plugins.d.ts +21 -0
  197. package/lib/src/utils/DeltaStorage.d.ts +118 -0
  198. package/lib/src/utils/LocaleUtils.d.ts +105 -0
  199. package/lib/src/utils/LocaleUtils.js +294 -0
  200. package/lib/src/utils/PageNameMatcher.d.ts +98 -0
  201. package/lib/src/utils/PathPreflight.d.ts +38 -0
  202. package/lib/src/utils/PathPreflight.js +50 -0
  203. package/lib/src/utils/SectionUtils.d.ts +40 -0
  204. package/lib/src/utils/addonConfigLayer.d.ts +144 -0
  205. package/lib/src/utils/addonConfigLayer.js +382 -0
  206. package/lib/src/utils/addonDatabaseRules.d.ts +25 -0
  207. package/lib/src/utils/addonDatabaseRules.js +57 -0
  208. package/lib/src/utils/addonHost.d.ts +51 -0
  209. package/lib/src/utils/addonHost.js +72 -0
  210. package/lib/src/utils/addonInstaller.d.ts +109 -0
  211. package/lib/src/utils/addonLock.d.ts +37 -0
  212. package/lib/src/utils/addonLock.js +48 -0
  213. package/lib/src/utils/addonPageSync.d.ts +45 -0
  214. package/lib/src/utils/addonProvenance.d.ts +48 -0
  215. package/lib/src/utils/addonTarball.d.ts +41 -0
  216. package/lib/src/utils/addonsPathResolver.d.ts +76 -0
  217. package/lib/src/utils/addonsPathResolver.js +129 -0
  218. package/lib/src/utils/assetMetadataTags.d.ts +66 -0
  219. package/lib/src/utils/atomicWrite.d.ts +28 -0
  220. package/lib/src/utils/auditConfigChange.d.ts +57 -0
  221. package/lib/src/utils/auditEventNames.d.ts +50 -0
  222. package/lib/src/utils/auditEventNames.generated.d.ts +169 -0
  223. package/lib/src/utils/auditEventNames.generated.js +174 -0
  224. package/lib/src/utils/auditEventNames.js +49 -0
  225. package/lib/src/utils/auditEvents.d.ts +265 -0
  226. package/lib/src/utils/auditEvents.js +309 -0
  227. package/lib/src/utils/auditRegistry.d.ts +102 -0
  228. package/lib/src/utils/auditRegistry.js +168 -0
  229. package/lib/src/utils/bip39English.d.ts +2 -0
  230. package/lib/src/utils/configEnvKeys.d.ts +68 -0
  231. package/lib/src/utils/configFiles.d.ts +74 -0
  232. package/lib/src/utils/configFiles.js +150 -0
  233. package/lib/src/utils/delegation.d.ts +48 -0
  234. package/lib/src/utils/deriveUsername.d.ts +21 -0
  235. package/lib/src/utils/explainMediaPath.d.ts +123 -0
  236. package/lib/src/utils/formerTitles.d.ts +69 -0
  237. package/lib/src/utils/frontmatterAccess.d.ts +54 -0
  238. package/lib/src/utils/headlessAdminPassword.d.ts +55 -0
  239. package/lib/src/utils/imageTransform.d.ts +52 -0
  240. package/lib/src/utils/instanceEnvSecret.d.ts +51 -0
  241. package/lib/src/utils/jobSlots.d.ts +43 -0
  242. package/lib/src/utils/keywordNormalizer.d.ts +127 -0
  243. package/lib/src/utils/logger.d.ts +70 -0
  244. package/lib/src/utils/logger.js +106 -0
  245. package/lib/src/utils/magicLinkDeviceState.d.ts +95 -0
  246. package/lib/src/utils/managerUtils.d.ts +40 -0
  247. package/lib/src/utils/migrateLegacyPrivateAttachments.d.ts +15 -0
  248. package/lib/src/utils/orgFilename.d.ts +22 -0
  249. package/lib/src/utils/pageFeature.d.ts +27 -0
  250. package/lib/src/utils/pageFrontmatter.d.ts +21 -0
  251. package/lib/src/utils/pageNotes.d.ts +150 -0
  252. package/lib/src/utils/pageTitleRule.d.ts +37 -0
  253. package/lib/src/utils/pageToArticle.d.ts +59 -0
  254. package/lib/src/utils/pageUrl.d.ts +18 -0
  255. package/lib/src/utils/passwordChange.d.ts +12 -0
  256. package/lib/src/utils/passwordHash.d.ts +60 -0
  257. package/lib/src/utils/permissionCatalog.d.ts +52 -0
  258. package/lib/src/utils/pluginFormatters.d.ts +452 -0
  259. package/lib/src/utils/pluginFormatters.js +714 -0
  260. package/lib/src/utils/privateLinkRewrite.d.ts +42 -0
  261. package/lib/src/utils/privateStoreAccess.d.ts +57 -0
  262. package/lib/src/utils/privateStoreAccess.js +65 -0
  263. package/lib/src/utils/privateStoreCatalogs.d.ts +40 -0
  264. package/lib/src/utils/privateStoreCrypto.d.ts +127 -0
  265. package/lib/src/utils/privateStoreDoor.d.ts +181 -0
  266. package/lib/src/utils/privateStoreExport.d.ts +72 -0
  267. package/lib/src/utils/privateStoreFiles.d.ts +120 -0
  268. package/lib/src/utils/privateStoreMeta.d.ts +64 -0
  269. package/lib/src/utils/privateStoreMigrations.d.ts +37 -0
  270. package/lib/src/utils/privateStorePath.d.ts +259 -0
  271. package/lib/src/utils/privateStorePath.js +436 -0
  272. package/lib/src/utils/privateStoreTakeout.d.ts +76 -0
  273. package/lib/src/utils/privateStoreUnlock.d.ts +175 -0
  274. package/lib/src/utils/proxyClaim.d.ts +59 -0
  275. package/lib/src/utils/proxyClaim.js +30 -0
  276. package/lib/src/utils/redactPrivateNames.d.ts +21 -0
  277. package/lib/src/utils/redactPrivateNames.js +89 -0
  278. package/lib/src/utils/redactSecrets.d.ts +58 -0
  279. package/lib/src/utils/redactSecrets.js +171 -0
  280. package/lib/src/utils/renameLinkRewrite.d.ts +112 -0
  281. package/lib/src/utils/roleGrants.d.ts +35 -0
  282. package/lib/src/utils/safeRedirect.d.ts +32 -0
  283. package/lib/src/utils/schedule.d.ts +54 -0
  284. package/lib/src/utils/secretFileMode.d.ts +17 -0
  285. package/lib/src/utils/seededShippedPages.d.ts +45 -0
  286. package/lib/src/utils/sensitiveValues.d.ts +59 -0
  287. package/lib/src/utils/sensitiveValues.js +106 -0
  288. package/lib/src/utils/sessionEnd.d.ts +12 -0
  289. package/lib/src/utils/sessionGeneration.d.ts +24 -0
  290. package/lib/src/utils/sessionIdle.d.ts +41 -0
  291. package/lib/src/utils/sessionLimits.d.ts +68 -0
  292. package/lib/src/utils/shareLockbox.d.ts +64 -0
  293. package/lib/src/utils/sigstoreTrustedRoot.d.ts +33 -0
  294. package/lib/src/utils/sniffMime.d.ts +21 -0
  295. package/lib/src/utils/storeSearchIndex.d.ts +75 -0
  296. package/lib/src/utils/subjectMayDo.d.ts +21 -0
  297. package/lib/src/utils/systemCategoryRules.d.ts +30 -0
  298. package/lib/src/utils/systemCategoryRules.js +41 -0
  299. package/lib/src/utils/userCreateError.d.ts +62 -0
  300. package/lib/src/utils/username.d.ts +53 -0
  301. package/lib/src/utils/vaultUrlRewrite.d.ts +27 -0
  302. package/lib/src/utils/version.d.ts +84 -0
  303. package/lib/src/utils/videoFrame.d.ts +21 -0
  304. package/package.json +54 -3
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,17 @@
1
- # @jwilleke/ngdpbase-types — placeholder
1
+ # @jwilleke/ngdpbase-types
2
2
 
3
- This 0.0.0 only reserves the name. Real versions are published from GitHub Actions with provenance, versioned with ngdpbase.
3
+ The TypeScript types an ngdpbase add-on compiles against, and a test kit of core's own values. Published with each ngdpbase release, at the same version. A dev dependency only: it never ships to a site, where `host` and `engine` hand the add-on the running core.
4
+
5
+ ```sh
6
+ npm install --save-dev @jwilleke/ngdpbase-types@<your ngdpbase.minVersion>
7
+ ```
8
+
9
+ ```typescript
10
+ import type { AddonModule, AddonHost, WikiEngine } from '@jwilleke/ngdpbase-types';
11
+ import { buildAddonHost, openAddonTestDatabase, toCsv, formatters } from '@jwilleke/ngdpbase-types/testing';
12
+ ```
13
+
14
+ - The main entry is types only. Importing it at run time fails, on purpose.
15
+ - `/testing` is for tests. `buildAddonHost(slug, defaults)` is the real host. `openAddonTestDatabase(owner, { migrations, ledgerTable })` is the handle `openAddonDatabase` returns, in memory. `toCsv` is `ExportManager.toCsv`. `formatters` is a plugin's `context.formatters`.
16
+
17
+ The add-on guide is [docs/guides/addons-developer-guide.md](https://github.com/jwilleke/ngdpbase/blob/master/docs/guides/addons-developer-guide.md).
@@ -0,0 +1,32 @@
1
+ /// <reference path="../../src/types/heic-decode.d.ts" />
2
+ /// <reference path="../../src/types/linkedom.d.ts" />
3
+ /// <reference path="../../src/types/markdown-it-plugins.d.ts" />
4
+ /**
5
+ * `@jwilleke/ngdpbase-types`: the add-on API's types, published with each
6
+ * ngdpbase release (#1865, the types slice of #1813).
7
+ *
8
+ * This file is the public contract. It re-exports, as types only, the
9
+ * declarations an add-on compiles against; every one is core's own
10
+ * declaration, never a copy. Anything not named here is internal and may
11
+ * change in any release. Additive only between majors, as `host` is.
12
+ *
13
+ * Values come from `host` at run time, and in tests from
14
+ * `@jwilleke/ngdpbase-types/testing`. A test holds this file to `export type`
15
+ * only, so the published entry carries no JavaScript.
16
+ */
17
+ export type { AddonModule } from '../../src/managers/AddonsManager.js';
18
+ export type { AddonHost } from '../../src/utils/addonHost.js';
19
+ export type { WikiEngine } from '../../src/types/WikiEngine.js';
20
+ export type { ApiContext } from '../../src/context/ApiContext.js';
21
+ export type { ActorContext } from '../../src/context/ActorContext.js';
22
+ export type { PermissionSubject } from '../../src/managers/UserManager.js';
23
+ export type { Decision } from '../../src/types/Policy.js';
24
+ export type { PluginContext, PluginParams, PluginFormatters } from '../../src/managers/PluginManager.js';
25
+ export type { SimplePlugin } from '../../src/plugins/types.js';
26
+ export type { AuditEvent } from '../../src/utils/auditEvents.js';
27
+ export type { JobRunContext } from '../../src/managers/BackgroundJobManager.js';
28
+ export type { default as DatabaseManager, AddonDatabaseOptions } from '../../src/managers/DatabaseManager.js';
29
+ export type { Migration } from '../../src/providers/sqliteMigrations.js';
30
+ export type { AddonDatabaseDeclaration, DatabaseEncrypt } from '../../src/utils/addonDatabaseRules.js';
31
+ export type { default as ExportManager } from '../../src/managers/ExportManager.js';
32
+ export type { default as PolicyDecisionPoint } from '../../src/security/PolicyDecisionPoint.js';
@@ -0,0 +1,43 @@
1
+ /// <reference path="../../src/types/heic-decode.d.ts" />
2
+ /// <reference path="../../src/types/linkedom.d.ts" />
3
+ /// <reference path="../../src/types/markdown-it-plugins.d.ts" />
4
+ import ExportManager from '../../src/managers/ExportManager.js';
5
+ import { type AddonDatabaseOptions } from '../../src/managers/DatabaseManager.js';
6
+ import { type SqliteHandle } from '../../src/providers/SqliteDatabaseProvider.js';
7
+ import { type AddonHost } from '../../src/utils/addonHost.js';
8
+ export { formatters } from '../../src/managers/PluginManager.js';
9
+ /**
10
+ * Core's `buildAddonHost`, with the audit registry bound to this add-on's
11
+ * defaults, as a site's merged configuration binds it at boot. The host
12
+ * refuses an event the add-on does not declare; core's `recordAuditEvent`
13
+ * then finds a declared one in the registry, as it does on a site. The
14
+ * binding is process-wide: the last host built is the one bound.
15
+ *
16
+ * @param slug - The add-on's canonical slug
17
+ * @param addonDefaults - The add-on's own `config/default-config.json`
18
+ */
19
+ export declare function buildAddonHost(slug: string, addonDefaults: Record<string, unknown>): AddonHost;
20
+ /** The add-on whose declaration a test database is checked against: its slug and its own `config/default-config.json`. */
21
+ export interface AddonTestDatabaseDeclarer {
22
+ slug: string;
23
+ defaults: Record<string, unknown>;
24
+ }
25
+ /**
26
+ * An add-on's database as `DatabaseManager.openAddonDatabase` returns it, in
27
+ * memory: the same provider, migration ledger and owner and ledger-table
28
+ * rules, with no file and no key. Each call opens a new database; the test
29
+ * closes the handle (`db.close()`).
30
+ *
31
+ * With `declaredBy`, the add-on's declaration (`ngdpbase.addons.<slug>.database`
32
+ * in its defaults, #1860) is read by core's own reader and must name this
33
+ * owner and ledger, so a test fails where a site would refuse the add-on or
34
+ * the open. `encrypt` is not applied: the database is in memory and never
35
+ * written to disk, so a declaration with `encrypt: "required"` opens without a key.
36
+ *
37
+ * @param owner - The add-on slug that owns the database
38
+ * @param options - Its migrations and ledger table, as given to `openAddonDatabase`
39
+ * @param declaredBy - The add-on whose declaration must cover this database
40
+ */
41
+ export declare function openAddonTestDatabase<Handle = SqliteHandle>(owner: string, options: AddonDatabaseOptions, declaredBy?: AddonTestDatabaseDeclarer): Handle;
42
+ /** `ExportManager.toCsv`: a header row and data rows as one CSV document (RFC 4180, CRLF, formula cells quoted). */
43
+ export declare const toCsv: ExportManager['toCsv'];
@@ -0,0 +1,53 @@
1
+ import ExportManager from '../../src/managers/ExportManager.js';
2
+ import { addonDatabaseDeclarationFor, checkAddonDatabaseRequest } from '../../src/managers/DatabaseManager.js';
3
+ import { addonDatabaseLayer } from '../../src/utils/addonConfigLayer.js';
4
+ import SqliteDatabaseProvider from '../../src/providers/SqliteDatabaseProvider.js';
5
+ import { buildAddonHost as buildHost } from '../../src/utils/addonHost.js';
6
+ import { bindAuditEvents } from '../../src/utils/auditRegistry.js';
7
+ export { formatters } from '../../src/managers/PluginManager.js';
8
+ /**
9
+ * Core's `buildAddonHost`, with the audit registry bound to this add-on's
10
+ * defaults, as a site's merged configuration binds it at boot. The host
11
+ * refuses an event the add-on does not declare; core's `recordAuditEvent`
12
+ * then finds a declared one in the registry, as it does on a site. The
13
+ * binding is process-wide: the last host built is the one bound.
14
+ *
15
+ * @param slug - The add-on's canonical slug
16
+ * @param addonDefaults - The add-on's own `config/default-config.json`
17
+ */
18
+ export function buildAddonHost(slug, addonDefaults) {
19
+ bindAuditEvents((key, fallback) => addonDefaults[key] ?? fallback);
20
+ return buildHost(slug, addonDefaults);
21
+ }
22
+ /**
23
+ * An add-on's database as `DatabaseManager.openAddonDatabase` returns it, in
24
+ * memory: the same provider, migration ledger and owner and ledger-table
25
+ * rules, with no file and no key. Each call opens a new database; the test
26
+ * closes the handle (`db.close()`).
27
+ *
28
+ * With `declaredBy`, the add-on's declaration (`ngdpbase.addons.<slug>.database`
29
+ * in its defaults, #1860) is read by core's own reader and must name this
30
+ * owner and ledger, so a test fails where a site would refuse the add-on or
31
+ * the open. `encrypt` is not applied: the database is in memory and never
32
+ * written to disk, so a declaration with `encrypt: "required"` opens without a key.
33
+ *
34
+ * @param owner - The add-on slug that owns the database
35
+ * @param options - Its migrations and ledger table, as given to `openAddonDatabase`
36
+ * @param declaredBy - The add-on whose declaration must cover this database
37
+ */
38
+ export function openAddonTestDatabase(owner, options, declaredBy) {
39
+ checkAddonDatabaseRequest(owner, options);
40
+ if (declaredBy) {
41
+ const { slug, defaults } = declaredBy;
42
+ const layer = addonDatabaseLayer([{ slug, dir: '', source: 'directory', enabled: true, defaults }], {});
43
+ const refused = layer.refused.get(slug);
44
+ if (refused)
45
+ throw new Error(`Add-on '${slug}' is not loaded: ${refused}`);
46
+ addonDatabaseDeclarationFor(layer.declarations, owner, options.ledgerTable);
47
+ }
48
+ return new SqliteDatabaseProvider(':memory:', '', options.migrations, options.ledgerTable).handle;
49
+ }
50
+ // toCsv reads nothing from the engine; the instance exists only to own the method.
51
+ const exportManager = new ExportManager({});
52
+ /** `ExportManager.toCsv`: a header row and data rows as one CSV document (RFC 4180, CRLF, formula cells quoted). */
53
+ export const toCsv = (headers, rows) => exportManager.toCsv(headers, rows);
@@ -0,0 +1,50 @@
1
+ /**
2
+ * What a cached render read (#1751).
3
+ *
4
+ * A render declares each data topic it depends on — by convention the name of
5
+ * the manager that owns the data, such as `LedgerManager` — before it reads.
6
+ * The topic's version is snapshotted at that moment, so a write that lands
7
+ * while the render is still running leaves the entry already stale rather
8
+ * than wrongly current. The manager bumps its topic after a write
9
+ * (`CacheManager.bump`), and `RegionCache.getOrSetVersioned` re-renders.
10
+ *
11
+ * A render whose output changes with nothing written (a clock) marks itself
12
+ * volatile: it is returned but never stored.
13
+ */
14
+ export type VersionLookup = (topic: string) => Promise<string>;
15
+ /** Pages: text, names, audiences, links, comments and footnotes. PageManager bumps it after every page change. */
16
+ export declare const PAGE_DATA_TOPIC = "PageManager";
17
+ /** Configuration, policies and role definitions. ConfigurationManager bumps it after every saved change. */
18
+ export declare const CONFIG_DATA_TOPIC = "ConfigurationManager";
19
+ /** Accounts: display names, roles, preferences. UserManager bumps it after every account change. */
20
+ export declare const USER_DATA_TOPIC = "UserManager";
21
+ /** Attachments: files, their metadata and which pages mention them. AttachmentManager bumps it after every write. */
22
+ export declare const ATTACHMENT_DATA_TOPIC = "AttachmentManager";
23
+ /** The media library index. MediaManager bumps it after every scan, rebuild or metadata change. */
24
+ export declare const MEDIA_DATA_TOPIC = "MediaManager";
25
+ /**
26
+ * The time, to the minute: its version is the current minute, so nothing has
27
+ * to write it. A plugin that shows the time, an uptime or a count that drifts
28
+ * on its own depends on it and is re-rendered at most once a minute, where
29
+ * `volatile` would re-render the whole page on every request.
30
+ */
31
+ export declare const CLOCK_TOPIC = "Clock";
32
+ /**
33
+ * What every cached page render reads (#1751): any page can link, list or
34
+ * include pages, show configuration and name people, so each render depends
35
+ * on these. A plugin adds its own data with `context.dependsOn(topic)`.
36
+ */
37
+ export declare const BASE_RENDER_TOPICS: readonly string[];
38
+ export default class CacheDependencies {
39
+ private readonly versionOf;
40
+ private readonly snapshots;
41
+ private volatile;
42
+ constructor(versionOf: VersionLookup);
43
+ /** This render reads `topic`'s data. Call it before reading. */
44
+ dependsOn(topic: string): void;
45
+ /** This render's output changes on its own; do not store it. */
46
+ markVolatile(): void;
47
+ isVolatile(): boolean;
48
+ /** Each declared topic with the version it had when declared. */
49
+ resolved(): Promise<Record<string, string>>;
50
+ }
@@ -0,0 +1,50 @@
1
+ /** Pages: text, names, audiences, links, comments and footnotes. PageManager bumps it after every page change. */
2
+ export const PAGE_DATA_TOPIC = 'PageManager';
3
+ /** Configuration, policies and role definitions. ConfigurationManager bumps it after every saved change. */
4
+ export const CONFIG_DATA_TOPIC = 'ConfigurationManager';
5
+ /** Accounts: display names, roles, preferences. UserManager bumps it after every account change. */
6
+ export const USER_DATA_TOPIC = 'UserManager';
7
+ /** Attachments: files, their metadata and which pages mention them. AttachmentManager bumps it after every write. */
8
+ export const ATTACHMENT_DATA_TOPIC = 'AttachmentManager';
9
+ /** The media library index. MediaManager bumps it after every scan, rebuild or metadata change. */
10
+ export const MEDIA_DATA_TOPIC = 'MediaManager';
11
+ /**
12
+ * The time, to the minute: its version is the current minute, so nothing has
13
+ * to write it. A plugin that shows the time, an uptime or a count that drifts
14
+ * on its own depends on it and is re-rendered at most once a minute, where
15
+ * `volatile` would re-render the whole page on every request.
16
+ */
17
+ export const CLOCK_TOPIC = 'Clock';
18
+ /**
19
+ * What every cached page render reads (#1751): any page can link, list or
20
+ * include pages, show configuration and name people, so each render depends
21
+ * on these. A plugin adds its own data with `context.dependsOn(topic)`.
22
+ */
23
+ export const BASE_RENDER_TOPICS = [PAGE_DATA_TOPIC, CONFIG_DATA_TOPIC, USER_DATA_TOPIC];
24
+ export default class CacheDependencies {
25
+ versionOf;
26
+ snapshots = new Map();
27
+ volatile = false;
28
+ constructor(versionOf) {
29
+ this.versionOf = versionOf;
30
+ }
31
+ /** This render reads `topic`'s data. Call it before reading. */
32
+ dependsOn(topic) {
33
+ if (topic && !this.snapshots.has(topic))
34
+ this.snapshots.set(topic, this.versionOf(topic));
35
+ }
36
+ /** This render's output changes on its own; do not store it. */
37
+ markVolatile() {
38
+ this.volatile = true;
39
+ }
40
+ isVolatile() {
41
+ return this.volatile;
42
+ }
43
+ /** Each declared topic with the version it had when declared. */
44
+ async resolved() {
45
+ const out = {};
46
+ for (const [topic, version] of this.snapshots)
47
+ out[topic] = await version;
48
+ return out;
49
+ }
50
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Cache Adapter Interface
3
+ *
4
+ * Defines the contract that all cache adapters must implement.
5
+ * This allows switching between different cache backends (node-cache, Redis, etc.)
6
+ * without changing application code.
7
+ */
8
+ /**
9
+ * Cache statistics structure
10
+ */
11
+ export interface CacheStats {
12
+ /** Number of cache hits */
13
+ hits: number;
14
+ /** Number of cache misses */
15
+ misses: number;
16
+ /** Number of keys in cache */
17
+ keys: number;
18
+ /** Approximate memory usage of keys in bytes */
19
+ ksize: number;
20
+ /** Approximate memory usage of values in bytes */
21
+ vsize: number;
22
+ }
23
+ /**
24
+ * Cache adapter interface
25
+ * All cache adapters must implement these methods
26
+ *
27
+ * @abstract
28
+ */
29
+ declare abstract class ICacheAdapter {
30
+ /**
31
+ * Get a value from the cache
32
+ *
33
+ * @param {string} key - The cache key
34
+ * @returns {Promise<T|undefined>} The cached value or undefined if not found
35
+ */
36
+ abstract get<T = unknown>(key: string): Promise<T | undefined>;
37
+ /**
38
+ * Set a value in the cache
39
+ *
40
+ * @param {string} key - The cache key
41
+ * @param {unknown} value - The value to cache
42
+ * @param {number} [ttlSec] - Time to live in seconds
43
+ * @returns {Promise<void>}
44
+ */
45
+ abstract set(key: string, value: unknown, ttlSec?: number): Promise<void>;
46
+ /**
47
+ * Delete one or more keys from the cache
48
+ *
49
+ * @param {string|string[]} keys - Single key or array of keys to delete
50
+ * @returns {Promise<void>}
51
+ */
52
+ abstract del(keys: string | string[]): Promise<void>;
53
+ /**
54
+ * Clear cache entries
55
+ *
56
+ * @param {string} [pattern] - Optional pattern to match keys (e.g., 'user:*')
57
+ * @returns {Promise<void>}
58
+ */
59
+ abstract clear(pattern?: string): Promise<void>;
60
+ /**
61
+ * Get keys matching a pattern
62
+ *
63
+ * @param {string} pattern - Pattern to match (e.g., 'user:*' or '*' for all)
64
+ * @returns {Promise<string[]>} Array of matching keys
65
+ */
66
+ abstract keys(pattern?: string): Promise<string[]>;
67
+ /**
68
+ * Get cache statistics
69
+ *
70
+ * @returns {Promise<CacheStats>} Cache statistics
71
+ */
72
+ abstract stats(): Promise<CacheStats>;
73
+ /**
74
+ * Check if the cache adapter is healthy/connected
75
+ *
76
+ * @returns {Promise<boolean>} True if healthy
77
+ */
78
+ abstract isHealthy(): Promise<boolean>;
79
+ /**
80
+ * Close/cleanup the cache adapter
81
+ *
82
+ * @returns {Promise<void>}
83
+ */
84
+ abstract close(): Promise<void>;
85
+ }
86
+ export default ICacheAdapter;