@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,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading and writing the bytes of a private store (#1415, epic #1382).
|
|
3
|
+
*
|
|
4
|
+
* The store DEK "encrypts every byte in `private/{user}/{store}/`"
|
|
5
|
+
* (docs/private-stores.md, Keys). This is the one place that turns
|
|
6
|
+
* that rule into file I/O: a caller asks for the store's {@link StoreFileIO}
|
|
7
|
+
* once, through its context, and every read and write it makes with it is
|
|
8
|
+
* ciphertext at rest when the store is encrypted. Providers do not decide the
|
|
9
|
+
* policy; they are handed an I/O that already carries it.
|
|
10
|
+
*
|
|
11
|
+
* `store.json` is the one file in a store that is never sealed — it holds the
|
|
12
|
+
* wrapped DEK needed to open the rest.
|
|
13
|
+
*/
|
|
14
|
+
import { type PrivateStoreLayout, type PrivateStoreLayoutOverrides } from './privateStorePath.js';
|
|
15
|
+
import type { ActorContext } from '../context/ActorContext.js';
|
|
16
|
+
export interface StoreFileIO {
|
|
17
|
+
/** True when this store's files are ciphertext at rest. */
|
|
18
|
+
readonly sealed: boolean;
|
|
19
|
+
readText(file: string, encoding?: BufferEncoding): Promise<string>;
|
|
20
|
+
writeText(file: string, text: string, encoding?: BufferEncoding): Promise<void>;
|
|
21
|
+
/** A store file's bytes — attachments (#1400) are binary, pages are text. */
|
|
22
|
+
readBytes(file: string): Promise<Buffer>;
|
|
23
|
+
writeBytes(file: string, bytes: Buffer): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
/** Files outside any encrypted store: read and written as they are. */
|
|
26
|
+
export declare const PLAIN_FILE_IO: StoreFileIO;
|
|
27
|
+
/**
|
|
28
|
+
* The I/O for `owner`'s `store`, as this context may use it. Plain for a store
|
|
29
|
+
* that is not encrypted; sealed with the store DEK when it is. An encrypted
|
|
30
|
+
* store whose DEK this context does not hold is refused — a read as much as a
|
|
31
|
+
* write, so a locked store never falls back to reading or writing in the clear.
|
|
32
|
+
*
|
|
33
|
+
* Whether the store is encrypted is asked of both its kind and its copy
|
|
34
|
+
* (#1834): `layout` is the configured one, whose `sealedVaults` are the kinds
|
|
35
|
+
* that are sealed. A vault of a sealed kind with no `store.json` (its door not
|
|
36
|
+
* yet opened) or a `store.json` that is not sealed is refused, read and write
|
|
37
|
+
* alike, with `SealedVaultRefusedError` — never handed plain I/O.
|
|
38
|
+
*/
|
|
39
|
+
export declare function storeFileIO(ctx: ActorContext | undefined, args: {
|
|
40
|
+
pagesDirectory: string;
|
|
41
|
+
owner: string;
|
|
42
|
+
store: string;
|
|
43
|
+
layout: PrivateStoreLayout;
|
|
44
|
+
}): Promise<StoreFileIO>;
|
|
45
|
+
/**
|
|
46
|
+
* Read one text file of `owner`'s `store` synchronously, as this context may:
|
|
47
|
+
* plain for a store that is not encrypted, opened with the store DEK when it
|
|
48
|
+
* is. Null when the file does not exist, or the store is encrypted and this
|
|
49
|
+
* context does not hold its DEK — a locked store reads as nothing, never in
|
|
50
|
+
* the clear (#1456: a store's page index is small, and page lookups are
|
|
51
|
+
* synchronous).
|
|
52
|
+
*
|
|
53
|
+
* A vault of a sealed kind that is not itself sealed (#1834) reads as nothing
|
|
54
|
+
* too, with a warning: its files, if any, were written in the clear and are
|
|
55
|
+
* not served as if they were sealed.
|
|
56
|
+
*/
|
|
57
|
+
export declare function readStoreTextSync(ctx: ActorContext | undefined, args: {
|
|
58
|
+
pagesDirectory: string;
|
|
59
|
+
owner: string;
|
|
60
|
+
store: string;
|
|
61
|
+
file: string;
|
|
62
|
+
layout: PrivateStoreLayout;
|
|
63
|
+
}): string | null;
|
|
64
|
+
/**
|
|
65
|
+
* Every store id in `owner`'s container, whether or not it can be opened (#1460).
|
|
66
|
+
*
|
|
67
|
+
* Which stores EXIST is a question about a folder, not about keys: an
|
|
68
|
+
* unencrypted store has no DEK for a session to hold, so
|
|
69
|
+
* `unlockedStoreIdsFor` — which answers from the session's key bag — can only
|
|
70
|
+
* ever name the encrypted ones. A caller that wants all of the owner's stores
|
|
71
|
+
* asks here and then opens each through {@link storeFileIO}, which refuses the
|
|
72
|
+
* encrypted ones it holds no key for.
|
|
73
|
+
*
|
|
74
|
+
* Empty for a user with no container. Nothing here decides access: the
|
|
75
|
+
* container rule (`mayActInPrivateContainer`) is the caller's to apply, as it
|
|
76
|
+
* is at the page door.
|
|
77
|
+
*/
|
|
78
|
+
export declare function privateStoreIdsOf(pagesDirectory: string, owner: string, layout?: PrivateStoreLayoutOverrides): Promise<string[]>;
|
|
79
|
+
/** The I/O for whichever store holds `file`; plain for a file in no store. */
|
|
80
|
+
export declare function storeFileIOForPath(ctx: ActorContext | undefined, args: {
|
|
81
|
+
pagesDirectory: string;
|
|
82
|
+
file: string;
|
|
83
|
+
layout: PrivateStoreLayout;
|
|
84
|
+
}): Promise<StoreFileIO>;
|
|
85
|
+
/** The vault `file` lies in — `{privateroot}/{owner}/{store}/…` — or null for a file in no vault. */
|
|
86
|
+
export declare function vaultOfFile(pagesDirectory: string, file: string, layout: PrivateStoreLayout): {
|
|
87
|
+
owner: string;
|
|
88
|
+
store: string;
|
|
89
|
+
} | null;
|
|
90
|
+
/**
|
|
91
|
+
* Whether `owner`'s `store` holds, or must hold, only sealed bytes (#1836):
|
|
92
|
+
* its kind is sealed, or its `store.json` is. A `store.json` that cannot be
|
|
93
|
+
* read counts as sealed — the answer that never lets plaintext in.
|
|
94
|
+
*
|
|
95
|
+
* For the paths that put bytes into a vault without its store I/O (a backup
|
|
96
|
+
* restore, a legacy migration, a tombstone put back): they hold no DEK, so
|
|
97
|
+
* where this is true they write only bytes that are already sealed, or refuse.
|
|
98
|
+
*/
|
|
99
|
+
export declare function vaultMustBeSealed(pagesDirectory: string, owner: string, store: string, layout: PrivateStoreLayout): Promise<boolean>;
|
|
100
|
+
/**
|
|
101
|
+
* Move a folder of store files — a page's history — from one place to another
|
|
102
|
+
* through each side's I/O (#1836): every file is read as its source stores it
|
|
103
|
+
* and written as its destination does, so history moved into a sealed vault
|
|
104
|
+
* is sealed with that vault's DEK, history moved out of one is opened, and a
|
|
105
|
+
* move between two sealed vaults is re-sealed. Two plain sides are a plain
|
|
106
|
+
* rename, as before.
|
|
107
|
+
*
|
|
108
|
+
* The copy is staged beside `toDir` and renamed into place only when every
|
|
109
|
+
* file is written, so a failure leaves the source whole and no half history
|
|
110
|
+
* at the destination. The source is removed last.
|
|
111
|
+
*/
|
|
112
|
+
export declare function moveStoreFolder(fromDir: string, toDir: string, fromIO: StoreFileIO, toIO: StoreFileIO): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Move one store file — a page's footnotes (#1839) — through each side's I/O,
|
|
115
|
+
* as {@link moveStoreFolder} moves a folder: read as its source stores it,
|
|
116
|
+
* written as its destination does, so a file moved into a sealed vault is
|
|
117
|
+
* sealed there and one moved out is opened. Two plain sides are a plain move.
|
|
118
|
+
* The destination is written (atomically) before the source is removed.
|
|
119
|
+
*/
|
|
120
|
+
export declare function moveStoreFile(fromFile: string, toFile: string, fromIO: StoreFileIO, toIO: StoreFileIO): Promise<void>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-store encrypt flag on disk (#1384).
|
|
3
|
+
*
|
|
4
|
+
* Lives on `pages/vaults/{user}/{store}/store.json`, not on PageManager.
|
|
5
|
+
* Missing file = encrypt off (`default/` stays plaintext unless enabled).
|
|
6
|
+
*/
|
|
7
|
+
import type { StoreKeyRecord } from './privateStoreCrypto.js';
|
|
8
|
+
import { type PrivateStoreLayout, type PrivateStoreLayoutOverrides } from './privateStorePath.js';
|
|
9
|
+
export declare function readStoreMeta(pagesDirectory: string, creator: string, store: string, layout?: PrivateStoreLayoutOverrides): Promise<StoreKeyRecord>;
|
|
10
|
+
/**
|
|
11
|
+
* How a vault stands against its kind (#1834). The vault's `store.json` says
|
|
12
|
+
* whether this copy is sealed; the kind (the system-category's `encrypt`,
|
|
13
|
+
* carried in the layout as `sealedVaults`) says whether it must be.
|
|
14
|
+
*
|
|
15
|
+
* - `plain`: the kind is not sealed and the copy is not either.
|
|
16
|
+
* - `sealed`: the copy is sealed (`store.json` `encrypt: true`).
|
|
17
|
+
* - `unopened`: the kind is sealed and there is no `store.json` — the owner
|
|
18
|
+
* has not walked through the vault door, so there is no key to seal with.
|
|
19
|
+
* - `mismatch`: the kind is sealed and `store.json` says the copy is not
|
|
20
|
+
* (or cannot be read as sealed).
|
|
21
|
+
*
|
|
22
|
+
* Only `plain` and `sealed` may be read or written.
|
|
23
|
+
*/
|
|
24
|
+
export type VaultSealState = 'plain' | 'sealed' | 'unopened' | 'mismatch';
|
|
25
|
+
export declare function kindIsSealed(layout: PrivateStoreLayoutOverrides, store: string): boolean;
|
|
26
|
+
/** {@link VaultSealState} of `owner`'s `store`, with the record that decided it. */
|
|
27
|
+
export declare function readVaultSealState(pagesDirectory: string, owner: string, store: string, layout: PrivateStoreLayout): Promise<{
|
|
28
|
+
state: VaultSealState;
|
|
29
|
+
meta: StoreKeyRecord;
|
|
30
|
+
}>;
|
|
31
|
+
/** The synchronous form of {@link readVaultSealState}, for synchronous page lookups. */
|
|
32
|
+
export declare function readVaultSealStateSync(pagesDirectory: string, owner: string, store: string, layout: PrivateStoreLayout): VaultSealState;
|
|
33
|
+
/**
|
|
34
|
+
* A read or write refused because the vault's kind is sealed and the vault
|
|
35
|
+
* is not (#1834). Never answered with plain I/O: the bytes would be clear on
|
|
36
|
+
* disk under a kind that says they are sealed.
|
|
37
|
+
*/
|
|
38
|
+
export declare class SealedVaultRefusedError extends Error {
|
|
39
|
+
readonly owner: string;
|
|
40
|
+
readonly store: string;
|
|
41
|
+
readonly reason: 'unopened' | 'mismatch';
|
|
42
|
+
readonly code = "sealed-vault-refused";
|
|
43
|
+
constructor(owner: string, store: string, reason: 'unopened' | 'mismatch');
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Throw {@link SealedVaultRefusedError} for a state that may not be read or
|
|
47
|
+
* written, logging it: an unopened vault is the owner's next step (warn), a
|
|
48
|
+
* mismatch is the site's configuration and its disk disagreeing (error).
|
|
49
|
+
* Names the owner and vault, never a page or its content.
|
|
50
|
+
*/
|
|
51
|
+
export declare function refuseUnsealedVault(owner: string, store: string, state: VaultSealState): void;
|
|
52
|
+
/** True when `dir` is a store directory with encrypt on (`store.json`). */
|
|
53
|
+
export declare function storeDirectoryIsEncrypted(dir: string, metaFilename?: string): Promise<boolean>;
|
|
54
|
+
/**
|
|
55
|
+
* `store.json` as the door writes it (#1414, docs/private-stores.md,
|
|
56
|
+
* "`store.json` shape"): the kind this copy was created under, whether this
|
|
57
|
+
* copy is sealed, when the user walked through the door, and the wrapped DEK
|
|
58
|
+
* when it is sealed. Per-user state and key material only — never policy.
|
|
59
|
+
*/
|
|
60
|
+
export type StoreFileRecord = StoreKeyRecord & {
|
|
61
|
+
kind?: string;
|
|
62
|
+
created?: string;
|
|
63
|
+
};
|
|
64
|
+
export declare function writeStoreMeta(pagesDirectory: string, creator: string, store: string, record: StoreFileRecord, layout?: PrivateStoreLayoutOverrides): Promise<void>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a private store has already been migrated for (#1457, epic #1382).
|
|
3
|
+
*
|
|
4
|
+
* A one-time migration over private pages cannot ask a global record whether
|
|
5
|
+
* it has run: a store is self-contained (docs/private-stores.md), an
|
|
6
|
+
* encrypted one is unreadable until its owner unlocks it, and each store
|
|
7
|
+
* therefore reaches its migration at a different moment. So the record lives
|
|
8
|
+
* in the store, beside its own indexes — `{store}/migrations.json`, the shape
|
|
9
|
+
* `files-index.json` and `pages-index.json` already use — and says only which
|
|
10
|
+
* migrations this store has had and when. No page, title or count: the file
|
|
11
|
+
* is per-store state, and a count of somebody's pages is theirs.
|
|
12
|
+
*
|
|
13
|
+
* It is read and written through the store's own I/O, so a sealed store's
|
|
14
|
+
* record is ciphertext at rest like everything else in it but `store.json`.
|
|
15
|
+
* A store that has not been migrated has no file, which is the same answer as
|
|
16
|
+
* a file that cannot be read — the migration then runs again, and it is
|
|
17
|
+
* idempotent by construction (`rewriteToPrivateLinks`).
|
|
18
|
+
*/
|
|
19
|
+
import type { ActorContext } from '../context/ActorContext.js';
|
|
20
|
+
import { type PrivateStoreLayout } from './privateStorePath.js';
|
|
21
|
+
/** The link migration of #1457: `[Title]` → `[store/Title]` within a store. */
|
|
22
|
+
export declare const PRIVATE_LINK_MIGRATION = "private-links";
|
|
23
|
+
export interface StoreMigrationTarget {
|
|
24
|
+
pagesDirectory: string;
|
|
25
|
+
owner: string;
|
|
26
|
+
store: string;
|
|
27
|
+
layout: PrivateStoreLayout;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Has this store had the migration `id`?
|
|
31
|
+
*
|
|
32
|
+
* @returns false when the record is missing or unreadable — running a
|
|
33
|
+
* migration a second time is safe, and skipping one that never ran is not.
|
|
34
|
+
*/
|
|
35
|
+
export declare function storeMigrationDone(ctx: ActorContext, where: StoreMigrationTarget, id: string): Promise<boolean>;
|
|
36
|
+
/** Record that this store has had the migration `id`, keeping any others. */
|
|
37
|
+
export declare function recordStoreMigration(ctx: ActorContext, where: StoreMigrationTarget, id: string): Promise<void>;
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Private-store paths (#1383, epic #1382).
|
|
3
|
+
*
|
|
4
|
+
* On-disk join (law): resolved pages `storagedir` + `privateroot` + userid + storeid + file.
|
|
5
|
+
* That is `{pagesDirectory}/{privateroot}/{user}/{store}/…` — a segment under the
|
|
6
|
+
* existing pages directory (SLOW), not `${SLOW_STORAGE}/private` and not FAST_STORAGE.
|
|
7
|
+
* User catalogs (`user-index.json` and siblings) live in that same user dir.
|
|
8
|
+
*
|
|
9
|
+
* Helpers take an optional layout override so unit tests need no live engine.
|
|
10
|
+
*
|
|
11
|
+
* ## What a store holds, and where these names are set
|
|
12
|
+
*
|
|
13
|
+
* A store is self-contained: everything about its pages is inside it, so a
|
|
14
|
+
* takeout is "copy this directory" and nothing of it sits in a shared index.
|
|
15
|
+
*
|
|
16
|
+
* ```
|
|
17
|
+
* private/{user}/user-keys.json the user's wrapped keys (#1414)
|
|
18
|
+
* private/{user}/user-index.json legacy: read once at unlock, then removed (#1385, #1456)
|
|
19
|
+
* private/{user}/{store}/store.json this store: its kind, encrypt, wrapped DEK (#1414)
|
|
20
|
+
* private/{user}/{store}/pages-index.json its pages (#1456)
|
|
21
|
+
* private/{user}/{store}/files-index.json its files (#1400)
|
|
22
|
+
* private/{user}/{store}/search-index.json its saved search index (#1458)
|
|
23
|
+
* private/{user}/{store}/deleted-index.json its trash (#1459)
|
|
24
|
+
* private/{user}/{store}/migrations.json the one-time migrations it has had (#1457)
|
|
25
|
+
* private/{user}/{store}/{uuid}.md a page
|
|
26
|
+
* private/{user}/{store}/versions/{uuid}/ that page's history
|
|
27
|
+
* private/{user}/{store}/deleted/{uuid}.md a deleted page, until it is purged
|
|
28
|
+
* private/{user}/{store}/attachments/ its files (#1400)
|
|
29
|
+
* private/{user}/{store}/footnotes/{uuid}.json a page's footnotes (#1839)
|
|
30
|
+
* private/{user}/{store}/comments/{uuid}/ a page's comments (#1839)
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* Every one of those names is DEFINED HERE, in
|
|
34
|
+
* {@link DEFAULT_PRIVATE_STORE_LAYOUT} — not in `config/app-default-config.json`.
|
|
35
|
+
* They are a disk convention this code owns, not a setting anyone tunes. An
|
|
36
|
+
* instance that must override one may still set the matching
|
|
37
|
+
* `ngdpbase.page.provider.filesystem.private.files.*` key (see
|
|
38
|
+
* {@link privateStoreLayoutFromConfig}); the default it overrides lives here.
|
|
39
|
+
*
|
|
40
|
+
* Every file but `store.json` is written through the store's `StoreFileIO`, so
|
|
41
|
+
* it is ciphertext at rest exactly when the store is encrypted. `store.json` is
|
|
42
|
+
* the one that cannot be: it holds the wrapped key needed to open the rest.
|
|
43
|
+
*/
|
|
44
|
+
export type PrivateStoreLayoutFiles = {
|
|
45
|
+
userkeys: string;
|
|
46
|
+
userindex: string;
|
|
47
|
+
storemeta: string;
|
|
48
|
+
/** A store's own file index, beside `store.json` (#1400). */
|
|
49
|
+
storefiles: string;
|
|
50
|
+
/** A store's own page index, beside `store.json` (#1456). */
|
|
51
|
+
storepages: string;
|
|
52
|
+
/** A store's own saved search index, beside its page index (#1458). */
|
|
53
|
+
storesearch: string;
|
|
54
|
+
/** Which one-time migrations this store has had, beside its indexes (#1457). */
|
|
55
|
+
storemigrations: string;
|
|
56
|
+
/** A store's own trash record, beside its page index (#1459). */
|
|
57
|
+
storedeleted: string;
|
|
58
|
+
};
|
|
59
|
+
export type PrivateStoreLayout = {
|
|
60
|
+
privateRoot: string;
|
|
61
|
+
defaultStoreId: string;
|
|
62
|
+
versionsDir: string;
|
|
63
|
+
deletedDir: string;
|
|
64
|
+
/** Non-page files inside a store: `{store}/{attachmentsDir}/{uuid}.ext` (#1400) */
|
|
65
|
+
attachmentsDir: string;
|
|
66
|
+
/** A page's footnotes: `{store}/{footnotesDir}/{uuid}.json` (#1839) */
|
|
67
|
+
footnotesDir: string;
|
|
68
|
+
/** A page's comments: `{store}/{commentsDir}/{uuid}/{id}.json` (#1839) */
|
|
69
|
+
commentsDir: string;
|
|
70
|
+
files: PrivateStoreLayoutFiles;
|
|
71
|
+
/**
|
|
72
|
+
* The vault ids whose kind is sealed: the system-category entries that
|
|
73
|
+
* declare the vault with `encrypt: true` (#1834). Read from configuration
|
|
74
|
+
* with the rest of the layout, so every store I/O decision — which already
|
|
75
|
+
* carries the layout — consults the kind as well as the vault's
|
|
76
|
+
* `store.json`, and a sealed kind's vault without a sealed `store.json`
|
|
77
|
+
* fails closed instead of being read and written in the clear.
|
|
78
|
+
*/
|
|
79
|
+
sealedVaults: readonly string[];
|
|
80
|
+
};
|
|
81
|
+
export type PrivateStoreLayoutOverrides = Partial<Omit<PrivateStoreLayout, 'files'>> & {
|
|
82
|
+
files?: Partial<PrivateStoreLayoutFiles>;
|
|
83
|
+
};
|
|
84
|
+
export declare const DEFAULT_PRIVATE_STORE_LAYOUT: PrivateStoreLayout;
|
|
85
|
+
export declare const DEFAULT_PRIVATE_STORE: string;
|
|
86
|
+
export declare const STORE_META_FILENAME: string;
|
|
87
|
+
export declare function resolvePrivateStoreLayout(overrides?: PrivateStoreLayoutOverrides): PrivateStoreLayout;
|
|
88
|
+
/** The user-level catalog filenames from layout (not a second hardcoded list). */
|
|
89
|
+
export declare function privateUserCatalogFiles(layout?: PrivateStoreLayoutOverrides): Set<string>;
|
|
90
|
+
export declare const PRIVATE_USER_CATALOG_FILES: Set<string>;
|
|
91
|
+
/**
|
|
92
|
+
* A system-category's vault, read from its `storageLocation.privatestore`
|
|
93
|
+
* (#1504): `pages/vaults/{user}/journal/` → `{ root: 'vaults', vaultId: 'journal' }`.
|
|
94
|
+
* The shape is fixed — `pages/`, the vaults' parent folder, the `{user}`
|
|
95
|
+
* placeholder, the vault id — and `null` for anything else, so a malformed
|
|
96
|
+
* entry never names a folder.
|
|
97
|
+
*/
|
|
98
|
+
export declare function parsePrivatestore(value: unknown): {
|
|
99
|
+
root: string;
|
|
100
|
+
vaultId: string;
|
|
101
|
+
} | null;
|
|
102
|
+
/** One `ngdpbase.system-category` entry that declares a vault. */
|
|
103
|
+
export interface SystemCategoryVault {
|
|
104
|
+
key: string;
|
|
105
|
+
root: string;
|
|
106
|
+
vaultId: string;
|
|
107
|
+
isDefault: boolean;
|
|
108
|
+
/** Whether a copy of this vault is sealed: the entry's own `encrypt`. */
|
|
109
|
+
encrypt: boolean;
|
|
110
|
+
}
|
|
111
|
+
/** The entries of `ngdpbase.system-category` that declare a vault, in config order. */
|
|
112
|
+
export declare function systemCategoryVaults(categories: unknown): SystemCategoryVault[];
|
|
113
|
+
export declare function privateStoreLayoutFromConfig(getProperty: (key: string, defaultValue: string) => unknown): PrivateStoreLayout;
|
|
114
|
+
export declare function isValidStoreId(store: string): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* A private page's name (#1456, operator 2026-09-22): `vaults/{owner}/{store}/{title}` —
|
|
117
|
+
* the same string as its URL without the leading slash. Wherever the system
|
|
118
|
+
* passes a page name, a private page is named this way; a plain title always
|
|
119
|
+
* means a public page. Titles never contain `/` (#1455), so the parts are
|
|
120
|
+
* unambiguous. Was `private/` until #1506.
|
|
121
|
+
*/
|
|
122
|
+
export declare const PRIVATE_PAGE_NAME_PREFIX = "vaults/";
|
|
123
|
+
/** The first path segment of a private page's URL: `/vaults/{owner}/{store}/{title}`. */
|
|
124
|
+
export declare const PRIVATE_URL_SEGMENT: string;
|
|
125
|
+
/**
|
|
126
|
+
* The vault parent folder, page-name prefix and URL segment before #1506
|
|
127
|
+
* (operator, 2026-09-28): `pages/private/`, `private/{owner}/{store}/{title}`,
|
|
128
|
+
* `/private/…`. Read only by the one-time move to `vaults` and by the things
|
|
129
|
+
* that must never mistake a leftover `private/` folder for public pages.
|
|
130
|
+
*/
|
|
131
|
+
export declare const LEGACY_PRIVATE_ROOT = "private";
|
|
132
|
+
/**
|
|
133
|
+
* The reserved start of a private page's slug: `vaults--{owner}-{vault}-{title}`.
|
|
134
|
+
* No public slug contains `--`, so the two can never collide. Was `private--`
|
|
135
|
+
* until #1507 (operator, 2026-09-29), for the same reason the page name moved
|
|
136
|
+
* from `private/` to `vaults/` in #1506.
|
|
137
|
+
*/
|
|
138
|
+
export declare const PRIVATE_SLUG_PREFIX = "vaults--";
|
|
139
|
+
export interface PrivatePageName {
|
|
140
|
+
owner: string;
|
|
141
|
+
store: string;
|
|
142
|
+
title: string;
|
|
143
|
+
}
|
|
144
|
+
export declare function formatPrivatePageName(owner: string, store: string, title: string): string;
|
|
145
|
+
/** The parts of a private page name, or null when `name` is not one. */
|
|
146
|
+
export declare function parsePrivatePageName(name: unknown): PrivatePageName | null;
|
|
147
|
+
/**
|
|
148
|
+
* The name a page an identifier opened is known by: its title — the
|
|
149
|
+
* identifier may be a uuid or slug, and every downstream index is keyed by
|
|
150
|
+
* title — or, for a vault page, its vault name (#1539). A vault page's bare
|
|
151
|
+
* title is a PUBLIC page's name, so the door would judge, and a write would
|
|
152
|
+
* hit, a different page.
|
|
153
|
+
*/
|
|
154
|
+
export declare function canonicalPageName(identifier: string, metadata: {
|
|
155
|
+
title?: string;
|
|
156
|
+
} | null | undefined): string;
|
|
157
|
+
/**
|
|
158
|
+
* A private page's LINK target, written inside brackets as `{store}/{Title}`
|
|
159
|
+
* (#1457). The store belongs to the owner of the page the link sits in, so the
|
|
160
|
+
* target names no user — {@link formatPrivatePageName} supplies the owner.
|
|
161
|
+
*
|
|
162
|
+
* `null` for anything else, including a target whose first segment is not a
|
|
163
|
+
* store id (`Docs/Setup`) and one with a second `/`: titles never contain one
|
|
164
|
+
* (#1455), so a deeper path is not a private page.
|
|
165
|
+
*/
|
|
166
|
+
export declare function parsePrivateLinkTarget(target: string): {
|
|
167
|
+
store: string;
|
|
168
|
+
title: string;
|
|
169
|
+
} | null;
|
|
170
|
+
export declare function mayContainPrivateLink(content: string): boolean;
|
|
171
|
+
/** Refuse a store id that is not a plain slug. Every join below runs it. */
|
|
172
|
+
export declare function assertStoreId(store: string): string;
|
|
173
|
+
/**
|
|
174
|
+
* A user folder or file name is exactly one path segment. Usernames have no
|
|
175
|
+
* enforced shape, so this refuses only what could leave the folder: empty,
|
|
176
|
+
* `.`, `..`, a separator, or NUL.
|
|
177
|
+
*/
|
|
178
|
+
export declare function isSafePathSegment(segment: string): boolean;
|
|
179
|
+
export declare function assertPathSegment(segment: string, what: string): string;
|
|
180
|
+
export declare function privatePageFilePath(pagesDirectory: string, creator: string, uuidOrBasename: string, store?: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
181
|
+
export declare function privateUserDir(pagesDirectory: string, username: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
182
|
+
export declare function privateUserKeysPath(pagesDirectory: string, username: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
183
|
+
export declare function privateUserIndexPath(pagesDirectory: string, username: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
184
|
+
export declare function privateStoreRoot(pagesDirectory: string, creator: string, store?: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
185
|
+
/**
|
|
186
|
+
* Folder for a store's non-page files: `{privateroot}/{user}/{store}/{attachmentsdir}` (#1386).
|
|
187
|
+
* Never the store root — an uploaded `.md` there would scan as a page.
|
|
188
|
+
*/
|
|
189
|
+
export declare function privateStoreAttachmentsDir(pagesDirectory: string, creator: string, store?: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
190
|
+
/** Non-page file in `{privateroot}/{user}/{store}/{attachmentsdir}/{file}` (#1386). */
|
|
191
|
+
export declare function privateStoreFilePath(pagesDirectory: string, creator: string, fileName: string, store?: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
192
|
+
/**
|
|
193
|
+
* True when `relParts` (path relative to the pages directory, split) names a
|
|
194
|
+
* store's attachments folder: `{privateroot}/{user}/{store}/{attachmentsdir}`.
|
|
195
|
+
* Depth-checked so a user or store that happens to be called `attachments` is not skipped.
|
|
196
|
+
*/
|
|
197
|
+
export declare function isPrivateStoreAttachmentsRel(relParts: string[], layout?: PrivateStoreLayoutOverrides): boolean;
|
|
198
|
+
export declare function storeMetaPath(pagesDirectory: string, creator: string, store?: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
199
|
+
/** A store's own file index: `{privateroot}/{user}/{store}/{storefiles}` (#1400). */
|
|
200
|
+
export declare function storeFileIndexPath(pagesDirectory: string, creator: string, store?: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
201
|
+
/** A store's own page index: `{privateroot}/{user}/{store}/{storepages}` (#1456). */
|
|
202
|
+
export declare function storePageIndexPath(pagesDirectory: string, creator: string, store?: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
203
|
+
/** A store's own saved search index: `{privateroot}/{user}/{store}/{storesearch}` (#1458). */
|
|
204
|
+
export declare function storeSearchIndexPath(pagesDirectory: string, creator: string, store?: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
205
|
+
/**
|
|
206
|
+
* A store's own trash record: `{privateroot}/{user}/{store}/{storedeleted}` (#1459).
|
|
207
|
+
*
|
|
208
|
+
* Beside the store's other indexes, so it is sealed exactly when the store is
|
|
209
|
+
* and travels with it — a deleted private page leaves no trace outside its own
|
|
210
|
+
* store, not in the global trash and not in `page-index.json`.
|
|
211
|
+
*/
|
|
212
|
+
export declare function storeDeletedIndexPath(pagesDirectory: string, creator: string, store?: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
213
|
+
/** A store's record of the one-time migrations it has had (#1457). */
|
|
214
|
+
export declare function storeMigrationsPath(pagesDirectory: string, creator: string, store?: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
215
|
+
export declare function privateVersionDirectory(pagesDirectory: string, creator: string, uuid: string, store?: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
216
|
+
/**
|
|
217
|
+
* Where a vault page's footnotes or comments are kept (#1839): a folder of
|
|
218
|
+
* the vault, `{privateroot}/{user}/{store}/{footnotesDir|commentsDir}`, so
|
|
219
|
+
* they are written through the vault's store I/O and sealed exactly when its
|
|
220
|
+
* pages are. A public page's are in the managers' own folders.
|
|
221
|
+
*/
|
|
222
|
+
export declare function privateStoreNotesDir(pagesDirectory: string, creator: string, store: string, kind: 'footnotes' | 'comments', layout?: PrivateStoreLayoutOverrides): string;
|
|
223
|
+
export declare function privateDeletedDirectory(pagesDirectory: string, creator: string, store?: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
224
|
+
/** Pre-#1383 live file: `{pages}/{privateroot}/{user}/{file}.md`. */
|
|
225
|
+
export declare function legacyPrivatePageFilePath(pagesDirectory: string, creator: string, uuidOrBasename: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
226
|
+
/** Legacy `pages/versions/private` = join(versionsdir, privateroot). No extra key. */
|
|
227
|
+
export declare function legacyPrivateVersionsRoot(pagesDirectory: string, layout?: PrivateStoreLayoutOverrides): string;
|
|
228
|
+
/**
|
|
229
|
+
* True when `filePath` is inside the private root of `pagesDirectory`. Measured
|
|
230
|
+
* from the pages directory, not by searching the absolute path for `/private/`
|
|
231
|
+
* — which matched every page on a host whose data sits under `/private/var`
|
|
232
|
+
* or `/private/tmp` (macOS).
|
|
233
|
+
*/
|
|
234
|
+
export declare function pathContainsPrivateRoot(pagesDirectory: string, filePath: string, layout?: PrivateStoreLayoutOverrides): boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Relative path from the pages directory, split on the platform separator.
|
|
237
|
+
* `{privateroot}/{user}/{store}/{file}.md` → store layout.
|
|
238
|
+
* `{privateroot}/{user}/{file}.md` → legacy layout (pre-#1383).
|
|
239
|
+
*
|
|
240
|
+
* `null` for anything else, including a store folder whose name is not a valid
|
|
241
|
+
* store id. A caller that finds `null` for a path under the private root must
|
|
242
|
+
* skip the file, never treat it as a public page ({@link isUnderPrivateRoot}).
|
|
243
|
+
*/
|
|
244
|
+
export declare function parsePrivatePageRel(relParts: string[], layout?: PrivateStoreLayoutOverrides): {
|
|
245
|
+
creator: string;
|
|
246
|
+
store: string;
|
|
247
|
+
} | null;
|
|
248
|
+
/**
|
|
249
|
+
* The store that holds a file at any depth — the live page, a version blob,
|
|
250
|
+
* a trash record or an attachment: `{privateroot}/{user}/{store}/…`. `null`
|
|
251
|
+
* for a file that is not inside a store, including the user-level catalogues
|
|
252
|
+
* beside the stores (#1415).
|
|
253
|
+
*/
|
|
254
|
+
export declare function parsePrivateStoreRel(relParts: string[], layout?: PrivateStoreLayoutOverrides): {
|
|
255
|
+
creator: string;
|
|
256
|
+
store: string;
|
|
257
|
+
} | null;
|
|
258
|
+
/** True when a path relative to the pages directory is inside the private root. */
|
|
259
|
+
export declare function isUnderPrivateRoot(relParts: string[], layout?: PrivateStoreLayoutOverrides): boolean;
|