@jini-ai/devops 0.7.3-next.1 → 0.7.3-next.3

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 (391) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +16 -0
  3. package/dist/backup/site/archive-extensions.d.ts +73 -0
  4. package/dist/backup/site/archive-extensions.js +129 -0
  5. package/dist/backup/site/archive-manifest.d.ts +85 -0
  6. package/dist/backup/site/archive-manifest.js +176 -0
  7. package/dist/backup/site/archive-media.d.ts +121 -0
  8. package/dist/backup/site/archive-media.js +93 -0
  9. package/dist/backup/site/backup-service.credentials.d.ts +31 -0
  10. package/dist/backup/site/backup-service.credentials.js +161 -0
  11. package/dist/backup/site/backup-service.d.ts +331 -0
  12. package/dist/backup/site/backup-service.js +125 -0
  13. package/dist/backup/site/backup-service.plan.d.ts +64 -0
  14. package/dist/backup/site/backup-service.plan.js +207 -0
  15. package/dist/backup/site/backup-service.push.d.ts +29 -0
  16. package/dist/backup/site/backup-service.push.js +82 -0
  17. package/dist/backup/site/backup-service.shared.d.ts +40 -0
  18. package/dist/backup/site/backup-service.shared.js +37 -0
  19. package/dist/backup/site/bundled-export-file-policy.d.ts +38 -0
  20. package/dist/backup/site/bundled-export-file-policy.js +40 -0
  21. package/dist/backup/site/credential-warnings.d.ts +41 -0
  22. package/dist/backup/site/credential-warnings.js +50 -0
  23. package/dist/backup/site/import-backend-steps.d.ts +167 -0
  24. package/dist/backup/site/import-backend-steps.js +170 -0
  25. package/dist/backup/site/import-backend.d.ts +167 -0
  26. package/dist/backup/site/import-backend.js +298 -0
  27. package/dist/backup/site/import-database.d.ts +118 -0
  28. package/dist/backup/site/import-database.js +167 -0
  29. package/dist/backup/site/import-index/admission.d.ts +54 -0
  30. package/dist/backup/site/import-index/admission.js +46 -0
  31. package/dist/backup/site/import-index/backfill.d.ts +106 -0
  32. package/dist/backup/site/import-index/backfill.js +137 -0
  33. package/dist/backup/site/import-index/errors.d.ts +28 -0
  34. package/dist/backup/site/import-index/errors.js +38 -0
  35. package/dist/backup/site/import-index/migrations/checksums.d.ts +4 -0
  36. package/dist/backup/site/import-index/migrations/checksums.js +4 -0
  37. package/dist/backup/site/import-index/migrations/site-imports-v1.d.ts +2 -0
  38. package/dist/backup/site/import-index/migrations/site-imports-v1.js +10 -0
  39. package/dist/backup/site/import-index/mode.d.ts +191 -0
  40. package/dist/backup/site/import-index/mode.js +272 -0
  41. package/dist/backup/site/import-index/open.d.ts +40 -0
  42. package/dist/backup/site/import-index/open.js +87 -0
  43. package/dist/backup/site/import-index/paging.d.ts +28 -0
  44. package/dist/backup/site/import-index/paging.js +66 -0
  45. package/dist/backup/site/import-index/payload-namespace.d.ts +80 -0
  46. package/dist/backup/site/import-index/payload-namespace.js +156 -0
  47. package/dist/backup/site/import-index/rows.d.ts +32 -0
  48. package/dist/backup/site/import-index/rows.js +61 -0
  49. package/dist/backup/site/import-index/schema.d.ts +8 -0
  50. package/dist/backup/site/import-index/schema.js +31 -0
  51. package/dist/backup/site/import-index/store.d.ts +27 -0
  52. package/dist/backup/site/import-index/store.js +33 -0
  53. package/dist/backup/site/import-index/sweep.d.ts +10 -0
  54. package/dist/backup/site/import-index/sweep.js +26 -0
  55. package/dist/backup/site/import-keep-off.d.ts +128 -0
  56. package/dist/backup/site/import-keep-off.js +204 -0
  57. package/dist/backup/site/import-plugin-state.d.ts +74 -0
  58. package/dist/backup/site/import-plugin-state.js +67 -0
  59. package/dist/backup/site/import-registry.d.ts +110 -0
  60. package/dist/backup/site/import-registry.js +205 -0
  61. package/dist/backup/site/import-restore-placement.d.ts +94 -0
  62. package/dist/backup/site/import-restore-placement.js +158 -0
  63. package/dist/backup/site/import-restore.d.ts +111 -0
  64. package/dist/backup/site/import-restore.js +120 -0
  65. package/dist/backup/site/import-verifier-inventory.d.ts +137 -0
  66. package/dist/backup/site/import-verifier-inventory.js +236 -0
  67. package/dist/backup/site/import-verifier-projection.d.ts +78 -0
  68. package/dist/backup/site/import-verifier-projection.js +100 -0
  69. package/dist/backup/site/import-verifier.d.ts +126 -0
  70. package/dist/backup/site/import-verifier.js +53 -0
  71. package/dist/backup/site/owned-temp-root.d.ts +12 -0
  72. package/dist/backup/site/owned-temp-root.js +2 -0
  73. package/dist/backup/site/package-file-inventory.d.ts +63 -0
  74. package/dist/backup/site/package-file-inventory.js +56 -0
  75. package/dist/backup/site/push-content.d.ts +70 -0
  76. package/dist/backup/site/push-content.js +56 -0
  77. package/dist/backup/site/react/ShowMoreImports.d.ts +21 -0
  78. package/dist/backup/site/react/ShowMoreImports.js +8 -0
  79. package/dist/backup/site/saved-keys-port.d.ts +47 -0
  80. package/dist/backup/site/saved-keys-port.js +3 -0
  81. package/dist/backup/site/saved-keys.d.ts +25 -0
  82. package/dist/backup/site/saved-keys.js +38 -0
  83. package/dist/backup/site/share-backend.d.ts +243 -0
  84. package/dist/backup/site/share-backend.js +284 -0
  85. package/dist/backup/site/share-database/projection.d.ts +195 -0
  86. package/dist/backup/site/share-database/projection.js +90 -0
  87. package/dist/backup/site/share-database/projection.media.d.ts +38 -0
  88. package/dist/backup/site/share-database/projection.media.js +179 -0
  89. package/dist/backup/site/share-database/projection.tables.d.ts +46 -0
  90. package/dist/backup/site/share-database/projection.tables.js +193 -0
  91. package/dist/backup/site/share-expiry.d.ts +75 -0
  92. package/dist/backup/site/share-expiry.js +49 -0
  93. package/dist/backup/site/share-export-failure.d.ts +17 -0
  94. package/dist/backup/site/share-export-failure.js +16 -0
  95. package/dist/backup/site/share-file-policy.d.ts +60 -0
  96. package/dist/backup/site/share-file-policy.js +146 -0
  97. package/dist/backup/site/share-hosting.d.ts +107 -0
  98. package/dist/backup/site/share-hosting.js +148 -0
  99. package/dist/backup/site/share-preparation-steps.d.ts +180 -0
  100. package/dist/backup/site/share-preparation-steps.js +109 -0
  101. package/dist/backup/site/share-preparation.d.ts +122 -0
  102. package/dist/backup/site/share-preparation.js +43 -0
  103. package/dist/backup/site/share-refusal.d.ts +21 -0
  104. package/dist/backup/site/share-refusal.js +20 -0
  105. package/dist/backup/site/share-registry.d.ts +124 -0
  106. package/dist/backup/site/share-registry.js +219 -0
  107. package/dist/backup/site/share-retention.d.ts +62 -0
  108. package/dist/backup/site/share-retention.js +126 -0
  109. package/dist/backup/site/share-service.d.ts +128 -0
  110. package/dist/backup/site/share-service.js +194 -0
  111. package/dist/backup/site/share-zip.d.ts +115 -0
  112. package/dist/backup/site/share-zip.js +144 -0
  113. package/dist/backup/site/sources.d.ts +344 -0
  114. package/dist/backup/site/sources.js +595 -0
  115. package/dist/backup/site/static-copy.d.ts +122 -0
  116. package/dist/backup/site/static-copy.js +165 -0
  117. package/dist/backup/site/static-download-html.d.ts +76 -0
  118. package/dist/backup/site/static-download-html.js +149 -0
  119. package/dist/backup/site/static-download-landing.d.ts +52 -0
  120. package/dist/backup/site/static-download-landing.js +95 -0
  121. package/dist/backup/site/static-download-layout.d.ts +96 -0
  122. package/dist/backup/site/static-download-layout.js +325 -0
  123. package/dist/backup/site/static-export-selection.d.ts +50 -0
  124. package/dist/backup/site/static-export-selection.js +76 -0
  125. package/dist/backup/site/static-site-packager.d.ts +42 -0
  126. package/dist/backup/site/static-site-packager.js +32 -0
  127. package/dist/backup/site/tool-registrations.d.ts +74 -0
  128. package/dist/backup/site/tool-registrations.js +201 -0
  129. package/dist/checks/complexity-debt.d.ts +100 -0
  130. package/dist/checks/complexity-debt.js +131 -0
  131. package/dist/checks/coverage/diff.js +5 -1
  132. package/dist/checks/env-access.d.ts +14 -1
  133. package/dist/checks/env-access.js +92 -6
  134. package/dist/checks/live-verify-checks.d.ts +29 -0
  135. package/dist/checks/live-verify-checks.js +30 -0
  136. package/dist/checks/quality-gates.d.ts +137 -0
  137. package/dist/checks/quality-gates.js +209 -0
  138. package/dist/core/deploy-types.d.ts +2 -0
  139. package/dist/deploy/admin-http/site-update-status.d.ts +8 -0
  140. package/dist/deploy/admin-http/site-update-status.js +15 -0
  141. package/dist/deploy/host-kit.d.ts +3 -0
  142. package/dist/deploy/index.d.ts +6 -0
  143. package/dist/deploy/index.js +6 -0
  144. package/dist/deploy/ops-runner.js +7 -0
  145. package/dist/deploy/ops-tool-contracts.d.ts +10 -1
  146. package/dist/deploy/react/Deployment.d.ts +37 -0
  147. package/dist/deploy/react/Deployment.js +94 -0
  148. package/dist/deploy/react/DockerfileTab.d.ts +72 -0
  149. package/dist/deploy/react/DockerfileTab.js +131 -0
  150. package/dist/deploy/react/HistoryTab.d.ts +43 -0
  151. package/dist/deploy/react/HistoryTab.js +12 -0
  152. package/dist/deploy/react/OverviewTab.d.ts +60 -0
  153. package/dist/deploy/react/OverviewTab.js +75 -0
  154. package/dist/deploy/react/PublishRunResult.d.ts +5 -1
  155. package/dist/deploy/react/PublishRunResult.js +4 -4
  156. package/dist/deploy/react/SiteUpdateNotice.d.ts +22 -0
  157. package/dist/deploy/react/SiteUpdateNotice.js +25 -0
  158. package/dist/deploy/react/StaticCredentialFields.d.ts +36 -0
  159. package/dist/deploy/react/StaticCredentialFields.js +63 -0
  160. package/dist/deploy/react/StaticCredentialSteps.d.ts +23 -0
  161. package/dist/deploy/react/StaticCredentialSteps.js +155 -0
  162. package/dist/deploy/react/StaticExportCard.d.ts +11 -0
  163. package/dist/deploy/react/StaticExportCard.js +97 -0
  164. package/dist/deploy/react/StaticPublishCredentials.d.ts +50 -0
  165. package/dist/deploy/react/StaticPublishCredentials.js +77 -0
  166. package/dist/deploy/react/StaticPublishForm.d.ts +12 -0
  167. package/dist/deploy/react/StaticPublishForm.js +91 -0
  168. package/dist/deploy/react/StaticSiteTab.d.ts +207 -0
  169. package/dist/deploy/react/StaticSiteTab.js +117 -0
  170. package/dist/deploy/react/deployment-visuals.d.ts +207 -0
  171. package/dist/deploy/react/deployment-visuals.js +101 -0
  172. package/dist/deploy/react/download-dockerfile.d.ts +14 -0
  173. package/dist/deploy/react/download-dockerfile.js +15 -0
  174. package/dist/deploy/react/hooks/publish-credential-draft.d.ts +33 -0
  175. package/dist/deploy/react/hooks/publish-credential-draft.js +54 -0
  176. package/dist/deploy/react/hooks/publish-credential-selection.d.ts +13 -0
  177. package/dist/deploy/react/hooks/publish-credential-selection.js +34 -0
  178. package/dist/deploy/react/hooks/publish-credential-writes.d.ts +20 -0
  179. package/dist/deploy/react/hooks/publish-credential-writes.js +99 -0
  180. package/dist/deploy/react/hooks/static-publish-actions.d.ts +10 -0
  181. package/dist/deploy/react/hooks/static-publish-actions.js +62 -0
  182. package/dist/deploy/react/hooks/static-publish-form.hooks.d.ts +38 -0
  183. package/dist/deploy/react/hooks/static-publish-form.hooks.js +103 -0
  184. package/dist/deploy/react/hooks/static-publish-run.hooks.d.ts +28 -0
  185. package/dist/deploy/react/hooks/static-publish-run.hooks.js +92 -0
  186. package/dist/deploy/react/hooks/use-dockerfile-source.hooks.d.ts +148 -0
  187. package/dist/deploy/react/hooks/use-dockerfile-source.hooks.js +155 -0
  188. package/dist/deploy/react/hooks/use-publish-credentials.hooks.d.ts +268 -0
  189. package/dist/deploy/react/hooks/use-publish-credentials.hooks.js +52 -0
  190. package/dist/deploy/react/hooks/use-static-export.hooks.d.ts +128 -0
  191. package/dist/deploy/react/hooks/use-static-export.hooks.js +159 -0
  192. package/dist/deploy/react/hooks/use-static-publish.hooks.d.ts +208 -0
  193. package/dist/deploy/react/hooks/use-static-publish.hooks.js +48 -0
  194. package/dist/deploy/react/index.d.ts +4 -0
  195. package/dist/deploy/react/index.js +2 -0
  196. package/dist/deploy/react/rules.d.ts +363 -0
  197. package/dist/deploy/react/rules.js +314 -0
  198. package/dist/deploy/react/use-deployment-overview.hooks.d.ts +41 -0
  199. package/dist/deploy/react/use-deployment-overview.hooks.js +11 -0
  200. package/dist/deploy/site/agent-tools.d.ts +42 -0
  201. package/dist/deploy/site/agent-tools.js +119 -0
  202. package/dist/deploy/site/deploy-config-registry.d.ts +155 -0
  203. package/dist/deploy/site/deploy-config-registry.js +124 -0
  204. package/dist/deploy/site/deploy-config.d.ts +97 -0
  205. package/dist/deploy/site/deploy-config.js +115 -0
  206. package/dist/deploy/site/deploy-ops/agent-tools.d.ts +22 -0
  207. package/dist/deploy/site/deploy-ops/agent-tools.js +76 -0
  208. package/dist/deploy/site/deploy-ops/registry.d.ts +134 -0
  209. package/dist/deploy/site/deploy-ops/registry.js +106 -0
  210. package/dist/deploy/site/deploy-ops/run-ops.d.ts +66 -0
  211. package/dist/deploy/site/deploy-ops/run-ops.js +34 -0
  212. package/dist/deploy/site/deploy-ops/secret-confirm.d.ts +36 -0
  213. package/dist/deploy/site/deploy-ops/secret-confirm.js +27 -0
  214. package/dist/deploy/site/deploy-targets/host-kit.d.ts +28 -0
  215. package/dist/deploy/site/deploy-targets/host-kit.js +120 -0
  216. package/dist/deploy/site/deploy-targets/registry.d.ts +157 -0
  217. package/dist/deploy/site/deploy-targets/registry.js +132 -0
  218. package/dist/deploy/site/deploy-targets/types.d.ts +27 -0
  219. package/dist/deploy/site/deploy-targets/types.js +2 -0
  220. package/dist/deploy/site/dockerfile.d.ts +137 -0
  221. package/dist/deploy/site/dockerfile.js +101 -0
  222. package/dist/deploy/site/export-run.d.ts +137 -0
  223. package/dist/deploy/site/export-run.js +152 -0
  224. package/dist/deploy/site/ports.d.ts +115 -0
  225. package/dist/deploy/site/ports.js +2 -0
  226. package/dist/deploy/site/publish-agent-tools.d.ts +18 -0
  227. package/dist/deploy/site/publish-agent-tools.js +120 -0
  228. package/dist/deploy/site/publish-candidate.d.ts +26 -0
  229. package/dist/deploy/site/publish-candidate.js +37 -0
  230. package/dist/deploy/site/publish-credentials/account-label-heal-scheduler.d.ts +78 -0
  231. package/dist/deploy/site/publish-credentials/account-label-heal-scheduler.js +88 -0
  232. package/dist/deploy/site/publish-credentials/compatibility-port.d.ts +38 -0
  233. package/dist/deploy/site/publish-credentials/compatibility-port.js +19 -0
  234. package/dist/deploy/site/publish-credentials/execution-mode.d.ts +43 -0
  235. package/dist/deploy/site/publish-credentials/execution-mode.js +19 -0
  236. package/dist/deploy/site/publish-credentials/store-owner.d.ts +11 -0
  237. package/dist/deploy/site/publish-credentials/store-owner.js +9 -0
  238. package/dist/deploy/site/publish-credentials/store-resolution.d.ts +55 -0
  239. package/dist/deploy/site/publish-credentials/store-resolution.js +100 -0
  240. package/dist/deploy/site/publish-credentials/store-validation.d.ts +68 -0
  241. package/dist/deploy/site/publish-credentials/store-validation.js +182 -0
  242. package/dist/deploy/site/publish-credentials/store.d.ts +322 -0
  243. package/dist/deploy/site/publish-credentials/store.js +372 -0
  244. package/dist/deploy/site/publish-credentials/types.d.ts +85 -0
  245. package/dist/deploy/site/publish-credentials/types.js +2 -0
  246. package/dist/deploy/site/publish-tool-capabilities.d.ts +123 -0
  247. package/dist/deploy/site/publish-tool-capabilities.js +175 -0
  248. package/dist/deploy/site/publish-tool-credential.d.ts +48 -0
  249. package/dist/deploy/site/publish-tool-credential.js +284 -0
  250. package/dist/deploy/site/publish-tool-deps.d.ts +205 -0
  251. package/dist/deploy/site/publish-tool-deps.js +15 -0
  252. package/dist/deploy/site/publish-tool-execution.d.ts +78 -0
  253. package/dist/deploy/site/publish-tool-execution.js +313 -0
  254. package/dist/deploy/site/publish-tool-schema.d.ts +29 -0
  255. package/dist/deploy/site/publish-tool-schema.js +38 -0
  256. package/dist/deploy/site/static-publish/adapter-export.d.ts +54 -0
  257. package/dist/deploy/site/static-publish/adapter-export.js +89 -0
  258. package/dist/deploy/site/static-publish/adapter-plan.d.ts +99 -0
  259. package/dist/deploy/site/static-publish/adapter-plan.js +112 -0
  260. package/dist/deploy/site/static-publish/adapter.d.ts +182 -0
  261. package/dist/deploy/site/static-publish/adapter.js +321 -0
  262. package/dist/deploy/site/static-publish/admin-publish-read.d.ts +209 -0
  263. package/dist/deploy/site/static-publish/admin-publish-read.js +116 -0
  264. package/dist/deploy/site/static-publish/credentials.d.ts +110 -0
  265. package/dist/deploy/site/static-publish/credentials.js +290 -0
  266. package/dist/deploy/site/static-publish/domain-publish-rows.d.ts +25 -0
  267. package/dist/deploy/site/static-publish/domain-publish-rows.js +43 -0
  268. package/dist/deploy/site/static-publish/domain-publish-tool.d.ts +19 -0
  269. package/dist/deploy/site/static-publish/domain-publish-tool.js +111 -0
  270. package/dist/deploy/site/static-publish/inspection.d.ts +24 -0
  271. package/dist/deploy/site/static-publish/inspection.js +69 -0
  272. package/dist/deploy/site/static-publish/publish-history.d.ts +197 -0
  273. package/dist/deploy/site/static-publish/publish-history.js +153 -0
  274. package/dist/deploy/site/static-publish/publish-run.d.ts +156 -0
  275. package/dist/deploy/site/static-publish/publish-run.js +186 -0
  276. package/dist/deploy/site/static-publish/types.d.ts +165 -0
  277. package/dist/deploy/site/static-publish/types.js +2 -0
  278. package/dist/deploy/site/static-publish/verify.d.ts +217 -0
  279. package/dist/deploy/site/static-publish/verify.js +248 -0
  280. package/dist/deploy/site/tool-registrations.d.ts +97 -0
  281. package/dist/deploy/site/tool-registrations.js +130 -0
  282. package/dist/deploy/site/types.d.ts +51 -0
  283. package/dist/deploy/site/types.js +2 -0
  284. package/dist/deploy/site-update/check-for-update.d.ts +19 -0
  285. package/dist/deploy/site-update/check-for-update.js +19 -0
  286. package/dist/deploy/site-update/contracts.d.ts +161 -0
  287. package/dist/deploy/site-update/contracts.js +94 -0
  288. package/dist/deploy/site-update/desktop-site-update.d.ts +66 -0
  289. package/dist/deploy/site-update/desktop-site-update.js +43 -0
  290. package/dist/deploy/site-update/fake-site-update.d.ts +39 -0
  291. package/dist/deploy/site-update/fake-site-update.js +52 -0
  292. package/dist/deploy/site-update/run-site-update.d.ts +121 -0
  293. package/dist/deploy/site-update/run-site-update.js +219 -0
  294. package/dist/deploy/site-update/self-hosted-site-update.d.ts +71 -0
  295. package/dist/deploy/site-update/self-hosted-site-update.js +79 -0
  296. package/dist/deploy/target-contracts.d.ts +3 -0
  297. package/dist/deploy/tool.d.ts +5 -8
  298. package/dist/deploy/tool.js +6 -9
  299. package/dist/dns/binding-sweeper.d.ts +72 -0
  300. package/dist/dns/binding-sweeper.js +53 -0
  301. package/dist/dns/index.d.ts +1 -0
  302. package/dist/dns/index.js +1 -0
  303. package/dist/dns/site/binding.repo.d.ts +71 -0
  304. package/dist/dns/site/binding.repo.js +45 -0
  305. package/dist/dns/site/dns-changes.d.ts +90 -0
  306. package/dist/dns/site/dns-changes.js +271 -0
  307. package/dist/dns/site/dns-tools.d.ts +46 -0
  308. package/dist/dns/site/dns-tools.js +204 -0
  309. package/dist/dns/site/mail-dns-status.d.ts +111 -0
  310. package/dist/dns/site/mail-dns-status.js +190 -0
  311. package/dist/dns/site/mail-dns-tools.d.ts +33 -0
  312. package/dist/dns/site/mail-dns-tools.js +62 -0
  313. package/dist/dns/site/mail-requirements.d.ts +30 -0
  314. package/dist/dns/site/mail-requirements.js +78 -0
  315. package/dist/dns/site/tool-deps.d.ts +21 -0
  316. package/dist/dns/site/tool-deps.js +2 -0
  317. package/dist/dns/site/tools.d.ts +74 -0
  318. package/dist/dns/site/tools.js +124 -0
  319. package/dist/local-dev/bind-host.d.ts +80 -0
  320. package/dist/local-dev/bind-host.js +90 -0
  321. package/dist/local-dev/dev-proxy-upstream.d.ts +69 -0
  322. package/dist/local-dev/dev-proxy-upstream.js +63 -0
  323. package/dist/local-dev/index.d.ts +28 -0
  324. package/dist/local-dev/index.js +25 -0
  325. package/dist/packaging/electron/archive.d.ts +2 -9
  326. package/dist/packaging/electron/asar-adapter.d.ts +2 -1
  327. package/dist/packaging/electron/entry.d.ts +2 -0
  328. package/dist/packaging/electron/move-to-applications.d.ts +165 -0
  329. package/dist/packaging/electron/move-to-applications.js +162 -0
  330. package/dist/packaging/electron/policies.d.ts +33 -4
  331. package/dist/packaging/electron/policies.js +29 -10
  332. package/dist/packaging/electron/ports.d.ts +1 -6
  333. package/dist/packaging/electron/staging.d.ts +11 -2
  334. package/dist/packaging/electron/staging.js +15 -5
  335. package/dist/react/site-share-expiry/ShareExpiryControls.d.ts +29 -0
  336. package/dist/react/site-share-expiry/ShareExpiryControls.js +7 -0
  337. package/dist/react/site-share-expiry/index.d.ts +2 -0
  338. package/dist/react/site-share-expiry/index.js +2 -0
  339. package/dist/source-control/react/ProvidersTab.d.ts +98 -0
  340. package/dist/source-control/react/ProvidersTab.js +195 -0
  341. package/dist/source-control/react/SourceControl.d.ts +51 -0
  342. package/dist/source-control/react/SourceControl.js +61 -0
  343. package/dist/source-control/react/hooks/use-source-control-credentials.hooks.d.ts +128 -0
  344. package/dist/source-control/react/hooks/use-source-control-credentials.hooks.js +102 -0
  345. package/dist/source-control/react/rules.d.ts +167 -0
  346. package/dist/source-control/react/rules.js +125 -0
  347. package/dist/source-control/react/source-control-visuals.d.ts +75 -0
  348. package/dist/source-control/react/source-control-visuals.js +48 -0
  349. package/dist/source-control/site/agent-tools.d.ts +5 -0
  350. package/dist/source-control/site/agent-tools.js +30 -0
  351. package/dist/source-control/site/bundled-provider-registry.d.ts +33 -0
  352. package/dist/source-control/site/bundled-provider-registry.js +37 -0
  353. package/dist/source-control/site/commit-schema.d.ts +40 -0
  354. package/dist/source-control/site/commit-schema.js +29 -0
  355. package/dist/source-control/site/commit-target.d.ts +26 -0
  356. package/dist/source-control/site/commit-target.js +58 -0
  357. package/dist/source-control/site/credential-form.d.ts +36 -0
  358. package/dist/source-control/site/credential-form.js +102 -0
  359. package/dist/source-control/site/credential-setup.d.ts +107 -0
  360. package/dist/source-control/site/credential-setup.js +216 -0
  361. package/dist/source-control/site/provider-kit.d.ts +37 -0
  362. package/dist/source-control/site/provider-kit.js +35 -0
  363. package/dist/source-control/site/provider-module.d.ts +251 -0
  364. package/dist/source-control/site/provider-module.js +2 -0
  365. package/dist/source-control/site/saved-key-bindings.d.ts +4 -0
  366. package/dist/source-control/site/saved-key-bindings.js +4 -0
  367. package/dist/source-control/site/static-site-packager-port.d.ts +37 -0
  368. package/dist/source-control/site/static-site-packager-port.js +2 -0
  369. package/dist/source-control/site/store.d.ts +209 -0
  370. package/dist/source-control/site/store.js +374 -0
  371. package/dist/source-control/site/store.validation.d.ts +72 -0
  372. package/dist/source-control/site/store.validation.js +168 -0
  373. package/dist/source-control/site/tool-registrations.d.ts +190 -0
  374. package/dist/source-control/site/tool-registrations.js +379 -0
  375. package/dist/static-export/site/export-preflight.d.ts +48 -0
  376. package/dist/static-export/site/export-preflight.js +82 -0
  377. package/dist/static-export/site/media-original-urls.d.ts +57 -0
  378. package/dist/static-export/site/media-original-urls.js +109 -0
  379. package/dist/static-export/site/ports.d.ts +82 -0
  380. package/dist/static-export/site/ports.js +29 -0
  381. package/dist/static-export/site/public-origin-policy.d.ts +32 -0
  382. package/dist/static-export/site/public-origin-policy.js +68 -0
  383. package/dist/static-export/site/route-manifest.d.ts +65 -0
  384. package/dist/static-export/site/route-manifest.js +139 -0
  385. package/dist/static-export/site/site-exporter.d.ts +158 -0
  386. package/dist/static-export/site/site-exporter.js +112 -0
  387. package/dist/static-export/site/static-security-headers.d.ts +39 -0
  388. package/dist/static-export/site/static-security-headers.js +43 -0
  389. package/dist/static-export/site/theme-preview-manifest.d.ts +35 -0
  390. package/dist/static-export/site/theme-preview-manifest.js +28 -0
  391. package/package.json +912 -8
