@jwilleke/ngdpbase-types 0.0.0 → 5.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +16 -2
- package/lib/packages/ngdpbase-types/index.d.ts +32 -0
- package/lib/packages/ngdpbase-types/testing.d.ts +43 -0
- package/lib/packages/ngdpbase-types/testing.js +53 -0
- package/lib/src/cache/CacheDependencies.d.ts +50 -0
- package/lib/src/cache/CacheDependencies.js +50 -0
- package/lib/src/cache/ICacheAdapter.d.ts +86 -0
- package/lib/src/cache/RegionCache.d.ts +171 -0
- package/lib/src/context/ActorContext.d.ts +48 -0
- package/lib/src/context/ActorContext.js +33 -0
- package/lib/src/context/ApiContext.d.ts +194 -0
- package/lib/src/context/ApiContext.js +273 -0
- package/lib/src/context/BaseContext.d.ts +110 -0
- package/lib/src/context/BaseContext.js +143 -0
- package/lib/src/context/JobContext.d.ts +153 -0
- package/lib/src/context/JobContext.js +144 -0
- package/lib/src/context/WikiContext.d.ts +404 -0
- package/lib/src/context/bootActions.d.ts +64 -0
- package/lib/src/context/bootActions.js +111 -0
- package/lib/src/converters/HtmlConverter.d.ts +70 -0
- package/lib/src/converters/IContentConverter.d.ts +94 -0
- package/lib/src/converters/JSPWikiConverter.d.ts +117 -0
- package/lib/src/converters/conversionWarning.d.ts +15 -0
- package/lib/src/converters/ncm/bridge.d.ts +22 -0
- package/lib/src/converters/ncm/existing.d.ts +23 -0
- package/lib/src/converters/ncm/fix/blocks.d.ts +89 -0
- package/lib/src/converters/ncm/fix/bulletMarkers.d.ts +21 -0
- package/lib/src/converters/ncm/fix/index.d.ts +36 -0
- package/lib/src/converters/ncm/fix/jspwikiBullets.d.ts +20 -0
- package/lib/src/converters/ncm/fix/jspwikiCodeMarkers.d.ts +38 -0
- package/lib/src/converters/ncm/fix/jspwikiHeadings.d.ts +25 -0
- package/lib/src/converters/ncm/fix/jspwikiIndent.d.ts +24 -0
- package/lib/src/converters/ncm/fix/jspwikiInsert.d.ts +21 -0
- package/lib/src/converters/ncm/fix/jspwikiItalic.d.ts +29 -0
- package/lib/src/converters/ncm/fix/jspwikiLinkLeftovers.d.ts +27 -0
- package/lib/src/converters/ncm/fix/moreInformationFooter.d.ts +25 -0
- package/lib/src/converters/ncm/fix/styleClosers.d.ts +25 -0
- package/lib/src/converters/ncm/fix/tightenLists.d.ts +30 -0
- package/lib/src/converters/ncm/fix/types.d.ts +33 -0
- package/lib/src/converters/ncm/footnotes.d.ts +39 -0
- package/lib/src/converters/ncm/images.d.ts +49 -0
- package/lib/src/converters/ncm/index.d.ts +20 -0
- package/lib/src/converters/ncm/links.d.ts +21 -0
- package/lib/src/converters/ncm/normalize.d.ts +39 -0
- package/lib/src/converters/ncm/placeholder.d.ts +25 -0
- package/lib/src/converters/ncm/tables.d.ts +36 -0
- package/lib/src/converters/ncm/types.d.ts +42 -0
- package/lib/src/http/egressPolicy.d.ts +52 -0
- package/lib/src/http/guardedFetch.d.ts +89 -0
- package/lib/src/http/guardedFetch.js +113 -0
- package/lib/src/http/guardedLookup.d.ts +48 -0
- package/lib/src/http/guardedLookup.js +73 -0
- package/lib/src/http/ssrf.d.ts +83 -0
- package/lib/src/http/ssrf.js +311 -0
- package/lib/src/mail/MailProvider.d.ts +36 -0
- package/lib/src/mail/NodemailerMailProvider.d.ts +26 -0
- package/lib/src/managers/AddonsManager.d.ts +691 -0
- package/lib/src/managers/AgentTokenManager.d.ts +269 -0
- package/lib/src/managers/AssetManager.d.ts +116 -0
- package/lib/src/managers/AttachmentManager.d.ts +1032 -0
- package/lib/src/managers/AuthManager.d.ts +1257 -0
- package/lib/src/managers/BackgroundJobManager.d.ts +434 -0
- package/lib/src/managers/BaseManager.d.ts +427 -0
- package/lib/src/managers/BaseManager.js +415 -0
- package/lib/src/managers/CacheManager.d.ts +159 -0
- package/lib/src/managers/CatalogManager.d.ts +235 -0
- package/lib/src/managers/CommentManager.d.ts +75 -0
- package/lib/src/managers/ConfigurationManager.d.ts +747 -0
- package/lib/src/managers/DatabaseManager.d.ts +188 -0
- package/lib/src/managers/DatabaseManager.js +590 -0
- package/lib/src/managers/EmailManager.d.ts +47 -0
- package/lib/src/managers/ExportManager.d.ts +129 -0
- package/lib/src/managers/ExportManager.js +420 -0
- package/lib/src/managers/FootnoteManager.d.ts +118 -0
- package/lib/src/managers/MediaManager.d.ts +279 -0
- package/lib/src/managers/MetricsManager.d.ts +89 -0
- package/lib/src/managers/NotificationManager.d.ts +165 -0
- package/lib/src/managers/OidcManager.d.ts +210 -0
- package/lib/src/managers/OrganizationManager.d.ts +107 -0
- package/lib/src/managers/PageManager.d.ts +1645 -0
- package/lib/src/managers/PersonManager.d.ts +48 -0
- package/lib/src/managers/PluginManager.d.ts +179 -0
- package/lib/src/managers/PluginManager.js +393 -0
- package/lib/src/managers/PolicyEvaluator.d.ts +213 -0
- package/lib/src/managers/RenderingManager.d.ts +358 -0
- package/lib/src/managers/RoleManager.d.ts +134 -0
- package/lib/src/managers/SearchManager.d.ts +402 -0
- package/lib/src/managers/ShareManager.d.ts +251 -0
- package/lib/src/managers/TemplateManager.d.ts +176 -0
- package/lib/src/managers/ThemeManager.d.ts +56 -0
- package/lib/src/managers/UserManager.d.ts +480 -0
- package/lib/src/managers/ValidationManager.d.ts +426 -0
- package/lib/src/managers/VariableManager.d.ts +145 -0
- package/lib/src/middleware/csrf.d.ts +3 -0
- package/lib/src/parsers/LinkParser.d.ts +457 -0
- package/lib/src/parsers/MarkupParser.d.ts +769 -0
- package/lib/src/parsers/context/ParseContext.d.ts +314 -0
- package/lib/src/parsers/data/emoji-map.d.ts +18 -0
- package/lib/src/parsers/dom/DOMBuilder.d.ts +210 -0
- package/lib/src/parsers/dom/DOMParser.d.ts +252 -0
- package/lib/src/parsers/dom/Tokenizer.d.ts +358 -0
- package/lib/src/parsers/dom/WikiDocument.d.ts +272 -0
- package/lib/src/parsers/dom/handlers/DOMLinkHandler.d.ts +260 -0
- package/lib/src/parsers/dom/handlers/DOMPluginHandler.d.ts +212 -0
- package/lib/src/parsers/dom/handlers/DOMVariableHandler.d.ts +171 -0
- package/lib/src/parsers/filters/BaseFilter.d.ts +269 -0
- package/lib/src/parsers/filters/FilterChain.d.ts +320 -0
- package/lib/src/parsers/handlers/BaseSyntaxHandler.d.ts +331 -0
- package/lib/src/parsers/handlers/HandlerRegistry.d.ts +225 -0
- package/lib/src/parsers/handlers/JSPWikiPreprocessor.d.ts +89 -0
- package/lib/src/parsers/handlers/LinkParserHandler.d.ts +80 -0
- package/lib/src/parsers/handlers/PluginSyntaxHandler.d.ts +78 -0
- package/lib/src/parsers/handlers/WikiFormHandler.d.ts +149 -0
- package/lib/src/parsers/handlers/WikiTagHandler.d.ts +125 -0
- package/lib/src/parsers/jspwikiTableRow.d.ts +39 -0
- package/lib/src/parsers/styleBlockSyntax.d.ts +14 -0
- package/lib/src/plugins/types.d.ts +79 -0
- package/lib/src/providers/AgentTokenAuthProvider.d.ts +40 -0
- package/lib/src/providers/AuthentikBearerAuthProvider.d.ts +75 -0
- package/lib/src/providers/BaseAttachmentProvider.d.ts +197 -0
- package/lib/src/providers/BaseAuthProvider.d.ts +220 -0
- package/lib/src/providers/BaseCacheProvider.d.ts +140 -0
- package/lib/src/providers/BaseCredentialsProvider.d.ts +84 -0
- package/lib/src/providers/BaseDatabaseProvider.d.ts +22 -0
- package/lib/src/providers/BaseDatabaseProvider.js +12 -0
- package/lib/src/providers/BaseLoggingProvider.d.ts +68 -0
- package/lib/src/providers/BaseLoggingProvider.js +37 -0
- package/lib/src/providers/BaseMediaProvider.d.ts +308 -0
- package/lib/src/providers/BasePageProvider.d.ts +337 -0
- package/lib/src/providers/BaseProvider.d.ts +98 -0
- package/lib/src/providers/BaseProvider.js +74 -0
- package/lib/src/providers/BaseSearchProvider.d.ts +362 -0
- package/lib/src/providers/BasicAttachmentProvider.d.ts +599 -0
- package/lib/src/providers/CloudflareAccessAuthProvider.d.ts +72 -0
- package/lib/src/providers/FileCredentialsProvider.d.ts +33 -0
- package/lib/src/providers/FileJobStateProvider.d.ts +58 -0
- package/lib/src/providers/FileLoggingProvider.d.ts +43 -0
- package/lib/src/providers/FileLoggingProvider.js +120 -0
- package/lib/src/providers/FileOidcAdapter.d.ts +25 -0
- package/lib/src/providers/FileSystemMediaProvider.d.ts +403 -0
- package/lib/src/providers/LunrSearchProvider.d.ts +280 -0
- package/lib/src/providers/MagicLinkAuthProvider.d.ts +125 -0
- package/lib/src/providers/NullCacheProvider.d.ts +72 -0
- package/lib/src/providers/OidcAuthProvider.d.ts +180 -0
- package/lib/src/providers/OidcBearerAuthProvider.d.ts +30 -0
- package/lib/src/providers/PasskeyAuthProvider.d.ts +58 -0
- package/lib/src/providers/PasswordAuthProvider.d.ts +20 -0
- package/lib/src/providers/SqliteDatabaseProvider.d.ts +55 -0
- package/lib/src/providers/SqliteDatabaseProvider.js +90 -0
- package/lib/src/providers/SqliteJobStateProvider.d.ts +41 -0
- package/lib/src/providers/databaseMigrations.d.ts +8 -0
- package/lib/src/providers/databaseMigrations.js +47 -0
- package/lib/src/providers/jobState.d.ts +99 -0
- package/lib/src/providers/lunrQueryToMiniSearch.d.ts +32 -0
- package/lib/src/providers/mediaFilenameDate.d.ts +22 -0
- package/lib/src/providers/sqliteBackup.d.ts +128 -0
- package/lib/src/providers/sqliteBackup.js +365 -0
- package/lib/src/providers/sqliteLocation.d.ts +17 -0
- package/lib/src/providers/sqliteLocation.js +55 -0
- package/lib/src/providers/sqliteMigrations.d.ts +48 -0
- package/lib/src/providers/sqliteMigrations.js +72 -0
- package/lib/src/rendering/githubAlerts.d.ts +22 -0
- package/lib/src/rendering/htmlPolicy.d.ts +76 -0
- package/lib/src/rendering/markdownConverter.d.ts +73 -0
- package/lib/src/security/PolicyDecisionPoint.d.ts +245 -0
- package/lib/src/security/PolicyInformationPoint.d.ts +448 -0
- package/lib/src/security/pageActions.d.ts +40 -0
- package/lib/src/security/permissions.generated.d.ts +78 -0
- package/lib/src/types/Asset.d.ts +414 -0
- package/lib/src/types/Catalog.d.ts +61 -0
- package/lib/src/types/Comment.d.ts +11 -0
- package/lib/src/types/Config.d.ts +388 -0
- package/lib/src/types/Organization.d.ts +78 -0
- package/lib/src/types/OrganizationProvider.d.ts +38 -0
- package/lib/src/types/Page.d.ts +220 -0
- package/lib/src/types/Person.d.ts +56 -0
- package/lib/src/types/PersonProvider.d.ts +25 -0
- package/lib/src/types/Policy.d.ts +139 -0
- package/lib/src/types/Policy.js +17 -0
- package/lib/src/types/Provider.d.ts +810 -0
- package/lib/src/types/Role.d.ts +84 -0
- package/lib/src/types/RoleProvider.d.ts +35 -0
- package/lib/src/types/Schema.d.ts +425 -0
- package/lib/src/types/Share.d.ts +172 -0
- package/lib/src/types/Share.js +81 -0
- package/lib/src/types/User.d.ts +304 -0
- package/lib/src/types/Version.d.ts +189 -0
- package/lib/src/types/WikiEngine.d.ts +128 -0
- package/lib/src/types/express.d.ts +120 -0
- package/lib/src/types/express.js +1 -0
- package/lib/src/types/guards.d.ts +78 -0
- package/lib/src/types/heic-decode.d.ts +16 -0
- package/lib/src/types/index.d.ts +19 -0
- package/lib/src/types/linkedom.d.ts +77 -0
- package/lib/src/types/markdown-it-plugins.d.ts +21 -0
- package/lib/src/utils/DeltaStorage.d.ts +118 -0
- package/lib/src/utils/LocaleUtils.d.ts +105 -0
- package/lib/src/utils/LocaleUtils.js +294 -0
- package/lib/src/utils/PageNameMatcher.d.ts +98 -0
- package/lib/src/utils/PathPreflight.d.ts +38 -0
- package/lib/src/utils/PathPreflight.js +50 -0
- package/lib/src/utils/SectionUtils.d.ts +40 -0
- package/lib/src/utils/addonConfigLayer.d.ts +144 -0
- package/lib/src/utils/addonConfigLayer.js +382 -0
- package/lib/src/utils/addonDatabaseRules.d.ts +25 -0
- package/lib/src/utils/addonDatabaseRules.js +57 -0
- package/lib/src/utils/addonHost.d.ts +51 -0
- package/lib/src/utils/addonHost.js +72 -0
- package/lib/src/utils/addonInstaller.d.ts +109 -0
- package/lib/src/utils/addonLock.d.ts +37 -0
- package/lib/src/utils/addonLock.js +48 -0
- package/lib/src/utils/addonPageSync.d.ts +45 -0
- package/lib/src/utils/addonProvenance.d.ts +48 -0
- package/lib/src/utils/addonTarball.d.ts +41 -0
- package/lib/src/utils/addonsPathResolver.d.ts +76 -0
- package/lib/src/utils/addonsPathResolver.js +129 -0
- package/lib/src/utils/assetMetadataTags.d.ts +66 -0
- package/lib/src/utils/atomicWrite.d.ts +28 -0
- package/lib/src/utils/auditConfigChange.d.ts +57 -0
- package/lib/src/utils/auditEventNames.d.ts +50 -0
- package/lib/src/utils/auditEventNames.generated.d.ts +169 -0
- package/lib/src/utils/auditEventNames.generated.js +174 -0
- package/lib/src/utils/auditEventNames.js +49 -0
- package/lib/src/utils/auditEvents.d.ts +265 -0
- package/lib/src/utils/auditEvents.js +309 -0
- package/lib/src/utils/auditRegistry.d.ts +102 -0
- package/lib/src/utils/auditRegistry.js +168 -0
- package/lib/src/utils/bip39English.d.ts +2 -0
- package/lib/src/utils/configEnvKeys.d.ts +68 -0
- package/lib/src/utils/configFiles.d.ts +74 -0
- package/lib/src/utils/configFiles.js +150 -0
- package/lib/src/utils/delegation.d.ts +48 -0
- package/lib/src/utils/deriveUsername.d.ts +21 -0
- package/lib/src/utils/explainMediaPath.d.ts +123 -0
- package/lib/src/utils/formerTitles.d.ts +69 -0
- package/lib/src/utils/frontmatterAccess.d.ts +54 -0
- package/lib/src/utils/headlessAdminPassword.d.ts +55 -0
- package/lib/src/utils/imageTransform.d.ts +52 -0
- package/lib/src/utils/instanceEnvSecret.d.ts +51 -0
- package/lib/src/utils/jobSlots.d.ts +43 -0
- package/lib/src/utils/keywordNormalizer.d.ts +127 -0
- package/lib/src/utils/logger.d.ts +70 -0
- package/lib/src/utils/logger.js +106 -0
- package/lib/src/utils/magicLinkDeviceState.d.ts +95 -0
- package/lib/src/utils/managerUtils.d.ts +40 -0
- package/lib/src/utils/migrateLegacyPrivateAttachments.d.ts +15 -0
- package/lib/src/utils/orgFilename.d.ts +22 -0
- package/lib/src/utils/pageFeature.d.ts +27 -0
- package/lib/src/utils/pageFrontmatter.d.ts +21 -0
- package/lib/src/utils/pageNotes.d.ts +150 -0
- package/lib/src/utils/pageTitleRule.d.ts +37 -0
- package/lib/src/utils/pageToArticle.d.ts +59 -0
- package/lib/src/utils/pageUrl.d.ts +18 -0
- package/lib/src/utils/passwordChange.d.ts +12 -0
- package/lib/src/utils/passwordHash.d.ts +60 -0
- package/lib/src/utils/permissionCatalog.d.ts +52 -0
- package/lib/src/utils/pluginFormatters.d.ts +452 -0
- package/lib/src/utils/pluginFormatters.js +714 -0
- package/lib/src/utils/privateLinkRewrite.d.ts +42 -0
- package/lib/src/utils/privateStoreAccess.d.ts +57 -0
- package/lib/src/utils/privateStoreAccess.js +65 -0
- package/lib/src/utils/privateStoreCatalogs.d.ts +40 -0
- package/lib/src/utils/privateStoreCrypto.d.ts +127 -0
- package/lib/src/utils/privateStoreDoor.d.ts +181 -0
- package/lib/src/utils/privateStoreExport.d.ts +72 -0
- package/lib/src/utils/privateStoreFiles.d.ts +120 -0
- package/lib/src/utils/privateStoreMeta.d.ts +64 -0
- package/lib/src/utils/privateStoreMigrations.d.ts +37 -0
- package/lib/src/utils/privateStorePath.d.ts +259 -0
- package/lib/src/utils/privateStorePath.js +436 -0
- package/lib/src/utils/privateStoreTakeout.d.ts +76 -0
- package/lib/src/utils/privateStoreUnlock.d.ts +175 -0
- package/lib/src/utils/proxyClaim.d.ts +59 -0
- package/lib/src/utils/proxyClaim.js +30 -0
- package/lib/src/utils/redactPrivateNames.d.ts +21 -0
- package/lib/src/utils/redactPrivateNames.js +89 -0
- package/lib/src/utils/redactSecrets.d.ts +58 -0
- package/lib/src/utils/redactSecrets.js +171 -0
- package/lib/src/utils/renameLinkRewrite.d.ts +112 -0
- package/lib/src/utils/roleGrants.d.ts +35 -0
- package/lib/src/utils/safeRedirect.d.ts +32 -0
- package/lib/src/utils/schedule.d.ts +54 -0
- package/lib/src/utils/secretFileMode.d.ts +17 -0
- package/lib/src/utils/seededShippedPages.d.ts +45 -0
- package/lib/src/utils/sensitiveValues.d.ts +59 -0
- package/lib/src/utils/sensitiveValues.js +106 -0
- package/lib/src/utils/sessionEnd.d.ts +12 -0
- package/lib/src/utils/sessionGeneration.d.ts +24 -0
- package/lib/src/utils/sessionIdle.d.ts +41 -0
- package/lib/src/utils/sessionLimits.d.ts +68 -0
- package/lib/src/utils/shareLockbox.d.ts +64 -0
- package/lib/src/utils/sigstoreTrustedRoot.d.ts +33 -0
- package/lib/src/utils/sniffMime.d.ts +21 -0
- package/lib/src/utils/storeSearchIndex.d.ts +75 -0
- package/lib/src/utils/subjectMayDo.d.ts +21 -0
- package/lib/src/utils/systemCategoryRules.d.ts +30 -0
- package/lib/src/utils/systemCategoryRules.js +41 -0
- package/lib/src/utils/userCreateError.d.ts +62 -0
- package/lib/src/utils/username.d.ts +53 -0
- package/lib/src/utils/vaultUrlRewrite.d.ts +27 -0
- package/lib/src/utils/version.d.ts +84 -0
- package/lib/src/utils/videoFrame.d.ts +21 -0
- package/package.json +54 -3
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import BaseManager from './BaseManager.js';
|
|
2
|
+
import type { WikiEngine } from '../types/WikiEngine.js';
|
|
3
|
+
import type { Migration } from '../providers/sqliteMigrations.js';
|
|
4
|
+
import { type ActorContext } from '../context/ActorContext.js';
|
|
5
|
+
import type { BackupData, ManagerBackupOptions, ManagerRestoreOptions } from './BaseManager.js';
|
|
6
|
+
import { type AddonDatabaseDeclaration } from '../utils/addonDatabaseRules.js';
|
|
7
|
+
import { type StagedRestoreManifest } from '../providers/sqliteBackup.js';
|
|
8
|
+
/** The environment variable holding the SQLCipher key. Never a config key: config is readable from the admin screens. */
|
|
9
|
+
export declare const DATABASE_KEY_ENV = "NGDPBASE_DATABASE_KEY";
|
|
10
|
+
/**
|
|
11
|
+
* The environment variable holding the key every database backup is encrypted
|
|
12
|
+
* under (#1723). Its own secret, not the database key: the copy that travels
|
|
13
|
+
* and the copy that stays should not fall to the same compromise. Never a
|
|
14
|
+
* config key. Unset, no database is backed up, and admins are told.
|
|
15
|
+
*/
|
|
16
|
+
export declare const BACKUP_KEY_ENV = "NGDPBASE_BACKUP_KEY";
|
|
17
|
+
/** How long a database backup or restore staging may run on its worker before it is stopped, when not configured. */
|
|
18
|
+
export declare const DEFAULT_BACKUP_WORKER_TIMEOUT_MS = 3600000;
|
|
19
|
+
/**
|
|
20
|
+
* A short fingerprint of a backup key (#1723, D3): the first 16 hex digits of
|
|
21
|
+
* an HMAC of a fixed label under the key. Recorded in each backup so a restore
|
|
22
|
+
* under another key says so plainly; it never reveals the key.
|
|
23
|
+
*/
|
|
24
|
+
export declare function backupKeyFingerprint(key: string): string;
|
|
25
|
+
/** One database in a backup, as DatabaseManager's entry in the backup document lists it. */
|
|
26
|
+
export interface DatabaseBackupEntry {
|
|
27
|
+
/** `application`, or `addon-<owner>`. */
|
|
28
|
+
name: string;
|
|
29
|
+
kind: 'application' | 'addon';
|
|
30
|
+
owner?: string;
|
|
31
|
+
/** The encrypted file beside the backup document: `<stem>.<name>.db`. */
|
|
32
|
+
file: string;
|
|
33
|
+
sizeBytes: number;
|
|
34
|
+
tables: number;
|
|
35
|
+
}
|
|
36
|
+
/** DatabaseManager's `data` in a backup document. */
|
|
37
|
+
export interface DatabaseBackupData {
|
|
38
|
+
format: 1;
|
|
39
|
+
/** `backupKeyFingerprint()` of the key the files are encrypted under. */
|
|
40
|
+
keyFingerprint?: string;
|
|
41
|
+
databases: DatabaseBackupEntry[];
|
|
42
|
+
/** Declared databases with no file yet (an add-on that never opened it). */
|
|
43
|
+
absent: string[];
|
|
44
|
+
/** Databases that could not be copied; the backup carries the others. */
|
|
45
|
+
failed: Array<{
|
|
46
|
+
name: string;
|
|
47
|
+
error: string;
|
|
48
|
+
}>;
|
|
49
|
+
}
|
|
50
|
+
/** What an add-on hands over to have its database opened and migrated. */
|
|
51
|
+
export interface AddonDatabaseOptions {
|
|
52
|
+
/** Dated migrations, strictly ascending by id — the same rules as core's ledger. */
|
|
53
|
+
migrations: Migration[];
|
|
54
|
+
/** Where the applied ids are recorded. Must start with the owner's slug (dashes as underscores) and `_`. */
|
|
55
|
+
ledgerTable: string;
|
|
56
|
+
}
|
|
57
|
+
/** A declared add-on database as Admin → Add-ons and the backup (#1723) see it. */
|
|
58
|
+
export interface DeclaredAddonDatabase extends AddonDatabaseDeclaration {
|
|
59
|
+
/** `<owner>.db` beside the application database; null when no application database is configured. */
|
|
60
|
+
file: string | null;
|
|
61
|
+
/** Whether this declaration's ledger is open in this process. */
|
|
62
|
+
open: boolean;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The request rules (addonDatabaseRules): the owner is a canonical slug, and
|
|
66
|
+
* the ledger table starts with its prefix. `openAddonDatabase` applies them,
|
|
67
|
+
* and so does the test kit's in-memory database
|
|
68
|
+
* (`@jwilleke/ngdpbase-types/testing`, #1865), so a test refuses what a site
|
|
69
|
+
* refuses.
|
|
70
|
+
*/
|
|
71
|
+
export declare function checkAddonDatabaseRequest(owner: string, options: AddonDatabaseOptions): void;
|
|
72
|
+
/**
|
|
73
|
+
* The declaration of this owner's ledger among `declarations`, or a refusal
|
|
74
|
+
* naming what is missing (#1860). `openAddonDatabase` asks it of the site's
|
|
75
|
+
* declarations; the test kit asks it of the add-on's own (#1865).
|
|
76
|
+
*/
|
|
77
|
+
export declare function addonDatabaseDeclarationFor(declarations: readonly AddonDatabaseDeclaration[], owner: string, ledgerTable: string): AddonDatabaseDeclaration;
|
|
78
|
+
declare class DatabaseManager extends BaseManager {
|
|
79
|
+
private provider;
|
|
80
|
+
private databaseFile;
|
|
81
|
+
private busyTimeoutMs;
|
|
82
|
+
private readonly addonDatabases;
|
|
83
|
+
/** What the start did with a staged restore (#1723), reported once the notifications exist. */
|
|
84
|
+
private restoreAtStart;
|
|
85
|
+
/** Why this manager is degraded, one entry per cause, so one cause clearing leaves the others. */
|
|
86
|
+
private readonly faults;
|
|
87
|
+
constructor(engine: WikiEngine);
|
|
88
|
+
initialize(config?: Record<string, unknown>): Promise<void>;
|
|
89
|
+
/** Whether an application database is open. */
|
|
90
|
+
isEnabled(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* The open connection, for a row-storing provider's constructor. Throws when
|
|
93
|
+
* no database is configured, so a provider that needs one fails at boot with
|
|
94
|
+
* the key to set rather than at its first write.
|
|
95
|
+
*/
|
|
96
|
+
getHandle<Handle = unknown>(): Handle;
|
|
97
|
+
/**
|
|
98
|
+
* Open (or join) an add-on's own database and run its migrations
|
|
99
|
+
* (ngdp-accounting-addons#13). The file is `<owner>.db` beside the application
|
|
100
|
+
* database, opened by the same provider under the same key, so it gets the
|
|
101
|
+
* same network-filesystem refusal, WAL, integrity check and newer-schema
|
|
102
|
+
* refusal. The first call for an owner opens the file; a later call — from an
|
|
103
|
+
* add-on that depends on the owner — adds its own ledger to the same file.
|
|
104
|
+
*
|
|
105
|
+
* Requires the application database: an operator who has not set
|
|
106
|
+
* `ngdpbase.database.provider` to `sqlite` has not chosen to keep a database.
|
|
107
|
+
*
|
|
108
|
+
* Opens only a declared database (#1860): an enabled add-on declares this
|
|
109
|
+
* owner and this ledger in `ngdpbase.addons.<slug>.database`. A declaration
|
|
110
|
+
* with `encrypt: "required"` is refused when `NGDPBASE_DATABASE_KEY` is not
|
|
111
|
+
* set; nothing is opened in the clear.
|
|
112
|
+
*/
|
|
113
|
+
openAddonDatabase<Handle = unknown>(owner: string, options: AddonDatabaseOptions): Handle;
|
|
114
|
+
/**
|
|
115
|
+
* Every add-on database declared on this site (#1860), whether or not its
|
|
116
|
+
* add-on is turned on — so a turned-off add-on's file is still listed and
|
|
117
|
+
* backed up (#1723). One entry per declared ledger; several may share an
|
|
118
|
+
* owner's file.
|
|
119
|
+
*/
|
|
120
|
+
getDeclaredDatabases(): DeclaredAddonDatabase[];
|
|
121
|
+
/**
|
|
122
|
+
* Why this add-on must not load, decided before it is imported (#1860): it
|
|
123
|
+
* declares a database `encrypt: "required"` and no key is set. Null when it
|
|
124
|
+
* may load. Asked by AddonsManager, as the configuration merge's refusals
|
|
125
|
+
* are (#1559).
|
|
126
|
+
*/
|
|
127
|
+
addonRefusal(slug: string): string | null;
|
|
128
|
+
private declarations;
|
|
129
|
+
/** The one rule: a database declared `encrypt: "required"` is never opened without the key. */
|
|
130
|
+
private static keyRefusal;
|
|
131
|
+
/**
|
|
132
|
+
* Copy every database into the backup BackupManager is writing: the
|
|
133
|
+
* application database and every declared add-on database, on or off, at
|
|
134
|
+
* one point in time, on a worker thread. Each goes into its own file,
|
|
135
|
+
* `<stem>.<name>.db`, beside the document, encrypted under
|
|
136
|
+
* `NGDPBASE_BACKUP_KEY`; the document references them. A database that
|
|
137
|
+
* fails is named in `warnings`, and the others are still written.
|
|
138
|
+
*
|
|
139
|
+
* Throws when there is no backup key: nothing is ever written unencrypted.
|
|
140
|
+
*/
|
|
141
|
+
backup(options?: ManagerBackupOptions): Promise<BackupData>;
|
|
142
|
+
/**
|
|
143
|
+
* Stage a restore of the databases in a backup, for the next start. Each
|
|
144
|
+
* backed-up database is opened under the backup key, integrity-checked, and
|
|
145
|
+
* copied into `<live>.staged` under this site's database key. All or
|
|
146
|
+
* nothing: if any fails, none is staged. A database the backup does not
|
|
147
|
+
* contain is left as it is. Live files are never touched here.
|
|
148
|
+
*
|
|
149
|
+
* BackupManager takes a fresh backup of the live data before calling this.
|
|
150
|
+
* A backed-up add-on database that no add-on on this site declares is not
|
|
151
|
+
* staged, and admins are told.
|
|
152
|
+
*/
|
|
153
|
+
restore(backupData: BackupData, options?: ManagerRestoreOptions): Promise<void>;
|
|
154
|
+
/** The restore staged and waiting for the next start, or null. */
|
|
155
|
+
getStagedRestore(): StagedRestoreManifest | null;
|
|
156
|
+
/**
|
|
157
|
+
* Throw away a staged restore before the restart applies it (#1723, D5):
|
|
158
|
+
* the staged files and the manifest are removed, the live databases are
|
|
159
|
+
* untouched. Recorded first (`backup-restore-cancel`, refuse): a cancel that
|
|
160
|
+
* cannot be recorded does not happen.
|
|
161
|
+
*/
|
|
162
|
+
cancelStagedRestore(ctx: ActorContext): Promise<StagedRestoreManifest>;
|
|
163
|
+
/**
|
|
164
|
+
* Tell admins what the start found (#1723): what it did with a staged
|
|
165
|
+
* restore, and a backup key that is missing or the database key. Called by
|
|
166
|
+
* the engine once every manager exists: DatabaseManager starts before the
|
|
167
|
+
* notifications do.
|
|
168
|
+
*/
|
|
169
|
+
reportAtBoot(): Promise<void>;
|
|
170
|
+
/** The application database and every declared add-on database (one per owner), on or off. */
|
|
171
|
+
private backupSources;
|
|
172
|
+
/** Put a staged restore in place, before any database opens; loud when it cannot. */
|
|
173
|
+
private applyRestoreAtStart;
|
|
174
|
+
private backupKey;
|
|
175
|
+
/** What is wrong with the backup key: missing, or the database key itself (D3). Null when sound. */
|
|
176
|
+
private backupKeyProblem;
|
|
177
|
+
/** `ngdpbase.database.backup.worker-timeout-ms`, read at use. */
|
|
178
|
+
private workerTimeoutMs;
|
|
179
|
+
/** Degrade for one cause; the dashboard shows every cause still standing. */
|
|
180
|
+
private fault;
|
|
181
|
+
private clearFault;
|
|
182
|
+
private notify;
|
|
183
|
+
/** Whether every open database passes SQLite's quick check; true when none is configured. */
|
|
184
|
+
integrityOk(): boolean;
|
|
185
|
+
/** Closes the add-on databases, then the application database. */
|
|
186
|
+
shutdown(): Promise<void>;
|
|
187
|
+
}
|
|
188
|
+
export default DatabaseManager;
|