@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,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a page's footnotes and comments are kept, and through which I/O (#1839).
|
|
3
|
+
*
|
|
4
|
+
* A public page's are in the managers' own folders (`ngdpbase.footnotes.storagedir`,
|
|
5
|
+
* `ngdpbase.comments.storagedir`), as before. A vault page's — a page named
|
|
6
|
+
* `vaults/{owner}/{store}/{title}` — are inside that vault
|
|
7
|
+
* (`{store}/footnotes/{uuid}.json`, `{store}/comments/{uuid}/`), read and
|
|
8
|
+
* written through the vault's store I/O: sealed exactly when its pages are,
|
|
9
|
+
* refused when the vault is locked or is a sealed kind's vault that hasn't been
|
|
10
|
+
* opened. Nothing of a vault page is kept outside the vault (operator, 2026-10-16).
|
|
11
|
+
*
|
|
12
|
+
* The place is decided by the page's NAME, never by a uuid alone: a vault page
|
|
13
|
+
* is in no shared index, so its uuid says nothing about where it is. Who may
|
|
14
|
+
* read or write a page's notes is the caller's to decide (the page's own read
|
|
15
|
+
* and edit doors); nothing here decides access.
|
|
16
|
+
*/
|
|
17
|
+
import type { ActorContext } from '../context/ActorContext.js';
|
|
18
|
+
import { type StoreFileIO } from './privateStoreFiles.js';
|
|
19
|
+
import { type PrivateStoreLayout } from './privateStorePath.js';
|
|
20
|
+
export type PageNotesKind = 'footnotes' | 'comments';
|
|
21
|
+
/** The page a footnote or comment belongs to: its name says where it is, its uuid which file. */
|
|
22
|
+
export interface PageRef {
|
|
23
|
+
/** The page's name: a public title, or its vault name `vaults/{owner}/{store}/{title}`. */
|
|
24
|
+
name: string;
|
|
25
|
+
uuid: string;
|
|
26
|
+
}
|
|
27
|
+
/** Where one kind of note lives: the manager's public folder, and the vaults. */
|
|
28
|
+
export interface PageNotesRoots {
|
|
29
|
+
kind: PageNotesKind;
|
|
30
|
+
/** The manager's own folder, for public pages. */
|
|
31
|
+
publicDir: string;
|
|
32
|
+
pagesDirectory: string;
|
|
33
|
+
layout: PrivateStoreLayout;
|
|
34
|
+
}
|
|
35
|
+
export interface PageNotesPath {
|
|
36
|
+
/** Footnotes: the page's `{uuid}.json`. Comments: the page's `{uuid}/` folder. */
|
|
37
|
+
path: string;
|
|
38
|
+
/** The vault the page is in; null for a public page. */
|
|
39
|
+
vault: {
|
|
40
|
+
owner: string;
|
|
41
|
+
store: string;
|
|
42
|
+
} | null;
|
|
43
|
+
}
|
|
44
|
+
interface EngineLike {
|
|
45
|
+
getManager<T = unknown>(name: string): T | undefined | null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The roots for `kind`: the manager's own folder, and the vaults where the
|
|
49
|
+
* page provider keeps them (its `storagedir` and the configured layout), read
|
|
50
|
+
* when asked rather than kept.
|
|
51
|
+
*/
|
|
52
|
+
export declare function pageNotesRoots(engine: EngineLike, kind: PageNotesKind, publicDir: string): PageNotesRoots;
|
|
53
|
+
/** Where `page`'s notes of this kind are on disk. Pure: no I/O, no key. */
|
|
54
|
+
export declare function pageNotesPath(page: PageRef, roots: PageNotesRoots): PageNotesPath;
|
|
55
|
+
/**
|
|
56
|
+
* Where `page`'s notes are and the I/O to use there, as `ctx` may. A vault
|
|
57
|
+
* that refuses `ctx` (locked, or a sealed kind's vault not yet opened) throws,
|
|
58
|
+
* for a read as for a write: a vault page's notes are never read or written
|
|
59
|
+
* in the clear.
|
|
60
|
+
*/
|
|
61
|
+
export declare function pageNotesPlace(ctx: ActorContext, page: PageRef, roots: PageNotesRoots): Promise<PageNotesPath & {
|
|
62
|
+
io: StoreFileIO;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Move a page's notes when the page changes place — into a vault, out of one,
|
|
66
|
+
* or between two — through both sides' I/O, as its history moves: sealed going
|
|
67
|
+
* into a sealed vault, opened coming out, never copied in the clear into a
|
|
68
|
+
* sealed one. A rename within one place moves nothing (the files are keyed by
|
|
69
|
+
* uuid). Both I/Os are resolved before anything moves.
|
|
70
|
+
*
|
|
71
|
+
* @returns true when something was moved
|
|
72
|
+
*/
|
|
73
|
+
export declare function movePageNotes(ctx: ActorContext, uuid: string, fromName: string, toName: string, roots: PageNotesRoots): Promise<boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* Move a vault page's notes left in the public folder before #1839 into its
|
|
76
|
+
* vault (the #1842 repair), through the vault's I/O: sealed when the vault is.
|
|
77
|
+
* Where the vault has none of this kind yet, this is the move
|
|
78
|
+
* {@link movePageNotes} makes. Where it already has some (written since
|
|
79
|
+
* #1839), the two are merged and the vault's own entries win; a comment file
|
|
80
|
+
* the vault already holds is never overwritten. The vault side is written
|
|
81
|
+
* before the public copy is removed, so a failure leaves two copies, never none.
|
|
82
|
+
*
|
|
83
|
+
* The vault's I/O is resolved first, so a locked vault, or a sealed kind's
|
|
84
|
+
* vault not yet opened, throws and nothing moves. Who may ask is the caller's
|
|
85
|
+
* to decide, and so is that `uuid` is a page of that vault.
|
|
86
|
+
*
|
|
87
|
+
* @param opts.dryRun - Count what would move, and move nothing
|
|
88
|
+
* @returns how many notes were (or would be) moved: footnotes, or comment files
|
|
89
|
+
*/
|
|
90
|
+
export declare function moveOutsideNotesIntoVault(ctx: ActorContext, vault: {
|
|
91
|
+
owner: string;
|
|
92
|
+
store: string;
|
|
93
|
+
}, uuid: string, roots: PageNotesRoots, opts?: {
|
|
94
|
+
dryRun?: boolean;
|
|
95
|
+
}): Promise<number>;
|
|
96
|
+
/** A vault page whose notes of one kind are outside its vault (#1839). */
|
|
97
|
+
export interface VaultPageNotesOutside {
|
|
98
|
+
owner: string;
|
|
99
|
+
vault: string;
|
|
100
|
+
/** The page, by uuid: a vault page's title is its owner's and is not logged. */
|
|
101
|
+
uuid: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Every vault page whose notes of `roots.kind` are in the manager's public
|
|
105
|
+
* folder rather than in its vault (#1839): written before notes moved into
|
|
106
|
+
* vaults, in the clear. A page is known by its file name (`{uuid}.md`), so the
|
|
107
|
+
* check needs no key and reads no page. Read only: nothing is moved, sealed or
|
|
108
|
+
* deleted; an administrator decides what to do with the files.
|
|
109
|
+
*/
|
|
110
|
+
export declare function findVaultPageNotesOutside(roots: PageNotesRoots): Promise<VaultPageNotesOutside[]>;
|
|
111
|
+
/** Whether `uuid` is a page of `owner`'s vault `store`, live or in its trash: known by its file name, no key needed. */
|
|
112
|
+
export declare function isVaultPageUuid(pagesDirectory: string, layout: PrivateStoreLayout, vault: {
|
|
113
|
+
owner: string;
|
|
114
|
+
store: string;
|
|
115
|
+
}, uuid: string): Promise<boolean>;
|
|
116
|
+
/** The manager state a startup check sets and clears: the manager's own (BaseManager). */
|
|
117
|
+
export interface CheckStateHooks {
|
|
118
|
+
/** True when this is a new state. */
|
|
119
|
+
markDegraded(reason: string): boolean;
|
|
120
|
+
/** Clears the degraded state only while it is still `reason`, so another fault stays reported. */
|
|
121
|
+
markReadyIfDegradedBy(reason: string): boolean;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The check for {@link findVaultPageNotesOutside}, made the way the
|
|
125
|
+
* unsealed-vault check reports (#1834, #1836): an error in the log naming each
|
|
126
|
+
* owner, vault and page uuid, the manager's degraded state (the subsystem
|
|
127
|
+
* banner) and, at startup, a system notification. Nothing is moved or
|
|
128
|
+
* deleted. A failing check is logged, never thrown: it must not stop the
|
|
129
|
+
* manager starting.
|
|
130
|
+
*
|
|
131
|
+
* Run again after a repair (#1842), it keeps what it found for the repair
|
|
132
|
+
* actions to offer, and clears the degraded state it set once nothing is left.
|
|
133
|
+
*/
|
|
134
|
+
export declare class VaultPageNotesCheck {
|
|
135
|
+
private readonly engine;
|
|
136
|
+
private readonly roots;
|
|
137
|
+
private readonly state;
|
|
138
|
+
private found;
|
|
139
|
+
private reason;
|
|
140
|
+
constructor(engine: EngineLike, roots: () => PageNotesRoots, state: CheckStateHooks);
|
|
141
|
+
/** What the last run found. */
|
|
142
|
+
findings(): VaultPageNotesOutside[];
|
|
143
|
+
/**
|
|
144
|
+
* @param opts.notify - Send the system notification on a new state: at startup; a re-run after a repair does not
|
|
145
|
+
*/
|
|
146
|
+
run(opts: {
|
|
147
|
+
notify: boolean;
|
|
148
|
+
}): Promise<VaultPageNotesOutside[]>;
|
|
149
|
+
}
|
|
150
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a page title may contain (#1455).
|
|
3
|
+
*
|
|
4
|
+
* Declared once, applied at the `PageManager` save door, so every writer meets
|
|
5
|
+
* it: the editor, the NCM funnel (import, MCP, paste, convert, ingest), addons
|
|
6
|
+
* and scripts. It used to be written out three times in `WikiRoutes`, which is
|
|
7
|
+
* why the paths that do not go through a route — an import, an agent write —
|
|
8
|
+
* could put a title on disk that the editor would have refused.
|
|
9
|
+
*
|
|
10
|
+
* The characters are refused for three separate reasons, and each one is a
|
|
11
|
+
* defect somebody met:
|
|
12
|
+
*
|
|
13
|
+
* - `/` breaks `/view/:page` routing, and `[store/Title]` — a private page's
|
|
14
|
+
* link — can only be read if no title contains one (#1457).
|
|
15
|
+
* - `\ # ? % " < > | *` break URLs, YAML frontmatter or file names.
|
|
16
|
+
*
|
|
17
|
+
* A private page's NAME is a path, `private/{owner}/{store}/{title}` (#1456).
|
|
18
|
+
* The rule is about the title, never the name.
|
|
19
|
+
*/
|
|
20
|
+
/** The characters a page title may not contain. */
|
|
21
|
+
export declare const FORBIDDEN_TITLE_CHARS: RegExp;
|
|
22
|
+
/** What a person is told when a title is refused — the editor's message. */
|
|
23
|
+
export declare const TITLE_RULE_MESSAGE = "Page title contains invalid characters. The following are not allowed: / \\ # ? % \" < > | *";
|
|
24
|
+
/** True when `title` breaks the rule. */
|
|
25
|
+
export declare function titleBreaksRule(title: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The same title with the forbidden characters replaced by `-`, for the NCM
|
|
28
|
+
* funnel, which converts someone else's data and must not drop a page over a
|
|
29
|
+
* character (operator, 2026-09-23: normalise and report). Runs of `-` collapse
|
|
30
|
+
* and the ends are trimmed, so `Docs/Setup` reads as `Docs-Setup` rather than
|
|
31
|
+
* `Docs--Setup-`.
|
|
32
|
+
*
|
|
33
|
+
* A caller that normalises says so in its report and records what the source
|
|
34
|
+
* called the page; the editor never normalises, because a person typing a
|
|
35
|
+
* title can simply be told.
|
|
36
|
+
*/
|
|
37
|
+
export declare function normaliseTitle(title: string): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slice 4 of #755 (#772) — page → schema.org `Article` mapper for the
|
|
3
|
+
* CatalogSource surface.
|
|
4
|
+
*
|
|
5
|
+
* This is the **internal CreativeWork** projection consumed by
|
|
6
|
+
* `CatalogManager.getCreativeWork('pages', uuid)` and the cross-source
|
|
7
|
+
* `list()` fan-out. It returns the typed `Article` from `src/types/Schema.ts`
|
|
8
|
+
* (no `@context`, no JSON-LD render quirks).
|
|
9
|
+
*
|
|
10
|
+
* Distinct from `src/utils/buildPageJsonLd.ts`, which builds the
|
|
11
|
+
* inline-`<script type="application/ld+json">` payload (Slice 6a / #765) and
|
|
12
|
+
* carries `@context` plus a few JSON-LD-render-only conventions. Per
|
|
13
|
+
* `docs/schemas.md` Decision 11: "AssetRecord (internal) + CreativeWork
|
|
14
|
+
* (JSON-LD render) coexist; render mapper converts." `pageToArticle` is the
|
|
15
|
+
* internal record; `buildPageJsonLd` is the render mapper. Both share the
|
|
16
|
+
* same source frontmatter and produce overlapping shapes — intentional, not
|
|
17
|
+
* duplicated logic.
|
|
18
|
+
*
|
|
19
|
+
* Ratified decisions honored (`docs/schemas.md`):
|
|
20
|
+
* - Decision 4: `@id` = canonical URL `/view/<slug>`; UUID = `identifier`.
|
|
21
|
+
* - Decision 5: `system-category` maps to `ngdp:category` (custom field,
|
|
22
|
+
* `ngdp:` prefix policy).
|
|
23
|
+
* - Decision 9: structured-data is JSON-LD only — this is the internal
|
|
24
|
+
* record that the JSON-LD render step consumes.
|
|
25
|
+
* - Decision 10: `author` immutable (original creator); `editor` mutable
|
|
26
|
+
* (last-saver). Both surface here when present.
|
|
27
|
+
* - Decision 13: `dateModified` = latest revision's timestamp (always
|
|
28
|
+
* `lastModified`, never any older revision's timestamp).
|
|
29
|
+
*
|
|
30
|
+
* Required fields per `Article`:
|
|
31
|
+
* - `@id`, `@type`, `identifier`, `name`, `url`.
|
|
32
|
+
* Optional fields are omitted (not emitted as `null`/empty) when source lacks
|
|
33
|
+
* them — JSON-LD consumers prefer absent over null.
|
|
34
|
+
*/
|
|
35
|
+
import type { Article } from '../types/Schema.js';
|
|
36
|
+
import type { PageFrontmatter } from '../types/Page.js';
|
|
37
|
+
export interface PageToArticleOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Canonical base URL (e.g. `https://wiki.example.com`). When set, `@id` and
|
|
40
|
+
* `url` are absolute; otherwise they're path-only `/view/<slug>` (still a
|
|
41
|
+
* valid IRI per JSON-LD 1.1).
|
|
42
|
+
*/
|
|
43
|
+
baseUrl?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Auto-tagged keywords from the search index (#507 / TaggingService). Merged
|
|
46
|
+
* with frontmatter `user-keywords` + `system-keywords` and deduplicated.
|
|
47
|
+
*/
|
|
48
|
+
autoTaggedKeywords?: string[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build the internal `Article` record for a single page.
|
|
52
|
+
*
|
|
53
|
+
* @param pageName Page title — used as `name` and to compute `@id` / `url`.
|
|
54
|
+
* For slug-bearing pages, pass the slug from `metadata.slug`
|
|
55
|
+
* so the URL stays stable across renames.
|
|
56
|
+
* @param metadata Frontmatter object (typically from `PageManager.getPageMetadata`).
|
|
57
|
+
* @param options Optional `baseUrl` and `autoTaggedKeywords`.
|
|
58
|
+
*/
|
|
59
|
+
export declare function pageToArticle(pageName: string, metadata: PageFrontmatter | null | undefined, options?: PageToArticleOptions): Article;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The URL of a page, and of an action on it (#1456, epic #1454).
|
|
3
|
+
*
|
|
4
|
+
* `/view/…` serves public pages only. A private page, named
|
|
5
|
+
* `vaults/{owner}/{store}/{title}`, lives at `/vaults/{owner}/{store}/{title}`,
|
|
6
|
+
* and every action on it lives under that path. This is the one place that
|
|
7
|
+
* turns a page name into a link, so routes, views and redirects agree.
|
|
8
|
+
* It holds no data and reads no config.
|
|
9
|
+
*/
|
|
10
|
+
/** The page actions that have a URL of their own. */
|
|
11
|
+
export type PageAction = 'view' | 'edit' | 'save' | 'delete' | 'history' | 'diff';
|
|
12
|
+
/**
|
|
13
|
+
* The URL for `action` on the page named `pageName`.
|
|
14
|
+
*
|
|
15
|
+
* @example pageUrl('Main') === '/view/Main'
|
|
16
|
+
* @example pageUrl('vaults/jim/default/Diary', 'edit') === '/vaults/jim/default/Diary/edit'
|
|
17
|
+
*/
|
|
18
|
+
export declare function pageUrl(pageName: string, action?: PageAction): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface PasswordRecord {
|
|
2
|
+
password?: string;
|
|
3
|
+
sessionGeneration?: number;
|
|
4
|
+
/** ISO 8601; when the password last changed. Absent on an account that never changed it. */
|
|
5
|
+
passwordChangedAt?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Change the record's password, in place. */
|
|
8
|
+
export declare function setPassword(record: PasswordRecord, newPassword: string, now?: Date): Promise<void>;
|
|
9
|
+
/** When the password last changed, in epoch seconds; null when it never has. */
|
|
10
|
+
export declare function passwordChangedAtSeconds(record: {
|
|
11
|
+
passwordChangedAt?: unknown;
|
|
12
|
+
} | null | undefined): number | null;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Password hashing — scrypt, with a per-user salt and in-place upgrade (#1042).
|
|
3
|
+
*
|
|
4
|
+
* ## What was wrong
|
|
5
|
+
*
|
|
6
|
+
* Passwords were stored as ONE round of SHA-256 with a single instance-wide
|
|
7
|
+
* salt (`amdwiki-salt` by default):
|
|
8
|
+
*
|
|
9
|
+
* sha256(password + globalSalt)
|
|
10
|
+
*
|
|
11
|
+
* SHA-256 is built to be fast, which is the opposite of what a password hash
|
|
12
|
+
* needs — an attacker holding `users.json` can try billions of candidates a
|
|
13
|
+
* second on commodity hardware. And because every account shared one salt,
|
|
14
|
+
* two users with the same password produced byte-identical hashes, so the
|
|
15
|
+
* store leaked which accounts shared a password without any cracking at all.
|
|
16
|
+
* The comparison was `===`, which is not constant-time.
|
|
17
|
+
*
|
|
18
|
+
* ## What replaces it
|
|
19
|
+
*
|
|
20
|
+
* scrypt from Node's standard library — no new dependency — with a random
|
|
21
|
+
* 16-byte salt per password and a constant-time comparison.
|
|
22
|
+
*
|
|
23
|
+
* The stored value is self-describing:
|
|
24
|
+
*
|
|
25
|
+
* scrypt$131072$8$1$<salt base64>$<hash base64>
|
|
26
|
+
*
|
|
27
|
+
* Carrying the parameters in the hash is what makes this maintainable: the
|
|
28
|
+
* cost can be raised later and old hashes keep verifying under the parameters
|
|
29
|
+
* they were written with, then upgrade on next login. A bare digest cannot do
|
|
30
|
+
* that, which is how the SHA-256 scheme became impossible to move off.
|
|
31
|
+
*
|
|
32
|
+
* ## Migration
|
|
33
|
+
*
|
|
34
|
+
* Existing hashes cannot be converted — the plaintext is not recoverable. So
|
|
35
|
+
* legacy values keep verifying, `needsRehash()` reports them, and the caller
|
|
36
|
+
* rewrites them after a successful login. The store ages over as people sign
|
|
37
|
+
* in; nobody is locked out and no reset email is needed.
|
|
38
|
+
*
|
|
39
|
+
* An empty stored hash stays unusable by design: `isExternal` accounts (magic
|
|
40
|
+
* link, OIDC) store `''`, and no password may ever match it.
|
|
41
|
+
*/
|
|
42
|
+
/** Hash a password under the current scheme. */
|
|
43
|
+
export declare function hashPassword(password: string): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Verify `password` against a stored value in EITHER scheme.
|
|
46
|
+
*
|
|
47
|
+
* @param stored the value from the user record
|
|
48
|
+
* @param legacySalt instance-wide salt, for pre-#1042 hashes only
|
|
49
|
+
*/
|
|
50
|
+
export declare function verifyPassword(password: string, stored: string, legacySalt: string): Promise<boolean>;
|
|
51
|
+
/**
|
|
52
|
+
* Should this stored value be rewritten after a successful login?
|
|
53
|
+
*
|
|
54
|
+
* True for legacy hashes, and for current-scheme hashes written under weaker
|
|
55
|
+
* parameters than today's — which is how a future cost increase rolls out.
|
|
56
|
+
* An empty hash is never rehashed; external accounts have no password.
|
|
57
|
+
*/
|
|
58
|
+
export declare function needsRehash(stored: string): boolean;
|
|
59
|
+
/** True when the value was written by the pre-#1042 scheme. */
|
|
60
|
+
export declare function isLegacyHash(stored: string): boolean;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which permission entries are actions someone may hold (#1638 slice 3).
|
|
3
|
+
*
|
|
4
|
+
* Every audit event is declared on a permission entry, so the catalog also
|
|
5
|
+
* holds records that no one is ever permitted to do — `system-start`,
|
|
6
|
+
* `job-failed`, `authentication-failed`. Those entries carry
|
|
7
|
+
* `"grantable": false`. This is the one predicate that says so; everything
|
|
8
|
+
* that hands out, offers or lists permissions asks it: app (OIDC) scopes,
|
|
9
|
+
* the generated `CorePermission` type, the admin roles matrix and the
|
|
10
|
+
* permission listings. Omitted means grantable.
|
|
11
|
+
*/
|
|
12
|
+
/** True unless the entry says `"grantable": false`. */
|
|
13
|
+
export declare function isGrantable(entry: unknown): boolean;
|
|
14
|
+
/** The names of the grantable entries in a permission catalog, in catalog order. */
|
|
15
|
+
export declare function grantablePermissionNames(definitions: unknown): string[];
|
|
16
|
+
/** The grantable entries of a permission catalog, as a map in catalog order. */
|
|
17
|
+
export declare function grantablePermissions<T>(definitions: Record<string, T> | null | undefined): Record<string, T>;
|
|
18
|
+
/**
|
|
19
|
+
* Permissions that were split into narrower ones, and what each stood for.
|
|
20
|
+
*
|
|
21
|
+
* A policy, an agent token or an app grant written before the split still
|
|
22
|
+
* names the old permission; it is read as all of the new ones, so nobody loses
|
|
23
|
+
* an ability on upgrade. New writing should name the new permissions.
|
|
24
|
+
*/
|
|
25
|
+
export declare const RETIRED_PERMISSIONS: ReadonlyMap<string, readonly string[]>;
|
|
26
|
+
/** The names with every retired permission replaced by what it stood for, de-duplicated, order kept. */
|
|
27
|
+
export declare function withRetiredExpanded(names: readonly string[]): string[];
|
|
28
|
+
/**
|
|
29
|
+
* What the standard OpenID Connect sign-in scopes let an app see, in plain
|
|
30
|
+
* words (#1572). They are not permissions, so they are not in the catalog;
|
|
31
|
+
* this is their one declaration — the consent page and the "My tokens and
|
|
32
|
+
* devices" list both read it through `describeScopes`.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SIGN_IN_SCOPE_LABELS: Readonly<Record<string, string>>;
|
|
35
|
+
/** One scope or permission as a person reads it: its name, and what it lets the holder do. */
|
|
36
|
+
export interface ScopeDescription {
|
|
37
|
+
name: string;
|
|
38
|
+
description: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A permission entry in plain words (#1764): its `label` — the end-user line
|
|
42
|
+
* shown wherever a person reads what a permission does — else its
|
|
43
|
+
* `description` (an add-on that declares no label), else nothing.
|
|
44
|
+
*/
|
|
45
|
+
export declare function permissionLabel(entry: unknown): string | null;
|
|
46
|
+
/**
|
|
47
|
+
* Scope or permission names in plain words (#1764), in order, without
|
|
48
|
+
* repeats: a sign-in scope by `SIGN_IN_SCOPE_LABELS`, a permission by
|
|
49
|
+
* `permissionLabel` of its catalog entry. A name declared nowhere (an app's
|
|
50
|
+
* own scope, such as a host's `patient/*.read`) is shown as itself.
|
|
51
|
+
*/
|
|
52
|
+
export declare function describeScopes(names: readonly string[], definitions: unknown): ScopeDescription[];
|