@jwilleke/ngdpbase-types 0.0.0 → 5.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +391 -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 +89 -0
- package/lib/src/managers/DatabaseManager.js +236 -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/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 +163 -0
- package/lib/src/utils/auditEventNames.generated.js +168 -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,125 @@
|
|
|
1
|
+
import BaseSyntaxHandler, { InitializationContext } from './BaseSyntaxHandler.js';
|
|
2
|
+
import ParseContext from '../context/ParseContext.js';
|
|
3
|
+
/**
|
|
4
|
+
* Wiki engine interface
|
|
5
|
+
*/
|
|
6
|
+
interface WikiEngine {
|
|
7
|
+
getManager(name: string): unknown;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* WikiTagHandler - JSP-like tag processing for conditional content and page inclusion
|
|
11
|
+
*
|
|
12
|
+
* Supports JSPWiki WikiTags:
|
|
13
|
+
* - <wiki:If test="condition">content</wiki:If> - Conditional display
|
|
14
|
+
* - <wiki:Include page="PageName" /> - Page inclusion
|
|
15
|
+
* - <wiki:UserCheck status="authenticated">content</wiki:UserCheck> - User validation
|
|
16
|
+
*
|
|
17
|
+
* Related Issue: #59 - WikiTag Handler (If, Include, UserCheck)
|
|
18
|
+
* Epic: #41 - Implement JSPWikiMarkupParser for Complete Enhancement Support
|
|
19
|
+
*/
|
|
20
|
+
declare class WikiTagHandler extends BaseSyntaxHandler {
|
|
21
|
+
handlerId: string;
|
|
22
|
+
private engine;
|
|
23
|
+
private config;
|
|
24
|
+
private supportedTags;
|
|
25
|
+
constructor(engine?: WikiEngine | null);
|
|
26
|
+
/**
|
|
27
|
+
* Initialize handler with configuration
|
|
28
|
+
* @param context - Initialization context
|
|
29
|
+
*/
|
|
30
|
+
protected onInitialize(context: InitializationContext): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Process content by finding and executing all WikiTag instances
|
|
33
|
+
* @param content - Content to process
|
|
34
|
+
* @param context - Parse context
|
|
35
|
+
* @returns Content with WikiTags processed
|
|
36
|
+
*/
|
|
37
|
+
process(content: string, context: ParseContext): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Handle a specific WikiTag match
|
|
40
|
+
* @param matchInfo - WikiTag match information
|
|
41
|
+
* @param context - Parse context
|
|
42
|
+
* @returns Tag output HTML
|
|
43
|
+
*/
|
|
44
|
+
private handleTag;
|
|
45
|
+
/**
|
|
46
|
+
* Handle wiki:If tag - conditional content display
|
|
47
|
+
* @param attributes - Tag attributes
|
|
48
|
+
* @param content - Tag content
|
|
49
|
+
* @param context - Parse context
|
|
50
|
+
* @returns Conditional content or empty string
|
|
51
|
+
*/
|
|
52
|
+
private handleIfTag;
|
|
53
|
+
/**
|
|
54
|
+
* Handle wiki:Include tag - page inclusion
|
|
55
|
+
* @param attributes - Tag attributes
|
|
56
|
+
* @param context - Parse context
|
|
57
|
+
* @returns Included page content
|
|
58
|
+
*/
|
|
59
|
+
private handleIncludeTag;
|
|
60
|
+
/**
|
|
61
|
+
* Handle wiki:UserCheck tag - user authentication and authorization checks
|
|
62
|
+
* @param attributes - Tag attributes
|
|
63
|
+
* @param content - Tag content
|
|
64
|
+
* @param context - Parse context
|
|
65
|
+
* @returns Content if user check passes, empty otherwise
|
|
66
|
+
*/
|
|
67
|
+
private handleUserCheckTag;
|
|
68
|
+
/**
|
|
69
|
+
* Evaluate conditional expression for wiki:If tags
|
|
70
|
+
* @param condition - Condition expression to evaluate
|
|
71
|
+
* @param context - Parse context
|
|
72
|
+
* @returns True if condition passes
|
|
73
|
+
*/
|
|
74
|
+
private evaluateCondition;
|
|
75
|
+
/**
|
|
76
|
+
* Evaluate complex boolean conditions with && and || operators
|
|
77
|
+
* @param condition - Complex condition expression
|
|
78
|
+
* @param context - Parse context
|
|
79
|
+
* @returns Evaluation result
|
|
80
|
+
*/
|
|
81
|
+
private evaluateComplexCondition;
|
|
82
|
+
/**
|
|
83
|
+
* Resolve context variable for conditions
|
|
84
|
+
* @param varName - Variable name
|
|
85
|
+
* @param context - Parse context
|
|
86
|
+
* @returns Variable value
|
|
87
|
+
*/
|
|
88
|
+
private resolveContextVariable;
|
|
89
|
+
/**
|
|
90
|
+
* Check for recursive inclusion to prevent infinite loops
|
|
91
|
+
* @param pageName - Page being included
|
|
92
|
+
* @param context - Parse context
|
|
93
|
+
* @returns True if recursive inclusion detected
|
|
94
|
+
*/
|
|
95
|
+
private isRecursiveInclusion;
|
|
96
|
+
/**
|
|
97
|
+
* Extract specific section from page content
|
|
98
|
+
* @param content - Full page content
|
|
99
|
+
* @param sectionName - Section name to extract
|
|
100
|
+
* @returns Section content or full content if section not found
|
|
101
|
+
*/
|
|
102
|
+
private extractSection;
|
|
103
|
+
/**
|
|
104
|
+
* Parse tag attributes from attribute string
|
|
105
|
+
* @param attributeString - Attribute string to parse
|
|
106
|
+
* @returns Parsed attributes
|
|
107
|
+
*/
|
|
108
|
+
private parseTagAttributes;
|
|
109
|
+
/**
|
|
110
|
+
* Get supported WikiTag patterns
|
|
111
|
+
* @returns Array of supported patterns
|
|
112
|
+
*/
|
|
113
|
+
getSupportedPatterns(): string[];
|
|
114
|
+
/**
|
|
115
|
+
* Get supported conditions for wiki:If tags
|
|
116
|
+
* @returns Array of supported conditions
|
|
117
|
+
*/
|
|
118
|
+
getSupportedConditions(): string[];
|
|
119
|
+
/**
|
|
120
|
+
* Get handler information for debugging and documentation
|
|
121
|
+
* @returns Handler information
|
|
122
|
+
*/
|
|
123
|
+
getInfo(): Record<string, unknown>;
|
|
124
|
+
}
|
|
125
|
+
export default WikiTagHandler;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One JSPWiki table row, read the way JSPWiki reads it (#1338).
|
|
3
|
+
*
|
|
4
|
+
* The one implementation for both table paths: a table inside a `%%` style
|
|
5
|
+
* block (`MarkupParser.createTableNode`) and a bare one
|
|
6
|
+
* (`JSPWikiPreprocessor`). They had a copy each, and the bare one dropped the
|
|
7
|
+
* last cell of every row without a trailing delimiter — 4,442 rows on 475
|
|
8
|
+
* jimstest pages — because it always cut the last split piece.
|
|
9
|
+
*
|
|
10
|
+
* - A row starting with `||` is a header row, split on `||`; otherwise on `|`.
|
|
11
|
+
* - The piece before the leading delimiter is empty and is dropped.
|
|
12
|
+
* - The trailing delimiter is optional. The piece after the last delimiter is
|
|
13
|
+
* dropped only when it is empty, as JSPWiki does; otherwise it is a cell.
|
|
14
|
+
* - A delimiter inside `[...]` belongs to a wiki link (`[Text|Page]`), not
|
|
15
|
+
* to the table.
|
|
16
|
+
*/
|
|
17
|
+
export interface JspwikiTableRow {
|
|
18
|
+
isHeader: boolean;
|
|
19
|
+
cells: string[];
|
|
20
|
+
}
|
|
21
|
+
export declare function parseJspwikiTableRow(line: string): JspwikiTableRow;
|
|
22
|
+
/**
|
|
23
|
+
* Split text on a delimiter, except inside `[...]` bracket groups: the pipe
|
|
24
|
+
* in `[wiki link|PageName]` is not a cell boundary.
|
|
25
|
+
*/
|
|
26
|
+
export declare function splitCellsBracketAware(text: string, delimiter: string): string[];
|
|
27
|
+
/**
|
|
28
|
+
* A GFM table's separator row: `|---|:---:|` (#1352). Cells of dashes, each
|
|
29
|
+
* optionally colon-edged for alignment; leading and trailing pipes optional.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isGfmSeparatorRow(line: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The rows of a table block, with a GFM table read as one (#1352): the row
|
|
34
|
+
* above a separator row is the header, and the separator itself is not a
|
|
35
|
+
* row. Without this a pasted GFM table rendered its `|---|` line as a row of
|
|
36
|
+
* dashes and had no header. A JSPWiki table has no separator row and comes
|
|
37
|
+
* through unchanged.
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseTableRows(lines: readonly string[]): JspwikiTableRow[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The opener of a block-form `%%` style block, on its own line (#1345).
|
|
3
|
+
*
|
|
4
|
+
* One or more class names, separated by spaces or dots — `%%information`,
|
|
5
|
+
* `%%btn btn-sm`, `%%size-20.bg-silver`. A dot is a class separator, as in
|
|
6
|
+
* the inline form (`%%btn.btn-info … /%`) and in Apache JSPWiki
|
|
7
|
+
* (`JSPWikiMarkupParser.handleDiv`). Shared by the markup parser's
|
|
8
|
+
* extraction and the JSPWiki preprocessor, which each had their own copy and
|
|
9
|
+
* had drifted: neither accepted a dot, and the preprocessor accepted only one
|
|
10
|
+
* class.
|
|
11
|
+
*/
|
|
12
|
+
export declare const STYLE_BLOCK_OPENER: RegExp;
|
|
13
|
+
/** The class attribute for an opener's captured names: dots and runs of spaces become one space. */
|
|
14
|
+
export declare function styleBlockClasses(captured: string): string;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin types for ngdpbase plugins
|
|
3
|
+
*
|
|
4
|
+
* These types provide proper TypeScript definitions for plugins
|
|
5
|
+
* that use the object-with-execute pattern.
|
|
6
|
+
*/
|
|
7
|
+
import type { PluginFormatters } from '../managers/PluginManager.js';
|
|
8
|
+
export type { PluginFormatters };
|
|
9
|
+
/**
|
|
10
|
+
* Wiki engine interface for plugins
|
|
11
|
+
*/
|
|
12
|
+
export interface WikiEngine {
|
|
13
|
+
getManager(name: string): unknown;
|
|
14
|
+
startTime?: number;
|
|
15
|
+
logger?: {
|
|
16
|
+
error: (...args: unknown[]) => void;
|
|
17
|
+
};
|
|
18
|
+
getConfig?(): {
|
|
19
|
+
get?: (key: string, defaultValue: unknown) => unknown;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Plugin context passed to plugins during execution
|
|
24
|
+
*/
|
|
25
|
+
export interface PluginContext {
|
|
26
|
+
engine?: WikiEngine;
|
|
27
|
+
pageName: string;
|
|
28
|
+
linkGraph: Record<string, unknown>;
|
|
29
|
+
/** Query-string parameters from the current HTTP request (e.g. { page: '2' }) */
|
|
30
|
+
query?: Record<string, string>;
|
|
31
|
+
/** #1820: PluginManager's formatter helpers, e.g. `context.formatters.escapeHtml(s)`. */
|
|
32
|
+
formatters: PluginFormatters;
|
|
33
|
+
/**
|
|
34
|
+
* #1751: this render reads `topic`'s data (by convention the owning
|
|
35
|
+
* manager's name, e.g. 'LedgerManager'). Call before reading; the cached
|
|
36
|
+
* page is re-rendered once the manager bumps that topic.
|
|
37
|
+
*/
|
|
38
|
+
dependsOn?: (topic: string) => void;
|
|
39
|
+
/** #1751: this render's output changes on its own; do not cache the page. */
|
|
40
|
+
markVolatile?: () => void;
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Plugin parameters (parsed from plugin syntax)
|
|
45
|
+
*/
|
|
46
|
+
export interface PluginParams {
|
|
47
|
+
[key: string]: string | number | boolean | undefined;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Simple plugin interface for plugins that use the execute method pattern
|
|
51
|
+
* (does not require the callable function signature)
|
|
52
|
+
*/
|
|
53
|
+
export interface SimplePlugin {
|
|
54
|
+
name?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
author?: string;
|
|
57
|
+
version?: string;
|
|
58
|
+
initialize?: (engine: unknown) => Promise<void> | void;
|
|
59
|
+
fetch?: (engine: unknown) => Promise<void> | void;
|
|
60
|
+
execute?: (context: PluginContext, params: PluginParams) => Promise<string> | string;
|
|
61
|
+
/**
|
|
62
|
+
* Its output changes with nothing written (a clock): a page that runs it is
|
|
63
|
+
* not kept in the page cache (#1751). Data a plugin reads from a manager is
|
|
64
|
+
* declared with `context.dependsOn(topic)` instead, which keeps the page
|
|
65
|
+
* cached until that data changes.
|
|
66
|
+
*/
|
|
67
|
+
volatile?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Callable plugin type for plugins that can be called directly
|
|
71
|
+
* (like referringPagesPlugin)
|
|
72
|
+
*/
|
|
73
|
+
export type CallablePlugin = ((pageName: string, params: PluginParams, linkGraph: Record<string, string[]>) => string | Promise<string>) & {
|
|
74
|
+
name: string;
|
|
75
|
+
description: string;
|
|
76
|
+
author: string;
|
|
77
|
+
version: string;
|
|
78
|
+
initialize?: (engine: unknown) => void;
|
|
79
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentTokenAuthProvider — verify a user-delegated agent API token presented
|
|
3
|
+
* on the `Authorization: Bearer <token>` header (#946).
|
|
4
|
+
*
|
|
5
|
+
* Counterpart to AuthentikBearerAuthProvider, but with no external IdP: the
|
|
6
|
+
* credential is minted in-app by the user it belongs to. Both providers can be
|
|
7
|
+
* enabled at once — the bearer middleware tries each registered bearer-capable
|
|
8
|
+
* provider in turn.
|
|
9
|
+
*
|
|
10
|
+
* The provider only answers "which user, and with which scopes". Permissions
|
|
11
|
+
* are resolved live from that user's record by the middleware, so a token
|
|
12
|
+
* never carries a snapshot of its owner's authority.
|
|
13
|
+
*
|
|
14
|
+
* Wire-up: request-time middleware in `src/app.ts` (header → verify →
|
|
15
|
+
* set req.userContext). Stateless — no session is created for API calls. It
|
|
16
|
+
* does NOT participate in the /login flow.
|
|
17
|
+
*/
|
|
18
|
+
import type { WikiEngine } from '../types/WikiEngine.js';
|
|
19
|
+
import type { AuthProvider, AuthVerifyCredentials, AuthResult, ViaToken } from './BaseAuthProvider.js';
|
|
20
|
+
/**
|
|
21
|
+
* Extra detail this provider returns alongside the username.
|
|
22
|
+
*
|
|
23
|
+
* `viaToken` is optional on `AuthResult` (#1048) because most providers have
|
|
24
|
+
* none; here it is REQUIRED. A successful agent-token verify without token
|
|
25
|
+
* detail would be a credential with no scope ceiling attached, so narrowing it
|
|
26
|
+
* is the point of this type rather than a formality.
|
|
27
|
+
*/
|
|
28
|
+
export interface AgentTokenAuthResult extends AuthResult {
|
|
29
|
+
viaToken: ViaToken;
|
|
30
|
+
}
|
|
31
|
+
export declare class AgentTokenAuthProvider implements AuthProvider {
|
|
32
|
+
readonly id = "agent-token";
|
|
33
|
+
readonly displayName = "Agent API Token";
|
|
34
|
+
/** Marks this provider as usable by the bearer middleware. */
|
|
35
|
+
readonly acceptsBearer = true;
|
|
36
|
+
private engine;
|
|
37
|
+
constructor(engine: WikiEngine);
|
|
38
|
+
verify(credentials: AuthVerifyCredentials): Promise<AgentTokenAuthResult | null>;
|
|
39
|
+
}
|
|
40
|
+
export default AgentTokenAuthProvider;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AuthentikBearerAuthProvider — verify an Authentik-issued OAuth/OIDC bearer
|
|
3
|
+
* JWT presented on the `Authorization: Bearer <token>` header (#818).
|
|
4
|
+
*
|
|
5
|
+
* Unlike the interactive Google-OIDC code-exchange flow, this provider trusts
|
|
6
|
+
* a token an automated client (e.g. an AI agent) already holds — minted in
|
|
7
|
+
* Authentik via the `client_credentials` grant against a per-person service
|
|
8
|
+
* account. It verifies the JWT signature against Authentik's JWKS, checks
|
|
9
|
+
* issuer + audience, then coordinates the identity to a local User record.
|
|
10
|
+
*
|
|
11
|
+
* Design mirrors CloudflareAccessAuthProvider (#649):
|
|
12
|
+
* - User coordination by **email** (`email` claim).
|
|
13
|
+
* - Unknown user → **JIT-provision** with default-role (overridable per
|
|
14
|
+
* Authentik group via `group-map`).
|
|
15
|
+
* - `groups[]` claim → ngdpbase roles via config-map.
|
|
16
|
+
*
|
|
17
|
+
* Author attribution (epic decision A): the service account's email is set to
|
|
18
|
+
* match the human's ngdpbase account, so `findUserByEmail` resolves to that
|
|
19
|
+
* user and pages are authored under their existing username (the UI renders
|
|
20
|
+
* their displayName, e.g. "Jim Willeke").
|
|
21
|
+
*
|
|
22
|
+
* Wire-up: invoked by the request-time middleware in `src/app.ts` (header →
|
|
23
|
+
* verify → resolve-or-provision → set req.userContext, stateless — no session
|
|
24
|
+
* is created for API calls). It does NOT participate in the /login flow.
|
|
25
|
+
*
|
|
26
|
+
* Token verification uses `jose.createRemoteJWKSet` against the configured
|
|
27
|
+
* JWKS URL — keys are fetched on demand and cached + rotated by jose.
|
|
28
|
+
*/
|
|
29
|
+
import { type JWTVerifyGetKey } from 'jose';
|
|
30
|
+
import type { WikiEngine } from '../types/WikiEngine.js';
|
|
31
|
+
import type { AuthProvider, AuthVerifyCredentials, AuthResult } from './BaseAuthProvider.js';
|
|
32
|
+
export interface AuthentikBearerConfig {
|
|
33
|
+
/** OIDC issuer, e.g. `https://auth.example.com/application/o/ngdpbase/`. */
|
|
34
|
+
issuer: string;
|
|
35
|
+
/** JWKS URI, e.g. `<issuer>jwks/`. */
|
|
36
|
+
jwksUrl: string;
|
|
37
|
+
/** Expected audience (the Authentik provider's client-id). */
|
|
38
|
+
audience: string;
|
|
39
|
+
/** Role assigned to JIT-provisioned users when no group maps. */
|
|
40
|
+
defaultRole: string;
|
|
41
|
+
/**
|
|
42
|
+
* Map of Authentik group name → ngdpbase role name. Groups absent from this
|
|
43
|
+
* map are silently ignored (user still gets defaultRole).
|
|
44
|
+
*/
|
|
45
|
+
groupMap: Record<string, string>;
|
|
46
|
+
}
|
|
47
|
+
export declare class AuthentikBearerAuthProvider implements AuthProvider {
|
|
48
|
+
readonly id = "authentik-bearer";
|
|
49
|
+
readonly displayName = "Authentik (Bearer)";
|
|
50
|
+
/** Marks this provider as usable by the bearer middleware. */
|
|
51
|
+
readonly acceptsBearer = true;
|
|
52
|
+
private readonly engine;
|
|
53
|
+
private readonly config;
|
|
54
|
+
private readonly jwks;
|
|
55
|
+
/**
|
|
56
|
+
* @param jwksOverride optional pre-built JWKS getter for tests; production
|
|
57
|
+
* omits this and uses `createRemoteJWKSet` against the configured JWKS URL.
|
|
58
|
+
*/
|
|
59
|
+
constructor(engine: WikiEngine, config: AuthentikBearerConfig, jwksOverride?: JWTVerifyGetKey);
|
|
60
|
+
/**
|
|
61
|
+
* Verify the bearer JWT and resolve (or provision) the local user.
|
|
62
|
+
* `credentials.token` is the raw JWT lifted from the `Authorization: Bearer`
|
|
63
|
+
* header by the request-time middleware.
|
|
64
|
+
*/
|
|
65
|
+
verify(credentials: AuthVerifyCredentials): Promise<AuthResult | null>;
|
|
66
|
+
private resolveOrProvision;
|
|
67
|
+
/**
|
|
68
|
+
* Map Authentik groups[] to ngdpbase role names. Groups without an entry in
|
|
69
|
+
* config.groupMap are dropped silently. Result always contains
|
|
70
|
+
* config.defaultRole — even with no group hits, user gets the default.
|
|
71
|
+
*/
|
|
72
|
+
private mapGroupsToRoles;
|
|
73
|
+
private findUserByEmail;
|
|
74
|
+
private deriveUniqueUsername;
|
|
75
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { AttachmentMetadata, AttachmentProvider } from '../types/index.js';
|
|
2
|
+
import type { StoreFileEntry, StoreFileLocation } from '../types/Provider.js';
|
|
3
|
+
import type { WikiEngine } from '../types/WikiEngine.js';
|
|
4
|
+
import { ProviderInfo } from './BasePageProvider.js';
|
|
5
|
+
import BaseProvider from './BaseProvider.js';
|
|
6
|
+
/**
|
|
7
|
+
* File information for attachment uploads
|
|
8
|
+
*/
|
|
9
|
+
interface FileInfo {
|
|
10
|
+
/** Original filename */
|
|
11
|
+
originalName: string;
|
|
12
|
+
/** MIME type */
|
|
13
|
+
mimeType: string;
|
|
14
|
+
/** File size in bytes */
|
|
15
|
+
size: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* User information
|
|
19
|
+
*/
|
|
20
|
+
interface User {
|
|
21
|
+
/** User identifier */
|
|
22
|
+
id?: string;
|
|
23
|
+
/** Username */
|
|
24
|
+
username?: string;
|
|
25
|
+
/** Email address */
|
|
26
|
+
email?: string;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Attachment retrieval result
|
|
31
|
+
*/
|
|
32
|
+
interface AttachmentResult {
|
|
33
|
+
/** File buffer */
|
|
34
|
+
buffer: Buffer;
|
|
35
|
+
/** Attachment metadata */
|
|
36
|
+
metadata: AttachmentMetadata;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* BaseAttachmentProvider - Abstract interface for attachment storage providers
|
|
40
|
+
*
|
|
41
|
+
* All attachment storage providers must extend this class and implement its methods.
|
|
42
|
+
* Providers handle the actual storage and retrieval of wiki attachments (files, images, etc.),
|
|
43
|
+
* whether from filesystem, database, cloud storage, or other backends.
|
|
44
|
+
*
|
|
45
|
+
* Following JSPWiki's attachment provider pattern.
|
|
46
|
+
*
|
|
47
|
+
* @class BaseAttachmentProvider
|
|
48
|
+
* @abstract
|
|
49
|
+
*
|
|
50
|
+
* @property {WikiEngine} engine - Reference to the wiki engine
|
|
51
|
+
* @property {boolean} initialized - Whether provider has been initialized
|
|
52
|
+
*
|
|
53
|
+
* @see {@link BasicAttachmentProvider} for filesystem implementation
|
|
54
|
+
* @see {@link AttachmentManager} for usage
|
|
55
|
+
*/
|
|
56
|
+
declare abstract class BaseAttachmentProvider extends BaseProvider implements AttachmentProvider {
|
|
57
|
+
/** Reference to the wiki engine */
|
|
58
|
+
protected engine: WikiEngine;
|
|
59
|
+
/** Whether provider has been initialized */
|
|
60
|
+
protected initialized: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Create a new attachment provider
|
|
63
|
+
*
|
|
64
|
+
* @constructor
|
|
65
|
+
* @param {WikiEngine} engine - The WikiEngine instance
|
|
66
|
+
* @throws {Error} If engine is not provided
|
|
67
|
+
*/
|
|
68
|
+
constructor(engine: WikiEngine);
|
|
69
|
+
/**
|
|
70
|
+
* Initialize the provider
|
|
71
|
+
*
|
|
72
|
+
* IMPORTANT: Providers MUST access configuration via ConfigurationManager:
|
|
73
|
+
* const configManager = this.engine.getManager('ConfigurationManager');
|
|
74
|
+
* const value = configManager.getProperty('key', 'default');
|
|
75
|
+
*
|
|
76
|
+
* Do NOT read configuration files directly.
|
|
77
|
+
*
|
|
78
|
+
* @returns {Promise<void>}
|
|
79
|
+
*/
|
|
80
|
+
abstract initialize(): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Upload/store an attachment with metadata (legacy method for backward compatibility)
|
|
83
|
+
* @param {Buffer} fileBuffer - File data
|
|
84
|
+
* @param {FileInfo} fileInfo - File information (originalName, mimeType, size)
|
|
85
|
+
* @param {Partial<AttachmentMetadata>} _metadata - Attachment metadata
|
|
86
|
+
* @param {User} _user - User uploading the attachment
|
|
87
|
+
* @returns {Promise<AttachmentMetadata>} Attachment metadata with ID
|
|
88
|
+
*/
|
|
89
|
+
storeAttachment(_fileBuffer: Buffer, _fileInfo: FileInfo, _metadata?: Partial<AttachmentMetadata>, _user?: User | null): Promise<AttachmentMetadata>;
|
|
90
|
+
/**
|
|
91
|
+
* Get attachment file data
|
|
92
|
+
* @param {string} attachmentId - Attachment identifier
|
|
93
|
+
* @returns {Promise<AttachmentResult|null>} File buffer and metadata
|
|
94
|
+
*/
|
|
95
|
+
abstract getAttachment(attachmentId: string): Promise<AttachmentResult | null>;
|
|
96
|
+
/**
|
|
97
|
+
* Get attachment metadata only (no file data)
|
|
98
|
+
* @param {string} attachmentId - Attachment identifier
|
|
99
|
+
* @returns {Promise<AttachmentMetadata|null>} Attachment metadata
|
|
100
|
+
*/
|
|
101
|
+
abstract getAttachmentMetadata(attachmentId: string): Promise<AttachmentMetadata | null>;
|
|
102
|
+
/**
|
|
103
|
+
* Update attachment metadata (e.g., add page reference)
|
|
104
|
+
* @param {string} attachmentId - Attachment identifier
|
|
105
|
+
* @param {Partial<AttachmentMetadata>} metadata - Updated metadata
|
|
106
|
+
* @returns {Promise<boolean>} Success status
|
|
107
|
+
*/
|
|
108
|
+
abstract updateAttachmentMetadata(attachmentId: string, metadata: Partial<AttachmentMetadata>): Promise<boolean>;
|
|
109
|
+
/**
|
|
110
|
+
* Delete an attachment
|
|
111
|
+
* @param {string} attachmentId - Attachment identifier
|
|
112
|
+
* @returns {Promise<boolean>} True if deleted, false if not found
|
|
113
|
+
*/
|
|
114
|
+
abstract deleteAttachment(attachmentId: string): Promise<boolean>;
|
|
115
|
+
/**
|
|
116
|
+
* Check if attachment exists
|
|
117
|
+
* @param {string} attachmentId - Attachment identifier
|
|
118
|
+
* @returns {Promise<boolean>}
|
|
119
|
+
*/
|
|
120
|
+
abstract attachmentExists(attachmentId: string): Promise<boolean>;
|
|
121
|
+
/**
|
|
122
|
+
* Get all attachments metadata (without file data)
|
|
123
|
+
* @returns {Promise<AttachmentMetadata[]>} Array of attachment metadata
|
|
124
|
+
*/
|
|
125
|
+
abstract getAllAttachments(): Promise<AttachmentMetadata[]>;
|
|
126
|
+
/**
|
|
127
|
+
* Get attachments used by a specific page
|
|
128
|
+
* @param {string} pageName - Page name/title
|
|
129
|
+
* @returns {Promise<AttachmentMetadata[]>} Array of attachment metadata
|
|
130
|
+
*/
|
|
131
|
+
abstract getAttachmentsForPage(pageName: string): Promise<AttachmentMetadata[]>;
|
|
132
|
+
/**
|
|
133
|
+
* List attachments for a page (AttachmentProvider interface method)
|
|
134
|
+
* @param {string} pageUuid - Page UUID
|
|
135
|
+
* @returns {Promise<AttachmentMetadata[]>} Array of attachment metadata
|
|
136
|
+
*/
|
|
137
|
+
abstract listAttachments(pageUuid: string): Promise<AttachmentMetadata[]>;
|
|
138
|
+
/**
|
|
139
|
+
* Delete all attachments for a page
|
|
140
|
+
* @param {string} pageUuid - Page UUID
|
|
141
|
+
* @returns {Promise<number>} Number of attachments deleted
|
|
142
|
+
*/
|
|
143
|
+
abstract deletePageAttachments(pageUuid: string): Promise<number>;
|
|
144
|
+
/**
|
|
145
|
+
* Find an attachment by its original filename across all attachments
|
|
146
|
+
* @param {string} filename - Original filename to search for
|
|
147
|
+
* @returns {Promise<AttachmentMetadata|null>} Matching attachment metadata or null
|
|
148
|
+
*/
|
|
149
|
+
getAttachmentByFilename(_filename: string): Promise<AttachmentMetadata | null>;
|
|
150
|
+
/** Store a file in a store. The same bytes already in THAT store return the existing entry. */
|
|
151
|
+
storeFileInStore(_location: StoreFileLocation, _bytes: Buffer, _file: {
|
|
152
|
+
originalName: string;
|
|
153
|
+
mimeType: string;
|
|
154
|
+
description: string;
|
|
155
|
+
author?: string;
|
|
156
|
+
pageName?: string;
|
|
157
|
+
}): Promise<StoreFileEntry>;
|
|
158
|
+
/** One file of a store, with its bytes; null when the store does not list it. */
|
|
159
|
+
getFileInStore(_location: StoreFileLocation, _id: string): Promise<{
|
|
160
|
+
entry: StoreFileEntry;
|
|
161
|
+
bytes: Buffer;
|
|
162
|
+
} | null>;
|
|
163
|
+
/** A store's files that were uploaded onto `pageName`. */
|
|
164
|
+
filesInStoreForPage(_location: StoreFileLocation, _pageName: string): Promise<StoreFileEntry[]>;
|
|
165
|
+
/** Delete a file from a store: its bytes and its index entry. Null when the store does not list it. */
|
|
166
|
+
deleteFileInStore(_location: StoreFileLocation, _id: string): Promise<StoreFileEntry | null>;
|
|
167
|
+
/**
|
|
168
|
+
* Refresh internal cache/index
|
|
169
|
+
* Re-scans storage and rebuilds indexes
|
|
170
|
+
* @returns {Promise<void>}
|
|
171
|
+
*/
|
|
172
|
+
abstract refreshAttachmentList(): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Get provider information
|
|
175
|
+
* @returns {ProviderInfo} Provider metadata
|
|
176
|
+
*/
|
|
177
|
+
getProviderInfo(): ProviderInfo;
|
|
178
|
+
/**
|
|
179
|
+
* Backup provider data
|
|
180
|
+
* Returns all metadata needed to restore attachments
|
|
181
|
+
* @returns {Promise<Record<string, unknown>>} Backup data
|
|
182
|
+
*/
|
|
183
|
+
abstract backup(): Promise<Record<string, unknown>>;
|
|
184
|
+
/**
|
|
185
|
+
* Restore provider data from backup
|
|
186
|
+
* @param {Record<string, unknown>} backupData - Backup data from backup()
|
|
187
|
+
* @returns {Promise<void>}
|
|
188
|
+
*/
|
|
189
|
+
abstract restore(backupData: Record<string, unknown>): Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* Shutdown the provider (cleanup resources)
|
|
192
|
+
* @returns {Promise<void>}
|
|
193
|
+
*/
|
|
194
|
+
shutdown(): Promise<void>;
|
|
195
|
+
}
|
|
196
|
+
export default BaseAttachmentProvider;
|
|
197
|
+
export { FileInfo, User, AttachmentResult };
|