@jwilleke/ngdpbase-types 0.0.0 → 5.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +16 -2
  3. package/lib/packages/ngdpbase-types/index.d.ts +32 -0
  4. package/lib/packages/ngdpbase-types/testing.d.ts +43 -0
  5. package/lib/packages/ngdpbase-types/testing.js +53 -0
  6. package/lib/src/cache/CacheDependencies.d.ts +50 -0
  7. package/lib/src/cache/CacheDependencies.js +50 -0
  8. package/lib/src/cache/ICacheAdapter.d.ts +86 -0
  9. package/lib/src/cache/RegionCache.d.ts +171 -0
  10. package/lib/src/context/ActorContext.d.ts +48 -0
  11. package/lib/src/context/ActorContext.js +33 -0
  12. package/lib/src/context/ApiContext.d.ts +194 -0
  13. package/lib/src/context/ApiContext.js +273 -0
  14. package/lib/src/context/BaseContext.d.ts +110 -0
  15. package/lib/src/context/BaseContext.js +143 -0
  16. package/lib/src/context/JobContext.d.ts +153 -0
  17. package/lib/src/context/JobContext.js +144 -0
  18. package/lib/src/context/WikiContext.d.ts +404 -0
  19. package/lib/src/context/bootActions.d.ts +64 -0
  20. package/lib/src/context/bootActions.js +111 -0
  21. package/lib/src/converters/HtmlConverter.d.ts +70 -0
  22. package/lib/src/converters/IContentConverter.d.ts +94 -0
  23. package/lib/src/converters/JSPWikiConverter.d.ts +117 -0
  24. package/lib/src/converters/conversionWarning.d.ts +15 -0
  25. package/lib/src/converters/ncm/bridge.d.ts +22 -0
  26. package/lib/src/converters/ncm/existing.d.ts +23 -0
  27. package/lib/src/converters/ncm/fix/blocks.d.ts +89 -0
  28. package/lib/src/converters/ncm/fix/bulletMarkers.d.ts +21 -0
  29. package/lib/src/converters/ncm/fix/index.d.ts +36 -0
  30. package/lib/src/converters/ncm/fix/jspwikiBullets.d.ts +20 -0
  31. package/lib/src/converters/ncm/fix/jspwikiCodeMarkers.d.ts +38 -0
  32. package/lib/src/converters/ncm/fix/jspwikiHeadings.d.ts +25 -0
  33. package/lib/src/converters/ncm/fix/jspwikiIndent.d.ts +24 -0
  34. package/lib/src/converters/ncm/fix/jspwikiInsert.d.ts +21 -0
  35. package/lib/src/converters/ncm/fix/jspwikiItalic.d.ts +29 -0
  36. package/lib/src/converters/ncm/fix/jspwikiLinkLeftovers.d.ts +27 -0
  37. package/lib/src/converters/ncm/fix/moreInformationFooter.d.ts +25 -0
  38. package/lib/src/converters/ncm/fix/styleClosers.d.ts +25 -0
  39. package/lib/src/converters/ncm/fix/tightenLists.d.ts +30 -0
  40. package/lib/src/converters/ncm/fix/types.d.ts +33 -0
  41. package/lib/src/converters/ncm/footnotes.d.ts +39 -0
  42. package/lib/src/converters/ncm/images.d.ts +49 -0
  43. package/lib/src/converters/ncm/index.d.ts +20 -0
  44. package/lib/src/converters/ncm/links.d.ts +21 -0
  45. package/lib/src/converters/ncm/normalize.d.ts +39 -0
  46. package/lib/src/converters/ncm/placeholder.d.ts +25 -0
  47. package/lib/src/converters/ncm/tables.d.ts +36 -0
  48. package/lib/src/converters/ncm/types.d.ts +42 -0
  49. package/lib/src/http/egressPolicy.d.ts +52 -0
  50. package/lib/src/http/guardedFetch.d.ts +89 -0
  51. package/lib/src/http/guardedFetch.js +113 -0
  52. package/lib/src/http/guardedLookup.d.ts +48 -0
  53. package/lib/src/http/guardedLookup.js +73 -0
  54. package/lib/src/http/ssrf.d.ts +83 -0
  55. package/lib/src/http/ssrf.js +311 -0
  56. package/lib/src/mail/MailProvider.d.ts +36 -0
  57. package/lib/src/mail/NodemailerMailProvider.d.ts +26 -0
  58. package/lib/src/managers/AddonsManager.d.ts +691 -0
  59. package/lib/src/managers/AgentTokenManager.d.ts +269 -0
  60. package/lib/src/managers/AssetManager.d.ts +116 -0
  61. package/lib/src/managers/AttachmentManager.d.ts +1032 -0
  62. package/lib/src/managers/AuthManager.d.ts +1257 -0
  63. package/lib/src/managers/BackgroundJobManager.d.ts +434 -0
  64. package/lib/src/managers/BaseManager.d.ts +427 -0
  65. package/lib/src/managers/BaseManager.js +415 -0
  66. package/lib/src/managers/CacheManager.d.ts +159 -0
  67. package/lib/src/managers/CatalogManager.d.ts +235 -0
  68. package/lib/src/managers/CommentManager.d.ts +75 -0
  69. package/lib/src/managers/ConfigurationManager.d.ts +747 -0
  70. package/lib/src/managers/DatabaseManager.d.ts +188 -0
  71. package/lib/src/managers/DatabaseManager.js +590 -0
  72. package/lib/src/managers/EmailManager.d.ts +47 -0
  73. package/lib/src/managers/ExportManager.d.ts +129 -0
  74. package/lib/src/managers/ExportManager.js +420 -0
  75. package/lib/src/managers/FootnoteManager.d.ts +118 -0
  76. package/lib/src/managers/MediaManager.d.ts +279 -0
  77. package/lib/src/managers/MetricsManager.d.ts +89 -0
  78. package/lib/src/managers/NotificationManager.d.ts +165 -0
  79. package/lib/src/managers/OidcManager.d.ts +210 -0
  80. package/lib/src/managers/OrganizationManager.d.ts +107 -0
  81. package/lib/src/managers/PageManager.d.ts +1645 -0
  82. package/lib/src/managers/PersonManager.d.ts +48 -0
  83. package/lib/src/managers/PluginManager.d.ts +179 -0
  84. package/lib/src/managers/PluginManager.js +393 -0
  85. package/lib/src/managers/PolicyEvaluator.d.ts +213 -0
  86. package/lib/src/managers/RenderingManager.d.ts +358 -0
  87. package/lib/src/managers/RoleManager.d.ts +134 -0
  88. package/lib/src/managers/SearchManager.d.ts +402 -0
  89. package/lib/src/managers/ShareManager.d.ts +251 -0
  90. package/lib/src/managers/TemplateManager.d.ts +176 -0
  91. package/lib/src/managers/ThemeManager.d.ts +56 -0
  92. package/lib/src/managers/UserManager.d.ts +480 -0
  93. package/lib/src/managers/ValidationManager.d.ts +426 -0
  94. package/lib/src/managers/VariableManager.d.ts +145 -0
  95. package/lib/src/middleware/csrf.d.ts +3 -0
  96. package/lib/src/parsers/LinkParser.d.ts +457 -0
  97. package/lib/src/parsers/MarkupParser.d.ts +769 -0
  98. package/lib/src/parsers/context/ParseContext.d.ts +314 -0
  99. package/lib/src/parsers/data/emoji-map.d.ts +18 -0
  100. package/lib/src/parsers/dom/DOMBuilder.d.ts +210 -0
  101. package/lib/src/parsers/dom/DOMParser.d.ts +252 -0
  102. package/lib/src/parsers/dom/Tokenizer.d.ts +358 -0
  103. package/lib/src/parsers/dom/WikiDocument.d.ts +272 -0
  104. package/lib/src/parsers/dom/handlers/DOMLinkHandler.d.ts +260 -0
  105. package/lib/src/parsers/dom/handlers/DOMPluginHandler.d.ts +212 -0
  106. package/lib/src/parsers/dom/handlers/DOMVariableHandler.d.ts +171 -0
  107. package/lib/src/parsers/filters/BaseFilter.d.ts +269 -0
  108. package/lib/src/parsers/filters/FilterChain.d.ts +320 -0
  109. package/lib/src/parsers/handlers/BaseSyntaxHandler.d.ts +331 -0
  110. package/lib/src/parsers/handlers/HandlerRegistry.d.ts +225 -0
  111. package/lib/src/parsers/handlers/JSPWikiPreprocessor.d.ts +89 -0
  112. package/lib/src/parsers/handlers/LinkParserHandler.d.ts +80 -0
  113. package/lib/src/parsers/handlers/PluginSyntaxHandler.d.ts +78 -0
  114. package/lib/src/parsers/handlers/WikiFormHandler.d.ts +149 -0
  115. package/lib/src/parsers/handlers/WikiTagHandler.d.ts +125 -0
  116. package/lib/src/parsers/jspwikiTableRow.d.ts +39 -0
  117. package/lib/src/parsers/styleBlockSyntax.d.ts +14 -0
  118. package/lib/src/plugins/types.d.ts +79 -0
  119. package/lib/src/providers/AgentTokenAuthProvider.d.ts +40 -0
  120. package/lib/src/providers/AuthentikBearerAuthProvider.d.ts +75 -0
  121. package/lib/src/providers/BaseAttachmentProvider.d.ts +197 -0
  122. package/lib/src/providers/BaseAuthProvider.d.ts +220 -0
  123. package/lib/src/providers/BaseCacheProvider.d.ts +140 -0
  124. package/lib/src/providers/BaseCredentialsProvider.d.ts +84 -0
  125. package/lib/src/providers/BaseDatabaseProvider.d.ts +22 -0
  126. package/lib/src/providers/BaseDatabaseProvider.js +12 -0
  127. package/lib/src/providers/BaseLoggingProvider.d.ts +68 -0
  128. package/lib/src/providers/BaseLoggingProvider.js +37 -0
  129. package/lib/src/providers/BaseMediaProvider.d.ts +308 -0
  130. package/lib/src/providers/BasePageProvider.d.ts +337 -0
  131. package/lib/src/providers/BaseProvider.d.ts +98 -0
  132. package/lib/src/providers/BaseProvider.js +74 -0
  133. package/lib/src/providers/BaseSearchProvider.d.ts +362 -0
  134. package/lib/src/providers/BasicAttachmentProvider.d.ts +599 -0
  135. package/lib/src/providers/CloudflareAccessAuthProvider.d.ts +72 -0
  136. package/lib/src/providers/FileCredentialsProvider.d.ts +33 -0
  137. package/lib/src/providers/FileJobStateProvider.d.ts +58 -0
  138. package/lib/src/providers/FileLoggingProvider.d.ts +43 -0
  139. package/lib/src/providers/FileLoggingProvider.js +120 -0
  140. package/lib/src/providers/FileOidcAdapter.d.ts +25 -0
  141. package/lib/src/providers/FileSystemMediaProvider.d.ts +403 -0
  142. package/lib/src/providers/LunrSearchProvider.d.ts +280 -0
  143. package/lib/src/providers/MagicLinkAuthProvider.d.ts +125 -0
  144. package/lib/src/providers/NullCacheProvider.d.ts +72 -0
  145. package/lib/src/providers/OidcAuthProvider.d.ts +180 -0
  146. package/lib/src/providers/OidcBearerAuthProvider.d.ts +30 -0
  147. package/lib/src/providers/PasskeyAuthProvider.d.ts +58 -0
  148. package/lib/src/providers/PasswordAuthProvider.d.ts +20 -0
  149. package/lib/src/providers/SqliteDatabaseProvider.d.ts +55 -0
  150. package/lib/src/providers/SqliteDatabaseProvider.js +90 -0
  151. package/lib/src/providers/SqliteJobStateProvider.d.ts +41 -0
  152. package/lib/src/providers/databaseMigrations.d.ts +8 -0
  153. package/lib/src/providers/databaseMigrations.js +47 -0
  154. package/lib/src/providers/jobState.d.ts +99 -0
  155. package/lib/src/providers/lunrQueryToMiniSearch.d.ts +32 -0
  156. package/lib/src/providers/mediaFilenameDate.d.ts +22 -0
  157. package/lib/src/providers/sqliteBackup.d.ts +128 -0
  158. package/lib/src/providers/sqliteBackup.js +365 -0
  159. package/lib/src/providers/sqliteLocation.d.ts +17 -0
  160. package/lib/src/providers/sqliteLocation.js +55 -0
  161. package/lib/src/providers/sqliteMigrations.d.ts +48 -0
  162. package/lib/src/providers/sqliteMigrations.js +72 -0
  163. package/lib/src/rendering/githubAlerts.d.ts +22 -0
  164. package/lib/src/rendering/htmlPolicy.d.ts +76 -0
  165. package/lib/src/rendering/markdownConverter.d.ts +73 -0
  166. package/lib/src/security/PolicyDecisionPoint.d.ts +245 -0
  167. package/lib/src/security/PolicyInformationPoint.d.ts +448 -0
  168. package/lib/src/security/pageActions.d.ts +40 -0
  169. package/lib/src/security/permissions.generated.d.ts +78 -0
  170. package/lib/src/types/Asset.d.ts +414 -0
  171. package/lib/src/types/Catalog.d.ts +61 -0
  172. package/lib/src/types/Comment.d.ts +11 -0
  173. package/lib/src/types/Config.d.ts +388 -0
  174. package/lib/src/types/Organization.d.ts +78 -0
  175. package/lib/src/types/OrganizationProvider.d.ts +38 -0
  176. package/lib/src/types/Page.d.ts +220 -0
  177. package/lib/src/types/Person.d.ts +56 -0
  178. package/lib/src/types/PersonProvider.d.ts +25 -0
  179. package/lib/src/types/Policy.d.ts +139 -0
  180. package/lib/src/types/Policy.js +17 -0
  181. package/lib/src/types/Provider.d.ts +810 -0
  182. package/lib/src/types/Role.d.ts +84 -0
  183. package/lib/src/types/RoleProvider.d.ts +35 -0
  184. package/lib/src/types/Schema.d.ts +425 -0
  185. package/lib/src/types/Share.d.ts +172 -0
  186. package/lib/src/types/Share.js +81 -0
  187. package/lib/src/types/User.d.ts +304 -0
  188. package/lib/src/types/Version.d.ts +189 -0
  189. package/lib/src/types/WikiEngine.d.ts +128 -0
  190. package/lib/src/types/express.d.ts +120 -0
  191. package/lib/src/types/express.js +1 -0
  192. package/lib/src/types/guards.d.ts +78 -0
  193. package/lib/src/types/heic-decode.d.ts +16 -0
  194. package/lib/src/types/index.d.ts +19 -0
  195. package/lib/src/types/linkedom.d.ts +77 -0
  196. package/lib/src/types/markdown-it-plugins.d.ts +21 -0
  197. package/lib/src/utils/DeltaStorage.d.ts +118 -0
  198. package/lib/src/utils/LocaleUtils.d.ts +105 -0
  199. package/lib/src/utils/LocaleUtils.js +294 -0
  200. package/lib/src/utils/PageNameMatcher.d.ts +98 -0
  201. package/lib/src/utils/PathPreflight.d.ts +38 -0
  202. package/lib/src/utils/PathPreflight.js +50 -0
  203. package/lib/src/utils/SectionUtils.d.ts +40 -0
  204. package/lib/src/utils/addonConfigLayer.d.ts +144 -0
  205. package/lib/src/utils/addonConfigLayer.js +382 -0
  206. package/lib/src/utils/addonDatabaseRules.d.ts +25 -0
  207. package/lib/src/utils/addonDatabaseRules.js +57 -0
  208. package/lib/src/utils/addonHost.d.ts +51 -0
  209. package/lib/src/utils/addonHost.js +72 -0
  210. package/lib/src/utils/addonInstaller.d.ts +109 -0
  211. package/lib/src/utils/addonLock.d.ts +37 -0
  212. package/lib/src/utils/addonLock.js +48 -0
  213. package/lib/src/utils/addonPageSync.d.ts +45 -0
  214. package/lib/src/utils/addonProvenance.d.ts +48 -0
  215. package/lib/src/utils/addonTarball.d.ts +41 -0
  216. package/lib/src/utils/addonsPathResolver.d.ts +76 -0
  217. package/lib/src/utils/addonsPathResolver.js +129 -0
  218. package/lib/src/utils/assetMetadataTags.d.ts +66 -0
  219. package/lib/src/utils/atomicWrite.d.ts +28 -0
  220. package/lib/src/utils/auditConfigChange.d.ts +57 -0
  221. package/lib/src/utils/auditEventNames.d.ts +50 -0
  222. package/lib/src/utils/auditEventNames.generated.d.ts +169 -0
  223. package/lib/src/utils/auditEventNames.generated.js +174 -0
  224. package/lib/src/utils/auditEventNames.js +49 -0
  225. package/lib/src/utils/auditEvents.d.ts +265 -0
  226. package/lib/src/utils/auditEvents.js +309 -0
  227. package/lib/src/utils/auditRegistry.d.ts +102 -0
  228. package/lib/src/utils/auditRegistry.js +168 -0
  229. package/lib/src/utils/bip39English.d.ts +2 -0
  230. package/lib/src/utils/configEnvKeys.d.ts +68 -0
  231. package/lib/src/utils/configFiles.d.ts +74 -0
  232. package/lib/src/utils/configFiles.js +150 -0
  233. package/lib/src/utils/delegation.d.ts +48 -0
  234. package/lib/src/utils/deriveUsername.d.ts +21 -0
  235. package/lib/src/utils/explainMediaPath.d.ts +123 -0
  236. package/lib/src/utils/formerTitles.d.ts +69 -0
  237. package/lib/src/utils/frontmatterAccess.d.ts +54 -0
  238. package/lib/src/utils/headlessAdminPassword.d.ts +55 -0
  239. package/lib/src/utils/imageTransform.d.ts +52 -0
  240. package/lib/src/utils/instanceEnvSecret.d.ts +51 -0
  241. package/lib/src/utils/jobSlots.d.ts +43 -0
  242. package/lib/src/utils/keywordNormalizer.d.ts +127 -0
  243. package/lib/src/utils/logger.d.ts +70 -0
  244. package/lib/src/utils/logger.js +106 -0
  245. package/lib/src/utils/magicLinkDeviceState.d.ts +95 -0
  246. package/lib/src/utils/managerUtils.d.ts +40 -0
  247. package/lib/src/utils/migrateLegacyPrivateAttachments.d.ts +15 -0
  248. package/lib/src/utils/orgFilename.d.ts +22 -0
  249. package/lib/src/utils/pageFeature.d.ts +27 -0
  250. package/lib/src/utils/pageFrontmatter.d.ts +21 -0
  251. package/lib/src/utils/pageNotes.d.ts +150 -0
  252. package/lib/src/utils/pageTitleRule.d.ts +37 -0
  253. package/lib/src/utils/pageToArticle.d.ts +59 -0
  254. package/lib/src/utils/pageUrl.d.ts +18 -0
  255. package/lib/src/utils/passwordChange.d.ts +12 -0
  256. package/lib/src/utils/passwordHash.d.ts +60 -0
  257. package/lib/src/utils/permissionCatalog.d.ts +52 -0
  258. package/lib/src/utils/pluginFormatters.d.ts +452 -0
  259. package/lib/src/utils/pluginFormatters.js +714 -0
  260. package/lib/src/utils/privateLinkRewrite.d.ts +42 -0
  261. package/lib/src/utils/privateStoreAccess.d.ts +57 -0
  262. package/lib/src/utils/privateStoreAccess.js +65 -0
  263. package/lib/src/utils/privateStoreCatalogs.d.ts +40 -0
  264. package/lib/src/utils/privateStoreCrypto.d.ts +127 -0
  265. package/lib/src/utils/privateStoreDoor.d.ts +181 -0
  266. package/lib/src/utils/privateStoreExport.d.ts +72 -0
  267. package/lib/src/utils/privateStoreFiles.d.ts +120 -0
  268. package/lib/src/utils/privateStoreMeta.d.ts +64 -0
  269. package/lib/src/utils/privateStoreMigrations.d.ts +37 -0
  270. package/lib/src/utils/privateStorePath.d.ts +259 -0
  271. package/lib/src/utils/privateStorePath.js +436 -0
  272. package/lib/src/utils/privateStoreTakeout.d.ts +76 -0
  273. package/lib/src/utils/privateStoreUnlock.d.ts +175 -0
  274. package/lib/src/utils/proxyClaim.d.ts +59 -0
  275. package/lib/src/utils/proxyClaim.js +30 -0
  276. package/lib/src/utils/redactPrivateNames.d.ts +21 -0
  277. package/lib/src/utils/redactPrivateNames.js +89 -0
  278. package/lib/src/utils/redactSecrets.d.ts +58 -0
  279. package/lib/src/utils/redactSecrets.js +171 -0
  280. package/lib/src/utils/renameLinkRewrite.d.ts +112 -0
  281. package/lib/src/utils/roleGrants.d.ts +35 -0
  282. package/lib/src/utils/safeRedirect.d.ts +32 -0
  283. package/lib/src/utils/schedule.d.ts +54 -0
  284. package/lib/src/utils/secretFileMode.d.ts +17 -0
  285. package/lib/src/utils/seededShippedPages.d.ts +45 -0
  286. package/lib/src/utils/sensitiveValues.d.ts +59 -0
  287. package/lib/src/utils/sensitiveValues.js +106 -0
  288. package/lib/src/utils/sessionEnd.d.ts +12 -0
  289. package/lib/src/utils/sessionGeneration.d.ts +24 -0
  290. package/lib/src/utils/sessionIdle.d.ts +41 -0
  291. package/lib/src/utils/sessionLimits.d.ts +68 -0
  292. package/lib/src/utils/shareLockbox.d.ts +64 -0
  293. package/lib/src/utils/sigstoreTrustedRoot.d.ts +33 -0
  294. package/lib/src/utils/sniffMime.d.ts +21 -0
  295. package/lib/src/utils/storeSearchIndex.d.ts +75 -0
  296. package/lib/src/utils/subjectMayDo.d.ts +21 -0
  297. package/lib/src/utils/systemCategoryRules.d.ts +30 -0
  298. package/lib/src/utils/systemCategoryRules.js +41 -0
  299. package/lib/src/utils/userCreateError.d.ts +62 -0
  300. package/lib/src/utils/username.d.ts +53 -0
  301. package/lib/src/utils/vaultUrlRewrite.d.ts +27 -0
  302. package/lib/src/utils/version.d.ts +84 -0
  303. package/lib/src/utils/videoFrame.d.ts +21 -0
  304. package/package.json +54 -3
