@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.
- package/LICENSE +201 -0
- package/README.md +16 -2
- package/lib/packages/ngdpbase-types/index.d.ts +32 -0
- package/lib/packages/ngdpbase-types/testing.d.ts +43 -0
- package/lib/packages/ngdpbase-types/testing.js +53 -0
- package/lib/src/cache/CacheDependencies.d.ts +50 -0
- package/lib/src/cache/CacheDependencies.js +50 -0
- package/lib/src/cache/ICacheAdapter.d.ts +86 -0
- package/lib/src/cache/RegionCache.d.ts +171 -0
- package/lib/src/context/ActorContext.d.ts +48 -0
- package/lib/src/context/ActorContext.js +33 -0
- package/lib/src/context/ApiContext.d.ts +194 -0
- package/lib/src/context/ApiContext.js +273 -0
- package/lib/src/context/BaseContext.d.ts +110 -0
- package/lib/src/context/BaseContext.js +143 -0
- package/lib/src/context/JobContext.d.ts +153 -0
- package/lib/src/context/JobContext.js +144 -0
- package/lib/src/context/WikiContext.d.ts +404 -0
- package/lib/src/context/bootActions.d.ts +64 -0
- package/lib/src/context/bootActions.js +111 -0
- package/lib/src/converters/HtmlConverter.d.ts +70 -0
- package/lib/src/converters/IContentConverter.d.ts +94 -0
- package/lib/src/converters/JSPWikiConverter.d.ts +117 -0
- package/lib/src/converters/conversionWarning.d.ts +15 -0
- package/lib/src/converters/ncm/bridge.d.ts +22 -0
- package/lib/src/converters/ncm/existing.d.ts +23 -0
- package/lib/src/converters/ncm/fix/blocks.d.ts +89 -0
- package/lib/src/converters/ncm/fix/bulletMarkers.d.ts +21 -0
- package/lib/src/converters/ncm/fix/index.d.ts +36 -0
- package/lib/src/converters/ncm/fix/jspwikiBullets.d.ts +20 -0
- package/lib/src/converters/ncm/fix/jspwikiCodeMarkers.d.ts +38 -0
- package/lib/src/converters/ncm/fix/jspwikiHeadings.d.ts +25 -0
- package/lib/src/converters/ncm/fix/jspwikiIndent.d.ts +24 -0
- package/lib/src/converters/ncm/fix/jspwikiInsert.d.ts +21 -0
- package/lib/src/converters/ncm/fix/jspwikiItalic.d.ts +29 -0
- package/lib/src/converters/ncm/fix/jspwikiLinkLeftovers.d.ts +27 -0
- package/lib/src/converters/ncm/fix/moreInformationFooter.d.ts +25 -0
- package/lib/src/converters/ncm/fix/styleClosers.d.ts +25 -0
- package/lib/src/converters/ncm/fix/tightenLists.d.ts +30 -0
- package/lib/src/converters/ncm/fix/types.d.ts +33 -0
- package/lib/src/converters/ncm/footnotes.d.ts +39 -0
- package/lib/src/converters/ncm/images.d.ts +49 -0
- package/lib/src/converters/ncm/index.d.ts +20 -0
- package/lib/src/converters/ncm/links.d.ts +21 -0
- package/lib/src/converters/ncm/normalize.d.ts +39 -0
- package/lib/src/converters/ncm/placeholder.d.ts +25 -0
- package/lib/src/converters/ncm/tables.d.ts +36 -0
- package/lib/src/converters/ncm/types.d.ts +42 -0
- package/lib/src/http/egressPolicy.d.ts +52 -0
- package/lib/src/http/guardedFetch.d.ts +89 -0
- package/lib/src/http/guardedFetch.js +113 -0
- package/lib/src/http/guardedLookup.d.ts +48 -0
- package/lib/src/http/guardedLookup.js +73 -0
- package/lib/src/http/ssrf.d.ts +83 -0
- package/lib/src/http/ssrf.js +311 -0
- package/lib/src/mail/MailProvider.d.ts +36 -0
- package/lib/src/mail/NodemailerMailProvider.d.ts +26 -0
- package/lib/src/managers/AddonsManager.d.ts +691 -0
- package/lib/src/managers/AgentTokenManager.d.ts +269 -0
- package/lib/src/managers/AssetManager.d.ts +116 -0
- package/lib/src/managers/AttachmentManager.d.ts +1032 -0
- package/lib/src/managers/AuthManager.d.ts +1257 -0
- package/lib/src/managers/BackgroundJobManager.d.ts +434 -0
- package/lib/src/managers/BaseManager.d.ts +427 -0
- package/lib/src/managers/BaseManager.js +415 -0
- package/lib/src/managers/CacheManager.d.ts +159 -0
- package/lib/src/managers/CatalogManager.d.ts +235 -0
- package/lib/src/managers/CommentManager.d.ts +75 -0
- package/lib/src/managers/ConfigurationManager.d.ts +747 -0
- package/lib/src/managers/DatabaseManager.d.ts +188 -0
- package/lib/src/managers/DatabaseManager.js +590 -0
- package/lib/src/managers/EmailManager.d.ts +47 -0
- package/lib/src/managers/ExportManager.d.ts +129 -0
- package/lib/src/managers/ExportManager.js +420 -0
- package/lib/src/managers/FootnoteManager.d.ts +118 -0
- package/lib/src/managers/MediaManager.d.ts +279 -0
- package/lib/src/managers/MetricsManager.d.ts +89 -0
- package/lib/src/managers/NotificationManager.d.ts +165 -0
- package/lib/src/managers/OidcManager.d.ts +210 -0
- package/lib/src/managers/OrganizationManager.d.ts +107 -0
- package/lib/src/managers/PageManager.d.ts +1645 -0
- package/lib/src/managers/PersonManager.d.ts +48 -0
- package/lib/src/managers/PluginManager.d.ts +179 -0
- package/lib/src/managers/PluginManager.js +393 -0
- package/lib/src/managers/PolicyEvaluator.d.ts +213 -0
- package/lib/src/managers/RenderingManager.d.ts +358 -0
- package/lib/src/managers/RoleManager.d.ts +134 -0
- package/lib/src/managers/SearchManager.d.ts +402 -0
- package/lib/src/managers/ShareManager.d.ts +251 -0
- package/lib/src/managers/TemplateManager.d.ts +176 -0
- package/lib/src/managers/ThemeManager.d.ts +56 -0
- package/lib/src/managers/UserManager.d.ts +480 -0
- package/lib/src/managers/ValidationManager.d.ts +426 -0
- package/lib/src/managers/VariableManager.d.ts +145 -0
- package/lib/src/middleware/csrf.d.ts +3 -0
- package/lib/src/parsers/LinkParser.d.ts +457 -0
- package/lib/src/parsers/MarkupParser.d.ts +769 -0
- package/lib/src/parsers/context/ParseContext.d.ts +314 -0
- package/lib/src/parsers/data/emoji-map.d.ts +18 -0
- package/lib/src/parsers/dom/DOMBuilder.d.ts +210 -0
- package/lib/src/parsers/dom/DOMParser.d.ts +252 -0
- package/lib/src/parsers/dom/Tokenizer.d.ts +358 -0
- package/lib/src/parsers/dom/WikiDocument.d.ts +272 -0
- package/lib/src/parsers/dom/handlers/DOMLinkHandler.d.ts +260 -0
- package/lib/src/parsers/dom/handlers/DOMPluginHandler.d.ts +212 -0
- package/lib/src/parsers/dom/handlers/DOMVariableHandler.d.ts +171 -0
- package/lib/src/parsers/filters/BaseFilter.d.ts +269 -0
- package/lib/src/parsers/filters/FilterChain.d.ts +320 -0
- package/lib/src/parsers/handlers/BaseSyntaxHandler.d.ts +331 -0
- package/lib/src/parsers/handlers/HandlerRegistry.d.ts +225 -0
- package/lib/src/parsers/handlers/JSPWikiPreprocessor.d.ts +89 -0
- package/lib/src/parsers/handlers/LinkParserHandler.d.ts +80 -0
- package/lib/src/parsers/handlers/PluginSyntaxHandler.d.ts +78 -0
- package/lib/src/parsers/handlers/WikiFormHandler.d.ts +149 -0
- package/lib/src/parsers/handlers/WikiTagHandler.d.ts +125 -0
- package/lib/src/parsers/jspwikiTableRow.d.ts +39 -0
- package/lib/src/parsers/styleBlockSyntax.d.ts +14 -0
- package/lib/src/plugins/types.d.ts +79 -0
- package/lib/src/providers/AgentTokenAuthProvider.d.ts +40 -0
- package/lib/src/providers/AuthentikBearerAuthProvider.d.ts +75 -0
- package/lib/src/providers/BaseAttachmentProvider.d.ts +197 -0
- package/lib/src/providers/BaseAuthProvider.d.ts +220 -0
- package/lib/src/providers/BaseCacheProvider.d.ts +140 -0
- package/lib/src/providers/BaseCredentialsProvider.d.ts +84 -0
- package/lib/src/providers/BaseDatabaseProvider.d.ts +22 -0
- package/lib/src/providers/BaseDatabaseProvider.js +12 -0
- package/lib/src/providers/BaseLoggingProvider.d.ts +68 -0
- package/lib/src/providers/BaseLoggingProvider.js +37 -0
- package/lib/src/providers/BaseMediaProvider.d.ts +308 -0
- package/lib/src/providers/BasePageProvider.d.ts +337 -0
- package/lib/src/providers/BaseProvider.d.ts +98 -0
- package/lib/src/providers/BaseProvider.js +74 -0
- package/lib/src/providers/BaseSearchProvider.d.ts +362 -0
- package/lib/src/providers/BasicAttachmentProvider.d.ts +599 -0
- package/lib/src/providers/CloudflareAccessAuthProvider.d.ts +72 -0
- package/lib/src/providers/FileCredentialsProvider.d.ts +33 -0
- package/lib/src/providers/FileJobStateProvider.d.ts +58 -0
- package/lib/src/providers/FileLoggingProvider.d.ts +43 -0
- package/lib/src/providers/FileLoggingProvider.js +120 -0
- package/lib/src/providers/FileOidcAdapter.d.ts +25 -0
- package/lib/src/providers/FileSystemMediaProvider.d.ts +403 -0
- package/lib/src/providers/LunrSearchProvider.d.ts +280 -0
- package/lib/src/providers/MagicLinkAuthProvider.d.ts +125 -0
- package/lib/src/providers/NullCacheProvider.d.ts +72 -0
- package/lib/src/providers/OidcAuthProvider.d.ts +180 -0
- package/lib/src/providers/OidcBearerAuthProvider.d.ts +30 -0
- package/lib/src/providers/PasskeyAuthProvider.d.ts +58 -0
- package/lib/src/providers/PasswordAuthProvider.d.ts +20 -0
- package/lib/src/providers/SqliteDatabaseProvider.d.ts +55 -0
- package/lib/src/providers/SqliteDatabaseProvider.js +90 -0
- package/lib/src/providers/SqliteJobStateProvider.d.ts +41 -0
- package/lib/src/providers/databaseMigrations.d.ts +8 -0
- package/lib/src/providers/databaseMigrations.js +47 -0
- package/lib/src/providers/jobState.d.ts +99 -0
- package/lib/src/providers/lunrQueryToMiniSearch.d.ts +32 -0
- package/lib/src/providers/mediaFilenameDate.d.ts +22 -0
- package/lib/src/providers/sqliteBackup.d.ts +128 -0
- package/lib/src/providers/sqliteBackup.js +365 -0
- package/lib/src/providers/sqliteLocation.d.ts +17 -0
- package/lib/src/providers/sqliteLocation.js +55 -0
- package/lib/src/providers/sqliteMigrations.d.ts +48 -0
- package/lib/src/providers/sqliteMigrations.js +72 -0
- package/lib/src/rendering/githubAlerts.d.ts +22 -0
- package/lib/src/rendering/htmlPolicy.d.ts +76 -0
- package/lib/src/rendering/markdownConverter.d.ts +73 -0
- package/lib/src/security/PolicyDecisionPoint.d.ts +245 -0
- package/lib/src/security/PolicyInformationPoint.d.ts +448 -0
- package/lib/src/security/pageActions.d.ts +40 -0
- package/lib/src/security/permissions.generated.d.ts +78 -0
- package/lib/src/types/Asset.d.ts +414 -0
- package/lib/src/types/Catalog.d.ts +61 -0
- package/lib/src/types/Comment.d.ts +11 -0
- package/lib/src/types/Config.d.ts +388 -0
- package/lib/src/types/Organization.d.ts +78 -0
- package/lib/src/types/OrganizationProvider.d.ts +38 -0
- package/lib/src/types/Page.d.ts +220 -0
- package/lib/src/types/Person.d.ts +56 -0
- package/lib/src/types/PersonProvider.d.ts +25 -0
- package/lib/src/types/Policy.d.ts +139 -0
- package/lib/src/types/Policy.js +17 -0
- package/lib/src/types/Provider.d.ts +810 -0
- package/lib/src/types/Role.d.ts +84 -0
- package/lib/src/types/RoleProvider.d.ts +35 -0
- package/lib/src/types/Schema.d.ts +425 -0
- package/lib/src/types/Share.d.ts +172 -0
- package/lib/src/types/Share.js +81 -0
- package/lib/src/types/User.d.ts +304 -0
- package/lib/src/types/Version.d.ts +189 -0
- package/lib/src/types/WikiEngine.d.ts +128 -0
- package/lib/src/types/express.d.ts +120 -0
- package/lib/src/types/express.js +1 -0
- package/lib/src/types/guards.d.ts +78 -0
- package/lib/src/types/heic-decode.d.ts +16 -0
- package/lib/src/types/index.d.ts +19 -0
- package/lib/src/types/linkedom.d.ts +77 -0
- package/lib/src/types/markdown-it-plugins.d.ts +21 -0
- package/lib/src/utils/DeltaStorage.d.ts +118 -0
- package/lib/src/utils/LocaleUtils.d.ts +105 -0
- package/lib/src/utils/LocaleUtils.js +294 -0
- package/lib/src/utils/PageNameMatcher.d.ts +98 -0
- package/lib/src/utils/PathPreflight.d.ts +38 -0
- package/lib/src/utils/PathPreflight.js +50 -0
- package/lib/src/utils/SectionUtils.d.ts +40 -0
- package/lib/src/utils/addonConfigLayer.d.ts +144 -0
- package/lib/src/utils/addonConfigLayer.js +382 -0
- package/lib/src/utils/addonDatabaseRules.d.ts +25 -0
- package/lib/src/utils/addonDatabaseRules.js +57 -0
- package/lib/src/utils/addonHost.d.ts +51 -0
- package/lib/src/utils/addonHost.js +72 -0
- package/lib/src/utils/addonInstaller.d.ts +109 -0
- package/lib/src/utils/addonLock.d.ts +37 -0
- package/lib/src/utils/addonLock.js +48 -0
- package/lib/src/utils/addonPageSync.d.ts +45 -0
- package/lib/src/utils/addonProvenance.d.ts +48 -0
- package/lib/src/utils/addonTarball.d.ts +41 -0
- package/lib/src/utils/addonsPathResolver.d.ts +76 -0
- package/lib/src/utils/addonsPathResolver.js +129 -0
- package/lib/src/utils/assetMetadataTags.d.ts +66 -0
- package/lib/src/utils/atomicWrite.d.ts +28 -0
- package/lib/src/utils/auditConfigChange.d.ts +57 -0
- package/lib/src/utils/auditEventNames.d.ts +50 -0
- package/lib/src/utils/auditEventNames.generated.d.ts +169 -0
- package/lib/src/utils/auditEventNames.generated.js +174 -0
- package/lib/src/utils/auditEventNames.js +49 -0
- package/lib/src/utils/auditEvents.d.ts +265 -0
- package/lib/src/utils/auditEvents.js +309 -0
- package/lib/src/utils/auditRegistry.d.ts +102 -0
- package/lib/src/utils/auditRegistry.js +168 -0
- package/lib/src/utils/bip39English.d.ts +2 -0
- package/lib/src/utils/configEnvKeys.d.ts +68 -0
- package/lib/src/utils/configFiles.d.ts +74 -0
- package/lib/src/utils/configFiles.js +150 -0
- package/lib/src/utils/delegation.d.ts +48 -0
- package/lib/src/utils/deriveUsername.d.ts +21 -0
- package/lib/src/utils/explainMediaPath.d.ts +123 -0
- package/lib/src/utils/formerTitles.d.ts +69 -0
- package/lib/src/utils/frontmatterAccess.d.ts +54 -0
- package/lib/src/utils/headlessAdminPassword.d.ts +55 -0
- package/lib/src/utils/imageTransform.d.ts +52 -0
- package/lib/src/utils/instanceEnvSecret.d.ts +51 -0
- package/lib/src/utils/jobSlots.d.ts +43 -0
- package/lib/src/utils/keywordNormalizer.d.ts +127 -0
- package/lib/src/utils/logger.d.ts +70 -0
- package/lib/src/utils/logger.js +106 -0
- package/lib/src/utils/magicLinkDeviceState.d.ts +95 -0
- package/lib/src/utils/managerUtils.d.ts +40 -0
- package/lib/src/utils/migrateLegacyPrivateAttachments.d.ts +15 -0
- package/lib/src/utils/orgFilename.d.ts +22 -0
- package/lib/src/utils/pageFeature.d.ts +27 -0
- package/lib/src/utils/pageFrontmatter.d.ts +21 -0
- package/lib/src/utils/pageNotes.d.ts +150 -0
- package/lib/src/utils/pageTitleRule.d.ts +37 -0
- package/lib/src/utils/pageToArticle.d.ts +59 -0
- package/lib/src/utils/pageUrl.d.ts +18 -0
- package/lib/src/utils/passwordChange.d.ts +12 -0
- package/lib/src/utils/passwordHash.d.ts +60 -0
- package/lib/src/utils/permissionCatalog.d.ts +52 -0
- package/lib/src/utils/pluginFormatters.d.ts +452 -0
- package/lib/src/utils/pluginFormatters.js +714 -0
- package/lib/src/utils/privateLinkRewrite.d.ts +42 -0
- package/lib/src/utils/privateStoreAccess.d.ts +57 -0
- package/lib/src/utils/privateStoreAccess.js +65 -0
- package/lib/src/utils/privateStoreCatalogs.d.ts +40 -0
- package/lib/src/utils/privateStoreCrypto.d.ts +127 -0
- package/lib/src/utils/privateStoreDoor.d.ts +181 -0
- package/lib/src/utils/privateStoreExport.d.ts +72 -0
- package/lib/src/utils/privateStoreFiles.d.ts +120 -0
- package/lib/src/utils/privateStoreMeta.d.ts +64 -0
- package/lib/src/utils/privateStoreMigrations.d.ts +37 -0
- package/lib/src/utils/privateStorePath.d.ts +259 -0
- package/lib/src/utils/privateStorePath.js +436 -0
- package/lib/src/utils/privateStoreTakeout.d.ts +76 -0
- package/lib/src/utils/privateStoreUnlock.d.ts +175 -0
- package/lib/src/utils/proxyClaim.d.ts +59 -0
- package/lib/src/utils/proxyClaim.js +30 -0
- package/lib/src/utils/redactPrivateNames.d.ts +21 -0
- package/lib/src/utils/redactPrivateNames.js +89 -0
- package/lib/src/utils/redactSecrets.d.ts +58 -0
- package/lib/src/utils/redactSecrets.js +171 -0
- package/lib/src/utils/renameLinkRewrite.d.ts +112 -0
- package/lib/src/utils/roleGrants.d.ts +35 -0
- package/lib/src/utils/safeRedirect.d.ts +32 -0
- package/lib/src/utils/schedule.d.ts +54 -0
- package/lib/src/utils/secretFileMode.d.ts +17 -0
- package/lib/src/utils/seededShippedPages.d.ts +45 -0
- package/lib/src/utils/sensitiveValues.d.ts +59 -0
- package/lib/src/utils/sensitiveValues.js +106 -0
- package/lib/src/utils/sessionEnd.d.ts +12 -0
- package/lib/src/utils/sessionGeneration.d.ts +24 -0
- package/lib/src/utils/sessionIdle.d.ts +41 -0
- package/lib/src/utils/sessionLimits.d.ts +68 -0
- package/lib/src/utils/shareLockbox.d.ts +64 -0
- package/lib/src/utils/sigstoreTrustedRoot.d.ts +33 -0
- package/lib/src/utils/sniffMime.d.ts +21 -0
- package/lib/src/utils/storeSearchIndex.d.ts +75 -0
- package/lib/src/utils/subjectMayDo.d.ts +21 -0
- package/lib/src/utils/systemCategoryRules.d.ts +30 -0
- package/lib/src/utils/systemCategoryRules.js +41 -0
- package/lib/src/utils/userCreateError.d.ts +62 -0
- package/lib/src/utils/username.d.ts +53 -0
- package/lib/src/utils/vaultUrlRewrite.d.ts +27 -0
- package/lib/src/utils/version.d.ts +84 -0
- package/lib/src/utils/videoFrame.d.ts +21 -0
- package/package.json +54 -3
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WikiDocument - Internal DOM representation of a wiki page
|
|
3
|
+
*
|
|
4
|
+
* Similar to JSPWiki's WikiDocument (org.apache.wiki.parser.WikiDocument)
|
|
5
|
+
* which extends JDOM2 Document. This provides a DOM-based alternative to
|
|
6
|
+
* string-based parsing, eliminating order-dependency issues.
|
|
7
|
+
*
|
|
8
|
+
* Key Features:
|
|
9
|
+
* - DOM-based structure (using linkedom for performance)
|
|
10
|
+
* - Cacheable representation
|
|
11
|
+
* - Metadata storage
|
|
12
|
+
* - WeakRef context for garbage collection
|
|
13
|
+
* - Standard W3C DOM API
|
|
14
|
+
*
|
|
15
|
+
* JSPWiki Reference:
|
|
16
|
+
* https://jspwiki.apache.org/apidocs/2.12.1/org/apache/wiki/parser/WikiDocument.html
|
|
17
|
+
*
|
|
18
|
+
* Related: GitHub Issue #93 - Migrate to WikiDocument DOM-Based Parsing
|
|
19
|
+
*/
|
|
20
|
+
import type { LinkedomElement, LinkedomText, LinkedomComment, LinkedomNode, LinkedomNodeList, LinkedomHTMLCollection } from 'linkedom';
|
|
21
|
+
export type { LinkedomElement, LinkedomText, LinkedomComment, LinkedomNode, LinkedomNodeList, LinkedomHTMLCollection };
|
|
22
|
+
/**
|
|
23
|
+
* WikiDocument metadata
|
|
24
|
+
*/
|
|
25
|
+
export interface WikiDocumentMetadata {
|
|
26
|
+
createdAt: string;
|
|
27
|
+
version: string;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* JSON serialization format
|
|
32
|
+
*/
|
|
33
|
+
export interface WikiDocumentJSON {
|
|
34
|
+
pageData: string;
|
|
35
|
+
html: string;
|
|
36
|
+
metadata: WikiDocumentMetadata;
|
|
37
|
+
version: string;
|
|
38
|
+
timestamp: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Document statistics
|
|
42
|
+
*/
|
|
43
|
+
export interface WikiDocumentStatistics {
|
|
44
|
+
nodeCount: number;
|
|
45
|
+
pageDataLength: number;
|
|
46
|
+
htmlLength: number;
|
|
47
|
+
hasContext: boolean;
|
|
48
|
+
metadata: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Rendering context (minimal interface)
|
|
52
|
+
* TODO: Replace with proper WikiContext import once converted
|
|
53
|
+
*/
|
|
54
|
+
export interface WikiContext {
|
|
55
|
+
pageName?: string;
|
|
56
|
+
userName?: string;
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* WikiDocument - DOM-based representation of a wiki page
|
|
61
|
+
*/
|
|
62
|
+
declare class WikiDocument {
|
|
63
|
+
private document;
|
|
64
|
+
private root;
|
|
65
|
+
private pageData;
|
|
66
|
+
private contextRef;
|
|
67
|
+
private metadata;
|
|
68
|
+
/**
|
|
69
|
+
* Creates a new WikiDocument
|
|
70
|
+
*
|
|
71
|
+
* @param pageData - Original wiki markup content
|
|
72
|
+
* @param context - Rendering context (stored as WeakRef)
|
|
73
|
+
*/
|
|
74
|
+
constructor(pageData: string, context?: WikiContext);
|
|
75
|
+
/**
|
|
76
|
+
* Gets the root element of the document
|
|
77
|
+
*
|
|
78
|
+
* @returns Root element (body)
|
|
79
|
+
*/
|
|
80
|
+
getRootElement(): LinkedomElement;
|
|
81
|
+
/**
|
|
82
|
+
* Gets the original wiki markup
|
|
83
|
+
*
|
|
84
|
+
* JSPWiki equivalent: getPageData()
|
|
85
|
+
*
|
|
86
|
+
* @returns Original page data
|
|
87
|
+
*/
|
|
88
|
+
getPageData(): string;
|
|
89
|
+
/**
|
|
90
|
+
* Sets the original wiki markup
|
|
91
|
+
*
|
|
92
|
+
* JSPWiki equivalent: setPageData(String data)
|
|
93
|
+
*
|
|
94
|
+
* @param data - Wiki markup
|
|
95
|
+
*/
|
|
96
|
+
setPageData(data: string): void;
|
|
97
|
+
/**
|
|
98
|
+
* Gets the rendering context (if still alive)
|
|
99
|
+
*
|
|
100
|
+
* JSPWiki equivalent: getContext()
|
|
101
|
+
*
|
|
102
|
+
* @returns Context object or null if garbage collected
|
|
103
|
+
*/
|
|
104
|
+
getContext(): WikiContext | null;
|
|
105
|
+
/**
|
|
106
|
+
* Sets the rendering context
|
|
107
|
+
*
|
|
108
|
+
* JSPWiki equivalent: setContext(Context ctx)
|
|
109
|
+
*
|
|
110
|
+
* @param context - Rendering context
|
|
111
|
+
*/
|
|
112
|
+
setContext(context: WikiContext | null): void;
|
|
113
|
+
/**
|
|
114
|
+
* Gets all metadata
|
|
115
|
+
*
|
|
116
|
+
* @returns Metadata object
|
|
117
|
+
*/
|
|
118
|
+
getMetadata(): WikiDocumentMetadata;
|
|
119
|
+
/**
|
|
120
|
+
* Sets a metadata value
|
|
121
|
+
*
|
|
122
|
+
* @param key - Metadata key
|
|
123
|
+
* @param value - Metadata value
|
|
124
|
+
*/
|
|
125
|
+
setMetadata(key: string, value: unknown): void;
|
|
126
|
+
/**
|
|
127
|
+
* Gets a metadata value
|
|
128
|
+
*
|
|
129
|
+
* @param key - Metadata key
|
|
130
|
+
* @param defaultValue - Default value if not found
|
|
131
|
+
* @returns Metadata value or default
|
|
132
|
+
*/
|
|
133
|
+
getMetadataValue(key: string, defaultValue?: unknown): unknown;
|
|
134
|
+
/**
|
|
135
|
+
* Creates a new element
|
|
136
|
+
*
|
|
137
|
+
* @param tag - Element tag name
|
|
138
|
+
* @param attributes - Element attributes
|
|
139
|
+
* @returns New element
|
|
140
|
+
*/
|
|
141
|
+
createElement(tag: string, attributes?: Record<string, string>): LinkedomElement;
|
|
142
|
+
/**
|
|
143
|
+
* Creates a text node
|
|
144
|
+
*
|
|
145
|
+
* @param text - Text content
|
|
146
|
+
* @returns New text node
|
|
147
|
+
*/
|
|
148
|
+
createTextNode(text: string): LinkedomText;
|
|
149
|
+
/**
|
|
150
|
+
* Creates a comment node
|
|
151
|
+
*
|
|
152
|
+
* @param text - Comment text
|
|
153
|
+
* @returns New comment node
|
|
154
|
+
*/
|
|
155
|
+
createCommentNode(text: string): LinkedomComment;
|
|
156
|
+
/**
|
|
157
|
+
* Appends a child to the root element
|
|
158
|
+
*
|
|
159
|
+
* @param node - Node to append
|
|
160
|
+
* @returns Appended node
|
|
161
|
+
*/
|
|
162
|
+
appendChild(node: LinkedomNode): LinkedomNode;
|
|
163
|
+
/**
|
|
164
|
+
* Inserts a node before a reference node in root
|
|
165
|
+
*
|
|
166
|
+
* @param newNode - Node to insert
|
|
167
|
+
* @param referenceNode - Reference node
|
|
168
|
+
* @returns Inserted node
|
|
169
|
+
*/
|
|
170
|
+
insertBefore(newNode: LinkedomNode, referenceNode: LinkedomNode | null): LinkedomNode;
|
|
171
|
+
/**
|
|
172
|
+
* Removes a child from the root element
|
|
173
|
+
*
|
|
174
|
+
* @param node - Node to remove
|
|
175
|
+
* @returns Removed node
|
|
176
|
+
*/
|
|
177
|
+
removeChild(node: LinkedomNode): LinkedomNode;
|
|
178
|
+
/**
|
|
179
|
+
* Replaces a child in the root element
|
|
180
|
+
*
|
|
181
|
+
* @param newNode - New node
|
|
182
|
+
* @param oldNode - Old node to replace
|
|
183
|
+
* @returns Replaced node
|
|
184
|
+
*/
|
|
185
|
+
replaceChild(newNode: LinkedomNode, oldNode: LinkedomNode): LinkedomNode;
|
|
186
|
+
/**
|
|
187
|
+
* Queries for a single element
|
|
188
|
+
*
|
|
189
|
+
* @param selector - CSS selector
|
|
190
|
+
* @returns First matching element or null
|
|
191
|
+
*/
|
|
192
|
+
querySelector(selector: string): LinkedomElement | null;
|
|
193
|
+
/**
|
|
194
|
+
* Queries for all matching elements
|
|
195
|
+
*
|
|
196
|
+
* @param selector - CSS selector
|
|
197
|
+
* @returns Matching elements
|
|
198
|
+
*/
|
|
199
|
+
querySelectorAll(selector: string): LinkedomNodeList;
|
|
200
|
+
/**
|
|
201
|
+
* Gets element by ID
|
|
202
|
+
*
|
|
203
|
+
* @param id - Element ID
|
|
204
|
+
* @returns Element or null
|
|
205
|
+
*/
|
|
206
|
+
getElementById(id: string): LinkedomElement | null;
|
|
207
|
+
/**
|
|
208
|
+
* Gets elements by class name
|
|
209
|
+
*
|
|
210
|
+
* @param className - Class name
|
|
211
|
+
* @returns Elements with class
|
|
212
|
+
*/
|
|
213
|
+
getElementsByClassName(className: string): LinkedomHTMLCollection;
|
|
214
|
+
/**
|
|
215
|
+
* Gets elements by tag name
|
|
216
|
+
*
|
|
217
|
+
* @param tagName - Tag name
|
|
218
|
+
* @returns Elements with tag
|
|
219
|
+
*/
|
|
220
|
+
getElementsByTagName(tagName: string): LinkedomHTMLCollection;
|
|
221
|
+
/**
|
|
222
|
+
* Serializes the document to HTML string
|
|
223
|
+
*
|
|
224
|
+
* JSPWiki equivalent: XHTMLRenderer.render()
|
|
225
|
+
*
|
|
226
|
+
* @returns HTML string
|
|
227
|
+
*/
|
|
228
|
+
toHTML(): string;
|
|
229
|
+
/**
|
|
230
|
+
* Serializes to string (for debugging)
|
|
231
|
+
*
|
|
232
|
+
* @returns String representation
|
|
233
|
+
*/
|
|
234
|
+
toString(): string;
|
|
235
|
+
/**
|
|
236
|
+
* Serializes to JSON (for caching)
|
|
237
|
+
*
|
|
238
|
+
* @returns JSON representation
|
|
239
|
+
*/
|
|
240
|
+
toJSON(): WikiDocumentJSON;
|
|
241
|
+
/**
|
|
242
|
+
* Deserializes from JSON (for cache restore)
|
|
243
|
+
*
|
|
244
|
+
* @param json - JSON data
|
|
245
|
+
* @param context - Rendering context
|
|
246
|
+
* @returns Restored WikiDocument
|
|
247
|
+
*/
|
|
248
|
+
static fromJSON(json: WikiDocumentJSON, context?: WikiContext | null): WikiDocument;
|
|
249
|
+
/**
|
|
250
|
+
* Clears all content from the document
|
|
251
|
+
*/
|
|
252
|
+
clear(): void;
|
|
253
|
+
/**
|
|
254
|
+
* Gets the number of child nodes in root
|
|
255
|
+
*
|
|
256
|
+
* @returns Number of children
|
|
257
|
+
*/
|
|
258
|
+
getChildCount(): number;
|
|
259
|
+
/**
|
|
260
|
+
* Checks if the document is empty
|
|
261
|
+
*
|
|
262
|
+
* @returns True if empty
|
|
263
|
+
*/
|
|
264
|
+
isEmpty(): boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Gets document statistics
|
|
267
|
+
*
|
|
268
|
+
* @returns Statistics
|
|
269
|
+
*/
|
|
270
|
+
getStatistics(): WikiDocumentStatistics;
|
|
271
|
+
}
|
|
272
|
+
export default WikiDocument;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOMLinkHandler - DOM-based link processing handler
|
|
3
|
+
*
|
|
4
|
+
* Replaces string-based regex link processing with DOM queries.
|
|
5
|
+
* Processes wiki links by querying WikiDocument for .wiki-link elements
|
|
6
|
+
* and updating them with proper href, classes, and attributes based on link type.
|
|
7
|
+
*
|
|
8
|
+
* Part of Phase 5 of WikiDocument DOM Migration (GitHub Issue #108)
|
|
9
|
+
*
|
|
10
|
+
* Supports:
|
|
11
|
+
* - Internal wiki links: [PageName], [Display|Target]
|
|
12
|
+
* - External links: [Display|http://example.com]
|
|
13
|
+
* - InterWiki links: [Display|Wikipedia:Article]
|
|
14
|
+
* - Email links: [Display|mailto:user@example.com]
|
|
15
|
+
* - Anchor links: [Display|#section]
|
|
16
|
+
* - Links with attributes: [Display|Target|class="custom"]
|
|
17
|
+
*
|
|
18
|
+
* Usage:
|
|
19
|
+
* In wiki markup: [Display|Target] becomes <a class="wiki-link" data-wiki-link="Target">
|
|
20
|
+
* This handler processes those elements and sets proper href, class, etc.
|
|
21
|
+
*/
|
|
22
|
+
import type WikiDocument from '../WikiDocument.js';
|
|
23
|
+
import type { LinkedomElement } from '../WikiDocument.js';
|
|
24
|
+
/**
|
|
25
|
+
* Link type enumeration
|
|
26
|
+
*/
|
|
27
|
+
export type LinkType = 'internal' | 'external' | 'interwiki' | 'email' | 'anchor';
|
|
28
|
+
/**
|
|
29
|
+
* Link information object
|
|
30
|
+
*/
|
|
31
|
+
export interface LinkInfo {
|
|
32
|
+
/** Display text for the link */
|
|
33
|
+
text: string;
|
|
34
|
+
/** Link target */
|
|
35
|
+
target: string;
|
|
36
|
+
/** Link attributes */
|
|
37
|
+
attributes: Record<string, string>;
|
|
38
|
+
/** Original wiki syntax */
|
|
39
|
+
originalText: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* InterWiki site configuration
|
|
43
|
+
*/
|
|
44
|
+
export interface InterWikiSite {
|
|
45
|
+
/** URL template with %s placeholder */
|
|
46
|
+
url: string;
|
|
47
|
+
/** Site description */
|
|
48
|
+
description?: string;
|
|
49
|
+
/** Site icon */
|
|
50
|
+
icon?: string;
|
|
51
|
+
/** Whether site is enabled */
|
|
52
|
+
enabled?: boolean;
|
|
53
|
+
/** Whether to open links in new window */
|
|
54
|
+
openInNewWindow?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* WikiEngine interface (minimal)
|
|
58
|
+
*/
|
|
59
|
+
interface WikiEngine {
|
|
60
|
+
/** Get a manager by name */
|
|
61
|
+
getManager(name: string): unknown;
|
|
62
|
+
/** Additional engine properties */
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Extracted link element from JSPWiki syntax extraction
|
|
67
|
+
*/
|
|
68
|
+
export interface ExtractedLinkElement {
|
|
69
|
+
/** Element type */
|
|
70
|
+
type: string;
|
|
71
|
+
/** Link target (may include pipe syntax: "Display|Target") */
|
|
72
|
+
target: string;
|
|
73
|
+
/** Unique ID for tracking */
|
|
74
|
+
id: number;
|
|
75
|
+
/** Original syntax */
|
|
76
|
+
syntax?: string;
|
|
77
|
+
/** Original text */
|
|
78
|
+
originalText?: string;
|
|
79
|
+
/** Start index in content */
|
|
80
|
+
startIndex?: number;
|
|
81
|
+
/** End index in content */
|
|
82
|
+
endIndex?: number;
|
|
83
|
+
/** Additional properties */
|
|
84
|
+
[key: string]: unknown;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Rendering context
|
|
88
|
+
*/
|
|
89
|
+
export interface RenderContext {
|
|
90
|
+
/** Page name */
|
|
91
|
+
pageName?: string;
|
|
92
|
+
/** Additional context properties */
|
|
93
|
+
[key: string]: unknown;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Link statistics by type
|
|
97
|
+
*/
|
|
98
|
+
export interface LinkTypeStats {
|
|
99
|
+
/** Number of internal links */
|
|
100
|
+
internal: number;
|
|
101
|
+
/** Number of external links */
|
|
102
|
+
external: number;
|
|
103
|
+
/** Number of InterWiki links */
|
|
104
|
+
interwiki: number;
|
|
105
|
+
/** Number of email links */
|
|
106
|
+
email: number;
|
|
107
|
+
/** Number of anchor links */
|
|
108
|
+
anchor: number;
|
|
109
|
+
/** Number of error links */
|
|
110
|
+
error: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Link processing statistics
|
|
114
|
+
*/
|
|
115
|
+
export interface LinkStatistics {
|
|
116
|
+
/** Total number of links */
|
|
117
|
+
totalLinks: number;
|
|
118
|
+
/** Link counts by type */
|
|
119
|
+
linkTypes: LinkTypeStats;
|
|
120
|
+
/** Number of red links (non-existent pages) */
|
|
121
|
+
redLinks: number;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* DOMLinkHandler class
|
|
125
|
+
*/
|
|
126
|
+
declare class DOMLinkHandler {
|
|
127
|
+
/** WikiEngine instance */
|
|
128
|
+
private engine;
|
|
129
|
+
/** LinkParser instance */
|
|
130
|
+
private linkParser;
|
|
131
|
+
/** PageManager instance */
|
|
132
|
+
private pageManager;
|
|
133
|
+
/** Set of available page names */
|
|
134
|
+
private pageNames;
|
|
135
|
+
/** Page name matcher for fuzzy matching */
|
|
136
|
+
private pageNameMatcher;
|
|
137
|
+
/**
|
|
138
|
+
* Creates a new DOMLinkHandler
|
|
139
|
+
*
|
|
140
|
+
* @param {WikiEngine} engine - WikiEngine instance
|
|
141
|
+
*/
|
|
142
|
+
constructor(engine: WikiEngine);
|
|
143
|
+
/**
|
|
144
|
+
* Initializes the handler
|
|
145
|
+
*/
|
|
146
|
+
initialize(): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Load page names from PageManager
|
|
149
|
+
*/
|
|
150
|
+
loadPageNames(): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Load InterWiki site configuration
|
|
153
|
+
*/
|
|
154
|
+
loadInterWikiConfiguration(): void;
|
|
155
|
+
/**
|
|
156
|
+
* Processes links in a WikiDocument
|
|
157
|
+
*
|
|
158
|
+
* Queries for .wiki-link elements and updates them with proper href and attributes.
|
|
159
|
+
* This is the DOM-based equivalent of LinkParserHandler.process()
|
|
160
|
+
*
|
|
161
|
+
* @param {WikiDocument} wikiDocument - The WikiDocument to process
|
|
162
|
+
* @param {RenderContext} context - Rendering context
|
|
163
|
+
* @returns {Promise<WikiDocument>} Updated WikiDocument
|
|
164
|
+
*/
|
|
165
|
+
processLinks(wikiDocument: WikiDocument, context: RenderContext): Promise<WikiDocument>;
|
|
166
|
+
/**
|
|
167
|
+
* Process a link element based on its type
|
|
168
|
+
*
|
|
169
|
+
* @param linkElement - The link DOM element
|
|
170
|
+
* @param linkInfo - Link information
|
|
171
|
+
* @param linkType - Link type
|
|
172
|
+
* @param context - Rendering context
|
|
173
|
+
*/
|
|
174
|
+
processLinkByType(linkElement: LinkedomElement, linkInfo: LinkInfo, linkType: LinkType, context: RenderContext): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Process internal wiki link
|
|
177
|
+
*
|
|
178
|
+
* @param linkElement - The link DOM element
|
|
179
|
+
* @param linkInfo - Link information
|
|
180
|
+
* @param _context - Rendering context (unused)
|
|
181
|
+
*/
|
|
182
|
+
processInternalLink(linkElement: LinkedomElement, linkInfo: LinkInfo, _context: RenderContext): void;
|
|
183
|
+
/**
|
|
184
|
+
* Process external link
|
|
185
|
+
*
|
|
186
|
+
* @param linkElement - The link DOM element
|
|
187
|
+
* @param linkInfo - Link information
|
|
188
|
+
* @param _context - Rendering context (unused)
|
|
189
|
+
*/
|
|
190
|
+
processExternalLink(linkElement: LinkedomElement, linkInfo: LinkInfo, _context: RenderContext): void;
|
|
191
|
+
/**
|
|
192
|
+
* Process InterWiki link
|
|
193
|
+
*
|
|
194
|
+
* @param linkElement - The link DOM element
|
|
195
|
+
* @param linkInfo - Link information
|
|
196
|
+
* @param _context - Rendering context (unused)
|
|
197
|
+
*/
|
|
198
|
+
processInterWikiLink(linkElement: LinkedomElement, linkInfo: LinkInfo, _context: RenderContext): void;
|
|
199
|
+
/**
|
|
200
|
+
* Process email link
|
|
201
|
+
*
|
|
202
|
+
* @param linkElement - The link DOM element
|
|
203
|
+
* @param linkInfo - Link information
|
|
204
|
+
* @param _context - Rendering context (unused)
|
|
205
|
+
*/
|
|
206
|
+
processEmailLink(linkElement: LinkedomElement, linkInfo: LinkInfo, _context: RenderContext): void;
|
|
207
|
+
/**
|
|
208
|
+
* Process anchor link
|
|
209
|
+
*
|
|
210
|
+
* @param linkElement - The link DOM element
|
|
211
|
+
* @param linkInfo - Link information
|
|
212
|
+
* @param _context - Rendering context (unused)
|
|
213
|
+
*/
|
|
214
|
+
processAnchorLink(linkElement: LinkedomElement, linkInfo: LinkInfo, _context: RenderContext): void;
|
|
215
|
+
/**
|
|
216
|
+
* Creates a DOM node from an extracted link element
|
|
217
|
+
*
|
|
218
|
+
* This method is part of the Phase 2 extraction-based parsing (Issue #114).
|
|
219
|
+
* It creates a link node from a pre-extracted element instead of parsing tokens.
|
|
220
|
+
*
|
|
221
|
+
* @param {ExtractedLinkElement} element - Extracted element from extractJSPWikiSyntax()
|
|
222
|
+
* @param {RenderContext} context - Rendering context; `pageOwner` selects the store a `[store/Title]` link resolves in (#1457)
|
|
223
|
+
* @param {WikiDocument} wikiDocument - WikiDocument to create node in
|
|
224
|
+
* @returns {Promise<Element>} DOM node for the link
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* const element = { type: 'link', target: 'PageName', id: 0, ... };
|
|
228
|
+
* const node = await handler.createNodeFromExtract(element, context, wikiDoc);
|
|
229
|
+
* // Returns: <a class="wiki-link wikipage" href="/view/PageName" data-jspwiki-id="0">PageName</a>
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* const element = { type: 'link', target: 'Click Here|PageName', id: 1, ... };
|
|
233
|
+
* const node = await handler.createNodeFromExtract(element, context, wikiDoc);
|
|
234
|
+
* // Returns: <a class="wiki-link wikipage" href="/view/PageName" data-jspwiki-id="1">Click Here</a>
|
|
235
|
+
*/
|
|
236
|
+
createNodeFromExtract(element: ExtractedLinkElement, context: RenderContext, wikiDocument: WikiDocument): Promise<LinkedomElement>;
|
|
237
|
+
/**
|
|
238
|
+
* Gets statistics about link processing
|
|
239
|
+
*
|
|
240
|
+
* @param {WikiDocument} wikiDocument - Document to analyze
|
|
241
|
+
* @returns {LinkStatistics} Statistics
|
|
242
|
+
*/
|
|
243
|
+
getStatistics(wikiDocument: WikiDocument): LinkStatistics;
|
|
244
|
+
/**
|
|
245
|
+
* Refresh page names cache (called when pages are added/removed)
|
|
246
|
+
*/
|
|
247
|
+
refreshPageNames(): Promise<void>;
|
|
248
|
+
/**
|
|
249
|
+
* Add a single page name to the known pages set (incremental update on page create/rename).
|
|
250
|
+
* Avoids the full getAllPages() reload cost of refreshPageNames().
|
|
251
|
+
* @param {string} pageName - Page name to add
|
|
252
|
+
*/
|
|
253
|
+
addPageName(pageName: string): void;
|
|
254
|
+
/**
|
|
255
|
+
* Remove a single page name from the known pages set (incremental update on page delete/rename).
|
|
256
|
+
* @param {string} pageName - Page name to remove
|
|
257
|
+
*/
|
|
258
|
+
removePageName(pageName: string): void;
|
|
259
|
+
}
|
|
260
|
+
export default DOMLinkHandler;
|