@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.
Files changed (304) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +16 -2
  3. package/lib/packages/ngdpbase-types/index.d.ts +32 -0
  4. package/lib/packages/ngdpbase-types/testing.d.ts +43 -0
  5. package/lib/packages/ngdpbase-types/testing.js +53 -0
  6. package/lib/src/cache/CacheDependencies.d.ts +50 -0
  7. package/lib/src/cache/CacheDependencies.js +50 -0
  8. package/lib/src/cache/ICacheAdapter.d.ts +86 -0
  9. package/lib/src/cache/RegionCache.d.ts +171 -0
  10. package/lib/src/context/ActorContext.d.ts +48 -0
  11. package/lib/src/context/ActorContext.js +33 -0
  12. package/lib/src/context/ApiContext.d.ts +194 -0
  13. package/lib/src/context/ApiContext.js +273 -0
  14. package/lib/src/context/BaseContext.d.ts +110 -0
  15. package/lib/src/context/BaseContext.js +143 -0
  16. package/lib/src/context/JobContext.d.ts +153 -0
  17. package/lib/src/context/JobContext.js +144 -0
  18. package/lib/src/context/WikiContext.d.ts +404 -0
  19. package/lib/src/context/bootActions.d.ts +64 -0
  20. package/lib/src/context/bootActions.js +111 -0
  21. package/lib/src/converters/HtmlConverter.d.ts +70 -0
  22. package/lib/src/converters/IContentConverter.d.ts +94 -0
  23. package/lib/src/converters/JSPWikiConverter.d.ts +117 -0
  24. package/lib/src/converters/conversionWarning.d.ts +15 -0
  25. package/lib/src/converters/ncm/bridge.d.ts +22 -0
  26. package/lib/src/converters/ncm/existing.d.ts +23 -0
  27. package/lib/src/converters/ncm/fix/blocks.d.ts +89 -0
  28. package/lib/src/converters/ncm/fix/bulletMarkers.d.ts +21 -0
  29. package/lib/src/converters/ncm/fix/index.d.ts +36 -0
  30. package/lib/src/converters/ncm/fix/jspwikiBullets.d.ts +20 -0
  31. package/lib/src/converters/ncm/fix/jspwikiCodeMarkers.d.ts +38 -0
  32. package/lib/src/converters/ncm/fix/jspwikiHeadings.d.ts +25 -0
  33. package/lib/src/converters/ncm/fix/jspwikiIndent.d.ts +24 -0
  34. package/lib/src/converters/ncm/fix/jspwikiInsert.d.ts +21 -0
  35. package/lib/src/converters/ncm/fix/jspwikiItalic.d.ts +29 -0
  36. package/lib/src/converters/ncm/fix/jspwikiLinkLeftovers.d.ts +27 -0
  37. package/lib/src/converters/ncm/fix/moreInformationFooter.d.ts +25 -0
  38. package/lib/src/converters/ncm/fix/styleClosers.d.ts +25 -0
  39. package/lib/src/converters/ncm/fix/tightenLists.d.ts +30 -0
  40. package/lib/src/converters/ncm/fix/types.d.ts +33 -0
  41. package/lib/src/converters/ncm/footnotes.d.ts +39 -0
  42. package/lib/src/converters/ncm/images.d.ts +49 -0
  43. package/lib/src/converters/ncm/index.d.ts +20 -0
  44. package/lib/src/converters/ncm/links.d.ts +21 -0
  45. package/lib/src/converters/ncm/normalize.d.ts +39 -0
  46. package/lib/src/converters/ncm/placeholder.d.ts +25 -0
  47. package/lib/src/converters/ncm/tables.d.ts +36 -0
  48. package/lib/src/converters/ncm/types.d.ts +42 -0
  49. package/lib/src/http/egressPolicy.d.ts +52 -0
  50. package/lib/src/http/guardedFetch.d.ts +89 -0
  51. package/lib/src/http/guardedFetch.js +113 -0
  52. package/lib/src/http/guardedLookup.d.ts +48 -0
  53. package/lib/src/http/guardedLookup.js +73 -0
  54. package/lib/src/http/ssrf.d.ts +83 -0
  55. package/lib/src/http/ssrf.js +311 -0
  56. package/lib/src/mail/MailProvider.d.ts +36 -0
  57. package/lib/src/mail/NodemailerMailProvider.d.ts +26 -0
  58. package/lib/src/managers/AddonsManager.d.ts +691 -0
  59. package/lib/src/managers/AgentTokenManager.d.ts +269 -0
  60. package/lib/src/managers/AssetManager.d.ts +116 -0
  61. package/lib/src/managers/AttachmentManager.d.ts +1032 -0
  62. package/lib/src/managers/AuthManager.d.ts +1257 -0
  63. package/lib/src/managers/BackgroundJobManager.d.ts +434 -0
  64. package/lib/src/managers/BaseManager.d.ts +427 -0
  65. package/lib/src/managers/BaseManager.js +415 -0
  66. package/lib/src/managers/CacheManager.d.ts +159 -0
  67. package/lib/src/managers/CatalogManager.d.ts +235 -0
  68. package/lib/src/managers/CommentManager.d.ts +75 -0
  69. package/lib/src/managers/ConfigurationManager.d.ts +747 -0
  70. package/lib/src/managers/DatabaseManager.d.ts +188 -0
  71. package/lib/src/managers/DatabaseManager.js +590 -0
  72. package/lib/src/managers/EmailManager.d.ts +47 -0
  73. package/lib/src/managers/ExportManager.d.ts +129 -0
  74. package/lib/src/managers/ExportManager.js +420 -0
  75. package/lib/src/managers/FootnoteManager.d.ts +118 -0
  76. package/lib/src/managers/MediaManager.d.ts +279 -0
  77. package/lib/src/managers/MetricsManager.d.ts +89 -0
  78. package/lib/src/managers/NotificationManager.d.ts +165 -0
  79. package/lib/src/managers/OidcManager.d.ts +210 -0
  80. package/lib/src/managers/OrganizationManager.d.ts +107 -0
  81. package/lib/src/managers/PageManager.d.ts +1645 -0
  82. package/lib/src/managers/PersonManager.d.ts +48 -0
  83. package/lib/src/managers/PluginManager.d.ts +179 -0
  84. package/lib/src/managers/PluginManager.js +393 -0
  85. package/lib/src/managers/PolicyEvaluator.d.ts +213 -0
  86. package/lib/src/managers/RenderingManager.d.ts +358 -0
  87. package/lib/src/managers/RoleManager.d.ts +134 -0
  88. package/lib/src/managers/SearchManager.d.ts +402 -0
  89. package/lib/src/managers/ShareManager.d.ts +251 -0
  90. package/lib/src/managers/TemplateManager.d.ts +176 -0
  91. package/lib/src/managers/ThemeManager.d.ts +56 -0
  92. package/lib/src/managers/UserManager.d.ts +480 -0
  93. package/lib/src/managers/ValidationManager.d.ts +426 -0
  94. package/lib/src/managers/VariableManager.d.ts +145 -0
  95. package/lib/src/middleware/csrf.d.ts +3 -0
  96. package/lib/src/parsers/LinkParser.d.ts +457 -0
  97. package/lib/src/parsers/MarkupParser.d.ts +769 -0
  98. package/lib/src/parsers/context/ParseContext.d.ts +314 -0
  99. package/lib/src/parsers/data/emoji-map.d.ts +18 -0
  100. package/lib/src/parsers/dom/DOMBuilder.d.ts +210 -0
  101. package/lib/src/parsers/dom/DOMParser.d.ts +252 -0
  102. package/lib/src/parsers/dom/Tokenizer.d.ts +358 -0
  103. package/lib/src/parsers/dom/WikiDocument.d.ts +272 -0
  104. package/lib/src/parsers/dom/handlers/DOMLinkHandler.d.ts +260 -0
  105. package/lib/src/parsers/dom/handlers/DOMPluginHandler.d.ts +212 -0
  106. package/lib/src/parsers/dom/handlers/DOMVariableHandler.d.ts +171 -0
  107. package/lib/src/parsers/filters/BaseFilter.d.ts +269 -0
  108. package/lib/src/parsers/filters/FilterChain.d.ts +320 -0
  109. package/lib/src/parsers/handlers/BaseSyntaxHandler.d.ts +331 -0
  110. package/lib/src/parsers/handlers/HandlerRegistry.d.ts +225 -0
  111. package/lib/src/parsers/handlers/JSPWikiPreprocessor.d.ts +89 -0
  112. package/lib/src/parsers/handlers/LinkParserHandler.d.ts +80 -0
  113. package/lib/src/parsers/handlers/PluginSyntaxHandler.d.ts +78 -0
  114. package/lib/src/parsers/handlers/WikiFormHandler.d.ts +149 -0
  115. package/lib/src/parsers/handlers/WikiTagHandler.d.ts +125 -0
  116. package/lib/src/parsers/jspwikiTableRow.d.ts +39 -0
  117. package/lib/src/parsers/styleBlockSyntax.d.ts +14 -0
  118. package/lib/src/plugins/types.d.ts +79 -0
  119. package/lib/src/providers/AgentTokenAuthProvider.d.ts +40 -0
  120. package/lib/src/providers/AuthentikBearerAuthProvider.d.ts +75 -0
  121. package/lib/src/providers/BaseAttachmentProvider.d.ts +197 -0
  122. package/lib/src/providers/BaseAuthProvider.d.ts +220 -0
  123. package/lib/src/providers/BaseCacheProvider.d.ts +140 -0
  124. package/lib/src/providers/BaseCredentialsProvider.d.ts +84 -0
  125. package/lib/src/providers/BaseDatabaseProvider.d.ts +22 -0
  126. package/lib/src/providers/BaseDatabaseProvider.js +12 -0
  127. package/lib/src/providers/BaseLoggingProvider.d.ts +68 -0
  128. package/lib/src/providers/BaseLoggingProvider.js +37 -0
  129. package/lib/src/providers/BaseMediaProvider.d.ts +308 -0
  130. package/lib/src/providers/BasePageProvider.d.ts +337 -0
  131. package/lib/src/providers/BaseProvider.d.ts +98 -0
  132. package/lib/src/providers/BaseProvider.js +74 -0
  133. package/lib/src/providers/BaseSearchProvider.d.ts +362 -0
  134. package/lib/src/providers/BasicAttachmentProvider.d.ts +599 -0
  135. package/lib/src/providers/CloudflareAccessAuthProvider.d.ts +72 -0
  136. package/lib/src/providers/FileCredentialsProvider.d.ts +33 -0
  137. package/lib/src/providers/FileJobStateProvider.d.ts +58 -0
  138. package/lib/src/providers/FileLoggingProvider.d.ts +43 -0
  139. package/lib/src/providers/FileLoggingProvider.js +120 -0
  140. package/lib/src/providers/FileOidcAdapter.d.ts +25 -0
  141. package/lib/src/providers/FileSystemMediaProvider.d.ts +403 -0
  142. package/lib/src/providers/LunrSearchProvider.d.ts +280 -0
  143. package/lib/src/providers/MagicLinkAuthProvider.d.ts +125 -0
  144. package/lib/src/providers/NullCacheProvider.d.ts +72 -0
  145. package/lib/src/providers/OidcAuthProvider.d.ts +180 -0
  146. package/lib/src/providers/OidcBearerAuthProvider.d.ts +30 -0
  147. package/lib/src/providers/PasskeyAuthProvider.d.ts +58 -0
  148. package/lib/src/providers/PasswordAuthProvider.d.ts +20 -0
  149. package/lib/src/providers/SqliteDatabaseProvider.d.ts +55 -0
  150. package/lib/src/providers/SqliteDatabaseProvider.js +90 -0
  151. package/lib/src/providers/SqliteJobStateProvider.d.ts +41 -0
  152. package/lib/src/providers/databaseMigrations.d.ts +8 -0
  153. package/lib/src/providers/databaseMigrations.js +47 -0
  154. package/lib/src/providers/jobState.d.ts +99 -0
  155. package/lib/src/providers/lunrQueryToMiniSearch.d.ts +32 -0
  156. package/lib/src/providers/mediaFilenameDate.d.ts +22 -0
  157. package/lib/src/providers/sqliteBackup.d.ts +128 -0
  158. package/lib/src/providers/sqliteBackup.js +365 -0
  159. package/lib/src/providers/sqliteLocation.d.ts +17 -0
  160. package/lib/src/providers/sqliteLocation.js +55 -0
  161. package/lib/src/providers/sqliteMigrations.d.ts +48 -0
  162. package/lib/src/providers/sqliteMigrations.js +72 -0
  163. package/lib/src/rendering/githubAlerts.d.ts +22 -0
  164. package/lib/src/rendering/htmlPolicy.d.ts +76 -0
  165. package/lib/src/rendering/markdownConverter.d.ts +73 -0
  166. package/lib/src/security/PolicyDecisionPoint.d.ts +245 -0
  167. package/lib/src/security/PolicyInformationPoint.d.ts +448 -0
  168. package/lib/src/security/pageActions.d.ts +40 -0
  169. package/lib/src/security/permissions.generated.d.ts +78 -0
  170. package/lib/src/types/Asset.d.ts +414 -0
  171. package/lib/src/types/Catalog.d.ts +61 -0
  172. package/lib/src/types/Comment.d.ts +11 -0
  173. package/lib/src/types/Config.d.ts +388 -0
  174. package/lib/src/types/Organization.d.ts +78 -0
  175. package/lib/src/types/OrganizationProvider.d.ts +38 -0
  176. package/lib/src/types/Page.d.ts +220 -0
  177. package/lib/src/types/Person.d.ts +56 -0
  178. package/lib/src/types/PersonProvider.d.ts +25 -0
  179. package/lib/src/types/Policy.d.ts +139 -0
  180. package/lib/src/types/Policy.js +17 -0
  181. package/lib/src/types/Provider.d.ts +810 -0
  182. package/lib/src/types/Role.d.ts +84 -0
  183. package/lib/src/types/RoleProvider.d.ts +35 -0
  184. package/lib/src/types/Schema.d.ts +425 -0
  185. package/lib/src/types/Share.d.ts +172 -0
  186. package/lib/src/types/Share.js +81 -0
  187. package/lib/src/types/User.d.ts +304 -0
  188. package/lib/src/types/Version.d.ts +189 -0
  189. package/lib/src/types/WikiEngine.d.ts +128 -0
  190. package/lib/src/types/express.d.ts +120 -0
  191. package/lib/src/types/express.js +1 -0
  192. package/lib/src/types/guards.d.ts +78 -0
  193. package/lib/src/types/heic-decode.d.ts +16 -0
  194. package/lib/src/types/index.d.ts +19 -0
  195. package/lib/src/types/linkedom.d.ts +77 -0
  196. package/lib/src/types/markdown-it-plugins.d.ts +21 -0
  197. package/lib/src/utils/DeltaStorage.d.ts +118 -0
  198. package/lib/src/utils/LocaleUtils.d.ts +105 -0
  199. package/lib/src/utils/LocaleUtils.js +294 -0
  200. package/lib/src/utils/PageNameMatcher.d.ts +98 -0
  201. package/lib/src/utils/PathPreflight.d.ts +38 -0
  202. package/lib/src/utils/PathPreflight.js +50 -0
  203. package/lib/src/utils/SectionUtils.d.ts +40 -0
  204. package/lib/src/utils/addonConfigLayer.d.ts +144 -0
  205. package/lib/src/utils/addonConfigLayer.js +382 -0
  206. package/lib/src/utils/addonDatabaseRules.d.ts +25 -0
  207. package/lib/src/utils/addonDatabaseRules.js +57 -0
  208. package/lib/src/utils/addonHost.d.ts +51 -0
  209. package/lib/src/utils/addonHost.js +72 -0
  210. package/lib/src/utils/addonInstaller.d.ts +109 -0
  211. package/lib/src/utils/addonLock.d.ts +37 -0
  212. package/lib/src/utils/addonLock.js +48 -0
  213. package/lib/src/utils/addonPageSync.d.ts +45 -0
  214. package/lib/src/utils/addonProvenance.d.ts +48 -0
  215. package/lib/src/utils/addonTarball.d.ts +41 -0
  216. package/lib/src/utils/addonsPathResolver.d.ts +76 -0
  217. package/lib/src/utils/addonsPathResolver.js +129 -0
  218. package/lib/src/utils/assetMetadataTags.d.ts +66 -0
  219. package/lib/src/utils/atomicWrite.d.ts +28 -0
  220. package/lib/src/utils/auditConfigChange.d.ts +57 -0
  221. package/lib/src/utils/auditEventNames.d.ts +50 -0
  222. package/lib/src/utils/auditEventNames.generated.d.ts +169 -0
  223. package/lib/src/utils/auditEventNames.generated.js +174 -0
  224. package/lib/src/utils/auditEventNames.js +49 -0
  225. package/lib/src/utils/auditEvents.d.ts +265 -0
  226. package/lib/src/utils/auditEvents.js +309 -0
  227. package/lib/src/utils/auditRegistry.d.ts +102 -0
  228. package/lib/src/utils/auditRegistry.js +168 -0
  229. package/lib/src/utils/bip39English.d.ts +2 -0
  230. package/lib/src/utils/configEnvKeys.d.ts +68 -0
  231. package/lib/src/utils/configFiles.d.ts +74 -0
  232. package/lib/src/utils/configFiles.js +150 -0
  233. package/lib/src/utils/delegation.d.ts +48 -0
  234. package/lib/src/utils/deriveUsername.d.ts +21 -0
  235. package/lib/src/utils/explainMediaPath.d.ts +123 -0
  236. package/lib/src/utils/formerTitles.d.ts +69 -0
  237. package/lib/src/utils/frontmatterAccess.d.ts +54 -0
  238. package/lib/src/utils/headlessAdminPassword.d.ts +55 -0
  239. package/lib/src/utils/imageTransform.d.ts +52 -0
  240. package/lib/src/utils/instanceEnvSecret.d.ts +51 -0
  241. package/lib/src/utils/jobSlots.d.ts +43 -0
  242. package/lib/src/utils/keywordNormalizer.d.ts +127 -0
  243. package/lib/src/utils/logger.d.ts +70 -0
  244. package/lib/src/utils/logger.js +106 -0
  245. package/lib/src/utils/magicLinkDeviceState.d.ts +95 -0
  246. package/lib/src/utils/managerUtils.d.ts +40 -0
  247. package/lib/src/utils/migrateLegacyPrivateAttachments.d.ts +15 -0
  248. package/lib/src/utils/orgFilename.d.ts +22 -0
  249. package/lib/src/utils/pageFeature.d.ts +27 -0
  250. package/lib/src/utils/pageFrontmatter.d.ts +21 -0
  251. package/lib/src/utils/pageNotes.d.ts +150 -0
  252. package/lib/src/utils/pageTitleRule.d.ts +37 -0
  253. package/lib/src/utils/pageToArticle.d.ts +59 -0
  254. package/lib/src/utils/pageUrl.d.ts +18 -0
  255. package/lib/src/utils/passwordChange.d.ts +12 -0
  256. package/lib/src/utils/passwordHash.d.ts +60 -0
  257. package/lib/src/utils/permissionCatalog.d.ts +52 -0
  258. package/lib/src/utils/pluginFormatters.d.ts +452 -0
  259. package/lib/src/utils/pluginFormatters.js +714 -0
  260. package/lib/src/utils/privateLinkRewrite.d.ts +42 -0
  261. package/lib/src/utils/privateStoreAccess.d.ts +57 -0
  262. package/lib/src/utils/privateStoreAccess.js +65 -0
  263. package/lib/src/utils/privateStoreCatalogs.d.ts +40 -0
  264. package/lib/src/utils/privateStoreCrypto.d.ts +127 -0
  265. package/lib/src/utils/privateStoreDoor.d.ts +181 -0
  266. package/lib/src/utils/privateStoreExport.d.ts +72 -0
  267. package/lib/src/utils/privateStoreFiles.d.ts +120 -0
  268. package/lib/src/utils/privateStoreMeta.d.ts +64 -0
  269. package/lib/src/utils/privateStoreMigrations.d.ts +37 -0
  270. package/lib/src/utils/privateStorePath.d.ts +259 -0
  271. package/lib/src/utils/privateStorePath.js +436 -0
  272. package/lib/src/utils/privateStoreTakeout.d.ts +76 -0
  273. package/lib/src/utils/privateStoreUnlock.d.ts +175 -0
  274. package/lib/src/utils/proxyClaim.d.ts +59 -0
  275. package/lib/src/utils/proxyClaim.js +30 -0
  276. package/lib/src/utils/redactPrivateNames.d.ts +21 -0
  277. package/lib/src/utils/redactPrivateNames.js +89 -0
  278. package/lib/src/utils/redactSecrets.d.ts +58 -0
  279. package/lib/src/utils/redactSecrets.js +171 -0
  280. package/lib/src/utils/renameLinkRewrite.d.ts +112 -0
  281. package/lib/src/utils/roleGrants.d.ts +35 -0
  282. package/lib/src/utils/safeRedirect.d.ts +32 -0
  283. package/lib/src/utils/schedule.d.ts +54 -0
  284. package/lib/src/utils/secretFileMode.d.ts +17 -0
  285. package/lib/src/utils/seededShippedPages.d.ts +45 -0
  286. package/lib/src/utils/sensitiveValues.d.ts +59 -0
  287. package/lib/src/utils/sensitiveValues.js +106 -0
  288. package/lib/src/utils/sessionEnd.d.ts +12 -0
  289. package/lib/src/utils/sessionGeneration.d.ts +24 -0
  290. package/lib/src/utils/sessionIdle.d.ts +41 -0
  291. package/lib/src/utils/sessionLimits.d.ts +68 -0
  292. package/lib/src/utils/shareLockbox.d.ts +64 -0
  293. package/lib/src/utils/sigstoreTrustedRoot.d.ts +33 -0
  294. package/lib/src/utils/sniffMime.d.ts +21 -0
  295. package/lib/src/utils/storeSearchIndex.d.ts +75 -0
  296. package/lib/src/utils/subjectMayDo.d.ts +21 -0
  297. package/lib/src/utils/systemCategoryRules.d.ts +30 -0
  298. package/lib/src/utils/systemCategoryRules.js +41 -0
  299. package/lib/src/utils/userCreateError.d.ts +62 -0
  300. package/lib/src/utils/username.d.ts +53 -0
  301. package/lib/src/utils/vaultUrlRewrite.d.ts +27 -0
  302. package/lib/src/utils/version.d.ts +84 -0
  303. package/lib/src/utils/videoFrame.d.ts +21 -0
  304. package/package.json +54 -3
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Schema.org OrganizationRole type (#617 follow-up)
3
+ *
4
+ * Canonical core record for an (organization, role) binding. Stored as one
5
+ * JSON file per `(organization, namedPosition)` pair under
6
+ * `ngdpbase.application.roles.storagedir`. Filename is `<namedPosition>.json`.
7
+ *
8
+ * `@id` uses URL form, hierarchical under the organization's URL space:
9
+ * `<org-url>/roles/<namedPosition>#role`
10
+ *
11
+ * __Membership only (#1431).__ A record says who belongs to this role in this
12
+ * organisation, and nothing else. It does NOT carry what the role permits:
13
+ * that is the policies in `ngdpbase.access.policies`, resolved at the moment
14
+ * of each decision, so a record cannot freeze authority at create time.
15
+ *
16
+ * Until #1431 the record snapshotted the catalogue entry — `roleName`,
17
+ * `description`, `issystem`, `icon`, `color` and a `permissions` list under
18
+ * `additionalProperty` — which later catalogue edits never updated, and which
19
+ * nothing read. They are no longer written, and RoleManager strips them from
20
+ * existing records at start-up (operator, 2026-09-21): the catalogue declares
21
+ * a role's settings and the policies decide what it permits.
22
+ *
23
+ * @see https://schema.org/OrganizationRole
24
+ */
25
+ import type { Person } from './Person.js';
26
+ import type { Organization } from './Organization.js';
27
+ /**
28
+ * Reference to another JSON-LD entity by `@id`.
29
+ */
30
+ export interface IdRef {
31
+ '@id': string;
32
+ }
33
+ /**
34
+ * Property-value pair used for schema.org `additionalProperty`.
35
+ *
36
+ * #1431: this no longer carries permissions. It did — as a snapshot of the
37
+ * role catalogue — and that copy drifted from the policies that actually
38
+ * grant. Nothing writes it now.
39
+ */
40
+ export interface PropertyValue {
41
+ '@type': 'PropertyValue';
42
+ name: string;
43
+ value: unknown;
44
+ }
45
+ /**
46
+ * Canonical OrganizationRole record.
47
+ *
48
+ * Required: `@context`, `@type`, `@id`, `namedPosition`, `organization`.
49
+ * Optional fields mirror schema.org OrganizationRole + the snapshot fields
50
+ * copied from the role catalog at create time.
51
+ */
52
+ export interface Role {
53
+ '@context': 'https://schema.org';
54
+ '@type': 'OrganizationRole';
55
+ /** URL form: `<org-url>/roles/<namedPosition>#role` */
56
+ '@id': string;
57
+ /** Catalog key into `ngdpbase.roles.definitions` (e.g. 'admin', 'editor'). */
58
+ namedPosition: string;
59
+ /** Reference to the owning Organization by its `@id`. */
60
+ organization: IdRef;
61
+ /** Persons holding this role. References by Person `@id`. */
62
+ member?: IdRef[];
63
+ /** schema.org extension properties. Not a permissions list (#1431). */
64
+ additionalProperty?: PropertyValue[];
65
+ /** Allow extension fields (forwards-compat). */
66
+ [key: string]: unknown;
67
+ }
68
+ /**
69
+ * Patch shape for update operations.
70
+ * `@context`/`@type`/`@id` are immutable; `namedPosition` and `organization`
71
+ * are the natural key for the file's location and cannot be changed via update.
72
+ */
73
+ export type RoleUpdate = Partial<Omit<Role, '@context' | '@type' | '@id' | 'namedPosition' | 'organization'>>;
74
+ /**
75
+ * Helpers used by callers when wiring Person/Organization references into
76
+ * Role records. Re-exported so tests can shape fixtures without touching
77
+ * the underlying types.
78
+ */
79
+ export type RoleMemberRef = IdRef;
80
+ export type RoleOrganizationRef = IdRef;
81
+ /** Type guard — narrows a Person to its `@id`. */
82
+ export declare function personIdRef(person: Pick<Person, '@id'>): IdRef;
83
+ /** Type guard — narrows an Organization to its `@id`. */
84
+ export declare function organizationIdRef(org: Pick<Organization, '@id'>): IdRef;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Storage seam for OrganizationRole records (#617 follow-up).
3
+ *
4
+ * File system is the v1 default. Future providers (database, LDAP) implement
5
+ * the same interface and register without touching RoleManager.
6
+ */
7
+ import type { BaseProvider } from './Provider.js';
8
+ import type { Role, RoleUpdate } from './Role.js';
9
+ export interface RoleProvider extends BaseProvider {
10
+ /** Return all roles the provider can see. */
11
+ list(): Promise<Role[]>;
12
+ /** Look up a role by `@id`. */
13
+ getById(id: string): Promise<Role | null>;
14
+ /**
15
+ * Look up the role record for a given (organization, namedPosition) pair.
16
+ * Returns null if no record exists for that combination.
17
+ */
18
+ getByOrgAndPosition(organizationId: string, namedPosition: string): Promise<Role | null>;
19
+ /** Return every role record whose `member` array contains `personId`. */
20
+ listByMember(personId: string): Promise<Role[]>;
21
+ /**
22
+ * Persist a new role record. The provider derives the storage filename
23
+ * from `role.namedPosition` (one file per (org, role) pair). Throws if a
24
+ * record already exists for the same (organization, namedPosition) pair.
25
+ */
26
+ create(role: Role): Promise<Role>;
27
+ /**
28
+ * Apply a partial update by `@id`. Returns the updated record, or null if not
29
+ * found. A field the patch sets to `undefined` is REMOVED from the record —
30
+ * how a stale field is cleared (#1431).
31
+ */
32
+ update(id: string, patch: RoleUpdate): Promise<Role | null>;
33
+ /** Delete by `@id`. Returns true if a record was removed. */
34
+ delete(id: string): Promise<boolean>;
35
+ }
@@ -0,0 +1,425 @@
1
+ /**
2
+ * Schema types — schema.org-shaped CreativeWork model for ngdpbase.
3
+ *
4
+ * Source of truth: docs/schemas.md (ratified 2026-05-20).
5
+ * Tracking EPIC: #755. This file is Slice 2 (#757).
6
+ *
7
+ * Two-shape model (per docs/schemas.md Decision 11):
8
+ * - `AssetRecord` (src/types/Asset.ts, #405 Phase 1) is the *internal*
9
+ * API type that managers, search index, picker UI, plugin renderers
10
+ * read. Already schema.org-aligned at the field-name level.
11
+ * - `CreativeWork` (this file) is the *JSON-LD render output* shape
12
+ * and what CatalogSource.get() / list() return. A render mapper at
13
+ * src/utils/jsonld.ts (planned, Slice 6 / #755) converts
14
+ * AssetRecord → CreativeWork applying the per-field render policy
15
+ * (map / omit / additionalProperty) from Decision 5.
16
+ *
17
+ * Naming conventions (per docs/schemas.md):
18
+ * - schema.org field names match exact casing: `dateCreated`,
19
+ * `thumbnailUrl`, `articleBody`.
20
+ * - JSON-LD identifiers use quoted keys: `'@id'`, `'@type'`,
21
+ * `'@context'`.
22
+ * - Custom fields outside schema.org use the `ngdp:` prefix in quoted
23
+ * keys: `'ngdp:category'`, `'ngdp:videoCodec'`. At render time the
24
+ * render mapper either maps these to a schema.org equivalent,
25
+ * omits them, or wraps them in an `additionalProperty` PropertyValue.
26
+ *
27
+ * This file declares interfaces only — no production consumer is wired
28
+ * in yet. Slices 3–6 of #755 will plug PageManager / MediaManager /
29
+ * AttachmentManager into the `CatalogSource` interface and add the
30
+ * JSON-LD render mapper that emits these shapes.
31
+ */
32
+ /** Discriminator literal — every CreativeWork carries one of these as `@type`. */
33
+ export type SchemaType = 'Article' | 'ImageObject' | 'VideoObject' | 'AudioObject' | 'DigitalDocument';
34
+ /**
35
+ * schema.org Person — minimal shape used for `author` / `editor`.
36
+ * Both fields also accept a plain string (legacy / unstructured byline).
37
+ */
38
+ export interface Person {
39
+ '@type': 'Person';
40
+ '@id'?: string;
41
+ name: string;
42
+ url?: string;
43
+ email?: string;
44
+ }
45
+ /**
46
+ * schema.org GeoCoordinates — decimal-degree latitude/longitude.
47
+ * Surfaced when the source file carries GPS (per Decision 12 — no
48
+ * platform-layer opt-out).
49
+ */
50
+ export interface GeoCoordinates {
51
+ '@type': 'GeoCoordinates';
52
+ latitude: number;
53
+ longitude: number;
54
+ elevation?: number;
55
+ }
56
+ /** schema.org Place — wraps `geo` so that JSON-LD nests cleanly. */
57
+ export interface Place {
58
+ '@type': 'Place';
59
+ geo: GeoCoordinates;
60
+ }
61
+ /**
62
+ * schema.org PropertyValue — the render-time wrapper for genuinely-custom
63
+ * fields that have no schema.org equivalent (per Decision 5,
64
+ * `additionalProperty` fallback). The render mapper emits these; internal
65
+ * code uses `ngdp:` prefixed keys directly.
66
+ */
67
+ export interface AdditionalProperty {
68
+ '@type': 'PropertyValue';
69
+ name: string;
70
+ value: string | number | boolean;
71
+ }
72
+ /**
73
+ * Internal storage shape for image/video EXIF camera metadata.
74
+ * schema.org's `exifData` is a Property array; we store this structured
75
+ * shape internally and let the render mapper convert at JSON-LD time
76
+ * (marked `⚠️` in docs/schemas.md).
77
+ */
78
+ export interface ExifCameraData {
79
+ make?: string;
80
+ model?: string;
81
+ lensModel?: string;
82
+ focalLength?: string;
83
+ fNumber?: string;
84
+ exposureTime?: string;
85
+ iso?: number;
86
+ }
87
+ /**
88
+ * A single `mentions` entry on an Article — typed reference to a page or
89
+ * external resource the article links to (extracted from wiki-links).
90
+ */
91
+ export interface Mention {
92
+ '@type': 'CreativeWork' | 'Thing';
93
+ name: string;
94
+ url?: string;
95
+ '@id'?: string;
96
+ }
97
+ /**
98
+ * Common base for every CreativeWork subtype.
99
+ *
100
+ * Per docs/schemas.md "common base" table. Every consumer surface
101
+ * (search index, picker tiles, picker filters, page header, JSON-LD)
102
+ * reads these.
103
+ */
104
+ export interface CreativeWorkBase {
105
+ /**
106
+ * Canonical dereferenceable URL (Decision 4).
107
+ * Pages: `/view/<slug>`. Media: `/media/file/<id>`.
108
+ * Changes when the page slug changes; not the same as `identifier`.
109
+ */
110
+ '@id': string;
111
+ /**
112
+ * The CreativeWork subtype — discriminator for the union.
113
+ * Drives which type-specific extension fields apply.
114
+ */
115
+ '@type': SchemaType;
116
+ /**
117
+ * Opaque rename-stable internal ID (Decision 4).
118
+ * For pages: frontmatter `uuid`. For media: sha256-derived item id.
119
+ * Optional at the base because some types (legacy attachments) may not
120
+ * have one; required on Article (narrowed below).
121
+ */
122
+ identifier?: string;
123
+ /** Display title — required. */
124
+ name: string;
125
+ /** Caption / abstract / image alt-text. */
126
+ description?: string;
127
+ /** ISO 8601 timestamp — when the original was authored or captured. */
128
+ dateCreated?: string;
129
+ /**
130
+ * ISO 8601 timestamp — last edit / file mtime.
131
+ * Per Decision 13: always the latest revision's timestamp on versioned
132
+ * pages, even when viewing an older revision.
133
+ */
134
+ dateModified?: string;
135
+ /**
136
+ * Immutable original creator (Decision 10 — see docs/GLOSSARY.md).
137
+ * String OR Person object. For pages: sourced from page-index
138
+ * `creator` / frontmatter `page-creator`. For media: EXIF Artist /
139
+ * IPTC By-line. Distinct from `editor` (Article extension, mutable).
140
+ */
141
+ author?: string | Person;
142
+ /** Tags / keywords — merged user-keywords + system-keywords for pages. */
143
+ keywords?: string[];
144
+ /** Canonical landing URL within ngdpbase — required. */
145
+ url: string;
146
+ /** Binary content URL — distinct from the landing `url`. Media only. */
147
+ contentUrl?: string;
148
+ /** Thumbnail URL when the type has a visual representation. */
149
+ thumbnailUrl?: string;
150
+ /** MIME type. */
151
+ encodingFormat?: string;
152
+ }
153
+ /**
154
+ * Article — ngdp pages.
155
+ *
156
+ * Adds page-specific fields: body text for search, wiki-link mentions,
157
+ * version, language, the mutable `editor` (last-saver) field, and the
158
+ * `ngdp:` namespace fields for category and slug.
159
+ */
160
+ export interface Article extends CreativeWorkBase {
161
+ '@type': 'Article';
162
+ /** identifier is required on Article (the frontmatter `uuid`). */
163
+ identifier: string;
164
+ /** Markdown body — feeds the search index. */
165
+ articleBody?: string;
166
+ /** Wiki-link extraction — `[Page Name]` references. */
167
+ mentions?: Mention[];
168
+ /** Page version string from the page provider. */
169
+ version?: string;
170
+ /** BCP-47 language tag from frontmatter or system default. */
171
+ inLanguage?: string;
172
+ /**
173
+ * Mutable last-saver (Decision 10 — see docs/GLOSSARY.md).
174
+ * Sourced from frontmatter `lastModifiedBy`. Updated on every save.
175
+ * Distinct from `author` (immutable, in base). Paired with
176
+ * `dateModified` (latest-revision timestamp + user).
177
+ */
178
+ editor?: string | Person;
179
+ /**
180
+ * ngdp page category. JSON-LD render policy: **map** to schema.org
181
+ * `about` / `genre` (Decision 5).
182
+ */
183
+ 'ngdp:category'?: string;
184
+ /**
185
+ * Frontmatter `slug`. JSON-LD render policy: **omit** (redundant with
186
+ * `@id`). Decision B (2026-05-20): kept on Article only, not promoted
187
+ * to base — only pages author slugs today.
188
+ */
189
+ 'ngdp:slug'?: string;
190
+ }
191
+ /**
192
+ * ImageObject — still images.
193
+ *
194
+ * Adds dimensions, GPS location, structured EXIF, and the orientation
195
+ * render hint. Pages do not get any of these.
196
+ */
197
+ export interface ImageObject extends CreativeWorkBase {
198
+ '@type': 'ImageObject';
199
+ /** Pixel width — from EXIF ImageWidth. */
200
+ width?: number;
201
+ /** Pixel height — from EXIF ImageHeight. */
202
+ height?: number;
203
+ /**
204
+ * GPS location wrapped as schema.org Place + GeoCoordinates.
205
+ * Surfaced when the source carries GPS tags (Decision 12 — no
206
+ * platform-layer opt-out).
207
+ */
208
+ contentLocation?: Place;
209
+ /**
210
+ * EXIF camera/lens data — internal structured shape (Decision schema
211
+ * mismatch ⚠️). The JSON-LD render mapper converts this to a
212
+ * `Property` array at render time.
213
+ */
214
+ exifData?: ExifCameraData;
215
+ /**
216
+ * EXIF Orientation (1–8). JSON-LD render policy: **omit** (internal
217
+ * render hint; the thumbnail renderer rotates based on this).
218
+ */
219
+ 'ngdp:orientation'?: number;
220
+ }
221
+ /**
222
+ * VideoObject — movies + animated formats.
223
+ *
224
+ * Adds dimensions, duration, bitrate, GPS (modern phones), and codec
225
+ * compatibility hints.
226
+ */
227
+ export interface VideoObject extends CreativeWorkBase {
228
+ '@type': 'VideoObject';
229
+ /** Pixel width. */
230
+ width?: number;
231
+ /** Pixel height. */
232
+ height?: number;
233
+ /**
234
+ * ISO 8601 duration — `PT1M30S` for 1 minute 30 seconds.
235
+ * Sourced from ExifTool MediaDuration / Duration.
236
+ */
237
+ duration?: string;
238
+ /** Average bitrate in bits/second. */
239
+ bitrate?: number;
240
+ /** GPS location — same shape as ImageObject. */
241
+ contentLocation?: Place;
242
+ /**
243
+ * Video codec hint. JSON-LD render policy: **omit** (internal
244
+ * compatibility detail for future transcoding decisions).
245
+ */
246
+ 'ngdp:videoCodec'?: string;
247
+ /**
248
+ * Audio codec hint. JSON-LD render policy: **omit** (internal
249
+ * compatibility detail).
250
+ */
251
+ 'ngdp:audioCodec'?: string;
252
+ }
253
+ /**
254
+ * AudioObject — sound files.
255
+ *
256
+ * Smaller surface than Video — duration, bitrate, codec hint.
257
+ */
258
+ export interface AudioObject extends CreativeWorkBase {
259
+ '@type': 'AudioObject';
260
+ /** ISO 8601 duration — `PT3M14S`. */
261
+ duration?: string;
262
+ /** Average bitrate in bits/second. */
263
+ bitrate?: number;
264
+ /**
265
+ * Audio codec hint. JSON-LD render policy: **omit** (internal
266
+ * compatibility detail).
267
+ */
268
+ 'ngdp:audioCodec'?: string;
269
+ }
270
+ /**
271
+ * DigitalDocument — PDFs, docx, generic attachments.
272
+ *
273
+ * Adds text body (for search) and language. No `numberOfPages`
274
+ * (rejected at the base per docs/schemas.md — print-era artifact).
275
+ */
276
+ export interface DigitalDocument extends CreativeWorkBase {
277
+ '@type': 'DigitalDocument';
278
+ /** PDF text extraction / docx body — feeds the search index. */
279
+ articleBody?: string;
280
+ /** BCP-47 language tag from `dc:language` / docx `core.language`. */
281
+ inLanguage?: string;
282
+ }
283
+ /**
284
+ * The full CreativeWork union — discriminated by `@type`.
285
+ * Use this as the return type for CatalogSource.get() and the element
286
+ * type for CatalogPage.items. Consumers narrow on `@type` to access
287
+ * subtype-specific fields.
288
+ *
289
+ * @example
290
+ * function describe(work: CreativeWork): string {
291
+ * switch (work['@type']) {
292
+ * case 'Article': return `page ${work['ngdp:slug'] ?? work.name}`;
293
+ * case 'ImageObject': return `image ${work.width}×${work.height}`;
294
+ * case 'VideoObject': return `video ${work.duration ?? '?'}`;
295
+ * case 'AudioObject': return `audio ${work.duration ?? '?'}`;
296
+ * case 'DigitalDocument': return `document ${work.encodingFormat}`;
297
+ * }
298
+ * }
299
+ */
300
+ export type CreativeWork = Article | ImageObject | VideoObject | AudioObject | DigitalDocument;
301
+ /**
302
+ * Query passed to CatalogSource.list() and CatalogManager.listCreativeWorks().
303
+ *
304
+ * `filters` is intentionally untyped — it carries source-specific knobs
305
+ * (e.g. MediaManager-only EXIF filters). Sources ignore keys they don't
306
+ * understand.
307
+ */
308
+ export interface CatalogQuery {
309
+ /** Restrict to specific subtypes. */
310
+ types?: SchemaType[];
311
+ /** Free-text query — delegated to the source's own search backend. */
312
+ text?: string;
313
+ /** Inclusive ISO 8601 date range against dateCreated. */
314
+ dateRange?: {
315
+ from?: string;
316
+ to?: string;
317
+ };
318
+ /** Keyword filter — terms must appear in `keywords`. */
319
+ keywords?: string[];
320
+ /** Page size. Sources may cap this. */
321
+ limit?: number;
322
+ /** Opaque cursor returned by a prior list() call. */
323
+ cursor?: string;
324
+ /** Source-specific filters bag (Decision 7). Sources ignore unknown keys. */
325
+ filters?: Record<string, unknown>;
326
+ }
327
+ /** A page of CreativeWorks plus cursor for the next page (if any). */
328
+ export interface CatalogPage {
329
+ items: CreativeWork[];
330
+ cursor?: string;
331
+ total?: number;
332
+ }
333
+ /** Options for CatalogSource.rebuild() — sources may add their own. */
334
+ export interface RebuildOpts {
335
+ /** Force full rebuild rather than incremental. */
336
+ force?: boolean;
337
+ }
338
+ /**
339
+ * The Manager-layer contract for asset sources (Decision 7).
340
+ *
341
+ * PageManager / MediaManager / AttachmentManager each implement this
342
+ * during their `initialize()`, registering themselves with
343
+ * CatalogManager via `registerSource()`. Storage providers underneath
344
+ * stay diverse and pluggable per-deployment.
345
+ *
346
+ * ACL filtering happens here (each source knows its permission model).
347
+ * `get()` returns `null` for both not-found and ACL-filtered; only throw
348
+ * on actual errors.
349
+ */
350
+ export interface CatalogSource {
351
+ /** Stable identifier — e.g. `'pages'`, `'media'`, `'attachments'`. */
352
+ readonly sourceId: string;
353
+ /** Which subtypes this source produces. */
354
+ readonly types: readonly SchemaType[];
355
+ /**
356
+ * Schema version of the on-disk records this source writes/reads.
357
+ * Compared against the manager's CURRENT_SCHEMA_VERSION constant on
358
+ * startup (Decision 6).
359
+ */
360
+ readonly currentSchemaVersion: number;
361
+ /**
362
+ * List CreativeWorks matching the query. Returns a cursor-paginated
363
+ * CatalogPage. Sources cap `limit` at their own discretion.
364
+ */
365
+ list(query: CatalogQuery): Promise<CatalogPage>;
366
+ /**
367
+ * Get a single CreativeWork by stable identifier (the
368
+ * `identifier` field — rename-stable UUID per Decision 4).
369
+ * Returns null for not-found and for ACL-filtered.
370
+ */
371
+ get(identifier: string): Promise<CreativeWork | null>;
372
+ /**
373
+ * Optional URL-based convenience lookup. When implemented, callers
374
+ * with only `@id` can resolve without computing the identifier.
375
+ */
376
+ getByUrl?(atId: string): Promise<CreativeWork | null>;
377
+ /**
378
+ * Rebuild this source's on-disk index from authoritative storage.
379
+ * Per Decision 6, this is what advances a stale `schemaVersion`.
380
+ */
381
+ rebuild(opts?: RebuildOpts): Promise<void>;
382
+ }
383
+ /**
384
+ * One row of CatalogManager.checkSchemaVersions() output.
385
+ * `isStale` is true when the on-disk index file's version is older
386
+ * than the manager's current constant.
387
+ */
388
+ export interface SchemaVersionReportEntry {
389
+ sourceId: string;
390
+ currentSchemaVersion: number;
391
+ onDiskSchemaVersion: number;
392
+ isStale: boolean;
393
+ }
394
+ /** Full schema-version report — one entry per registered source. */
395
+ export type SchemaVersionReport = SchemaVersionReportEntry[];
396
+ /**
397
+ * Maps a page frontmatter object + body to an Article CreativeWork.
398
+ * Implementation lands in Slice 4 (#755) — PageManager.
399
+ *
400
+ * Note: the concrete input type is intentionally loose here; Slice 4
401
+ * will narrow it to the canonical PageFrontmatter type.
402
+ */
403
+ export type PageFrontmatterMapper = (frontmatter: Record<string, unknown>, body: string) => Article;
404
+ /**
405
+ * Maps a media-file record (EXIF/QuickTime extraction) to a media-typed
406
+ * CreativeWork. Implementation lands in Slice 3 (#755) — MediaManager
407
+ * via FileSystemMediaProvider.
408
+ */
409
+ export type MediaExifMapper = (record: Record<string, unknown>) => ImageObject | VideoObject | AudioObject;
410
+ /**
411
+ * Maps an extracted PDF/docx metadata + text body to a DigitalDocument
412
+ * CreativeWork. Implementation lands in Slice 5 (#755) —
413
+ * AttachmentManager.
414
+ */
415
+ export type PdfDocxMapper = (metadata: Record<string, unknown>, body: string) => DigitalDocument;
416
+ /** Narrow a CreativeWork to Article. */
417
+ export declare function isArticle(work: CreativeWork): work is Article;
418
+ /** Narrow a CreativeWork to ImageObject. */
419
+ export declare function isImageObject(work: CreativeWork): work is ImageObject;
420
+ /** Narrow a CreativeWork to VideoObject. */
421
+ export declare function isVideoObject(work: CreativeWork): work is VideoObject;
422
+ /** Narrow a CreativeWork to AudioObject. */
423
+ export declare function isAudioObject(work: CreativeWork): work is AudioObject;
424
+ /** Narrow a CreativeWork to DigitalDocument. */
425
+ export declare function isDigitalDocument(work: CreativeWork): work is DigitalDocument;