@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,272 @@
1
+ import { ImportHistoryUnavailable, importHistoryMissing, mapSqliteError } from './errors.js';
2
+ /**
3
+ * Import-history authority: which store (legacy JSON snapshot or the SQLite index) owns the
4
+ * history, the write fence that records an indexed write before its SQL runs, and the tidy-only
5
+ * retirement of the JSON snapshot. The state lives OUTSIDE the DB because it must still say
6
+ * "indexed" when the DB itself is gone; together with the witness file it stops a missing DB from
7
+ * reopening the stale JSON snapshot, which lacks every post-cutover row and request fence.
8
+ */
9
+ export const IMPORT_INDEX_STATE_SCHEMA = 'site-import-index-state/1';
10
+ const UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
11
+ const HISTORY_FILE = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\.json$/;
12
+ const STATE_KEYS = ['cutoverAt', 'dbId', 'firstIndexedWriteAt', 'legacyRetiredAt', 'mode', 'schema'].join();
13
+ const RETIRE_BATCH = 200;
14
+ /** Fixed paths under the workspace root. Neither name matches `^<uuid>\.json$`, so no build reads them as a record. */
15
+ export function indexStatePaths({ root }, _optional = {}) {
16
+ return { state: `${root}/import-index.state.json`, witness: `${root}/.history-indexed-v1` };
17
+ }
18
+ const legacyState = () => ({ schema: IMPORT_INDEX_STATE_SCHEMA, mode: 'legacy', dbId: null, cutoverAt: 0, firstIndexedWriteAt: 0, legacyRetiredAt: 0 });
19
+ const isTime = (value) => Number.isSafeInteger(value) && value >= 0;
20
+ // Each mode's invariant as one list of checks, so every field is judged and nothing is inferred from another.
21
+ function modeChecks({ state }) {
22
+ const recordedCutover = [typeof state.dbId === 'string' && UUID.test(state.dbId), state.cutoverAt > 0];
23
+ if (state.mode === 'legacy')
24
+ return [state.dbId === null, state.cutoverAt === 0, state.firstIndexedWriteAt === 0, state.legacyRetiredAt === 0];
25
+ if (state.mode === 'cutover')
26
+ return [...recordedCutover, state.firstIndexedWriteAt === 0, state.legacyRetiredAt === 0];
27
+ return [state.mode === 'indexed', ...recordedCutover, state.firstIndexedWriteAt > 0];
28
+ }
29
+ const modeFieldsValid = ({ state }) => modeChecks({ state }).every(Boolean);
30
+ /** Strict shape check: an exact key set and per-mode invariants. Nothing is salvaged from a near miss. */
31
+ export function parseIndexState({ value }, _optional = {}) {
32
+ if (Object.prototype.toString.call(value) !== '[object Object]')
33
+ return undefined;
34
+ const state = value;
35
+ if (Object.keys(state).sort().join() !== STATE_KEYS || state.schema !== IMPORT_INDEX_STATE_SCHEMA)
36
+ return undefined;
37
+ if (![state.cutoverAt, state.firstIndexedWriteAt, state.legacyRetiredAt].every(isTime))
38
+ return undefined;
39
+ return modeFieldsValid({ state }) ? state : undefined;
40
+ }
41
+ export function readIndexState({ file, readJson }, _optional = {}) {
42
+ const read = readJson({ file }, {});
43
+ if (read.state === 'missing')
44
+ return { kind: 'missing' };
45
+ // Unreadable or malformed state might have said "indexed", so it is never repaired or set aside here.
46
+ const state = read.state === 'ok' ? parseIndexState({ value: read.value }) : undefined;
47
+ return state === undefined ? { kind: 'invalid' } : { kind: 'valid', state };
48
+ }
49
+ /** `writeJson` must replace the file atomically in private mode (temp file, fsync, rename, directory flush). */
50
+ export function writeIndexState({ file, writeJson, state }, _optional = {}) {
51
+ // Publishing a shape readIndexState rejects would refuse every later open.
52
+ if (parseIndexState({ value: state }) === undefined)
53
+ throw new TypeError('Refusing to write an invalid import index state.');
54
+ writeJson({ file, value: state }, {});
55
+ }
56
+ const LEGACY = { mode: 'legacy' };
57
+ const SQLITE_MESSAGES = {
58
+ busy: 'Import history is busy. Try again in a moment.',
59
+ storage: 'There is not enough free disk space to record the import. Free up space and try again.',
60
+ damaged: 'Import history could not be read. Imports are paused and nothing was changed. Contact support with this error ID.',
61
+ };
62
+ function classifyOpenError({ error }) {
63
+ if (error?.code === 'ENOENT')
64
+ return { kind: 'untrusted', reason: 'missing' };
65
+ let mapped = error;
66
+ try {
67
+ mapSqliteError({ error, messages: SQLITE_MESSAGES });
68
+ }
69
+ catch (thrown) {
70
+ mapped = thrown;
71
+ }
72
+ if (!(mapped instanceof ImportHistoryUnavailable))
73
+ throw error;
74
+ if (mapped.code === 'IMPORT_HISTORY_DAMAGED')
75
+ return { kind: 'untrusted', reason: 'damaged', error: mapped };
76
+ if (mapped.code === 'IMPORT_HISTORY_NEWER')
77
+ return { kind: 'refused', error: mapped };
78
+ // Busy and out-of-space are transient: thrown, so the host neither repairs nor latches a refusal.
79
+ throw mapped;
80
+ }
81
+ const metaValue = ({ db, key }) => db.prepare('SELECT value FROM meta WHERE key = ?').get(key)?.value;
82
+ function openChecked({ args, state }) {
83
+ // Opening a DB that is not there could create an empty one, so missing evidence never opens.
84
+ if (!args.evidence.dbArtifactsPresent)
85
+ return { kind: 'untrusted', reason: 'missing' };
86
+ let handle;
87
+ try {
88
+ handle = args.openExisting({ readonly: args.access === 'read' }, {});
89
+ }
90
+ catch (error) {
91
+ return classifyOpenError({ error });
92
+ }
93
+ try {
94
+ // db_id ties the DB to this workspace; cutover_at ties it to this cutover, so a copied or older DB is refused.
95
+ if (metaValue({ db: handle.db, key: 'db_id' }) === state.dbId && metaValue({ db: handle.db, key: 'cutover_at' }) === String(state.cutoverAt))
96
+ return { kind: 'ok', handle };
97
+ handle.close({}, {});
98
+ return { kind: 'untrusted', reason: 'mismatch' };
99
+ }
100
+ catch (error) {
101
+ try {
102
+ handle.close({}, {});
103
+ }
104
+ catch { }
105
+ return classifyOpenError({ error });
106
+ }
107
+ }
108
+ function resolveLegacy({ args, publishLegacy, allowBackfill }) {
109
+ if (args.access === 'read' || args.policy.cutoverPolicy === 'rollback' || !allowBackfill)
110
+ return LEGACY;
111
+ // Explicit legacy before any candidate open lets a later open tell an interrupted first backfill
112
+ // (legacy state + DB artifacts) from lost state (no state + DB artifacts, which is refused).
113
+ if (publishLegacy)
114
+ args.writeState({ state: legacyState() }, {});
115
+ const result = args.backfill({}, {});
116
+ if (result.state === 'blocked')
117
+ return LEGACY;
118
+ // The SQL marker proves a complete candidate; authority moves only with this later state publish.
119
+ const cutover = { schema: IMPORT_INDEX_STATE_SCHEMA, mode: 'cutover', dbId: result.dbId, cutoverAt: result.cutoverAt, firstIndexedWriteAt: 0, legacyRetiredAt: 0 };
120
+ args.writeState({ state: cutover }, {});
121
+ // The backfill just committed the DB, so the earlier probe is stale; a failed check must not rebuild in a loop.
122
+ return resolveCutover({ args: { ...args, evidence: { ...args.evidence, dbArtifactsPresent: true } }, state: cutover, allowBackfill: false });
123
+ }
124
+ function resolveCutover({ args, state, allowBackfill }) {
125
+ const opened = openChecked({ args, state });
126
+ if (opened.kind === 'refused')
127
+ return { mode: 'refused', error: opened.error };
128
+ if (opened.kind === 'ok') {
129
+ if (args.policy.cutoverPolicy === 'enable')
130
+ return { mode: 'cutover', state, handle: opened.handle };
131
+ opened.handle.close({}, {});
132
+ // Pre-write rollback: the DB still equals the JSON, but JSON may be written only once legacy authority is durable.
133
+ if (args.access === 'locked')
134
+ args.writeState({ state: legacyState() }, {});
135
+ return LEGACY;
136
+ }
137
+ // Before the first indexed write a missing, damaged or foreign DB leaves legacy authoritative.
138
+ // Pending owner stages live in payloads/, which nothing here touches, so owner setup still completes.
139
+ if (args.access === 'read')
140
+ return LEGACY;
141
+ args.prepareRetry({ reason: opened.reason }, {});
142
+ args.writeState({ state: legacyState() }, {});
143
+ return resolveLegacy({ args, publishLegacy: false, allowBackfill });
144
+ }
145
+ function resolveIndexed({ args, state }) {
146
+ if (args.policy.cutoverPolicy === 'rollback')
147
+ args.log({ message: 'Rollback is not possible after the first indexed import write; the index-aware store stays in use.' }, {});
148
+ const opened = openChecked({ args, state });
149
+ if (opened.kind === 'ok')
150
+ return { mode: 'indexed', state, handle: opened.handle };
151
+ if (opened.kind === 'refused')
152
+ return { mode: 'refused', error: opened.error };
153
+ // Never fall back to legacy: the snapshot lacks post-cutover rows and fences, so it would admit duplicates.
154
+ return { mode: 'refused', error: opened.reason === 'damaged' && opened.error !== undefined ? opened.error : importHistoryMissing({}) };
155
+ }
156
+ /** Picks the authority for one lock acquisition (or one lock-free read). The host latches a refusal. */
157
+ export function resolveMode(args, _optional = {}) {
158
+ const { state, evidence } = args;
159
+ if (state.kind === 'invalid')
160
+ return { mode: 'refused', error: importHistoryMissing({}) };
161
+ if (state.kind === 'missing') {
162
+ // DB artifacts or a witness without a state file means the state was lost, not that history never existed.
163
+ if (evidence.dbArtifactsPresent || evidence.indexedWitnessPresent)
164
+ return { mode: 'refused', error: importHistoryMissing({}) };
165
+ return resolveLegacy({ args, publishLegacy: true, allowBackfill: true });
166
+ }
167
+ if (state.state.mode === 'indexed')
168
+ return resolveIndexed({ args, state: state.state });
169
+ // The witness is written only after state says indexed, so beside an earlier mode it proves the state went backwards.
170
+ if (evidence.indexedWitnessPresent)
171
+ return { mode: 'refused', error: importHistoryMissing({}) };
172
+ return state.state.mode === 'cutover' ? resolveCutover({ args, state: state.state, allowBackfill: true }) : resolveLegacy({ args, publishLegacy: false, allowBackfill: true });
173
+ }
174
+ /** Throws unless a legacy JSON put is allowed under the current lock. */
175
+ export function confirmLegacyAuthority({ state, evidence }, _optional = {}) {
176
+ const legacy = state.kind === 'missing' ? !evidence.dbArtifactsPresent : state.kind === 'valid' && state.state.mode === 'legacy';
177
+ if (!legacy || evidence.indexedWitnessPresent)
178
+ throw importHistoryMissing({});
179
+ }
180
+ /**
181
+ * The write fence, called before every indexed SQL mutation (admission, recovery/expiry put,
182
+ * ordinary put). State is durably indexed first, then the witness exists, and only then may SQL run;
183
+ * a throw from either step means no SQL. A crash after the fence but before SQL only closes the
184
+ * legacy fallback early, which is the conservative direction.
185
+ */
186
+ export function markIndexedWrite({ state, clock, writeState, ensureIndexedWitness }, _optional = {}) {
187
+ if (state.mode === 'legacy')
188
+ throw new TypeError('An indexed write needs cutover or indexed authority; legacy writes go to the JSON snapshot.');
189
+ if (state.mode === 'indexed') {
190
+ // Re-establishes a lost witness; resolveMode already validated the DB under this lock.
191
+ ensureIndexedWitness({}, {});
192
+ return state;
193
+ }
194
+ const next = { ...state, mode: 'indexed', firstIndexedWriteAt: clock.nowMs() };
195
+ writeState({ state: next }, {});
196
+ ensureIndexedWitness({}, {});
197
+ return next;
198
+ }
199
+ /** Creates `<root>/.history-indexed-v1` exclusively at 0600, fsyncs it, flushes the root. Monotonic: never retired. */
200
+ export function writeIndexedWitness({ root, fs }, _optional = {}) {
201
+ const file = indexStatePaths({ root }).witness;
202
+ try {
203
+ fs.writeExclusive({ file, mode: 0o600 }, {});
204
+ }
205
+ catch (error) {
206
+ if (error?.code !== 'EEXIST' || fs.kind({ file }, {}) !== 'file')
207
+ throw error;
208
+ }
209
+ fs.fsyncFile({ file }, {});
210
+ fs.fsyncDir({ dir: root }, {});
211
+ }
212
+ function classifyHistoryFiles({ root, fs, cutoverAt }) {
213
+ const eligible = [];
214
+ let newer = 0;
215
+ for (const name of fs.readdir({ dir: root }, {})) {
216
+ // Only snapshot records match; state, witness, DB artifacts and payloads/ never do.
217
+ if (!HISTORY_FILE.test(name))
218
+ continue;
219
+ const stat = fs.stat({ file: `${root}/${name}` }, {});
220
+ if (stat.kind !== 'file')
221
+ continue;
222
+ // A newer file can only come from a pre-index build after a downgrade, so it may be the only copy.
223
+ if (stat.mtimeMs > cutoverAt)
224
+ newer++;
225
+ else
226
+ eligible.push(`${root}/${name}`);
227
+ }
228
+ return { eligible, newer };
229
+ }
230
+ function unlinkBatch({ fs, files }) {
231
+ let removed = 0;
232
+ let gone = 0;
233
+ for (const file of files) {
234
+ try {
235
+ fs.unlink({ file }, {});
236
+ removed++;
237
+ }
238
+ catch (error) {
239
+ // Already gone counts as done; any other failure stays for the next tidy.
240
+ if (error?.code === 'ENOENT')
241
+ gone++;
242
+ }
243
+ }
244
+ return { removed, failed: files.length - removed - gone };
245
+ }
246
+ /**
247
+ * Tidy-only retention (owner-decided, no approval card): in indexed mode, from `cutoverAt +
248
+ * legacyRetireMs`, deletes at most 200 old regular snapshot files per pass. `legacyRetiredAt` is
249
+ * set only once no eligible file remains, so a partial or failed pass resumes on the next tidy.
250
+ */
251
+ export function retireLegacySnapshot({ root, state, clock, policy, fs, writeState, log }, _optional = {}) {
252
+ // Cutover still lets legacy take authority back, so the snapshot must survive until indexed.
253
+ if (state.mode !== 'indexed')
254
+ return { removed: 0, finished: false };
255
+ if (state.legacyRetiredAt !== 0)
256
+ return { removed: 0, finished: true };
257
+ const now = clock.nowMs();
258
+ if (now < state.cutoverAt + policy.legacyRetireMs)
259
+ return { removed: 0, finished: false };
260
+ const { eligible, newer } = classifyHistoryFiles({ root, fs, cutoverAt: state.cutoverAt });
261
+ if (newer > 0)
262
+ log({ message: `Kept ${newer} import history files written after the switch to indexed history.` }, {});
263
+ const batch = eligible.slice(0, RETIRE_BATCH);
264
+ const { removed, failed } = unlinkBatch({ fs, files: batch });
265
+ if (failed > 0)
266
+ log({ message: `${failed} old import history files could not be removed; tidy will retry.` }, {});
267
+ const finished = failed === 0 && batch.length === eligible.length;
268
+ if (finished)
269
+ writeState({ state: { ...state, legacyRetiredAt: now } }, {});
270
+ return { removed, finished };
271
+ }
272
+ //# sourceMappingURL=mode.js.map
@@ -0,0 +1,40 @@
1
+ import type { ImportHistoryPolicy } from '@jini-ai/core/contracts/site/site-import-history';
2
+ import type { SqliteSyncClient, SqliteSyncOpener } from '@jini-ai/core/contracts/storage';
3
+ /** A memo key: `[file, db_id]` text when the DB has an id, else the open handle itself. */
4
+ export type ImportIndexIntegrityKey = string | SqliteSyncClient;
5
+ /** Remembers which import-index DBs already passed the integrity check. */
6
+ export interface ImportIndexIntegrityMemo {
7
+ has(required: {
8
+ key: ImportIndexIntegrityKey;
9
+ }, optional?: Record<string, never>): boolean;
10
+ add(required: {
11
+ key: ImportIndexIntegrityKey;
12
+ }, optional?: Record<string, never>): void;
13
+ }
14
+ /**
15
+ * Creates one integrity memo. Each composed backend owns its own, because the integrity
16
+ * check is slow and re-running it on every open of the same file+db_id is wasted work,
17
+ * while a module-level memo would leak "already checked" across unrelated hosts and tests.
18
+ */
19
+ export declare function createImportIndexIntegrityMemo(_required: Record<string, never>, _optional?: Record<string, never>): ImportIndexIntegrityMemo;
20
+ export declare function openImportIndex({ file, open, clock, policy, checkIntegrity, integrityMemo }: {
21
+ file: string;
22
+ open: SqliteSyncOpener;
23
+ clock: {
24
+ nowMs(): number;
25
+ };
26
+ policy: ImportHistoryPolicy;
27
+ integrityMemo: ImportIndexIntegrityMemo;
28
+ checkIntegrity: (required: {
29
+ db: SqliteSyncClient;
30
+ file: string;
31
+ }, optional?: Record<string, never>) => void;
32
+ }, { mustExist, readonly }?: {
33
+ mustExist?: boolean;
34
+ readonly?: boolean;
35
+ }): {
36
+ db: SqliteSyncClient;
37
+ store: import("./store.js").ImportIndexStore;
38
+ close(_required: Record<string, never>, _optional?: Record<string, never>): void;
39
+ };
40
+ //# sourceMappingURL=open.d.ts.map
@@ -0,0 +1,87 @@
1
+ import { ImportHistoryUnavailable, mapSqliteError } from './errors.js';
2
+ import { migrateImportIndex } from './schema.js';
3
+ import { IMPORT_INDEX_MIGRATION_CHECKSUMS } from './migrations/checksums.js';
4
+ import { createImportIndexStore } from './store.js';
5
+ /**
6
+ * Creates one integrity memo. Each composed backend owns its own, because the integrity
7
+ * check is slow and re-running it on every open of the same file+db_id is wasted work,
8
+ * while a module-level memo would leak "already checked" across unrelated hosts and tests.
9
+ */
10
+ export function createImportIndexIntegrityMemo(_required, _optional = {}) {
11
+ const identities = new Set();
12
+ const handles = new WeakSet();
13
+ return {
14
+ has: ({ key }, _optional = {}) => typeof key === 'string' ? identities.has(key) : handles.has(key),
15
+ add: ({ key }, _optional = {}) => { if (typeof key === 'string')
16
+ identities.add(key);
17
+ else
18
+ handles.add(key); },
19
+ };
20
+ }
21
+ const DAMAGED_MESSAGE = 'Import history could not be read. Imports are paused and nothing was changed. Contact support with this error ID.';
22
+ function damaged(_required, _optional = {}) {
23
+ return new ImportHistoryUnavailable({ code: 'IMPORT_HISTORY_DAMAGED', status: 503, message: DAMAGED_MESSAGE });
24
+ }
25
+ function userVersion({ db }, _optional = {}) {
26
+ return Number(db.pragma('user_version', { simple: true }));
27
+ }
28
+ // A reader never migrates, so it must prove the file is exactly the schema this build understands.
29
+ function assertReadableSchema({ db }, _optional = {}) {
30
+ const version = userVersion({ db });
31
+ if (version > 1)
32
+ throw new ImportHistoryUnavailable({ code: 'IMPORT_HISTORY_NEWER', status: 503, message: 'Import history was written by a newer version of the app. Update the app to continue.' });
33
+ if (version !== 1)
34
+ throw damaged({});
35
+ const applied = db.prepare('SELECT id, checksum FROM site_import_migrations ORDER BY id').all();
36
+ const schema = db.prepare("SELECT value FROM meta WHERE key='schema'").get();
37
+ const ledgerMatches = applied.length === 1 && applied[0].id === 'site-imports-v1' && applied[0].checksum === IMPORT_INDEX_MIGRATION_CHECKSUMS['site-imports-v1'];
38
+ if (!ledgerMatches || schema?.value !== 'site-imports-v1')
39
+ throw damaged({});
40
+ }
41
+ function configureConnection({ db, readonly }, _optional = {}) {
42
+ if (!readonly) {
43
+ db.pragma('journal_mode = WAL');
44
+ db.pragma('synchronous = FULL');
45
+ }
46
+ db.pragma('busy_timeout = 5000');
47
+ db.pragma('foreign_keys = ON');
48
+ }
49
+ function prepareDatabase({ db, clock, readonly, mustExist }, _optional = {}) {
50
+ configureConnection({ db, readonly });
51
+ if ((readonly || mustExist) && userVersion({ db }) === 0)
52
+ throw damaged({});
53
+ if (readonly)
54
+ assertReadableSchema({ db });
55
+ else
56
+ migrateImportIndex({ db, clock });
57
+ }
58
+ function checkIntegrityOnce({ db, file, checkIntegrity, integrityMemo }, _optional = {}) {
59
+ const dbId = db.prepare("SELECT value FROM meta WHERE key='db_id'").get()?.value;
60
+ const key = dbId === undefined ? db : JSON.stringify([file, dbId]);
61
+ if (integrityMemo.has({ key }))
62
+ return;
63
+ checkIntegrity({ db, file }, {});
64
+ integrityMemo.add({ key });
65
+ }
66
+ export function openImportIndex({ file, open, clock, policy, checkIntegrity, integrityMemo }, { mustExist = false, readonly = false } = {}) {
67
+ let db;
68
+ try {
69
+ db = open(file, { readonly, fileMustExist: readonly || mustExist });
70
+ prepareDatabase({ db, clock, readonly, mustExist });
71
+ checkIntegrityOnce({ db, file, checkIntegrity, integrityMemo });
72
+ const handle = db;
73
+ return { db: handle, store: createImportIndexStore({ db: handle, clock, policy }), close(_required, _optional = {}) { handle.close(); } };
74
+ }
75
+ catch (error) {
76
+ try {
77
+ db?.close();
78
+ }
79
+ catch { }
80
+ return mapSqliteError({ error, messages: {
81
+ busy: 'Import history is busy. Try again in a moment.',
82
+ storage: 'There is not enough free disk space to record the import. Free up space and try again.',
83
+ damaged: DAMAGED_MESSAGE,
84
+ } });
85
+ }
86
+ }
87
+ //# sourceMappingURL=open.js.map
@@ -0,0 +1,28 @@
1
+ import type { ImportHistoryPolicy, SiteImportPage, SiteImportRecord } from '@jini-ai/core/contracts/site/site-import-history';
2
+ import type { SqliteSyncClient } from '@jini-ai/core/contracts/storage';
3
+ export declare function encodeCursor({ createdMs, importId }: {
4
+ createdMs: number;
5
+ importId: string;
6
+ }, _optional?: Record<string, never>): string;
7
+ export declare function decodeCursor({ cursor }: {
8
+ cursor: string;
9
+ }, _optional?: Record<string, never>): {
10
+ createdMs: number;
11
+ importId: string;
12
+ };
13
+ export declare function listPage({ db, clock, policy, principalId, cursor, limit }: {
14
+ db: SqliteSyncClient;
15
+ clock: {
16
+ nowMs(): number;
17
+ };
18
+ policy: ImportHistoryPolicy;
19
+ principalId: string;
20
+ cursor?: string;
21
+ limit?: number;
22
+ }, _optional?: Record<string, never>): SiteImportPage<SiteImportRecord>;
23
+ export declare function listAll({ readPage }: {
24
+ readPage: (required: {
25
+ cursor?: string;
26
+ }, optional?: Record<string, never>) => SiteImportPage<SiteImportRecord>;
27
+ }, _optional?: Record<string, never>): SiteImportRecord[];
28
+ //# sourceMappingURL=paging.d.ts.map
@@ -0,0 +1,66 @@
1
+ import { SiteShareRefusal } from '../share-refusal.js';
2
+ const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
3
+ const CURSOR = /^v1\.([0-9]{1,15})\.([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$/;
4
+ export function encodeCursor({ createdMs, importId }, _optional = {}) {
5
+ const text = `v1.${createdMs}.${importId}`;
6
+ let cursor = '';
7
+ let buffer = 0;
8
+ let bits = 0;
9
+ for (let index = 0; index < text.length; index++) {
10
+ buffer = (buffer << 8) | text.charCodeAt(index);
11
+ bits += 8;
12
+ while (bits >= 6) {
13
+ bits -= 6;
14
+ cursor += ALPHABET[(buffer >>> bits) & 63];
15
+ }
16
+ }
17
+ if (bits > 0)
18
+ cursor += ALPHABET[(buffer << (6 - bits)) & 63];
19
+ return cursor;
20
+ }
21
+ export function decodeCursor({ cursor }, _optional = {}) {
22
+ const invalid = { code: 'INVALID_CURSOR', message: 'This list of imports changed. Reload it to see the newest imports.' };
23
+ if (cursor.length > 96 || !/^[A-Za-z0-9_-]+$/.test(cursor))
24
+ throw new SiteShareRefusal(invalid);
25
+ let text = '';
26
+ let buffer = 0;
27
+ let bits = 0;
28
+ for (const character of cursor) {
29
+ buffer = (buffer << 6) | ALPHABET.indexOf(character);
30
+ bits += 6;
31
+ if (bits >= 8) {
32
+ bits -= 8;
33
+ text += String.fromCharCode((buffer >>> bits) & 255);
34
+ }
35
+ }
36
+ const match = CURSOR.exec(text);
37
+ if (!match)
38
+ throw new SiteShareRefusal(invalid);
39
+ const result = { createdMs: Number(match[1]), importId: match[2] };
40
+ if (!Number.isSafeInteger(result.createdMs) || result.createdMs < 0 || encodeCursor(result) !== cursor)
41
+ throw new SiteShareRefusal(invalid);
42
+ return result;
43
+ }
44
+ export function listPage({ db, clock, policy, principalId, cursor, limit }, _optional = {}) {
45
+ const size = limit !== undefined && Number.isInteger(limit) ? Math.max(1, Math.min(50, limit)) : 50;
46
+ const now = clock.nowMs();
47
+ const bound = cursor === undefined ? undefined : decodeCursor({ cursor });
48
+ // A cursor never selects a principal.
49
+ const sql = `SELECT row_json FROM imports WHERE principal_id = ? AND (settled_ms IS NULL OR settled_ms > ?)${bound === undefined ? '' : ' AND (created_ms, import_id) < (?,?)'} ORDER BY created_ms DESC, import_id DESC LIMIT ?`;
50
+ const parameters = bound === undefined ? [principalId, now - policy.historyVisibleMs, size + 1] : [principalId, now - policy.historyVisibleMs, bound.createdMs, bound.importId, size + 1];
51
+ const rows = db.prepare(sql).all(...parameters);
52
+ const imports = rows.slice(0, size).map(row => JSON.parse(row.row_json));
53
+ const last = imports.at(-1);
54
+ return { imports, ...(rows.length > size && last !== undefined ? { nextCursor: encodeCursor({ createdMs: Date.parse(last.createdAt), importId: last.importId }) } : {}) };
55
+ }
56
+ export function listAll({ readPage }, _optional = {}) {
57
+ const imports = [];
58
+ let cursor;
59
+ do {
60
+ const page = readPage(cursor === undefined ? {} : { cursor }, {});
61
+ imports.push(...page.imports);
62
+ cursor = page.nextCursor;
63
+ } while (cursor !== undefined);
64
+ return imports;
65
+ }
66
+ //# sourceMappingURL=paging.js.map
@@ -0,0 +1,80 @@
1
+ import type { JsonFileRead } from '@jini-ai/core/contracts/site/fs-durable-json';
2
+ export interface ImportPayloadFs {
3
+ readdir(required: {
4
+ dir: string;
5
+ }, optional?: Record<string, never>): string[];
6
+ kind(required: {
7
+ file: string;
8
+ }, optional?: Record<string, never>): 'file' | 'directory' | 'other' | 'missing';
9
+ rename(required: {
10
+ from: string;
11
+ to: string;
12
+ }, optional?: Record<string, never>): void;
13
+ rm(required: {
14
+ file: string;
15
+ recursive: boolean;
16
+ }, optional?: Record<string, never>): void;
17
+ mkdir(required: {
18
+ dir: string;
19
+ mode: number;
20
+ }, optional?: Record<string, never>): void;
21
+ chmod(required: {
22
+ file: string;
23
+ mode: number;
24
+ }, optional?: Record<string, never>): void;
25
+ writeExclusive(required: {
26
+ file: string;
27
+ mode: number;
28
+ }, optional?: Record<string, never>): void;
29
+ fsyncFile(required: {
30
+ file: string;
31
+ }, optional?: Record<string, never>): void;
32
+ fsyncDir(required: {
33
+ dir: string;
34
+ }, optional?: Record<string, never>): void;
35
+ }
36
+ export declare function payloadPaths({ root }: {
37
+ root: string;
38
+ }, _optional?: Record<string, never>): {
39
+ dir: string;
40
+ marker: string;
41
+ upload: ({ uploadId }: {
42
+ uploadId: string;
43
+ }, _optional?: Record<string, never>) => string;
44
+ uploadMeta: ({ uploadId }: {
45
+ uploadId: string;
46
+ }, _optional?: Record<string, never>) => string;
47
+ stage: ({ importId }: {
48
+ importId: string;
49
+ }, _optional?: Record<string, never>) => string;
50
+ };
51
+ export declare function ensurePayloadNamespace({ root, paths, fs }: {
52
+ root: string;
53
+ paths: ReturnType<typeof payloadPaths>;
54
+ fs: ImportPayloadFs;
55
+ }, _optional?: Record<string, never>): void;
56
+ type ExpireReaders = {
57
+ readUpload: (required: {
58
+ uploadId: string;
59
+ }, optional?: Record<string, never>) => JsonFileRead;
60
+ statusOf: (required: {
61
+ importId: string;
62
+ }, optional?: Record<string, never>) => 'active' | 'terminal' | 'unreadable' | 'absent';
63
+ };
64
+ export declare function expirePayloads({ paths, fs, clock, readUpload, statusOf, report }: {
65
+ paths: ReturnType<typeof payloadPaths>;
66
+ fs: ImportPayloadFs;
67
+ clock: {
68
+ nowMs(): number;
69
+ };
70
+ report: (required: {
71
+ operation: string;
72
+ error: unknown;
73
+ }, optional?: Record<string, never>) => void;
74
+ } & ExpireReaders, _optional?: Record<string, never>): void;
75
+ export declare function countStagedPayloads({ paths, fs }: {
76
+ paths: ReturnType<typeof payloadPaths>;
77
+ fs: ImportPayloadFs;
78
+ }, _optional?: Record<string, never>): number;
79
+ export {};
80
+ //# sourceMappingURL=payload-namespace.d.ts.map