@@ -0,0 +1,252 @@
1
+ import WikiDocument from './WikiDocument.js';
2
+ /**
3
+ * DOMParser - Complete DOM-based parsing pipeline for wiki markup
4
+ *
5
+ * ============================================================================
6
+ * ARCHITECTURE NOTE (Phase 4, Issue #118):
7
+ * ============================================================================
8
+ *
9
+ * **This DOMParser is a REFERENCE IMPLEMENTATION and is NOT actively used
10
+ * in the current rendering pipeline.**
11
+ *
12
+ * This parser uses the Tokenizer → DOMBuilder pipeline, which was the Phase 0
13
+ * approach to WikiDocument DOM parsing. However, it has been superseded by
14
+ * the extraction-based approach in Phases 1-3.
15
+ *
16
+ * CURRENT ACTIVE PIPELINE:
17
+ * ------------------------
18
+ * Use `MarkupParser.parseWithDOMExtraction()` instead of this DOMParser.
19
+ *
20
+ * The new pipeline:
21
+ * 1. MarkupParser.extractJSPWikiSyntax() - Extract JSPWiki syntax
22
+ * 2. MarkupParser.createDOMNode() - Create DOM nodes
23
+ * 3. markdown-it makeHtml() - Process markdown
24
+ * 4. MarkupParser.mergeDOMNodes() - Merge nodes into HTML
25
+ *
26
+ * WHY THIS DOMPARSER IS KEPT:
27
+ * ---------------------------
28
+ * - Reference implementation for token-based parsing
29
+ * - Useful for understanding the tokenization approach
30
+ * - May be enhanced for specific use cases in the future
31
+ * - Educational value for understanding different parsing strategies
32
+ *
33
+ * SEE ALSO:
34
+ * - Tokenizer.js - For detailed architecture notes
35
+ * - MarkupParser.parseWithDOMExtraction() - Current active pipeline
36
+ * - Issue #114 - WikiDocument DOM Solution
37
+ * - Issue #118 - Architecture documentation (this change)
38
+ *
39
+ * ============================================================================
40
+ *
41
+ * ORIGINAL DESCRIPTION:
42
+ * Integrates Tokenizer and DOMBuilder to convert wiki markup into
43
+ * a structured WikiDocument DOM tree. Provides error handling, recovery,
44
+ * and detailed error messages with position information.
45
+ *
46
+ * This follows JSPWiki's MarkupParser architecture.
47
+ *
48
+ * Key Features:
49
+ * - Complete parsing pipeline (Tokenizer → DOMBuilder)
50
+ * - Error handling with position tracking
51
+ * - Helpful error messages
52
+ * - Parse statistics and metadata
53
+ * - Graceful degradation on errors
54
+ *
55
+ * Part of Phase 2.5 of WikiDocument DOM Migration (GitHub Issue #93)
56
+ *
57
+ * JSPWiki Reference:
58
+ * https://github.com/apache/jspwiki/blob/master/jspwiki-main/src/main/java/org/apache/wiki/parser/MarkupParser.java
59
+ */
60
+ /**
61
+ * DOMParser options
62
+ */
63
+ export interface DOMParserOptions {
64
+ /** Enable debug logging */
65
+ debug?: boolean;
66
+ /** Throw on parse errors instead of creating error document */
67
+ throwOnError?: boolean;
68
+ /** Error callback */
69
+ onError?: ((error: ParseError) => void) | null;
70
+ /** Warning callback */
71
+ onWarning?: ((warning: WarningInfo) => void) | null;
72
+ }
73
+ /**
74
+ * Parse statistics
75
+ */
76
+ export interface ParseStatistics {
77
+ /** Total number of parses attempted */
78
+ totalParses: number;
79
+ /** Number of successful parses */
80
+ successfulParses: number;
81
+ /** Number of failed parses */
82
+ failedParses: number;
83
+ /** Total parse time in milliseconds */
84
+ totalParseTime: number;
85
+ /** Last parse time in milliseconds */
86
+ lastParseTime: number;
87
+ }
88
+ /**
89
+ * Extended statistics with computed values
90
+ */
91
+ export interface ExtendedStatistics extends ParseStatistics {
92
+ /** Average parse time in milliseconds */
93
+ averageParseTime: number;
94
+ /** Success rate as percentage */
95
+ successRate: number;
96
+ }
97
+ /**
98
+ * Validation result
99
+ */
100
+ export interface ValidationResult {
101
+ /** Whether the content is valid */
102
+ valid: boolean;
103
+ /** Parse errors */
104
+ errors: ErrorInfo[];
105
+ /** Parse warnings */
106
+ warnings: WarningInfo[];
107
+ }
108
+ /**
109
+ * Error information
110
+ */
111
+ export interface ErrorInfo {
112
+ /** Error message */
113
+ message: string;
114
+ /** Character position */
115
+ position?: number;
116
+ /** Line number */
117
+ line?: number;
118
+ /** Column number */
119
+ column?: number;
120
+ }
121
+ /**
122
+ * Warning information
123
+ */
124
+ export interface WarningInfo {
125
+ /** Warning message */
126
+ message: string;
127
+ /** Line number */
128
+ line?: number;
129
+ /** Column number */
130
+ column?: number;
131
+ }
132
+ /**
133
+ * Token interface (from Tokenizer)
134
+ */
135
+ export interface Token {
136
+ /** Token type */
137
+ type: string;
138
+ /** Token value */
139
+ value: string;
140
+ /** Line number */
141
+ line?: number;
142
+ /** Column number */
143
+ column?: number;
144
+ /** Additional properties */
145
+ [key: string]: unknown;
146
+ }
147
+ /**
148
+ * Rendering context
149
+ */
150
+ export interface RenderContext {
151
+ /** Additional context properties */
152
+ [key: string]: unknown;
153
+ }
154
+ /**
155
+ * DOMParser class
156
+ */
157
+ declare class DOMParser {
158
+ /** Parser options */
159
+ protected options: Required<DOMParserOptions>;
160
+ /** Parse statistics */
161
+ private parseStats;
162
+ /**
163
+ * Creates a new DOMParser
164
+ *
165
+ * @param options - Parser options
166
+ */
167
+ constructor(options?: DOMParserOptions);
168
+ /**
169
+ * Parses wiki markup content into a WikiDocument
170
+ *
171
+ * Main entry point for DOM-based parsing. This is equivalent to
172
+ * JSPWiki's MarkupParser.parse() method.
173
+ *
174
+ * @param content - Wiki markup content to parse
175
+ * @param context - Rendering context (page info, user, etc.)
176
+ * @returns Parsed WikiDocument with DOM tree
177
+ * @throws ParseError if throwOnError is true and parsing fails
178
+ */
179
+ parse(content: string | null | undefined, context?: RenderContext | null): WikiDocument;
180
+ /**
181
+ * Creates an error document when parsing fails
182
+ *
183
+ * This allows graceful degradation - the page will still render
184
+ * but show the error to the user.
185
+ *
186
+ * @param content - Original content
187
+ * @param context - Rendering context
188
+ * @param error - The error that occurred
189
+ * @returns Error document
190
+ */
191
+ createErrorDocument(content: string, context: RenderContext | null, error: Error): WikiDocument;
192
+ /**
193
+ * Validates wiki markup without building full DOM
194
+ *
195
+ * Useful for syntax checking before saving.
196
+ *
197
+ * @param content - Wiki markup to validate
198
+ * @returns Validation result { valid: boolean, errors: [], warnings: [] }
199
+ */
200
+ validate(content: string): ValidationResult;
201
+ /**
202
+ * Checks tokens for common warnings
203
+ *
204
+ * @param tokens - Tokens to check
205
+ * @param result - Result object to add warnings to
206
+ */
207
+ checkForWarnings(tokens: Token[], result: ValidationResult): void;
208
+ /**
209
+ * Gets parser statistics
210
+ *
211
+ * @returns Parser statistics
212
+ */
213
+ getStatistics(): ExtendedStatistics;
214
+ /**
215
+ * Resets parser statistics
216
+ */
217
+ resetStatistics(): void;
218
+ /**
219
+ * Logs debug message if debug mode enabled
220
+ *
221
+ * @param message - Message to log
222
+ */
223
+ log(message: string): void;
224
+ }
225
+ /**
226
+ * Custom error class for parse errors
227
+ */
228
+ export declare class ParseError extends Error {
229
+ /** Error type */
230
+ type: string;
231
+ /** Character position */
232
+ position: number;
233
+ /** Line number */
234
+ line: number;
235
+ /** Column number */
236
+ column: number;
237
+ /** Underlying error */
238
+ cause?: Error;
239
+ /**
240
+ * Creates a parse error with position information
241
+ *
242
+ * @param type - Error type
243
+ * @param position - Character position
244
+ * @param line - Line number
245
+ * @param column - Column number
246
+ * @param message - Error message
247
+ * @param cause - Underlying error
248
+ */
249
+ constructor(type: string, position: number, line: number, column: number, message: string, cause?: Error);
250
+ }
251
+ export { DOMParser };
252
+ export default DOMParser;
@@ -0,0 +1,358 @@
1
+ /**
2
+ * Tokenizer - Character-by-character parser for wiki markup
3
+ *
4
+ * ============================================================================
5
+ * ARCHITECTURE NOTE (Phase 4, Issue #118):
6
+ * ============================================================================
7
+ *
8
+ * **This Tokenizer is a REFERENCE IMPLEMENTATION and is NOT actively used
9
+ * in the current rendering pipeline.**
10
+ *
11
+ * HISTORY:
12
+ * --------
13
+ * Prior to Issue #114, this Tokenizer was part of the Phase 0 DOM parsing
14
+ * pipeline (Tokenizer → DOMBuilder → WikiDocument). However, this approach
15
+ * had conflicts when trying to parse both markdown AND JSPWiki syntax,
16
+ * resulting in bugs like ## headings becoming list items (Issue #110, #93).
17
+ *
18
+ * CURRENT ARCHITECTURE (Phases 1-3, Issue #114):
19
+ * -----------------------------------------------
20
+ * The rendering pipeline now uses a pre-extraction strategy inspired by
21
+ * JSPWiki's approach with FlexMark:
22
+ *
23
+ * 1. **Phase 1 - Extraction** (MarkupParser.extractJSPWikiSyntax())
24
+ * - Extract ONLY JSPWiki syntax using regex
25
+ * - Replace with HTML comment placeholders
26
+ * - Result: Sanitized markdown + extracted elements
27
+ *
28
+ * 2. **Phase 2 - DOM Creation** (MarkupParser.createDOMNode())
29
+ * - Create DOM nodes from extracted elements
30
+ * - Uses DOMVariableHandler, DOMPluginHandler, DOMLinkHandler
31
+ * - Result: Array of DOM nodes with data-jspwiki-id
32
+ *
33
+ * 3. **Phase 3 - markdown-it + Merge** (MarkupParser.parseWithDOMExtraction())
34
+ * - markdown-it processes the sanitized markdown (handles ALL markdown)
35
+ * - mergeDOMNodes() replaces placeholders with rendered nodes
36
+ * - Result: Final HTML with both markdown and JSPWiki syntax
37
+ *
38
+ * WHY THIS TOKENIZER IS KEPT:
39
+ * ---------------------------
40
+ * - **Reference**: Documents JSPWiki syntax patterns clearly
41
+ * - **Testing**: Useful for unit testing syntax recognition
42
+ * - **Future**: May be enhanced for advanced use cases
43
+ * - **Educational**: Helps understand what we're parsing
44
+ *
45
+ * KEY DIFFERENCE:
46
+ * --------------
47
+ * - **Tokenizer**: Character-by-character, token-based parsing
48
+ * - **extractJSPWikiSyntax()**: Regex-based extraction (faster, simpler)
49
+ *
50
+ * The extraction approach is faster and avoids markdown conflicts because:
51
+ * 1. It extracts JSPWiki syntax BEFORE markdown parsing
52
+ * 2. markdown-it handles ALL markdown (no conflicts)
53
+ * 3. DOM nodes are merged back AFTER markdown conversion
54
+ *
55
+ * ============================================================================
56
+ *
57
+ * KEY FEATURES OF THIS TOKENIZER:
58
+ * - Character-by-character reading with position tracking
59
+ * - Lookahead support via peekChar()
60
+ * - Pushback support for complex token recognition
61
+ * - Line and column tracking for error reporting
62
+ * - Handles Unicode characters correctly
63
+ * - JSPWiki-only syntax (no markdown patterns)
64
+ *
65
+ * RELATED:
66
+ * - Issue #93: WikiDocument DOM Epic
67
+ * - Issue #110: Escaping bug
68
+ * - Issue #114: WikiDocument DOM Solution (heading bug fix)
69
+ * - Issue #118: Remove Markdown Tokenization (this change)
70
+ * - docs/planning/WikiDocument-DOM-Solution.md
71
+ *
72
+ * Part of Phase 2 of WikiDocument DOM Migration (GitHub Issue #93)
73
+ */
74
+ /**
75
+ * Token types enum
76
+ */
77
+ export declare enum TokenType {
78
+ TEXT = "TEXT",
79
+ ESCAPED = "ESCAPED",
80
+ VARIABLE = "VARIABLE",
81
+ PLUGIN = "PLUGIN",
82
+ METADATA = "METADATA",
83
+ WIKI_TAG = "WIKI_TAG",
84
+ LINK = "LINK",
85
+ INTERWIKI = "INTERWIKI",
86
+ HEADING = "HEADING",
87
+ LIST_ITEM = "LIST_ITEM",
88
+ TABLE_CELL = "TABLE_CELL",
89
+ BOLD = "BOLD",
90
+ ITALIC = "ITALIC",
91
+ CODE_INLINE = "CODE_INLINE",
92
+ CODE_BLOCK = "CODE_BLOCK",
93
+ COMMENT = "COMMENT",
94
+ NEWLINE = "NEWLINE",
95
+ EOF = "EOF"
96
+ }
97
+ /**
98
+ * Token metadata interface
99
+ */
100
+ export interface TokenMetadata {
101
+ /** Variable name (for VARIABLE tokens) */
102
+ varName?: string;
103
+ /** Plugin content (for PLUGIN tokens) */
104
+ pluginContent?: string;
105
+ /** Metadata content (for METADATA tokens) */
106
+ metadataContent?: string;
107
+ /** Link target (for LINK tokens) */
108
+ link?: string;
109
+ /** Link text (for LINK tokens) */
110
+ text?: string;
111
+ /** Raw attribute string after the second pipe (for LINK tokens), e.g. `class='btn'` */
112
+ attrs?: string;
113
+ /** Heading level (for HEADING tokens) */
114
+ level?: number;
115
+ /** List marker (* or #) (for LIST_ITEM tokens) */
116
+ marker?: string;
117
+ /** Whether list is ordered (for LIST_ITEM tokens) */
118
+ ordered?: boolean;
119
+ /** Additional metadata properties */
120
+ [key: string]: unknown;
121
+ }
122
+ /**
123
+ * Position information
124
+ */
125
+ export interface PositionInfo {
126
+ /** Character position in input */
127
+ position: number;
128
+ /** Line number */
129
+ line: number;
130
+ /** Column number */
131
+ column: number;
132
+ }
133
+ /**
134
+ * Token structure
135
+ */
136
+ export interface Token extends PositionInfo {
137
+ /** Token type from TokenType enum */
138
+ type: TokenType | string;
139
+ /** Token value/content */
140
+ value: string;
141
+ /** Additional token-specific data */
142
+ metadata?: TokenMetadata;
143
+ /** Index signature for additional properties */
144
+ [key: string]: unknown;
145
+ }
146
+ /**
147
+ * Tokenizer class
148
+ */
149
+ export declare class Tokenizer {
150
+ /** Input string */
151
+ protected input: string;
152
+ /** Length of input */
153
+ private length;
154
+ /** Current position in input */
155
+ position: number;
156
+ /** Current line number */
157
+ line: number;
158
+ /** Current column number */
159
+ column: number;
160
+ /** Pushback buffer for character lookahead */
161
+ private pushbackBuffer;
162
+ /**
163
+ * Create a new Tokenizer
164
+ * @param input - The wiki markup to tokenize
165
+ */
166
+ constructor(input: string | null | undefined);
167
+ /**
168
+ * Get the current character without advancing
169
+ * @returns Current character or null if at EOF
170
+ */
171
+ peekChar(): string | null;
172
+ /**
173
+ * Get the next character and advance position
174
+ * @returns Next character or null if at EOF
175
+ */
176
+ nextChar(): string | null;
177
+ /**
178
+ * Push a character back onto the input stream
179
+ * Allows the tokenizer to "undo" reading a character
180
+ * @param char - Character to push back
181
+ */
182
+ pushBack(char: string | null): void;
183
+ /**
184
+ * Peek ahead N characters without consuming them
185
+ * @param count - Number of characters to peek ahead
186
+ * @returns String of next N characters
187
+ */
188
+ peekAhead(count: number): string;
189
+ /**
190
+ * Skip whitespace characters (space, tab)
191
+ * Does NOT skip newlines
192
+ * @returns Number of whitespace characters skipped
193
+ */
194
+ skipWhitespace(): number;
195
+ /**
196
+ * Skip all whitespace including newlines
197
+ * @returns Number of whitespace characters skipped
198
+ */
199
+ skipAllWhitespace(): number;
200
+ /**
201
+ * Check if we're at the end of the input
202
+ * @returns True if at EOF
203
+ */
204
+ isEOF(): boolean;
205
+ /**
206
+ * Check if we're at the start of a line
207
+ * @returns True if at line start
208
+ */
209
+ isLineStart(): boolean;
210
+ /**
211
+ * Get current position information
212
+ * @returns Position information
213
+ */
214
+ getPosition(): PositionInfo;
215
+ /**
216
+ * Create a token with current position information
217
+ * @param type - Token type from TokenType enum
218
+ * @param value - Token value
219
+ * @param metadata - Additional token metadata
220
+ * @returns The created token
221
+ */
222
+ createToken(type: TokenType | string, value: string, metadata?: TokenMetadata): Token;
223
+ /**
224
+ * Read until a specific character or string is found
225
+ * @param delimiters - Character(s) to stop at
226
+ * @param consume - Whether to consume the delimiter
227
+ * @returns Text read until delimiter
228
+ */
229
+ readUntil(delimiters: string | string[], consume?: boolean): string;
230
+ /**
231
+ * Match a specific string at current position
232
+ * @param str - String to match
233
+ * @param consume - Whether to consume if matched
234
+ * @returns True if matched
235
+ */
236
+ match(str: string, consume?: boolean): boolean;
237
+ /**
238
+ * Expect a specific string at current position, throw if not found
239
+ * @param str - String to expect
240
+ * @throws Error if string not found
241
+ */
242
+ expect(str: string): void;
243
+ /**
244
+ * Get a substring of the input
245
+ * @param start - Start position
246
+ * @param end - End position
247
+ * @returns Substring
248
+ */
249
+ substring(start: number, end: number): string;
250
+ /**
251
+ * Reset tokenizer to beginning
252
+ */
253
+ reset(): void;
254
+ /**
255
+ * Tokenize the entire input into tokens
256
+ * @returns Array of tokens
257
+ */
258
+ tokenize(): Token[];
259
+ /**
260
+ * Get the next token from the input
261
+ * @returns Next token or null if EOF
262
+ */
263
+ nextToken(): Token | null;
264
+ /**
265
+ * Parse newline token
266
+ * @returns Newline token
267
+ */
268
+ parseNewlineToken(): Token;
269
+ /**
270
+ * Parse escaped text: [[text]
271
+ * Syntax: [[content] where [[ outputs literal [
272
+ * Everything between [[ and ] is treated as plain text
273
+ * Example: [[{$variable}] renders as literal [{$variable}]
274
+ * @returns Escaped token
275
+ */
276
+ parseEscapedToken(): Token;
277
+ /**
278
+ * Parse bracket directive [{...}]
279
+ * Determines type based on content:
280
+ * - [{$...}] → Variable
281
+ * - [{SET ...}] → Metadata
282
+ * - [{...}] → Plugin
283
+ * @returns Directive token
284
+ */
285
+ parseBracketDirective(): Token;
286
+ /**
287
+ * Parse variable: [{$varname}]
288
+ * Called after [{has been consumed
289
+ * @param pos - Position object
290
+ * @returns Variable token
291
+ */
292
+ parseVariableToken(pos: PositionInfo): Token;
293
+ /**
294
+ * Parse metadata: [{SET name=value}]
295
+ * Called after [{ has been consumed
296
+ * @param pos - Position object
297
+ * @returns Metadata token
298
+ */
299
+ parseMetadataToken(pos: PositionInfo): Token;
300
+ /**
301
+ * Parse plugin: [{PluginName param1=value1}]
302
+ * Called after [{ has been consumed
303
+ * @param pos - Position object
304
+ * @returns Plugin token
305
+ */
306
+ parsePluginToken(pos: PositionInfo): Token;
307
+ /**
308
+ * Parse wiki tag or link: [link], [link|text]
309
+ * @returns Wiki tag or link token
310
+ */
311
+ parseWikiTagToken(): Token;
312
+ /**
313
+ * Parse heading: !!!, !!, !
314
+ * @returns Heading token
315
+ */
316
+ parseHeadingToken(): Token;
317
+ /**
318
+ * Parse list item: *, #, **, ##, etc.
319
+ * @returns List item token
320
+ */
321
+ parseListItemToken(): Token;
322
+ /**
323
+ * Parse table cell: | cell
324
+ * @returns Table cell token
325
+ */
326
+ parseTableCellToken(): Token;
327
+ /**
328
+ * Parse bold: __text__
329
+ * @returns Bold token
330
+ */
331
+ parseBoldToken(): Token;
332
+ /**
333
+ * Parse italic: ''text''
334
+ * @returns Italic token
335
+ */
336
+ parseItalicToken(): Token;
337
+ /**
338
+ * Parse inline code: {{text}}
339
+ * @returns Code inline token
340
+ */
341
+ parseCodeInlineToken(): Token;
342
+ /**
343
+ * Parse code block: {{{code}}}
344
+ * @returns Code block token
345
+ */
346
+ parseCodeBlockToken(): Token;
347
+ /**
348
+ * Parse HTML comment: <!-- comment -->
349
+ * @returns Comment token
350
+ */
351
+ parseCommentToken(): Token;
352
+ /**
353
+ * Parse plain text until next special character
354
+ * @returns Text token
355
+ */
356
+ parseTextToken(): Token;
357
+ }
358
+ export { Tokenizer as default };