@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,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lockboxes for links to encrypted vaults (#1388).
|
|
3
|
+
*
|
|
4
|
+
* A link to an encrypted vault is `/share/{token}#{key}`. The part after `#`
|
|
5
|
+
* is the link's private key; browsers never send it, so the server never sees
|
|
6
|
+
* it. The key pair is made in the owner's browser, which sends the server
|
|
7
|
+
* only the public half (`LinkPublicKey`).
|
|
8
|
+
*
|
|
9
|
+
* The server prepares each covered page, and the files it uses, and locks
|
|
10
|
+
* them for that public key: a {@link Lockbox}. It can lock, never open. The
|
|
11
|
+
* recipient's browser opens each lockbox with the private key from the link.
|
|
12
|
+
*
|
|
13
|
+
* The algorithm is WebCrypto's own, so the server (Node's `crypto.webcrypto`)
|
|
14
|
+
* and the browser (`window.crypto.subtle`, public/js/share-viewer.js) run the
|
|
15
|
+
* same steps: ECDH on P-256 between a fresh ephemeral key and the link's key,
|
|
16
|
+
* HKDF-SHA-256 over the shared secret, AES-256-GCM over the content.
|
|
17
|
+
*/
|
|
18
|
+
/** The public half of a link's key pair: a P-256 point, as WebCrypto exports it in JWK. */
|
|
19
|
+
export interface LinkPublicKey {
|
|
20
|
+
kty: 'EC';
|
|
21
|
+
crv: 'P-256';
|
|
22
|
+
x: string;
|
|
23
|
+
y: string;
|
|
24
|
+
}
|
|
25
|
+
/** One locked item, as stored and as served. */
|
|
26
|
+
export interface Lockbox {
|
|
27
|
+
v: 1;
|
|
28
|
+
/** The ephemeral public key the content was locked with. */
|
|
29
|
+
epk: LinkPublicKey;
|
|
30
|
+
/** AES-GCM IV, base64url. */
|
|
31
|
+
iv: string;
|
|
32
|
+
/** AES-GCM ciphertext with its tag, base64url. */
|
|
33
|
+
ct: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The public key a browser sent, checked strictly: a P-256 point and nothing
|
|
37
|
+
* else. Anything malformed is refused rather than stored.
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseLinkPublicKey(value: unknown): LinkPublicKey | null;
|
|
40
|
+
/** Lock `plaintext` for the link whose public key is `linkKey`. Only that link's private key opens it. */
|
|
41
|
+
export declare function sealForLink(linkKey: LinkPublicKey, plaintext: Uint8Array): Promise<Lockbox>;
|
|
42
|
+
/**
|
|
43
|
+
* The key part of a link, `{d}.{x}.{y}` in base64url: the private key the
|
|
44
|
+
* owner's browser made. The server never holds one; this is for the tests,
|
|
45
|
+
* and mirrors what the viewer does.
|
|
46
|
+
*/
|
|
47
|
+
export declare function linkKeyFromParts(jwk: {
|
|
48
|
+
d: string;
|
|
49
|
+
x: string;
|
|
50
|
+
y: string;
|
|
51
|
+
}): string;
|
|
52
|
+
/**
|
|
53
|
+
* Make a key pair on the server. A link's pair is made in the owner's browser,
|
|
54
|
+
* so for links this is the tests' stand-in; a person's own key pair for proxy
|
|
55
|
+
* access (#1762 slice 5, `privateStoreCrypto.newPersonKey`) is made here.
|
|
56
|
+
*/
|
|
57
|
+
export declare function newLinkKeyPair(): Promise<{
|
|
58
|
+
publicKey: LinkPublicKey;
|
|
59
|
+
linkKey: string;
|
|
60
|
+
}>;
|
|
61
|
+
/** Open a lockbox with a link's key, as the recipient's browser does. */
|
|
62
|
+
export declare function openLockbox(linkKey: string, box: Lockbox): Promise<Uint8Array>;
|
|
63
|
+
/** True when `value` has the shape of a stored lockbox. */
|
|
64
|
+
export declare function isLockbox(value: unknown): value is Lockbox;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Sigstore trusted root, fetched through the guarded client (#1830).
|
|
3
|
+
*
|
|
4
|
+
* The trusted root (Fulcio certificate authorities, Rekor and CT log keys,
|
|
5
|
+
* timestamp authorities) is distributed by Sigstore's TUF repository, which
|
|
6
|
+
* signs and versions it so a stale or forged copy is refused. `tuf-js` does the
|
|
7
|
+
* TUF verification. Its default fetcher is Node's global `fetch`, which would
|
|
8
|
+
* open the network outside src/http and past the egress policy (#1133, #1139),
|
|
9
|
+
* so a fetcher is supplied here that downloads through the function the caller
|
|
10
|
+
* gives it — in AddonsManager, `guardedFetch`.
|
|
11
|
+
*
|
|
12
|
+
* The TUF cache starts from the root shipped inside `@sigstore/tuf` (its
|
|
13
|
+
* `seeds.json`) and lives where the caller says (`<data>/addons/.sigstore`).
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_TUF_MIRROR = "https://tuf-repo-cdn.sigstore.dev";
|
|
16
|
+
/** A GET that resolves to the status and body, or throws when the host cannot be reached. */
|
|
17
|
+
export type TufDownload = (url: string, maxBytes: number) => Promise<{
|
|
18
|
+
status: number;
|
|
19
|
+
body: Buffer;
|
|
20
|
+
}>;
|
|
21
|
+
/** The trusted root as shipped in `@sigstore/tuf`, with no network. For tests and as the TUF seed. */
|
|
22
|
+
export declare function seededTrustedRoot(mirrorUrl?: string): unknown;
|
|
23
|
+
/**
|
|
24
|
+
* The current trusted root, refreshed from the TUF repository through
|
|
25
|
+
* `download` and verified by TUF. Throws when the repository cannot be reached
|
|
26
|
+
* or does not verify.
|
|
27
|
+
*/
|
|
28
|
+
export declare function fetchTrustedRoot(options: {
|
|
29
|
+
cacheDir: string;
|
|
30
|
+
mirrorUrl?: string;
|
|
31
|
+
download: TufDownload;
|
|
32
|
+
maxBytes: number;
|
|
33
|
+
}): Promise<unknown>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The type a file's bytes show it to be, for the formats we can recognise
|
|
3
|
+
* (#1624). An upload's declared type is the browser's claim; this is the
|
|
4
|
+
* evidence. Returns null when the bytes match none of the formats below —
|
|
5
|
+
* the caller decides what an unrecognised file is.
|
|
6
|
+
*
|
|
7
|
+
* Markup is recognised from the first kilobyte, case-insensitively, after
|
|
8
|
+
* leading whitespace (trimStart also drops a byte-order mark). SVG is checked before HTML because
|
|
9
|
+
* an SVG may itself contain a `<script>`.
|
|
10
|
+
*/
|
|
11
|
+
export type SniffedMime = 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp' | 'application/pdf' | 'image/svg+xml' | 'text/html' | 'text/xml';
|
|
12
|
+
/** Every type sniffMime can return: a claim of one of these must match the bytes. */
|
|
13
|
+
export declare const SNIFFABLE_MIME: ReadonlySet<string>;
|
|
14
|
+
export declare function sniffMime(b: Buffer): SniffedMime | null;
|
|
15
|
+
/**
|
|
16
|
+
* The type an upload is stored and served as. The bytes decide when they are
|
|
17
|
+
* recognisable; a claim of a recognisable type the bytes do not bear out
|
|
18
|
+
* becomes `application/octet-stream`; anything else keeps its declared type,
|
|
19
|
+
* since nothing here can check it (a .docx, a plain text file).
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveUploadMime(bytes: Buffer, declared: string | undefined): string;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A private store's own saved search index (#1458, epic #1454).
|
|
3
|
+
*
|
|
4
|
+
* A private page is in NO shared index (#1456), so its owner could not search
|
|
5
|
+
* it at all. Each store therefore keeps its own search index beside its page
|
|
6
|
+
* index — `{store}/search-index.json`, written through the store's own I/O, so
|
|
7
|
+
* it is ciphertext at rest exactly when the store is (operator, 2026-09-22:
|
|
8
|
+
* "each store keeps its own saved search index").
|
|
9
|
+
*
|
|
10
|
+
* It is SAVED, not built at search time: a document per page holds everything
|
|
11
|
+
* a match needs — title, body text, tags, category and `lastModified` — so a
|
|
12
|
+
* search reads one small file per store and never opens a page file. Building
|
|
13
|
+
* from the pages at search time was rejected as too slow for a large store.
|
|
14
|
+
*
|
|
15
|
+
* This module holds the shape and the matching rule and nothing else: no I/O,
|
|
16
|
+
* no config, no access decision. Who may read a store's index is decided
|
|
17
|
+
* before anyone gets here (PageManager, with the requester's context).
|
|
18
|
+
*/
|
|
19
|
+
/** One page, as its store's search index holds it. */
|
|
20
|
+
export interface StoreSearchDocument {
|
|
21
|
+
uuid: string;
|
|
22
|
+
title: string;
|
|
23
|
+
/** The page body — what a full-text match reads. */
|
|
24
|
+
text: string;
|
|
25
|
+
/** Frontmatter `tags` and `user-keywords`, folded into one list. */
|
|
26
|
+
tags: string[];
|
|
27
|
+
/** Frontmatter `system-category`, empty when the page carries none. */
|
|
28
|
+
category: string;
|
|
29
|
+
lastModified: string;
|
|
30
|
+
}
|
|
31
|
+
/** The file: `{ version, documents: { [uuid]: StoreSearchDocument } }`. */
|
|
32
|
+
export interface StoreSearchIndexFile {
|
|
33
|
+
version: number;
|
|
34
|
+
documents: Record<string, StoreSearchDocument>;
|
|
35
|
+
}
|
|
36
|
+
export declare const STORE_SEARCH_INDEX_VERSION = 1;
|
|
37
|
+
/** What a caller asks a store's index. Every field is optional; all of them narrow. */
|
|
38
|
+
export interface StoreSearchQuery {
|
|
39
|
+
/** Free text. Empty means "every document", as the shared no-text branch does. */
|
|
40
|
+
query?: string;
|
|
41
|
+
/** `system-category` values; a document matches when it carries one of them. */
|
|
42
|
+
categories?: string[];
|
|
43
|
+
/** `user-keywords` / tags; a document matches when it carries one of them. */
|
|
44
|
+
userKeywords?: string[];
|
|
45
|
+
/** Which fields the free text is matched in: `title`, `content`, `category`, `keywords`, or `all`. */
|
|
46
|
+
searchIn?: string[];
|
|
47
|
+
/** Longest snippet returned. Default 200, as the Lunr provider's default is. */
|
|
48
|
+
snippetLength?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface StoreSearchMatch {
|
|
51
|
+
document: StoreSearchDocument;
|
|
52
|
+
score: number;
|
|
53
|
+
snippet: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The document for one page of a store, from what a save already has in hand.
|
|
57
|
+
*
|
|
58
|
+
* The same frontmatter fields the shared index reads (`tags`,
|
|
59
|
+
* `user-keywords`, `system-category`), so a private page and a public one are
|
|
60
|
+
* found by the same words.
|
|
61
|
+
*/
|
|
62
|
+
export declare function storeSearchDocument(args: {
|
|
63
|
+
uuid: string;
|
|
64
|
+
title: string;
|
|
65
|
+
content: string;
|
|
66
|
+
metadata?: Record<string, unknown>;
|
|
67
|
+
}): StoreSearchDocument;
|
|
68
|
+
/**
|
|
69
|
+
* The documents of one store that match, best first.
|
|
70
|
+
*
|
|
71
|
+
* Every term must match somewhere (AND), as the field-scoped shared search
|
|
72
|
+
* does. A title match scores far above a body match, so the page a reader
|
|
73
|
+
* named comes first.
|
|
74
|
+
*/
|
|
75
|
+
export declare function matchStoreSearch(documents: Record<string, StoreSearchDocument>, ask?: StoreSearchQuery): StoreSearchMatch[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* subjectMayDo — the one door for a plugin, middleware or handler that has an
|
|
3
|
+
* engine and a subject and needs an allow/deny (#1198, security-posture P2).
|
|
4
|
+
*
|
|
5
|
+
* Asks the PDP (`PolicyDecisionPoint.permits`) and nothing else. The
|
|
6
|
+
* subject is forwarded as it was given, so `viaToken` / `viaShare` reach the
|
|
7
|
+
* ceilings. No engine, no PDP, or no subject is a refusal — the
|
|
8
|
+
* anonymous role's policy is asked through `ANONYMOUS_SUBJECT` by the caller
|
|
9
|
+
* that means anonymous, never by this helper defaulting to it.
|
|
10
|
+
*
|
|
11
|
+
* Exists so the sites that used to ask `userHasRole(userContext, 'admin')`
|
|
12
|
+
* had somewhere to go that is not a second evaluator: a role name skips
|
|
13
|
+
* PolicyEvaluator, deny policies and the token ceiling; this does not.
|
|
14
|
+
*/
|
|
15
|
+
import type { PermissionSubject } from '../managers/UserManager.js';
|
|
16
|
+
import type { CorePermission } from '../security/permissions.generated.js';
|
|
17
|
+
type EngineLike = {
|
|
18
|
+
getManager: (name: string) => unknown;
|
|
19
|
+
} | null | undefined;
|
|
20
|
+
export declare function subjectMayDo(engine: EngineLike, subject: PermissionSubject | null | undefined, action: CorePermission): Promise<boolean>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rules a `ngdpbase.system-category` entry's values follow
|
|
3
|
+
* (docs/system-category.md, "The fields"), said once for every reader: the
|
|
4
|
+
* configuration merge, which refuses an add-on's entry that breaks them
|
|
5
|
+
* (#1559), and ValidationManager, which checks the site's own entries at
|
|
6
|
+
* startup.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SYSTEM_CATEGORY_KEY = "ngdpbase.system-category";
|
|
9
|
+
/**
|
|
10
|
+
* The fields of an entry that are its `owner`'s declaration (operator,
|
|
11
|
+
* 2026-09-29): `encrypt` and `defaultPrivate` stand, and `shareMaxDays` is
|
|
12
|
+
* decided by the owner. For an entry an add-on declares, a site's
|
|
13
|
+
* `app-custom-config.json` never changes them, nor `owner` itself.
|
|
14
|
+
*/
|
|
15
|
+
export declare const OWNER_DECIDED_FIELDS: readonly ["owner", "encrypt", "defaultPrivate", "shareMaxDays"];
|
|
16
|
+
/** One mistyped value: what is wrong, and what every reader takes it to mean. */
|
|
17
|
+
export interface SystemCategoryValueProblem {
|
|
18
|
+
/** Names the entry, the field and the bad value. */
|
|
19
|
+
message: string;
|
|
20
|
+
/** What the value is read as, and what that does. */
|
|
21
|
+
readAs: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What is wrong with the types of one entry's values, one per field, naming
|
|
25
|
+
* the entry and the field. Empty when sound. `defaultPrivate` is the boolean
|
|
26
|
+
* `true` or `false`, or the string `"choice"`; `encrypt` is a boolean.
|
|
27
|
+
* Anything else is compared as false by every reader, so the string `"true"`
|
|
28
|
+
* would start pages public and leave the vault unsealed.
|
|
29
|
+
*/
|
|
30
|
+
export declare function systemCategoryValueProblems(key: string, entry: unknown): SystemCategoryValueProblem[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rules a `ngdpbase.system-category` entry's values follow
|
|
3
|
+
* (docs/system-category.md, "The fields"), said once for every reader: the
|
|
4
|
+
* configuration merge, which refuses an add-on's entry that breaks them
|
|
5
|
+
* (#1559), and ValidationManager, which checks the site's own entries at
|
|
6
|
+
* startup.
|
|
7
|
+
*/
|
|
8
|
+
export const SYSTEM_CATEGORY_KEY = 'ngdpbase.system-category';
|
|
9
|
+
/**
|
|
10
|
+
* The fields of an entry that are its `owner`'s declaration (operator,
|
|
11
|
+
* 2026-09-29): `encrypt` and `defaultPrivate` stand, and `shareMaxDays` is
|
|
12
|
+
* decided by the owner. For an entry an add-on declares, a site's
|
|
13
|
+
* `app-custom-config.json` never changes them, nor `owner` itself.
|
|
14
|
+
*/
|
|
15
|
+
export const OWNER_DECIDED_FIELDS = ['owner', 'encrypt', 'defaultPrivate', 'shareMaxDays'];
|
|
16
|
+
/**
|
|
17
|
+
* What is wrong with the types of one entry's values, one per field, naming
|
|
18
|
+
* the entry and the field. Empty when sound. `defaultPrivate` is the boolean
|
|
19
|
+
* `true` or `false`, or the string `"choice"`; `encrypt` is a boolean.
|
|
20
|
+
* Anything else is compared as false by every reader, so the string `"true"`
|
|
21
|
+
* would start pages public and leave the vault unsealed.
|
|
22
|
+
*/
|
|
23
|
+
export function systemCategoryValueProblems(key, entry) {
|
|
24
|
+
if (!entry || typeof entry !== 'object')
|
|
25
|
+
return [];
|
|
26
|
+
const e = entry;
|
|
27
|
+
const problems = [];
|
|
28
|
+
if (e.defaultPrivate !== undefined && e.defaultPrivate !== true && e.defaultPrivate !== false && e.defaultPrivate !== 'choice') {
|
|
29
|
+
problems.push({
|
|
30
|
+
message: `system-category '${key}': defaultPrivate must be true, false or "choice", got ${JSON.stringify(e.defaultPrivate)}`,
|
|
31
|
+
readAs: 'it is read as false, so new pages start public'
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (e.encrypt !== undefined && typeof e.encrypt !== 'boolean') {
|
|
35
|
+
problems.push({
|
|
36
|
+
message: `system-category '${key}': encrypt must be true or false, got ${JSON.stringify(e.encrypt)}`,
|
|
37
|
+
readAs: 'it is read as false, so the vault is not sealed'
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return problems;
|
|
41
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed user-creation failures and the safe messages registration may show (#1086).
|
|
3
|
+
*
|
|
4
|
+
* `POST /register` used to disclose every username on the instance to an
|
|
5
|
+
* unauthenticated visitor. Two independent defects produced that:
|
|
6
|
+
*
|
|
7
|
+
* 1. `UserManager.createUser` built its duplicate-username error by joining
|
|
8
|
+
* `getAllUsernames()` into the message.
|
|
9
|
+
* 2. `processRegister` forwarded `getErrorMessage(err)` straight into a
|
|
10
|
+
* redirect, which the register page rendered.
|
|
11
|
+
*
|
|
12
|
+
* The second is the one that matters. Fixing only the message would leave the
|
|
13
|
+
* route one internal `throw` away from the same exposure, because it treats
|
|
14
|
+
* arbitrary exception text as user-facing copy — and every layer beneath it
|
|
15
|
+
* can throw.
|
|
16
|
+
*
|
|
17
|
+
* So failures now carry a machine-readable `reason`, and the route maps that to
|
|
18
|
+
* a small closed set of messages. Anything unrecognised — a disk error, a
|
|
19
|
+
* provider bug, a future exception nobody anticipated — becomes the generic
|
|
20
|
+
* failure. That default is what makes this hold for errors that do not exist
|
|
21
|
+
* yet.
|
|
22
|
+
*
|
|
23
|
+
* The codebase is careful about this elsewhere, which is what made the
|
|
24
|
+
* registration path look like an oversight rather than a policy: login returns
|
|
25
|
+
* a uniform "Invalid username or password", `requestMagicLink` always redirects
|
|
26
|
+
* with `magic=sent` whether or not the address exists, and agent-token revoke
|
|
27
|
+
* returns 404 rather than 403 to avoid confirming that a token exists.
|
|
28
|
+
*/
|
|
29
|
+
/** Why a user could not be created. */
|
|
30
|
+
export type UserCreateFailureReason =
|
|
31
|
+
/** The requested username is already taken. */
|
|
32
|
+
'username-taken'
|
|
33
|
+
/** The display name collides with something that already exists. */
|
|
34
|
+
| 'display-name-conflict'
|
|
35
|
+
/** The email address already belongs to another account (#1748). */
|
|
36
|
+
| 'email-taken';
|
|
37
|
+
/**
|
|
38
|
+
* A user-creation failure with a reason a caller can branch on.
|
|
39
|
+
*
|
|
40
|
+
* The `message` is for logs and may contain internal detail; it must never be
|
|
41
|
+
* shown to a caller. `safeRegistrationMessage` is the only thing that decides
|
|
42
|
+
* what a visitor sees.
|
|
43
|
+
*/
|
|
44
|
+
export declare class UserCreateError extends Error {
|
|
45
|
+
readonly reason: UserCreateFailureReason;
|
|
46
|
+
constructor(reason: UserCreateFailureReason, message: string);
|
|
47
|
+
}
|
|
48
|
+
/** Shown when the cause is unknown, or known but not safe to describe. */
|
|
49
|
+
export declare const GENERIC_REGISTRATION_FAILURE = "Registration failed. Please try again.";
|
|
50
|
+
/**
|
|
51
|
+
* Map a thrown value to a message that is safe to show an unauthenticated
|
|
52
|
+
* visitor.
|
|
53
|
+
*
|
|
54
|
+
* Deliberately conservative: only a real `UserCreateError` carrying a known
|
|
55
|
+
* reason produces a specific message. A plain object shaped like one is not
|
|
56
|
+
* trusted, because only the code that constructs a `UserCreateError` has
|
|
57
|
+
* decided the reason is accurate.
|
|
58
|
+
*
|
|
59
|
+
* Callers must still log the original error — this discards detail on purpose,
|
|
60
|
+
* and the detail is what makes a real failure diagnosable.
|
|
61
|
+
*/
|
|
62
|
+
export declare function safeRegistrationMessage(err: unknown): string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One spelling of a username, for comparison (#1436).
|
|
3
|
+
*
|
|
4
|
+
* A username is an identifier, not prose: `jim`, `Jim` and `" jim "` are one
|
|
5
|
+
* account, and every comparison has to agree about that. Before this they did
|
|
6
|
+
* not. `FileUserProvider` keyed its map on the raw string, so those three were
|
|
7
|
+
* three separate accounts and `createUser`'s duplicate check did not see the
|
|
8
|
+
* case variants — an account could be registered whose name differed from an
|
|
9
|
+
* existing one only in case, which is the classic lookalike.
|
|
10
|
+
*
|
|
11
|
+
* The same split ran through the code the other way. `getAnonymousUser()`
|
|
12
|
+
* emits `'Anonymous'` while roughly ten sites compare against `'anonymous'`,
|
|
13
|
+
* so those guards never fired for a real visitor. They failed closed, which is
|
|
14
|
+
* luck rather than design — it is the same defect as #1433, where a viewer was
|
|
15
|
+
* written to the cache key under one spelling and read back under another.
|
|
16
|
+
*
|
|
17
|
+
* __Normalize to compare; keep the original to display.__ The stored record
|
|
18
|
+
* keeps whatever the person typed, because that is their name; the index and
|
|
19
|
+
* every equality test use this.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* The comparison form of a username: trimmed, lower-cased.
|
|
23
|
+
*
|
|
24
|
+
* Lower-case rather than upper: `toLowerCase()` is what the existing checks
|
|
25
|
+
* already used (`isSystemPrincipal`, the sitemap subject list), so this agrees
|
|
26
|
+
* with them rather than introducing a third convention.
|
|
27
|
+
*
|
|
28
|
+
* A non-string is normalized to the empty string rather than throwing, because
|
|
29
|
+
* callers pass values straight from a request body — and empty is already the
|
|
30
|
+
* "no username" case every caller handles.
|
|
31
|
+
*/
|
|
32
|
+
export declare function normalizeUsername(username: unknown): string;
|
|
33
|
+
/**
|
|
34
|
+
* True when two usernames name the same account.
|
|
35
|
+
*
|
|
36
|
+
* Exists so a comparison reads as the question it is asking, and so no call
|
|
37
|
+
* site re-implements the rule by hand — which is how the spellings diverged.
|
|
38
|
+
*/
|
|
39
|
+
export declare function sameUsername(a: unknown, b: unknown): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Names no person may register.
|
|
42
|
+
*
|
|
43
|
+
* `anonymous` is the principal for "nobody authenticated" — a real account
|
|
44
|
+
* holding that name would collide with it wherever the name is compared.
|
|
45
|
+
* `asserted` was the subject removed in #1435; it is reserved so the name
|
|
46
|
+
* cannot be taken in the window before anyone reconsiders the concept.
|
|
47
|
+
*
|
|
48
|
+
* The system principal is NOT listed here: its name comes from `.env` and is
|
|
49
|
+
* checked separately by `isSystemPrincipal`, because an operator chooses it.
|
|
50
|
+
*/
|
|
51
|
+
export declare const RESERVED_USERNAMES: readonly string[];
|
|
52
|
+
/** True when the name belongs to a principal rather than a person. */
|
|
53
|
+
export declare function isReservedUsername(username: unknown): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrite links to private pages from `private/…` to `vaults/…` (#1506).
|
|
3
|
+
*
|
|
4
|
+
* Old addresses are not redirected (operator, 2026-09-28), so every link a
|
|
5
|
+
* page stores is rewritten once instead. Links to a private page written the
|
|
6
|
+
* #1457 way, `[store/Title]`, carry no prefix and are untouched; this is for
|
|
7
|
+
* the full forms a person may have written by hand:
|
|
8
|
+
*
|
|
9
|
+
* - a URL path or page name: `/private/jim/default/Diary`, `[x|private/jim/default/Diary]`
|
|
10
|
+
* - URL-encoded: `/view/private%2Fjim%2Fdefault%2FDiary`
|
|
11
|
+
*
|
|
12
|
+
* Only a target naming a vault that exists is rewritten, so text that merely
|
|
13
|
+
* looks like one — `/private/var/folders/…` on macOS, `private/secrets.md` —
|
|
14
|
+
* is left alone. A second run writes nothing: a rewritten link no longer
|
|
15
|
+
* starts with `private`.
|
|
16
|
+
*/
|
|
17
|
+
/** The migration id, recorded per vault and for the public pages. */
|
|
18
|
+
export declare const VAULT_URL_MIGRATION = "vault-urls";
|
|
19
|
+
/**
|
|
20
|
+
* @param content - a page's body
|
|
21
|
+
* @param vaults - the vaults that exist, as `owner/store`
|
|
22
|
+
* @returns the rewritten body and how many links changed
|
|
23
|
+
*/
|
|
24
|
+
export declare function rewriteLegacyVaultUrls(content: string, vaults: ReadonlySet<string>): {
|
|
25
|
+
content: string;
|
|
26
|
+
rewritten: number;
|
|
27
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Version Management Script for ngdpbase
|
|
4
|
+
*
|
|
5
|
+
* Helps manage semantic versioning for the project.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* node version.js - Show current version
|
|
9
|
+
* node version.js patch - Increment patch version (bug fixes)
|
|
10
|
+
* node version.js minor - Increment minor version (new features)
|
|
11
|
+
* node version.js major - Increment major version (breaking changes)
|
|
12
|
+
* node version.js set <version> - Set specific version
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Parsed version components
|
|
16
|
+
*/
|
|
17
|
+
export interface VersionComponents {
|
|
18
|
+
major: number;
|
|
19
|
+
minor: number;
|
|
20
|
+
patch: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Version increment type
|
|
24
|
+
*/
|
|
25
|
+
export type VersionIncrementType = 'major' | 'minor' | 'patch';
|
|
26
|
+
/**
|
|
27
|
+
* Minimal shape of the parts of package-lock.json this tool touches.
|
|
28
|
+
*/
|
|
29
|
+
export interface PackageLock {
|
|
30
|
+
version?: string;
|
|
31
|
+
lockfileVersion?: number;
|
|
32
|
+
packages?: Record<string, {
|
|
33
|
+
version?: string;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}>;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Set the project's own version in a parsed lockfile — the pure half of
|
|
40
|
+
* {@link updatePackageLock}, split out so the mapping is testable without
|
|
41
|
+
* touching the filesystem.
|
|
42
|
+
*
|
|
43
|
+
* Writes exactly two fields: the top-level `version` and the root package entry
|
|
44
|
+
* `packages[""].version`. Dependency entries are never touched — only npm may
|
|
45
|
+
* change those, and rewriting one here would corrupt resolution.
|
|
46
|
+
*
|
|
47
|
+
* @param {PackageLock} lock - Parsed lockfile (mutated in place and returned)
|
|
48
|
+
* @param {string} newVersion - New version string
|
|
49
|
+
* @returns {PackageLock} The same object, for convenient chaining
|
|
50
|
+
*/
|
|
51
|
+
export declare function applyVersionToLock(lock: PackageLock, newVersion: string): PackageLock;
|
|
52
|
+
/**
|
|
53
|
+
* Parse a semantic version string
|
|
54
|
+
*
|
|
55
|
+
* @param {string} version - Version string (e.g., "1.2.3")
|
|
56
|
+
* @returns {VersionComponents} Parsed version components
|
|
57
|
+
* @throws {Error} If version format is invalid
|
|
58
|
+
*/
|
|
59
|
+
export declare function parseVersion(version: string): VersionComponents;
|
|
60
|
+
/**
|
|
61
|
+
* Whether `version` is `minimum` or later (both `x.y.z`). An add-on states the
|
|
62
|
+
* core release it needs this way (#1757: `ngdpbase.minVersion`).
|
|
63
|
+
*
|
|
64
|
+
* @throws {Error} If either version format is invalid
|
|
65
|
+
*/
|
|
66
|
+
export declare function isAtLeast(version: string, minimum: string): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Format version components into string
|
|
69
|
+
*
|
|
70
|
+
* @param {number} major - Major version
|
|
71
|
+
* @param {number} minor - Minor version
|
|
72
|
+
* @param {number} patch - Patch version
|
|
73
|
+
* @returns {string} Formatted version string
|
|
74
|
+
*/
|
|
75
|
+
export declare function formatVersion(major: number, minor: number, patch: number): string;
|
|
76
|
+
/**
|
|
77
|
+
* Increment version based on type
|
|
78
|
+
*
|
|
79
|
+
* @param {string} currentVersion - Current version string
|
|
80
|
+
* @param {VersionIncrementType} type - Type of increment
|
|
81
|
+
* @returns {string} New version string
|
|
82
|
+
* @throws {Error} If increment type is invalid
|
|
83
|
+
*/
|
|
84
|
+
export declare function incrementVersion(currentVersion: string, type: VersionIncrementType): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single-frame extraction from a video file via ffmpeg-static (#722 Slice 1).
|
|
3
|
+
*
|
|
4
|
+
* Used by FileSystemMediaProvider.getThumbnailBuffer to populate poster-frame
|
|
5
|
+
* thumbnails for video items, plugging the resulting JPEG buffer into the
|
|
6
|
+
* existing Sharp pipeline (same downstream code path as image thumbnails).
|
|
7
|
+
*
|
|
8
|
+
* ffmpeg-static ships a statically-linked ffmpeg binary in the package — no
|
|
9
|
+
* system ffmpeg dependency. The package exports the absolute binary path.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Extract a single video frame at the given timestamp as an MJPEG buffer.
|
|
13
|
+
* Returns null on any error so the caller can fall back to the icon
|
|
14
|
+
* placeholder without crashing the request.
|
|
15
|
+
*
|
|
16
|
+
* @param filePath Absolute path to the source video file
|
|
17
|
+
* @param atSeconds Seek timestamp; defaults to 1 (the conventional poster
|
|
18
|
+
* position — early enough to be quick, late enough to
|
|
19
|
+
* usually skip the black opening frame)
|
|
20
|
+
*/
|
|
21
|
+
export declare function extractVideoFrame(filePath: string, atSeconds?: number): Promise<Buffer | null>;
|
package/package.json
CHANGED
|
@@ -1,4 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"
|
|
1
|
+
{
|
|
2
|
+
"name": "@jwilleke/ngdpbase-types",
|
|
3
|
+
"version": "5.18.0",
|
|
4
|
+
"description": "TypeScript types for ngdpbase add-ons, and a test kit of core's own values. A dev dependency, versioned with ngdpbase.",
|
|
3
5
|
"license": "Apache-2.0",
|
|
4
|
-
"
|
|
6
|
+
"author": "Jim Willeke",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/jwilleke/ngdpbase.git",
|
|
10
|
+
"directory": "packages/ngdpbase-types"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/jwilleke/ngdpbase/blob/master/docs/guides/addons-developer-guide.md",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"types": "./lib/packages/ngdpbase-types/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./lib/packages/ngdpbase-types/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./testing": {
|
|
20
|
+
"types": "./lib/packages/ngdpbase-types/testing.d.ts",
|
|
21
|
+
"default": "./lib/packages/ngdpbase-types/testing.js"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"lib",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=24.15.0"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@jwilleke/oidc-auth-server": "0.4.0",
|
|
35
|
+
"@simplewebauthn/server": "^14.0.3",
|
|
36
|
+
"@types/express": "^5.0.5",
|
|
37
|
+
"@types/express-session": "^1.19.0",
|
|
38
|
+
"@types/fs-extra": "^11.0.4",
|
|
39
|
+
"@types/markdown-it": "^14.2.0",
|
|
40
|
+
"@types/multer": "^2.3.0",
|
|
41
|
+
"@types/node": "^24.19.2",
|
|
42
|
+
"better-sqlite3-multiple-ciphers": "^13.0.3",
|
|
43
|
+
"express": "^5.3.0",
|
|
44
|
+
"express-session": "^1.19.0",
|
|
45
|
+
"fs-extra": "^11.4.1",
|
|
46
|
+
"ipaddr.js": "^2.5.0",
|
|
47
|
+
"jose": "^6.2.12",
|
|
48
|
+
"linkedom": "^0.18.13",
|
|
49
|
+
"markdown-it": "^14.3.1",
|
|
50
|
+
"minimatch": "^10.2.6",
|
|
51
|
+
"minisearch": "7.2.0",
|
|
52
|
+
"multer": "^2.4.0",
|
|
53
|
+
"winston": "^3.17.0"
|
|
54
|
+
}
|
|
55
|
+
}
|