@@ -0,0 +1,109 @@
1
+ import { createHash } from "node:crypto";
2
+ import path from "node:path";
3
+ import { SiteShareRefusal } from "./share-refusal.js";
4
+ const PROVENANCE_KEYS = ["templateId", "templateVersion", "schemaVersion", "schemaTag"];
5
+ const PROVENANCE_TEXT = /^[a-z\d_.+-]{1,128}$/i;
6
+ /**
7
+ * Binds the share steps to a host's caps, file walker and snapshot reader.
8
+ * @returns the steps; each refuses with a {@link SiteShareRefusal} instead of returning a partial share.
9
+ */
10
+ export function createShareSteps(deps) {
11
+ /** Adds one buffered file after re-checking the caps with it counted. */
12
+ function addBuffered(required) {
13
+ required.ledger.sizes.push({ path: required.file.path, bytes: required.file.content.length });
14
+ deps.checkShareLimits({ files: required.ledger.sizes });
15
+ required.ledger.buffered.push(required.file);
16
+ }
17
+ /**
18
+ * Snapshots the site database and returns only the sanitizer's fresh projection.
19
+ * Release the private snapshot before buffering media and assembling the public ZIP: the snapshot
20
+ * is scoped to this helper, so it is released before the caller does either.
21
+ * `snapshotRoot` is a private folder outside the source site: Export never writes into site storage.
22
+ * @throws SiteShareRefusal DATABASE_SNAPSHOT_FAILED with the snapshot's caller-safe message.
23
+ */
24
+ async function captureProjectedDatabase(required, optional = {}) {
25
+ const snapshot = await deps.captureDatabaseSnapshot({ dbOps: required.dbOps, scopeId: "site-share" }, { maxBytes: deps.limits.maxExpandedBytes, snapshotRoot: required.snapshotRoot });
26
+ if (!snapshot.ok)
27
+ throw new SiteShareRefusal({ code: "DATABASE_SNAPSHOT_FAILED", message: snapshot.message });
28
+ const projected = await required.sanitize({ snapshot: snapshot.bytes }, { signal: optional.signal });
29
+ return { projected, watermarkAtCapture: snapshot.watermarkAtCapture };
30
+ }
31
+ /** Collects the share profile's files (never the media folder); any skipped file refuses by name. */
32
+ async function collectShareFiles(required) {
33
+ const collected = await deps.collectFiles({ sources: required.sources, include: { ...required.include, media: false } }, { profile: "share" });
34
+ if (collected.skipped.length) {
35
+ const skipped = collected.skipped[0];
36
+ if (skipped === undefined)
37
+ throw new Error("Share export has no skipped-file details");
38
+ throw new SiteShareRefusal({ code: "UNSAFE_FILE", message: `Cannot share '${skipped.path}': ${skipped.reason}. Remove it or replace it with a regular file.` });
39
+ }
40
+ return collected;
41
+ }
42
+ /** Reads the blob's size from the store without fetching it; refuses a missing, invalid or over-cap blob. */
43
+ async function reportedBlobSize(required) {
44
+ if (!required.blobStore.sizeOf)
45
+ throw new SiteShareRefusal({ code: "UNBOUNDED_MEDIA", message: "This media store cannot report blob sizes. Configure a size-aware blob store before sharing." });
46
+ const size = await required.blobStore.sizeOf({ storageKey: required.storageKey });
47
+ if (size === null)
48
+ throw new SiteShareRefusal({ code: "MISSING_MEDIA", message: `Share media '${required.storageKey}' is missing from the blob store.` });
49
+ if (!Number.isSafeInteger(size) || size < 0)
50
+ throw new SiteShareRefusal({ code: "UNBOUNDED_MEDIA", message: "Media storage returned an invalid byte count; nothing was shared." });
51
+ if (required.document && (size === 0 || size > deps.limits.maxDocumentBytes))
52
+ throw new SiteShareRefusal({ code: "INVALID_DOCUMENT", message: deps.messages.invalidDocument });
53
+ deps.checkShareLimits({ files: [{ path: "media/blob", bytes: size }] });
54
+ return size;
55
+ }
56
+ /** Reads the blob and refuses bytes whose length or checksum differ from what was reported. */
57
+ async function fetchVerifiedBlob(required) {
58
+ const { media } = required;
59
+ const content = Buffer.from(await required.blobStore.get({ storageKey: media.storageKey }));
60
+ if (content.length !== required.size || (media.sha256 && createHash("sha256").update(content).digest("hex") !== media.sha256))
61
+ throw new SiteShareRefusal({ code: "MEDIA_CHANGED", message: `Share media '${media.storageKey}' changed or failed its checksum.` });
62
+ return content;
63
+ }
64
+ return { addBuffered, captureProjectedDatabase, collectShareFiles, reportedBlobSize, fetchVerifiedBlob, addPortableSettings: createPortableSettingsStep({ deps, addBuffered }) };
65
+ }
66
+ function createPortableSettingsStep({ deps, addBuffered }) {
67
+ /** Read only the small, no-follow planned settings files; all other metadata is discarded. */
68
+ async function readPortableJson(required) {
69
+ if (!required.file)
70
+ return {};
71
+ if (required.file.bytes > deps.limits.maxManifestBytes)
72
+ throw new SiteShareRefusal({ code: "INVALID_SETTINGS", message: deps.messages.settingsTooLarge({ path: required.file.path }) });
73
+ const read = await deps.readPlannedFile(required.file);
74
+ if (!read.ok)
75
+ throw new SiteShareRefusal({ code: "PLAN_STALE", message: read.message });
76
+ try {
77
+ const value = JSON.parse(read.bytes.toString("utf8"));
78
+ if (value !== null && typeof value === "object" && !Array.isArray(value))
79
+ return value;
80
+ }
81
+ catch { /* A malformed portable setting must not produce a partial share. */ }
82
+ throw new SiteShareRefusal({ code: "INVALID_SETTINGS", message: `Share settings '${required.file.path}' must contain a JSON object.` });
83
+ }
84
+ /**
85
+ * Regenerates root `settings.json` with name and named template provenance, never host configuration.
86
+ * @returns the shared site name: the config's string `name`, else the site folder name.
87
+ */
88
+ async function addPortableSettings(required) {
89
+ const config = await readPortableJson({ file: required.files.find(file => file.path === "settings/config.json") });
90
+ const name = typeof config.name === "string" ? config.name : path.basename(required.siteDir);
91
+ const meta = await readPortableJson({ file: required.files.find(file => file.path === "settings/.site-meta.json") });
92
+ addBuffered({ ledger: required.ledger, file: { path: "settings.json", content: Buffer.from(JSON.stringify({ name, template: pickProvenance({ meta }) })) } });
93
+ return name;
94
+ }
95
+ return addPortableSettings;
96
+ }
97
+ function pickProvenance(required, _options = {}) {
98
+ const provenance = {};
99
+ // Pick named provenance fields; never spread site identity, paths, fingerprints or storage.
100
+ for (const key of PROVENANCE_KEYS) {
101
+ const value = required.meta[key];
102
+ const validText = typeof value === "string" && PROVENANCE_TEXT.test(value);
103
+ const validNumber = typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
104
+ if (validText || validNumber)
105
+ provenance[key] = value;
106
+ }
107
+ return provenance;
108
+ }
109
+ //# sourceMappingURL=share-preparation-steps.js.map
@@ -0,0 +1,122 @@
1
+ import type { DbOpsPort } from "@jini-ai/core/contracts/site/gated-mutations-ports";
2
+ import type { SealedSecret } from "@jini-ai/core/contracts/vault";
3
+ import type { ArchiveMediaCopy, ArchiveMediaEntry, ArchiveMediaRewriter } from "./archive-media.js";
4
+ import type { CredentialWarning } from "./credential-warnings.js";
5
+ import { ENCRYPTED_KEYS_DESCRIPTOR, type SiteSavedKeysPort } from "./saved-keys-port.js";
6
+ import type { ShareCollectedFiles, ShareDatabaseProjection, ShareDatabaseSanitizer, ShareLedger, SharePlannedFile, ShareSteps } from "./share-preparation-steps.js";
7
+ /** What the host supplies beyond the call's ports: the share profile's scopes, its steps and its file/extension/schema readers. */
8
+ export interface SharePreparationDeps<TSources extends {
9
+ siteDir: string;
10
+ }, TInclude extends object, TFile extends SharePlannedFile & {
11
+ scope: string;
12
+ }, TCollected extends ShareCollectedFiles<TFile> & {
13
+ notices?: readonly string[];
14
+ scopeNotes: unknown;
15
+ }, TMedia, TBlobStore, TTransformer, TPlugin, TSchema> {
16
+ /** The scopes a share carries (all on): the host's own scope names. */
17
+ readonly include: TInclude;
18
+ readonly steps: ShareSteps<TSources, TInclude, TFile, TCollected>;
19
+ /** Throws a {@link SiteShareRefusal} when the listed files break the archive caps. */
20
+ readonly checkShareLimits: (required: {
21
+ files: readonly {
22
+ path: string;
23
+ bytes: number;
24
+ }[];
25
+ }) => void;
26
+ /** Reads the non-settings files' installed extensions (themes, plugins) and returns the files to ship. */
27
+ readonly prepareExtensions: (required: {
28
+ sources: TSources;
29
+ files: readonly TFile[];
30
+ }, optional: {
31
+ signal?: AbortSignal;
32
+ packageThemesRoot?: string;
33
+ }) => Promise<{
34
+ files: TFile[];
35
+ plugins: TPlugin[];
36
+ notices?: readonly string[];
37
+ }>;
38
+ /** Picks exactly one public copy per media item and buffers its bytes into the ledger. */
39
+ readonly bufferArchiveMedia: (required: {
40
+ sources: readonly TMedia[];
41
+ blobStore: TBlobStore;
42
+ imageTransformer: TTransformer;
43
+ ledger: ShareLedger;
44
+ }, optional: {
45
+ signal?: AbortSignal;
46
+ packageThemesRoot?: string;
47
+ }) => Promise<ArchiveMediaCopy[]>;
48
+ /** The runtime's schema identity the archive records. */
49
+ readonly runtimeSchema: () => TSchema;
50
+ }
51
+ /** What the call supplies: the database, the site's sources, the sanitizer and the media ports. */
52
+ export interface SharePreparationPorts<TSources, TProjection, TBlobStore, TTransformer> {
53
+ dbOps: DbOpsPort;
54
+ snapshotRoot: string;
55
+ sources: TSources;
56
+ sanitize: ShareDatabaseSanitizer<TProjection>;
57
+ blobStore: TBlobStore;
58
+ imageTransformer: TTransformer;
59
+ rewriteMedia: ArchiveMediaRewriter;
60
+ savedKeys?: Pick<SiteSavedKeysPort, "capture">;
61
+ shareId?: string;
62
+ workspaceId?: string;
63
+ includeSavedKeys?: boolean;
64
+ }
65
+ /**
66
+ * The prepared share, before the host stamps its own build identity on it. Fields the host's plan
67
+ * type adds (its version field) are the host's to add; this module never names one.
68
+ */
69
+ export interface SharePreparedContent<TInclude, TFile, TCollected extends {
70
+ scopeNotes: unknown;
71
+ }, TPlugin, TSchema> {
72
+ readonly target: {
73
+ readonly kind: "zip";
74
+ };
75
+ readonly profile: "share";
76
+ readonly include: TInclude;
77
+ readonly notices: string[];
78
+ readonly credentialWarnings: readonly CredentialWarning[];
79
+ readonly encryptedKeys?: typeof ENCRYPTED_KEYS_DESCRIPTOR;
80
+ readonly sealedPassword?: SealedSecret;
81
+ readonly media: ArchiveMediaEntry[];
82
+ readonly plugins: TPlugin[];
83
+ readonly database: {
84
+ readonly bytes: Buffer;
85
+ readonly watermarkAtCapture: number;
86
+ };
87
+ readonly files: TFile[];
88
+ readonly bufferedFiles: {
89
+ path: string;
90
+ content: Buffer;
91
+ }[];
92
+ readonly skipped: [];
93
+ readonly scopeNotes: TCollected["scopeNotes"];
94
+ readonly totalBytes: number;
95
+ readonly site: {
96
+ readonly name: string;
97
+ readonly folderName: string;
98
+ };
99
+ readonly schema: TSchema;
100
+ readonly createdAt: string;
101
+ }
102
+ /**
103
+ * Same consistent snapshot and collector as a repository backup, with a fresh DB projection and
104
+ * regenerated portable settings. Media comes ONLY from snapshot records through the blob-store
105
+ * owner, so object-storage sites work and unreferenced/chat upload bytes cannot ride along.
106
+ * `snapshotRoot` is the injected private folder the database snapshot lands in (never the source site).
107
+ * @complexity O(site entries + snapshot + referenced blob bytes), bounded by archive caps.
108
+ */
109
+ export declare function prepareShareContent<TSources extends {
110
+ siteDir: string;
111
+ }, TInclude extends object, TFile extends SharePlannedFile & {
112
+ scope: string;
113
+ }, TCollected extends ShareCollectedFiles<TFile> & {
114
+ notices?: readonly string[];
115
+ scopeNotes: unknown;
116
+ }, TMedia, TBlobStore, TTransformer, TPlugin, TSchema, TProjection extends ShareDatabaseProjection<TMedia>>(required: SharePreparationPorts<TSources, TProjection, TBlobStore, TTransformer> & {
117
+ deps: SharePreparationDeps<TSources, TInclude, TFile, TCollected, TMedia, TBlobStore, TTransformer, TPlugin, TSchema>;
118
+ }, optional?: {
119
+ signal?: AbortSignal;
120
+ packageThemesRoot?: string;
121
+ }): Promise<SharePreparedContent<TInclude, TFile, TCollected, TPlugin, TSchema>>;
122
+ //# sourceMappingURL=share-preparation.d.ts.map
@@ -0,0 +1,43 @@
1
+ import path from "node:path";
2
+ import { SAVED_KEYS_PATH, ENCRYPTED_KEYS_DESCRIPTOR } from "./saved-keys-port.js";
3
+ import { SiteShareRefusal } from "./share-refusal.js";
4
+ /**
5
+ * Same consistent snapshot and collector as a repository backup, with a fresh DB projection and
6
+ * regenerated portable settings. Media comes ONLY from snapshot records through the blob-store
7
+ * owner, so object-storage sites work and unreferenced/chat upload bytes cannot ride along.
8
+ * `snapshotRoot` is the injected private folder the database snapshot lands in (never the source site).
9
+ * @complexity O(site entries + snapshot + referenced blob bytes), bounded by archive caps.
10
+ */
11
+ export async function prepareShareContent(required, optional = {}) {
12
+ const { deps } = required;
13
+ optional.signal?.throwIfAborted();
14
+ const { projected, watermarkAtCapture, savedKeys } = await deps.steps.captureProjectedDatabase(required, optional);
15
+ const collected = await deps.steps.collectShareFiles({ sources: required.sources, include: deps.include });
16
+ const extensions = await deps.prepareExtensions({ sources: required.sources, files: collected.files.filter(file => file.scope !== "settings") }, optional);
17
+ const files = extensions.files;
18
+ const notices = preparationNotices({ projected, collected, savedKeys });
19
+ notices.push(...(extensions.notices ?? []));
20
+ const ledger = { notices, sizes: [...files.map(file => ({ path: file.path, bytes: file.bytes })), { path: "content.db", bytes: projected.bytes.length }], buffered: [] };
21
+ deps.checkShareLimits({ files: ledger.sizes });
22
+ const copies = await deps.bufferArchiveMedia({ sources: requireArchiveMediaSources(projected), blobStore: required.blobStore, imageTransformer: required.imageTransformer, ledger }, optional);
23
+ const bytes = await required.rewriteMedia({ bytes: projected.bytes, copies }, optional);
24
+ const database = ledger.sizes.find(file => file.path === "content.db");
25
+ if (database === undefined)
26
+ throw new Error("Share size ledger has no content database");
27
+ database.bytes = bytes.length;
28
+ deps.checkShareLimits({ files: ledger.sizes });
29
+ if (savedKeys)
30
+ deps.steps.addBuffered({ ledger, file: { path: SAVED_KEYS_PATH, content: savedKeys.encryptedKeys } });
31
+ const name = await deps.steps.addPortableSettings({ files: collected.files, siteDir: required.sources.siteDir, ledger });
32
+ return { target: { kind: "zip" }, profile: "share", include: deps.include, notices, credentialWarnings: projected.credentialWarnings ?? [], ...(savedKeys ? { encryptedKeys: ENCRYPTED_KEYS_DESCRIPTOR, sealedPassword: savedKeys.sealedPassword } : {}), media: copies.map(({ id, slug, path, sha256 }) => ({ id, slug, path, sha256 })), plugins: extensions.plugins, database: { bytes, watermarkAtCapture }, files, bufferedFiles: ledger.buffered, skipped: [], scopeNotes: collected.scopeNotes, totalBytes: ledger.sizes.reduce((sum, file) => sum + file.bytes, 0), site: { name, folderName: path.basename(required.sources.siteDir) }, schema: deps.runtimeSchema(), createdAt: new Date().toISOString() };
33
+ }
34
+ function requireArchiveMediaSources(projected) {
35
+ if (!projected.archiveMedia && projected.media.length)
36
+ throw new SiteShareRefusal({ code: "INVALID_MEDIA", message: "Share projection has no archive media metadata." });
37
+ return projected.archiveMedia ?? [];
38
+ }
39
+ /** Boundaries return independent notice lists; assembly owns the combined operation-local list. */
40
+ function preparationNotices(required, _options = {}) {
41
+ return [...(required.projected.notices ?? []), ...(required.collected.notices ?? []), ...(required.savedKeys?.notices ?? [])];
42
+ }
43
+ //# sourceMappingURL=share-preparation.js.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The one refusal type of site share/backup. It is a class, so callers tell an expected, caller-safe
3
+ * refusal from an unexpected failure with `instanceof`; the process must hold exactly one copy of it.
4
+ */
5
+ export declare class SiteShareRefusal extends Error {
6
+ readonly code: string;
7
+ constructor(required: {
8
+ code: string;
9
+ message: string;
10
+ }, { cause }?: {
11
+ cause?: unknown;
12
+ });
13
+ }
14
+ /** Display an archive-controlled name in a refusal, never use this value for lookup.
15
+ * Strip invisible controls before quoting, and bound each name to 120 UTF-16 units so a
16
+ * hostile ZIP cannot flood or visually reorder a refusal. Pure; O(name.length) time/space.
17
+ */
18
+ export declare function archiveRefusalName({ name }: {
19
+ name: string;
20
+ }, _options?: {}): string;
21
+ //# sourceMappingURL=share-refusal.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The one refusal type of site share/backup. It is a class, so callers tell an expected, caller-safe
3
+ * refusal from an unexpected failure with `instanceof`; the process must hold exactly one copy of it.
4
+ */
5
+ export class SiteShareRefusal extends Error {
6
+ code;
7
+ constructor(required, { cause } = {}) { super(required.message, { cause }); this.code = required.code; this.name = "SiteShareRefusal"; }
8
+ }
9
+ /** Display an archive-controlled name in a refusal, never use this value for lookup.
10
+ * Strip invisible controls before quoting, and bound each name to 120 UTF-16 units so a
11
+ * hostile ZIP cannot flood or visually reorder a refusal. Pure; O(name.length) time/space.
12
+ */
13
+ export function archiveRefusalName({ name }, _options = {}) {
14
+ const clean = name.replace(/[\p{Cc}\p{Cf}]/gu, "");
15
+ if (clean.length <= 120)
16
+ return clean;
17
+ // Do not split an astral character at the truncation boundary.
18
+ return clean.slice(0, 119).replace(/[\uD800-\uDBFF]$/, "") + "…";
19
+ }
20
+ //# sourceMappingURL=share-refusal.js.map
@@ -0,0 +1,124 @@
1
+ import type { SealedSecret } from "@jini-ai/core/contracts/vault";
2
+ import type { CredentialWarning } from "./credential-warnings.js";
3
+ /** Host values the registry cannot own: its artifact naming, the public file-name shape and the archive size cap. */
4
+ export interface ShareRegistryHost {
5
+ /** Suffix of the private artifact file kept beside each record (for example `.share.zip`). */
6
+ readonly artifactSuffix: string;
7
+ /** Accepts the public file names this host mints; a token is only ever served with a matching file. */
8
+ readonly shareFile: RegExp;
9
+ /** Largest archive the registry will write, in bytes. */
10
+ readonly maxArchiveBytes: number;
11
+ }
12
+ export interface SiteShareRecord {
13
+ readonly shareId: string;
14
+ readonly token: string;
15
+ readonly site: string;
16
+ readonly file: string;
17
+ readonly bytes: number;
18
+ readonly sha256: string;
19
+ readonly url: string | null;
20
+ readonly status: "active" | "revoked" | "failed" | "expired";
21
+ readonly createdAt: string;
22
+ readonly revokedAt: string | null;
23
+ readonly hasEncryptedKeys?: boolean;
24
+ readonly sealedPassword?: SealedSecret;
25
+ readonly notices?: readonly string[];
26
+ readonly credentialWarnings?: readonly CredentialWarning[];
27
+ readonly needsAcknowledgement?: boolean;
28
+ readonly notes?: readonly string[];
29
+ readonly storage?: {
30
+ readonly provider: string;
31
+ readonly key: string;
32
+ readonly url?: string;
33
+ readonly binding?: string;
34
+ };
35
+ /** Set only at creation from the owner's choice, never changed after. Absent or null: the link never expires. */
36
+ readonly expiresAt?: string | null;
37
+ }
38
+ export declare const SHARE_TOKEN_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
39
+ export declare const SHARE_TOKEN_LENGTH = 16;
40
+ export declare const SHARE_TOKEN_PATTERN = "[A-Za-z]{16}";
41
+ export declare const SHARE_TOKEN: RegExp;
42
+ /**
43
+ * Private per-site share catalog, outside every backup walk and public static root. One atomic
44
+ * metadata file per export prevents unrelated concurrent creates from overwriting each other.
45
+ * Revocation is a permanent create-only tombstone: a racing upload can never resurrect access.
46
+ * @complexity O(exports) listing; O(1) token lookup/updates, plus artifact bytes on disk.
47
+ */
48
+ export declare class SiteShareRegistry {
49
+ readonly directory: string;
50
+ private readonly host;
51
+ private readonly now;
52
+ /** @param optional.now The host clock (epoch ms) the public lookup compares `expiresAt` against; a host should inject its own. */
53
+ constructor(required: {
54
+ directory: string;
55
+ host: ShareRegistryHost;
56
+ }, optional?: {
57
+ now?: () => number;
58
+ });
59
+ private meta;
60
+ artifactPath(required: {
61
+ shareId: string;
62
+ }, _optional?: Record<string, never>): string;
63
+ /** Immutable token-to-id claim gives O(1) public lookups and forbids replay after revocation. */
64
+ reserveToken(required: {
65
+ token: string;
66
+ shareId: string;
67
+ }, _optional?: Record<string, never>): Promise<void>;
68
+ put(required: {
69
+ record: SiteShareRecord;
70
+ }, _optional?: Record<string, never>): Promise<void>;
71
+ /** Atomic metadata write with no token-shape check, so `disable` can still tombstone a row minted
72
+ * before the 16-letter switch (its token was reserved when it was created). */
73
+ private writeRecord;
74
+ get(required: {
75
+ shareId: string;
76
+ site?: string;
77
+ }, _optional?: Record<string, never>): Promise<SiteShareRecord | null>;
78
+ private readRow;
79
+ /** A tombstone's content, or null when it does not exist; any other read error propagates. */
80
+ private readTombstone;
81
+ /**
82
+ * The permanent, create-only expiry tombstone (content: the stated `expiresAt`), synced to disk
83
+ * before returning so the artifact is never unlinked while a reader could still see `active`.
84
+ * An existing tombstone is success: a crash between this and the unlink is retried by the next pass.
85
+ */
86
+ markExpired(required: {
87
+ shareId: string;
88
+ expiresAt: string;
89
+ }, _optional?: Record<string, never>): Promise<void>;
90
+ list(required: {
91
+ site?: string;
92
+ }, _optional?: Record<string, never>): Promise<SiteShareRecord[]>;
93
+ findToken(required: {
94
+ token: string;
95
+ file: string;
96
+ }, _optional?: Record<string, never>): Promise<SiteShareRecord | null>;
97
+ disable(required: {
98
+ shareId: string;
99
+ site: string;
100
+ }, _optional?: Record<string, never>): Promise<SiteShareRecord | null>;
101
+ writeArtifact(required: {
102
+ shareId: string;
103
+ bytes: Buffer;
104
+ }, _optional?: Record<string, never>): Promise<void>;
105
+ /** Read the same private artifact this registry wrote; paths never come from HTTP input.
106
+ * @complexity O(archive bytes), bounded by the share archive cap.
107
+ */
108
+ readArtifact(required: {
109
+ shareId: string;
110
+ }, _optional?: Record<string, never>): Promise<Buffer>;
111
+ deleteArtifact(required: {
112
+ shareId: string;
113
+ }, _optional?: Record<string, never>): Promise<void>;
114
+ }
115
+ /**
116
+ * A fresh share id and public token. `randomInt` draws from the CSPRNG and rejection-samples, so each
117
+ * of the 52 letters is equally likely (no modulo bias): 16 draws give log2(52^16) ≈ 91 bits.
118
+ * @complexity O(SHARE_TOKEN_LENGTH).
119
+ */
120
+ export declare function newShareIdentity(_required: Record<string, never>, _optional?: Record<string, never>): {
121
+ shareId: string;
122
+ token: string;
123
+ };
124
+ //# sourceMappingURL=share-registry.d.ts.map
@@ -0,0 +1,219 @@
1
+ import { randomInt, randomUUID } from "node:crypto";
2
+ import { mkdir, open, readFile, readdir, rename, statfs, unlink, writeFile } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { SiteShareRefusal } from "./share-refusal.js";
5
+ import { isShareExpired } from "./share-expiry.js";
6
+ const ID = /^[0-9a-f-]{36}$/;
7
+ /** Owner decision 2026-10-25: share tokens are 16 ASCII letters (~91 bits), short enough to read
8
+ * aloud yet unguessable. No digits, and no other shape is accepted: old 64-hex links are dead.
9
+ * The one source of the token shape; route and object-store key checks build on SHARE_TOKEN_PATTERN. */
10
+ const ASCII_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
11
+ export const SHARE_TOKEN_ALPHABET = ASCII_LETTERS;
12
+ export const SHARE_TOKEN_LENGTH = 16;
13
+ export const SHARE_TOKEN_PATTERN = `[A-Za-z]{${SHARE_TOKEN_LENGTH}}`;
14
+ export const SHARE_TOKEN = new RegExp(`^${SHARE_TOKEN_PATTERN}$`);
15
+ /**
16
+ * Private per-site share catalog, outside every backup walk and public static root. One atomic
17
+ * metadata file per export prevents unrelated concurrent creates from overwriting each other.
18
+ * Revocation is a permanent create-only tombstone: a racing upload can never resurrect access.
19
+ * @complexity O(exports) listing; O(1) token lookup/updates, plus artifact bytes on disk.
20
+ */
21
+ export class SiteShareRegistry {
22
+ directory;
23
+ host;
24
+ now;
25
+ /** @param optional.now The host clock (epoch ms) the public lookup compares `expiresAt` against; a host should inject its own. */
26
+ constructor(required, optional = {}) { this.directory = required.directory; this.host = required.host; this.now = optional.now ?? Date.now; }
27
+ meta({ id }, _optional = {}) {
28
+ if (!ID.test(id))
29
+ throw new SiteShareRefusal({ code: "INVALID_INPUT", message: "Invalid shareId." });
30
+ return path.join(this.directory, `${id}.json`);
31
+ }
32
+ artifactPath(required, _optional = {}) {
33
+ this.meta({ id: required.shareId });
34
+ return path.join(this.directory, `${required.shareId}${this.host.artifactSuffix}`);
35
+ }
36
+ /** Immutable token-to-id claim gives O(1) public lookups and forbids replay after revocation. */
37
+ async reserveToken(required, _optional = {}) {
38
+ if (!SHARE_TOKEN.test(required.token))
39
+ throw new SiteShareRefusal({ code: "INVALID_INPUT", message: "Invalid share token." });
40
+ this.meta({ id: required.shareId });
41
+ await mkdir(this.directory, { recursive: true, mode: 0o700 });
42
+ const file = path.join(this.directory, `${required.token}.token`);
43
+ try {
44
+ await writeFile(file, required.shareId, { flag: "wx", mode: 0o600 });
45
+ }
46
+ catch (error) {
47
+ if (error.code !== "EEXIST")
48
+ throw error;
49
+ if (await readFile(file, "utf8") !== required.shareId)
50
+ throw new SiteShareRefusal({ code: "TOKEN_EXISTS", message: "This share token has already been used. Create a new export." });
51
+ }
52
+ }
53
+ async put(required, _optional = {}) {
54
+ await this.reserveToken(required.record);
55
+ await this.writeRecord(required.record);
56
+ }
57
+ /** Atomic metadata write with no token-shape check, so `disable` can still tombstone a row minted
58
+ * before the 16-letter switch (its token was reserved when it was created). */
59
+ async writeRecord(record) {
60
+ const temp = path.join(this.directory, `.${randomUUID()}.tmp`);
61
+ try {
62
+ await writeFile(temp, JSON.stringify(record), { flag: "wx", mode: 0o600 });
63
+ await rename(temp, this.meta({ id: record.shareId }));
64
+ }
65
+ finally {
66
+ await unlink(temp).catch(error => { if (error.code !== "ENOENT")
67
+ throw error; });
68
+ }
69
+ }
70
+ async get(required, _optional = {}) {
71
+ const stored = await this.readRow(required.shareId);
72
+ if (!stored)
73
+ return null;
74
+ const row = { ...stored, credentialWarnings: stored.credentialWarnings ?? [], needsAcknowledgement: stored.needsAcknowledgement ?? false };
75
+ if (required.site !== undefined && row.site !== required.site)
76
+ return null;
77
+ const revokedAt = await this.readTombstone(`${row.shareId}.revoked`);
78
+ if (revokedAt !== null)
79
+ return { ...row, status: "revoked", revokedAt };
80
+ // Checked after `.revoked` so `revoked > expired`; like revocation, a racing whole-record `put`
81
+ // (acknowledge, delivery rewrite) cannot bring an expired link back to `active`.
82
+ if (await this.readTombstone(`${row.shareId}.expired`) !== null)
83
+ return { ...row, status: "expired" };
84
+ return row;
85
+ }
86
+ async readRow(shareId) {
87
+ try {
88
+ return JSON.parse(await readFile(this.meta({ id: shareId }), "utf8"));
89
+ }
90
+ catch (error) {
91
+ if (error.code === "ENOENT") {
92
+ return null;
93
+ }
94
+ throw error;
95
+ }
96
+ }
97
+ /** A tombstone's content, or null when it does not exist; any other read error propagates. */
98
+ async readTombstone(name) {
99
+ try {
100
+ return await readFile(path.join(this.directory, name), "utf8");
101
+ }
102
+ catch (error) {
103
+ if (error.code !== "ENOENT")
104
+ throw error;
105
+ return null;
106
+ }
107
+ }
108
+ /**
109
+ * The permanent, create-only expiry tombstone (content: the stated `expiresAt`), synced to disk
110
+ * before returning so the artifact is never unlinked while a reader could still see `active`.
111
+ * An existing tombstone is success: a crash between this and the unlink is retried by the next pass.
112
+ */
113
+ async markExpired(required, _optional = {}) {
114
+ this.meta({ id: required.shareId });
115
+ const file = path.join(this.directory, `${required.shareId}.expired`);
116
+ let handle;
117
+ try {
118
+ handle = await open(file, "wx", 0o600);
119
+ }
120
+ catch (error) {
121
+ if (error.code === "EEXIST")
122
+ return;
123
+ throw error;
124
+ }
125
+ try {
126
+ await handle.writeFile(required.expiresAt);
127
+ await handle.sync();
128
+ }
129
+ finally {
130
+ await handle.close();
131
+ }
132
+ }
133
+ async list(required, _optional = {}) {
134
+ let names;
135
+ try {
136
+ names = await readdir(this.directory);
137
+ }
138
+ catch (error) {
139
+ if (error.code === "ENOENT") {
140
+ return [];
141
+ }
142
+ throw error;
143
+ }
144
+ const rows = [];
145
+ for (const name of names) {
146
+ if (!name.endsWith(".json") || !ID.test(name.slice(0, -5)))
147
+ continue;
148
+ const row = await this.get({ shareId: name.slice(0, -5), ...required });
149
+ if (row)
150
+ rows.push(row);
151
+ }
152
+ return rows.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
153
+ }
154
+ async findToken(required, _optional = {}) {
155
+ if (!SHARE_TOKEN.test(required.token) || !this.host.shareFile.test(required.file))
156
+ return null;
157
+ let shareId;
158
+ try {
159
+ shareId = await readFile(path.join(this.directory, `${required.token}.token`), "utf8");
160
+ }
161
+ catch (error) {
162
+ if (error.code === "ENOENT") {
163
+ return null;
164
+ }
165
+ throw error;
166
+ }
167
+ const row = await this.get({ shareId });
168
+ return row && servesToken({ row, ...required }) && !isShareExpired({ row, now: this.now() }) ? row : null;
169
+ }
170
+ async disable(required, _optional = {}) {
171
+ const row = await this.get(required);
172
+ if (!row)
173
+ return null;
174
+ const revokedAt = row.revokedAt ?? new Date().toISOString();
175
+ try {
176
+ await writeFile(path.join(this.directory, `${row.shareId}.revoked`), revokedAt, { flag: "wx", mode: 0o600 });
177
+ }
178
+ catch (error) {
179
+ if (error.code !== "EEXIST")
180
+ throw error;
181
+ }
182
+ const revoked = { ...row, status: "revoked", revokedAt };
183
+ await this.writeRecord(revoked);
184
+ return revoked;
185
+ }
186
+ async writeArtifact(required, _optional = {}) {
187
+ if (required.bytes.length > this.host.maxArchiveBytes)
188
+ throw new SiteShareRefusal({ code: "LIMIT_EXCEEDED", message: "Share exceeds the 300 MiB archive cap." });
189
+ await mkdir(this.directory, { recursive: true, mode: 0o700 });
190
+ const space = await statfs(this.directory);
191
+ if (space.bavail * space.bsize < required.bytes.length + 16 * 1024 * 1024)
192
+ throw new SiteShareRefusal({ code: "INSUFFICIENT_STORAGE", message: "Insufficient private storage for this ZIP and 16 MiB of working space." });
193
+ await writeFile(this.artifactPath(required), required.bytes, { flag: "wx", mode: 0o600 });
194
+ }
195
+ /** Read the same private artifact this registry wrote; paths never come from HTTP input.
196
+ * @complexity O(archive bytes), bounded by the share archive cap.
197
+ */
198
+ async readArtifact(required, _optional = {}) {
199
+ return readFile(this.artifactPath(required));
200
+ }
201
+ async deleteArtifact(required, _optional = {}) {
202
+ await unlink(this.artifactPath(required)).catch(error => { if (error.code !== "ENOENT")
203
+ throw error; });
204
+ }
205
+ }
206
+ /** A public token serves only its own active, acknowledged file. */
207
+ function servesToken({ row, token, file }, _optional = {}) {
208
+ return row.token === token && row.file === file && row.status === "active" && !row.needsAcknowledgement && !row.credentialWarnings?.length;
209
+ }
210
+ /**
211
+ * A fresh share id and public token. `randomInt` draws from the CSPRNG and rejection-samples, so each
212
+ * of the 52 letters is equally likely (no modulo bias): 16 draws give log2(52^16) ≈ 91 bits.
213
+ * @complexity O(SHARE_TOKEN_LENGTH).
214
+ */
215
+ export function newShareIdentity(_required, _optional = {}) {
216
+ const token = Array.from({ length: SHARE_TOKEN_LENGTH }, () => SHARE_TOKEN_ALPHABET[randomInt(SHARE_TOKEN_ALPHABET.length)]).join("");
217
+ return { shareId: randomUUID(), token };
218
+ }
219
+ //# sourceMappingURL=share-registry.js.map