@proofoftech/flowsafe 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (388) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +91 -44
  3. package/deployment-identity-protocol.d.mts +52 -0
  4. package/deployment-identity-protocol.mjs +231 -0
  5. package/dist/agent-host/approval-resumer.d.ts +3 -3
  6. package/dist/agent-host/approval-resumer.d.ts.map +1 -1
  7. package/dist/agent-host/approval-resumer.js +6 -7
  8. package/dist/agent-host/approval-resumer.js.map +1 -1
  9. package/dist/agent-host/catalog.js +2 -2
  10. package/dist/agent-host/catalog.js.map +1 -1
  11. package/dist/agent-host/index.d.ts +2 -2
  12. package/dist/agent-host/index.d.ts.map +1 -1
  13. package/dist/agent-host/index.js.map +1 -1
  14. package/dist/agent-host/router.d.ts +2 -2
  15. package/dist/agent-host/router.d.ts.map +1 -1
  16. package/dist/agent-host/router.js +22 -54
  17. package/dist/agent-host/router.js.map +1 -1
  18. package/dist/agent-host/thread-host.d.ts +42 -8
  19. package/dist/agent-host/thread-host.d.ts.map +1 -1
  20. package/dist/agent-host/thread-host.js +533 -106
  21. package/dist/agent-host/thread-host.js.map +1 -1
  22. package/dist/agent-host/thread-topology.d.ts +28 -7
  23. package/dist/agent-host/thread-topology.d.ts.map +1 -1
  24. package/dist/agent-host/thread-topology.js +97 -39
  25. package/dist/agent-host/thread-topology.js.map +1 -1
  26. package/dist/agent-host/trusted-context.d.ts.map +1 -1
  27. package/dist/agent-host/trusted-context.js +3 -1
  28. package/dist/agent-host/trusted-context.js.map +1 -1
  29. package/dist/agent-host/types.d.ts +2 -0
  30. package/dist/agent-host/types.d.ts.map +1 -1
  31. package/dist/agent-runner/agent-run-state.d.ts +9 -8
  32. package/dist/agent-runner/agent-run-state.d.ts.map +1 -1
  33. package/dist/agent-runner/agent-run-state.js +78 -40
  34. package/dist/agent-runner/agent-run-state.js.map +1 -1
  35. package/dist/agent-runner/durable-agent-runner.d.ts +18 -16
  36. package/dist/agent-runner/durable-agent-runner.d.ts.map +1 -1
  37. package/dist/agent-runner/durable-agent-runner.js +120 -43
  38. package/dist/agent-runner/durable-agent-runner.js.map +1 -1
  39. package/dist/agent-runner/index.d.ts +1 -1
  40. package/dist/agent-runner/index.d.ts.map +1 -1
  41. package/dist/agent-runner/index.js +1 -1
  42. package/dist/agent-runner/index.js.map +1 -1
  43. package/dist/approval-api/actor-context.d.ts +67 -0
  44. package/dist/approval-api/actor-context.d.ts.map +1 -0
  45. package/dist/approval-api/actor-context.js +120 -0
  46. package/dist/approval-api/actor-context.js.map +1 -0
  47. package/dist/approval-api/contract.d.ts +12 -23
  48. package/dist/approval-api/contract.d.ts.map +1 -1
  49. package/dist/approval-api/d1-store.d.ts +7 -15
  50. package/dist/approval-api/d1-store.d.ts.map +1 -1
  51. package/dist/approval-api/d1-store.js +83 -159
  52. package/dist/approval-api/d1-store.js.map +1 -1
  53. package/dist/approval-api/grants.d.ts +3 -17
  54. package/dist/approval-api/grants.d.ts.map +1 -1
  55. package/dist/approval-api/grants.js +19 -39
  56. package/dist/approval-api/grants.js.map +1 -1
  57. package/dist/approval-api/index.d.ts +8 -8
  58. package/dist/approval-api/index.d.ts.map +1 -1
  59. package/dist/approval-api/index.js +5 -5
  60. package/dist/approval-api/index.js.map +1 -1
  61. package/dist/approval-api/principal.d.ts +29 -30
  62. package/dist/approval-api/principal.d.ts.map +1 -1
  63. package/dist/approval-api/principal.js +73 -54
  64. package/dist/approval-api/principal.js.map +1 -1
  65. package/dist/approval-api/resource-ownership.d.ts +64 -0
  66. package/dist/approval-api/resource-ownership.d.ts.map +1 -0
  67. package/dist/approval-api/resource-ownership.js +329 -0
  68. package/dist/approval-api/resource-ownership.js.map +1 -0
  69. package/dist/approval-api/retention.d.ts +6 -11
  70. package/dist/approval-api/retention.d.ts.map +1 -1
  71. package/dist/approval-api/retention.js +7 -12
  72. package/dist/approval-api/retention.js.map +1 -1
  73. package/dist/approval-api/router.d.ts +9 -8
  74. package/dist/approval-api/router.d.ts.map +1 -1
  75. package/dist/approval-api/router.js +50 -18
  76. package/dist/approval-api/router.js.map +1 -1
  77. package/dist/approval-api/service.d.ts +26 -36
  78. package/dist/approval-api/service.d.ts.map +1 -1
  79. package/dist/approval-api/service.js +104 -166
  80. package/dist/approval-api/service.js.map +1 -1
  81. package/dist/approval-api/store-factory.d.ts +19 -0
  82. package/dist/approval-api/store-factory.d.ts.map +1 -0
  83. package/dist/approval-api/store-factory.js +49 -0
  84. package/dist/approval-api/store-factory.js.map +1 -0
  85. package/dist/approval-api/store.d.ts +22 -36
  86. package/dist/approval-api/store.d.ts.map +1 -1
  87. package/dist/approval-api/store.js +48 -66
  88. package/dist/approval-api/store.js.map +1 -1
  89. package/dist/approval-api/types.d.ts +28 -22
  90. package/dist/approval-api/types.d.ts.map +1 -1
  91. package/dist/approval-api/types.js +51 -3
  92. package/dist/approval-api/types.js.map +1 -1
  93. package/dist/approval-ui/client.js +3 -3
  94. package/dist/approval-ui/client.js.map +1 -1
  95. package/dist/approval-ui/stream.d.ts +4 -4
  96. package/dist/approval-ui/stream.d.ts.map +1 -1
  97. package/dist/approval-ui/stream.js +2 -2
  98. package/dist/approval-ui/tips.d.ts +1 -1
  99. package/dist/approval-ui/tips.js +1 -1
  100. package/dist/approval-ui/tips.js.map +1 -1
  101. package/dist/approval-ui/use-approval-dashboard.d.ts +3 -3
  102. package/dist/approval-ui/use-approval-dashboard.js +1 -1
  103. package/dist/artifacts/index.d.ts +2 -3
  104. package/dist/artifacts/index.d.ts.map +1 -1
  105. package/dist/artifacts/index.js +9 -8
  106. package/dist/artifacts/index.js.map +1 -1
  107. package/dist/audit-export/audit-proxy.d.ts +71 -0
  108. package/dist/audit-export/audit-proxy.d.ts.map +1 -0
  109. package/dist/audit-export/audit-proxy.js +142 -0
  110. package/dist/audit-export/audit-proxy.js.map +1 -0
  111. package/dist/audit-export/index.d.ts +4 -7
  112. package/dist/audit-export/index.d.ts.map +1 -1
  113. package/dist/audit-export/index.js +1 -4
  114. package/dist/audit-export/index.js.map +1 -1
  115. package/dist/audit-export/queue-types.d.ts +5 -0
  116. package/dist/audit-export/queue-types.d.ts.map +1 -0
  117. package/dist/audit-export/queue-types.js +3 -0
  118. package/dist/audit-export/queue-types.js.map +1 -0
  119. package/dist/background-tasks/d1-storage.d.ts +9 -19
  120. package/dist/background-tasks/d1-storage.d.ts.map +1 -1
  121. package/dist/background-tasks/d1-storage.js +22 -52
  122. package/dist/background-tasks/d1-storage.js.map +1 -1
  123. package/dist/background-tasks/host.d.ts +4 -6
  124. package/dist/background-tasks/host.d.ts.map +1 -1
  125. package/dist/background-tasks/host.js +14 -17
  126. package/dist/background-tasks/host.js.map +1 -1
  127. package/dist/background-tasks/index.d.ts +1 -1
  128. package/dist/background-tasks/index.d.ts.map +1 -1
  129. package/dist/background-tasks/index.js +3 -3
  130. package/dist/background-tasks/index.js.map +1 -1
  131. package/dist/background-tasks/routes.d.ts +8 -4
  132. package/dist/background-tasks/routes.d.ts.map +1 -1
  133. package/dist/background-tasks/routes.js +33 -31
  134. package/dist/background-tasks/routes.js.map +1 -1
  135. package/dist/deployment-identity-protocol.d.ts +3 -0
  136. package/dist/deployment-identity-protocol.d.ts.map +1 -0
  137. package/dist/deployment-identity-protocol.js +3 -0
  138. package/dist/deployment-identity-protocol.js.map +1 -0
  139. package/dist/do-runner/breakwater-keys.d.ts +7 -5
  140. package/dist/do-runner/breakwater-keys.d.ts.map +1 -1
  141. package/dist/do-runner/breakwater-keys.js +7 -5
  142. package/dist/do-runner/breakwater-keys.js.map +1 -1
  143. package/dist/do-runner/cf-types.d.ts +18 -12
  144. package/dist/do-runner/cf-types.d.ts.map +1 -1
  145. package/dist/do-runner/cf-types.js.map +1 -1
  146. package/dist/do-runner/d1-storage.d.ts +51 -189
  147. package/dist/do-runner/d1-storage.d.ts.map +1 -1
  148. package/dist/do-runner/d1-storage.js +111 -362
  149. package/dist/do-runner/d1-storage.js.map +1 -1
  150. package/dist/do-runner/deployment-identity.d.ts +121 -0
  151. package/dist/do-runner/deployment-identity.d.ts.map +1 -0
  152. package/dist/do-runner/deployment-identity.js +272 -0
  153. package/dist/do-runner/deployment-identity.js.map +1 -0
  154. package/dist/do-runner/do-error-response.d.ts +1 -1
  155. package/dist/do-runner/do-error-response.d.ts.map +1 -1
  156. package/dist/do-runner/do-error-response.js +7 -1
  157. package/dist/do-runner/do-error-response.js.map +1 -1
  158. package/dist/do-runner/durable-object.d.ts +23 -16
  159. package/dist/do-runner/durable-object.d.ts.map +1 -1
  160. package/dist/do-runner/durable-object.js +303 -70
  161. package/dist/do-runner/durable-object.js.map +1 -1
  162. package/dist/do-runner/execution-context.d.ts +1 -0
  163. package/dist/do-runner/execution-context.d.ts.map +1 -1
  164. package/dist/do-runner/execution-context.js +4 -7
  165. package/dist/do-runner/execution-context.js.map +1 -1
  166. package/dist/do-runner/execution-principal-header.d.ts +16 -0
  167. package/dist/do-runner/execution-principal-header.d.ts.map +1 -0
  168. package/dist/do-runner/execution-principal-header.js +20 -0
  169. package/dist/do-runner/execution-principal-header.js.map +1 -0
  170. package/dist/do-runner/hub-do.d.ts +17 -25
  171. package/dist/do-runner/hub-do.d.ts.map +1 -1
  172. package/dist/do-runner/hub-do.js +63 -59
  173. package/dist/do-runner/hub-do.js.map +1 -1
  174. package/dist/do-runner/index.d.ts +12 -10
  175. package/dist/do-runner/index.d.ts.map +1 -1
  176. package/dist/do-runner/index.js +10 -9
  177. package/dist/do-runner/index.js.map +1 -1
  178. package/dist/do-runner/init.d.ts +0 -7
  179. package/dist/do-runner/init.d.ts.map +1 -1
  180. package/dist/do-runner/init.js +1 -2
  181. package/dist/do-runner/init.js.map +1 -1
  182. package/dist/do-runner/memory-id.d.ts +8 -25
  183. package/dist/do-runner/memory-id.d.ts.map +1 -1
  184. package/dist/do-runner/memory-id.js +25 -52
  185. package/dist/do-runner/memory-id.js.map +1 -1
  186. package/dist/do-runner/path-safe-id.d.ts +2 -48
  187. package/dist/do-runner/path-safe-id.d.ts.map +1 -1
  188. package/dist/do-runner/path-safe-id.js +3 -93
  189. package/dist/do-runner/path-safe-id.js.map +1 -1
  190. package/dist/do-runner/pubsub.d.ts +1 -1
  191. package/dist/do-runner/pubsub.js +1 -1
  192. package/dist/do-runner/runtime.d.ts +47 -34
  193. package/dist/do-runner/runtime.d.ts.map +1 -1
  194. package/dist/do-runner/runtime.js +281 -143
  195. package/dist/do-runner/runtime.js.map +1 -1
  196. package/dist/do-runner/schedule-source.d.ts +81 -0
  197. package/dist/do-runner/schedule-source.d.ts.map +1 -0
  198. package/dist/do-runner/schedule-source.js +64 -0
  199. package/dist/do-runner/schedule-source.js.map +1 -0
  200. package/dist/do-runner/table-prefix.d.ts +3 -0
  201. package/dist/do-runner/table-prefix.d.ts.map +1 -0
  202. package/dist/do-runner/table-prefix.js +17 -0
  203. package/dist/do-runner/table-prefix.js.map +1 -0
  204. package/dist/do-runner/thread-do.d.ts +18 -32
  205. package/dist/do-runner/thread-do.d.ts.map +1 -1
  206. package/dist/do-runner/thread-do.js +52 -74
  207. package/dist/do-runner/thread-do.js.map +1 -1
  208. package/dist/goals/objective-routes.d.ts +7 -4
  209. package/dist/goals/objective-routes.d.ts.map +1 -1
  210. package/dist/goals/objective-routes.js +58 -43
  211. package/dist/goals/objective-routes.js.map +1 -1
  212. package/dist/host-kit/approval-bridge.d.ts +18 -21
  213. package/dist/host-kit/approval-bridge.d.ts.map +1 -1
  214. package/dist/host-kit/approval-bridge.js +37 -37
  215. package/dist/host-kit/approval-bridge.js.map +1 -1
  216. package/dist/host-kit/bearer-auth.d.ts +3 -4
  217. package/dist/host-kit/bearer-auth.d.ts.map +1 -1
  218. package/dist/host-kit/bearer-auth.js +7 -11
  219. package/dist/host-kit/bearer-auth.js.map +1 -1
  220. package/dist/host-kit/do-run-topology.d.ts +14 -5
  221. package/dist/host-kit/do-run-topology.d.ts.map +1 -1
  222. package/dist/host-kit/do-run-topology.js +47 -15
  223. package/dist/host-kit/do-run-topology.js.map +1 -1
  224. package/dist/host-kit/env-vars.d.ts +1 -1
  225. package/dist/host-kit/env-vars.js +1 -1
  226. package/dist/host-kit/flowsafe-worker.d.ts +159 -80
  227. package/dist/host-kit/flowsafe-worker.d.ts.map +1 -1
  228. package/dist/host-kit/flowsafe-worker.js +629 -142
  229. package/dist/host-kit/flowsafe-worker.js.map +1 -1
  230. package/dist/host-kit/host-approval-service.d.ts +62 -54
  231. package/dist/host-kit/host-approval-service.d.ts.map +1 -1
  232. package/dist/host-kit/host-approval-service.js +90 -61
  233. package/dist/host-kit/host-approval-service.js.map +1 -1
  234. package/dist/host-kit/hub-topology.d.ts +6 -7
  235. package/dist/host-kit/hub-topology.d.ts.map +1 -1
  236. package/dist/host-kit/hub-topology.js +16 -12
  237. package/dist/host-kit/hub-topology.js.map +1 -1
  238. package/dist/host-kit/index.d.ts +13 -11
  239. package/dist/host-kit/index.d.ts.map +1 -1
  240. package/dist/host-kit/index.js +9 -12
  241. package/dist/host-kit/index.js.map +1 -1
  242. package/dist/host-kit/maintenance-capability.d.ts +58 -0
  243. package/dist/host-kit/maintenance-capability.d.ts.map +1 -0
  244. package/dist/host-kit/maintenance-capability.js +268 -0
  245. package/dist/host-kit/maintenance-capability.js.map +1 -0
  246. package/dist/host-kit/memory-boundary.d.ts +4 -19
  247. package/dist/host-kit/memory-boundary.d.ts.map +1 -1
  248. package/dist/host-kit/memory-boundary.js +12 -27
  249. package/dist/host-kit/memory-boundary.js.map +1 -1
  250. package/dist/host-kit/resource-access.d.ts +4 -0
  251. package/dist/host-kit/resource-access.d.ts.map +1 -0
  252. package/dist/host-kit/resource-access.js +12 -0
  253. package/dist/host-kit/resource-access.js.map +1 -0
  254. package/dist/host-kit/run-router.d.ts +25 -15
  255. package/dist/host-kit/run-router.d.ts.map +1 -1
  256. package/dist/host-kit/run-router.js +61 -46
  257. package/dist/host-kit/run-router.js.map +1 -1
  258. package/dist/host-kit/state-egress.d.ts +51 -0
  259. package/dist/host-kit/state-egress.d.ts.map +1 -0
  260. package/dist/host-kit/state-egress.js +120 -0
  261. package/dist/host-kit/state-egress.js.map +1 -0
  262. package/dist/host-kit/stream-router.d.ts +9 -4
  263. package/dist/host-kit/stream-router.d.ts.map +1 -1
  264. package/dist/host-kit/stream-router.js +45 -38
  265. package/dist/host-kit/stream-router.js.map +1 -1
  266. package/dist/host-kit/stream-ticket.d.ts +10 -10
  267. package/dist/host-kit/stream-ticket.d.ts.map +1 -1
  268. package/dist/host-kit/stream-ticket.js +60 -90
  269. package/dist/host-kit/stream-ticket.js.map +1 -1
  270. package/dist/host-kit/thread-topology.d.ts +17 -11
  271. package/dist/host-kit/thread-topology.d.ts.map +1 -1
  272. package/dist/host-kit/thread-topology.js +33 -59
  273. package/dist/host-kit/thread-topology.js.map +1 -1
  274. package/dist/host-kit/verifier.d.ts +6 -6
  275. package/dist/host-kit/verifier.d.ts.map +1 -1
  276. package/dist/host-kit/verifier.js +51 -119
  277. package/dist/host-kit/verifier.js.map +1 -1
  278. package/dist/http-body.d.ts +20 -0
  279. package/dist/http-body.d.ts.map +1 -0
  280. package/dist/http-body.js +67 -0
  281. package/dist/http-body.js.map +1 -0
  282. package/dist/schedules/index.d.ts +3 -2
  283. package/dist/schedules/index.d.ts.map +1 -1
  284. package/dist/schedules/index.js +5 -4
  285. package/dist/schedules/index.js.map +1 -1
  286. package/dist/schedules/router.d.ts +16 -10
  287. package/dist/schedules/router.d.ts.map +1 -1
  288. package/dist/schedules/router.js +153 -91
  289. package/dist/schedules/router.js.map +1 -1
  290. package/dist/schedules/schedules-d1.d.ts +88 -0
  291. package/dist/schedules/schedules-d1.d.ts.map +1 -1
  292. package/dist/schedules/schedules-d1.js +411 -50
  293. package/dist/schedules/schedules-d1.js.map +1 -1
  294. package/dist/schedules/target-policy.d.ts +29 -0
  295. package/dist/schedules/target-policy.d.ts.map +1 -0
  296. package/dist/schedules/target-policy.js +70 -0
  297. package/dist/schedules/target-policy.js.map +1 -0
  298. package/dist/schedules/tick.d.ts +125 -21
  299. package/dist/schedules/tick.d.ts.map +1 -1
  300. package/dist/schedules/tick.js +637 -160
  301. package/dist/schedules/tick.js.map +1 -1
  302. package/dist/signal-providers/delivery.d.ts +0 -19
  303. package/dist/signal-providers/delivery.d.ts.map +1 -1
  304. package/dist/signal-providers/delivery.js +5 -54
  305. package/dist/signal-providers/delivery.js.map +1 -1
  306. package/dist/signal-providers/github-provider.d.ts.map +1 -1
  307. package/dist/signal-providers/github-provider.js +9 -16
  308. package/dist/signal-providers/github-provider.js.map +1 -1
  309. package/dist/signal-providers/host-do.d.ts +3 -45
  310. package/dist/signal-providers/host-do.d.ts.map +1 -1
  311. package/dist/signal-providers/host-do.js +86 -106
  312. package/dist/signal-providers/host-do.js.map +1 -1
  313. package/dist/signal-providers/host-topology.d.ts +5 -14
  314. package/dist/signal-providers/host-topology.d.ts.map +1 -1
  315. package/dist/signal-providers/host-topology.js +11 -25
  316. package/dist/signal-providers/host-topology.js.map +1 -1
  317. package/dist/signal-providers/index.d.ts +3 -3
  318. package/dist/signal-providers/index.d.ts.map +1 -1
  319. package/dist/signal-providers/index.js +3 -3
  320. package/dist/signal-providers/index.js.map +1 -1
  321. package/dist/signal-providers/provider.d.ts +4 -5
  322. package/dist/signal-providers/provider.d.ts.map +1 -1
  323. package/dist/signal-providers/provider.js +5 -6
  324. package/dist/signal-providers/provider.js.map +1 -1
  325. package/dist/signal-providers/subscription-d1.d.ts +10 -57
  326. package/dist/signal-providers/subscription-d1.d.ts.map +1 -1
  327. package/dist/signal-providers/subscription-d1.js +208 -155
  328. package/dist/signal-providers/subscription-d1.js.map +1 -1
  329. package/dist/signal-providers/webhook-route.d.ts +28 -14
  330. package/dist/signal-providers/webhook-route.d.ts.map +1 -1
  331. package/dist/signal-providers/webhook-route.js +117 -88
  332. package/dist/signal-providers/webhook-route.js.map +1 -1
  333. package/dist/signals/client.js +8 -8
  334. package/dist/signals/client.js.map +1 -1
  335. package/dist/signals/d1-shared.js +1 -1
  336. package/dist/signals/d1-shared.js.map +1 -1
  337. package/dist/signals/index.d.ts +1 -1
  338. package/dist/signals/index.d.ts.map +1 -1
  339. package/dist/signals/index.js.map +1 -1
  340. package/dist/signals/notification-dispatch.d.ts +12 -6
  341. package/dist/signals/notification-dispatch.d.ts.map +1 -1
  342. package/dist/signals/notification-dispatch.js +37 -21
  343. package/dist/signals/notification-dispatch.js.map +1 -1
  344. package/dist/signals/notifications-d1.d.ts +5 -8
  345. package/dist/signals/notifications-d1.d.ts.map +1 -1
  346. package/dist/signals/notifications-d1.js +8 -13
  347. package/dist/signals/notifications-d1.js.map +1 -1
  348. package/dist/signals/router.d.ts +10 -10
  349. package/dist/signals/router.d.ts.map +1 -1
  350. package/dist/signals/router.js +49 -51
  351. package/dist/signals/router.js.map +1 -1
  352. package/dist/signals/thread-do-routes.d.ts +74 -15
  353. package/dist/signals/thread-do-routes.d.ts.map +1 -1
  354. package/dist/signals/thread-do-routes.js +484 -41
  355. package/dist/signals/thread-do-routes.js.map +1 -1
  356. package/dist/signals/thread-state-d1.d.ts.map +1 -1
  357. package/dist/signals/thread-state-d1.js +2 -3
  358. package/dist/signals/thread-state-d1.js.map +1 -1
  359. package/package.json +29 -6
  360. package/scripts/seed-deployment-identity.mjs +252 -0
  361. package/dist/approval-api/tenant-brand.d.ts +0 -35
  362. package/dist/approval-api/tenant-brand.d.ts.map +0 -1
  363. package/dist/approval-api/tenant-brand.js +0 -19
  364. package/dist/approval-api/tenant-brand.js.map +0 -1
  365. package/dist/approval-api/tenant-context.d.ts +0 -84
  366. package/dist/approval-api/tenant-context.d.ts.map +0 -1
  367. package/dist/approval-api/tenant-context.js +0 -112
  368. package/dist/approval-api/tenant-context.js.map +0 -1
  369. package/dist/approval-api/tenant-store.d.ts +0 -36
  370. package/dist/approval-api/tenant-store.d.ts.map +0 -1
  371. package/dist/approval-api/tenant-store.js +0 -129
  372. package/dist/approval-api/tenant-store.js.map +0 -1
  373. package/dist/do-runner/resume-ledger.d.ts +0 -48
  374. package/dist/do-runner/resume-ledger.d.ts.map +0 -1
  375. package/dist/do-runner/resume-ledger.js +0 -60
  376. package/dist/do-runner/resume-ledger.js.map +0 -1
  377. package/dist/do-runner/thread-header.d.ts +0 -31
  378. package/dist/do-runner/thread-header.d.ts.map +0 -1
  379. package/dist/do-runner/thread-header.js +0 -39
  380. package/dist/do-runner/thread-header.js.map +0 -1
  381. package/dist/host-kit/subdomain-check.d.ts +0 -23
  382. package/dist/host-kit/subdomain-check.d.ts.map +0 -1
  383. package/dist/host-kit/subdomain-check.js +0 -61
  384. package/dist/host-kit/subdomain-check.js.map +0 -1
  385. package/dist/host-kit/tenant-registry.d.ts +0 -51
  386. package/dist/host-kit/tenant-registry.d.ts.map +0 -1
  387. package/dist/host-kit/tenant-registry.js +0 -88
  388. package/dist/host-kit/tenant-registry.js.map +0 -1
@@ -5,7 +5,7 @@ export interface D1StorageOptions {
5
5
  binding: D1DatabaseBinding;
6
6
  /** Storage instance id. Default: 'flowsafe'. */
7
7
  id?: string;
8
- /** Table name prefix (letters, numbers, underscores). */
8
+ /** Mastra-compatible SQL identifier prefix of at most 39 characters, or empty. */
9
9
  tablePrefix?: string;
10
10
  /**
11
11
  * Additional storage domains composed over the D1Store default, such as
@@ -24,6 +24,8 @@ export declare function createD1Storage(options: D1StorageOptions): MastraCompos
24
24
  */
25
25
  export interface SnapshotDatabase {
26
26
  prepare(query: string): SnapshotStatement;
27
+ /** D1 transactional batch, required when owner lifecycle cleanup is wired. */
28
+ batch?(statements: SnapshotStatement[]): Promise<unknown[]>;
27
29
  }
28
30
  export interface SnapshotStatement {
29
31
  bind(...values: unknown[]): SnapshotStatement;
@@ -33,26 +35,33 @@ export interface SnapshotStatement {
33
35
  }>;
34
36
  }
35
37
  /** Structural: R2ArtifactStore.deleteRun, without importing the artifacts module. */
36
- export interface TenantArtifactPurger {
38
+ export interface RunArtifactPurger {
37
39
  deleteRun(workflowId: string, runId: string): Promise<number>;
38
40
  }
39
41
  export interface PurgeExpiredRunsOptions {
40
42
  /** workflowOutputTTL: runs untouched for longer than this are eligible. */
41
43
  ttlMs: number;
42
- /** Must match createD1Storage's tablePrefix. */
44
+ /** Must satisfy and match createD1Storage's max-39 tablePrefix contract. */
43
45
  tablePrefix?: string;
44
46
  /**
45
47
  * When set, each purged run's R2 artifacts are deleted WITH its snapshot
46
- * row. Hosts that store artifacts must pass the same store purgeTenant
47
- * gets: the snapshot row is the only enumerable record of a run's
48
- * artifact keys (R2 keys lead with workflowId — there is no run-level
49
- * listing without it), so a retention purge without this pairing strands
50
- * the run's artifacts beyond even purgeTenant's reach.
48
+ * row. Hosts that store artifacts must wire this: the snapshot row is the
49
+ * only enumerable record of a run's artifact keys (R2 keys lead with
50
+ * workflowId — there is no run-level listing without it), so a retention
51
+ * purge without this pairing strands the run's artifacts until the
52
+ * deployment itself is decommissioned.
51
53
  */
52
- artifactStore?: TenantArtifactPurger;
54
+ artifactStore?: RunArtifactPurger;
53
55
  /**
54
- * Runs processed per call. Artifact-paired path: default 100 — the cron's
55
- * subrequest-budget guard, same batching as the demo-tenant reaper. Each
56
+ * Deployment-local resource-owner table. When supplied, each snapshot delete
57
+ * and its run-owner release commit in the same D1 transaction. The composed
58
+ * Flowsafe Worker always supplies this; lower-level callers without the
59
+ * resource registry omit it.
60
+ */
61
+ resourceOwnerTable?: string;
62
+ /**
63
+ * Runs processed per call. Artifact-paired path: default 100 — the purge duty's
64
+ * subrequest-budget guard, same batching as any batched reaper. Each
56
65
  * run costs ~2+N subrequests (R2 list, per-artifact deletes, its row's
57
66
  * DELETE), so an UNBOUNDED first backlog would blow the Workers
58
67
  * per-invocation cap mid-pass and log an error every firing until it
@@ -68,12 +77,9 @@ export interface PurgeExpiredRunsOptions {
68
77
  /**
69
78
  * The tables `purgeExpiredWorkflowRuns` deletes from under the run TTL — the
70
79
  * production anchor the schema guard cross-checks every `run-ttl` retention
71
- * declaration against, the retention counterpart of
72
- * TENANT_RANGE_PURGE_TABLES for the offboarding leg. One table, because the run
73
- * TTL rides a `run_id` range paired with artifact deletion and an app-owned
74
- * index (its own block below), not the tenant-range map. The guard reads THIS,
75
- * not a literal copied into the test, so a purge that changes what it targets
76
- * and a guard that still blesses the old set cannot drift apart silently.
80
+ * declaration against. The guard reads THIS, not a literal copied into the
81
+ * test, so a purge that changes what it targets and a guard that still
82
+ * blesses the old set cannot drift apart silently.
77
83
  */
78
84
  export declare const RUN_TTL_PURGE_TABLES: readonly string[];
79
85
  /**
@@ -84,14 +90,14 @@ export declare const RUN_TTL_PURGE_TABLES: readonly string[];
84
90
  * pending/paused) are never touched — expiring a suspended run would kill a
85
91
  * pending approval. A missing snapshot table reads as zero purgeable runs
86
92
  * (Mastra creates it lazily with the first persisted run). TTL enforcement
87
- * is a storage-layer property, so it lives here; scheduling (Worker cron /
88
- * DO alarm) stays with the caller. Returns the number of deleted rows.
93
+ * is a storage-layer property, so it lives here; alarm scheduling stays with
94
+ * the caller. Returns the number of deleted rows.
89
95
  */
90
96
  export declare function purgeExpiredWorkflowRuns(db: SnapshotDatabase, options: PurgeExpiredRunsOptions): Promise<number>;
91
97
  export interface PurgeExpiredThreadsOptions {
92
98
  /** Threads untouched for longer than this are eligible, with their messages. */
93
99
  ttlMs: number;
94
- /** Must match createD1Storage's tablePrefix. */
100
+ /** Must satisfy and match createD1Storage's max-39 tablePrefix contract. */
95
101
  tablePrefix?: string;
96
102
  /**
97
103
  * Threads processed per call. Default 100 — the shrinking eligible set is the
@@ -120,7 +126,7 @@ export interface PurgeExpiredThreadsResult {
120
126
  */
121
127
  export declare const THREAD_TTL_PURGE_TABLES: readonly string[];
122
128
  /**
123
- * Thread-level retention (docs/agent-memory-tenancy.md item 7): deletes agent
129
+ * Thread-level retention (docs/agent-memory-isolation.md#thread-retention): deletes agent
124
130
  * memory threads whose `updatedAt` is older than the TTL, each with its
125
131
  * messages. The terminal-status shape `purgeExpiredWorkflowRuns` uses does not
126
132
  * transfer — threads are not per-run and have no status, so there is nothing to
@@ -132,7 +138,7 @@ export declare const THREAD_TTL_PURGE_TABLES: readonly string[];
132
138
  * so there is no per-message IDLENESS signal — a message's lifetime is its
133
139
  * thread's, and its rows are reachable only through it. Deleting a thread first
134
140
  * would strand its messages beyond every later firing of this purge (only
135
- * purgeTenant, at offboarding, still ranges over their salted `thread_id`).
141
+ * decommissioning the deployment's database would still reap them).
136
142
  *
137
143
  * EVERY statement re-checks the CURRENT row rather than trusting the SELECT's id
138
144
  * list, and that is load-bearing here in a way it is not for
@@ -167,13 +173,12 @@ export declare const THREAD_TTL_PURGE_TABLES: readonly string[];
167
173
  * milliseconds away. (2) A message inserted AFTER its thread's row is already
168
174
  * gone is orphaned by the writer, not by this purge; D1 offers no cross-statement
169
175
  * transaction through this seam to close it. An orphan is unreachable by recall
170
- * (nothing lists a thread that does not exist), stays tenant-salted on its
171
- * `thread_id`, and is reaped by purgeTenant at offboarding — a hygiene cost, not
172
- * a leak.
176
+ * (nothing lists a thread that does not exist) and vanishes with the
177
+ * deployment's database at decommission — a hygiene cost, not a leak.
173
178
  *
174
179
  * `mastra_resources` (working memory) is deliberately untouched: a resource is
175
180
  * the OWNER's, shared across every thread they have, so one thread aging out
176
- * says nothing about it. It is reaped at offboarding (purgeTenant).
181
+ * says nothing about it. It lives until the deployment is decommissioned.
177
182
  *
178
183
  * Missing tables read as zero (a deployment with no agent memory never created
179
184
  * them). Scheduling stays with the caller — see createFlowsafeWorker's
@@ -200,7 +205,7 @@ export interface PurgeExpiredBackgroundTasksOptions {
200
205
  * failure stays inspectable.
201
206
  */
202
207
  failedTtlMs?: number;
203
- /** Must match createD1Storage's tablePrefix. */
208
+ /** Must satisfy and match createD1Storage's max-39 tablePrefix contract. */
204
209
  tablePrefix?: string;
205
210
  /** Clock override for tests. */
206
211
  now?: () => number;
@@ -215,9 +220,9 @@ export interface PurgeExpiredBackgroundTasksResult {
215
220
  * Background-task TTL cleanup: deletes terminal task
216
221
  * rows from `mastra_background_tasks` once their `completedAt` is older than the
217
222
  * TTL, mirroring core `BackgroundTaskManager.cleanup()` at the storage layer so
218
- * a purge cron can reap them WITHOUT a live manager — the same posture as
223
+ * a maintenance purge can reap them WITHOUT a live manager: the same posture as
219
224
  * purgeExpiredWorkflowRuns/purgeExpiredThreads (raw D1 binding, failure-isolated
220
- * as a cron duty). Two windows, exactly as core: completed rows expire fast
225
+ * as a purge duty). Two windows, exactly as core: completed rows expire fast
221
226
  * (default 1h), failed/cancelled/timed_out slowly (default 24h) so a failure
222
227
  * stays inspectable.
223
228
  *
@@ -242,12 +247,12 @@ export interface PurgeExpiredNotificationsOptions {
242
247
  * Resolved (delivered/seen/dismissed/archived/discarded) notifications whose
243
248
  * `updatedAt` is older than this expire. PENDING rows are never touched — one
244
249
  * may be waiting on a future `deliverAt`, and reaping it would drop a signal
245
- * the model has not seen. No default: the caller (createFlowsafeWorker's cron)
250
+ * the model has not seen. No default: the caller (createFlowsafeWorker's purge duty)
246
251
  * gates this on an opt-in retention window, since a durable inbox is meant to
247
252
  * be readable until the host says otherwise.
248
253
  */
249
254
  ttlMs: number;
250
- /** Must match createD1Storage's tablePrefix. */
255
+ /** Must satisfy and match createD1Storage's max-39 tablePrefix contract. */
251
256
  tablePrefix?: string;
252
257
  /** Clock override for tests. */
253
258
  now?: () => number;
@@ -255,8 +260,8 @@ export interface PurgeExpiredNotificationsOptions {
255
260
  /**
256
261
  * Notification TTL cleanup: deletes terminal agent-inbox
257
262
  * rows from `mastra_notifications` once their `updatedAt` is older than the TTL,
258
- * at the storage layer so a cron reaps them without a live agent — the same
259
- * posture as the other purges (raw D1 binding, failure-isolated as a cron duty).
263
+ * at the storage layer so alarm maintenance reaps them without a live agent —
264
+ * the same posture as the other purges (raw D1 binding, failure-isolated duty).
260
265
  * `updatedAt` is ISO-8601 TEXT, so lexicographic `<` is a correct timestamp
261
266
  * comparison. A missing table reads as zero (notifications may never have been
262
267
  * sent). Scheduling stays with the caller.
@@ -277,7 +282,7 @@ export interface PurgeExpiredThreadStateOptions {
277
282
  * kept until the host sets a window).
278
283
  */
279
284
  ttlMs: number;
280
- /** Must match createD1Storage's tablePrefix. */
285
+ /** Must satisfy and match createD1Storage's max-39 tablePrefix contract. */
281
286
  tablePrefix?: string;
282
287
  /** Clock override for tests. */
283
288
  now?: () => number;
@@ -288,9 +293,9 @@ export interface PurgeExpiredThreadStateOptions {
288
293
  * on `updatedAt` for the same reason `purgeExpiredThreads` does — thread state
289
294
  * has no terminal status, so time-since-last-write is the only "done" signal.
290
295
  * ISO-8601 TEXT encoding; missing table reads as zero; scheduling stays with the
291
- * caller. Independent of the thread TTL (an orphan row is reaped here or at
292
- * offboarding by purgeTenant), so it self-bounds without touching the delicate
293
- * messages-before-threads ordering of purgeExpiredThreads.
296
+ * caller. Independent of the thread TTL (an orphan row is reaped here or when
297
+ * the deployment is decommissioned), so it self-bounds without touching the
298
+ * delicate messages-before-threads ordering of purgeExpiredThreads.
294
299
  */
295
300
  export declare function purgeExpiredThreadState(db: SnapshotDatabase, options: PurgeExpiredThreadStateOptions): Promise<number>;
296
301
  /**
@@ -299,7 +304,8 @@ export declare function purgeExpiredThreadState(db: SnapshotDatabase, options: P
299
304
  * declaration against. It is the schedule-trigger counterpart to
300
305
  * THREAD_STATE_TTL_PURGE_TABLES.
301
306
  * Only the trigger HISTORY expires; the schedule rows themselves are standing
302
- * config (retention 'none', reaped at offboarding by purgeTenant).
307
+ * config (retention 'none' — they live until deleted over the schedule
308
+ * surface or the deployment is decommissioned).
303
309
  */
304
310
  export declare const SCHEDULE_TRIGGER_TTL_PURGE_TABLES: readonly string[];
305
311
  export interface PurgeExpiredScheduleTriggersOptions {
@@ -309,171 +315,27 @@ export interface PurgeExpiredScheduleTriggersOptions {
309
315
  * history is inspectable until the host sets a window.
310
316
  */
311
317
  ttlMs: number;
312
- /** Must match createD1Storage's tablePrefix. */
318
+ /** Must satisfy and match createD1Storage's max-39 tablePrefix contract. */
313
319
  tablePrefix?: string;
314
320
  /** Clock override for tests. */
315
321
  now?: () => number;
316
322
  }
317
323
  /**
318
- * Schedule-trigger TTL cleanup: deletes trigger-history
324
+ * Schedule-trigger TTL cleanup: deletes terminal trigger-history
319
325
  * rows from `mastra_schedule_triggers` once their `actualFireAt` is older than the
320
- * TTL, at the storage layer so a cron reaps them without a live tick — the same
321
- * posture as the other purges (raw D1 binding, failure-isolated as a cron duty).
326
+ * TTL, at the storage layer so alarm maintenance reaps them without a live tick —
327
+ * the same posture as the other purges (raw D1 binding, failure-isolated duty).
322
328
  *
323
329
  * `actualFireAt` is stored as INTEGER ms-epoch (core types
324
330
  * `ScheduleTrigger.actualFireAt` as `number`, unlike the ISO-TEXT timestamp
325
331
  * columns the other domains use), so the comparison is a NUMERIC `<` against a
326
332
  * numeric cutoff — a correct timestamp comparison over integers. A missing table
327
333
  * reads as zero (schedules may never have fired). Scheduling stays with the
328
- * caller. Deleting trigger history never touches a live schedule (its own row is
329
- * in `mastra_schedules`), so there is no ordering constraint.
334
+ * caller. Deferred rows are live dispatch/reconciliation state and are never
335
+ * TTL-purged; their eventual settlement also finalizes any pending schedule
336
+ * deletion.
330
337
  */
331
338
  export declare function purgeExpiredScheduleTriggers(db: SnapshotDatabase, options: PurgeExpiredScheduleTriggersOptions): Promise<number>;
332
- /**
333
- * Additive, app-owned index for the tenant range predicate. It couples us to
334
- * Mastra's snapshot column name (`run_id`, snake_case — its timestamps are
335
- * camelCase) — the schema-guard test pins that name so a @mastra/core bump
336
- * that renames it fails CI, not a purge.
337
- */
338
- export declare function ensureSnapshotRunIdIndex(db: SnapshotDatabase, tablePrefix?: string): Promise<void>;
339
- export interface PurgeTenantOptions {
340
- /** Must satisfy the tenant-ID pattern `^[a-z0-9]{3,32}$`; see the range note below. */
341
- tenantId: string;
342
- /** Must match createD1Storage's tablePrefix. */
343
- tablePrefix?: string;
344
- /**
345
- * The tenant's R2 artifacts are deleted per surviving run BEFORE the
346
- * snapshot rows go (deleteRun needs the run list — snapshot rows are the
347
- * only enumerable record of a run's artifact keys). That is also why the
348
- * SAME store must ride purgeExpiredWorkflowRuns' `artifactStore`:
349
- * retention deletes rows this offboarding can then no longer see, so an
350
- * unpaired retention purge strands those runs' artifacts.
351
- */
352
- artifactStore?: TenantArtifactPurger;
353
- }
354
- export interface PurgeTenantResult {
355
- snapshots: number;
356
- /** Agent-memory rows (docs/agent-memory-tenancy.md): salted thread ids. */
357
- threads: number;
358
- /** Agent-memory rows: deleted by their salted thread_id. */
359
- messages: number;
360
- /** Agent-memory rows: salted resource ids (working memory). */
361
- resources: number;
362
- /** Background-task rows, ranged over their tenant-salted `run_id`. */
363
- backgroundTasks: number;
364
- /** Agent-inbox rows, ranged over their tenant-salted `thread_id`. */
365
- notifications: number;
366
- /** Thread-state rows (state lanes + goals), ranged over `thread_id`. */
367
- threadState: number;
368
- /** Schedule rows, metadata-filtered on their `metadata.tenantId`. */
369
- schedules: number;
370
- /** Schedule-trigger rows, metadata-filtered on their `metadata.tenantId`. */
371
- scheduleTriggers: number;
372
- approvals: number;
373
- /** Signal-subscription rows, filtered by the `tenant_id` column. */
374
- subscriptions: number;
375
- artifacts: number;
376
- }
377
- /**
378
- * The `PurgeTenantResult` field a range-purged table reports into. A feature
379
- * adopting a new `mastra_*` domain (notifications, thread-state, background
380
- * tasks, schedules) adds its counter HERE, its row to
381
- * TENANT_RANGE_PURGE_TABLES, and its field to PurgeTenantResult — all in the
382
- * same change. The union is what makes that mechanical rather than
383
- * remembered: a counter with no result field fails the pin below, and a result
384
- * field with no counter fails the `memory` initializer in purgeTenant.
385
- */
386
- export type TenantRangePurgeCounter = 'threads' | 'messages' | 'resources' | 'backgroundTasks' | 'notifications' | 'threadState';
387
- /** One table purgeTenant reaps by the tenant-exact `[tid_, tid\x60)` range predicate. */
388
- export interface TenantRangePurgeTable {
389
- /** The PurgeTenantResult field this table's deleted-row count lands in. */
390
- counter: TenantRangePurgeCounter;
391
- /** Unprefixed table name; purgeTenant applies the host's tablePrefix. */
392
- table: string;
393
- /**
394
- * The tenant-salted column the range rides. Thread-keyed tables use their
395
- * `thread_id` (a minted `${tenantId}_${uuid}`); row-keyed tables use their own
396
- * salted `id`. Any column whose values are salted ids works — that is the
397
- * whole reason the ids are salted at mint (docs/agent-memory-tenancy.md).
398
- */
399
- column: string;
400
- }
401
- /**
402
- * The tenant-range purge inventory, extensible by construction: each
403
- * later feature appends its adopted table here instead of editing purgeTenant's
404
- * body, so adoption is one additive row plus the counter/result pair the types
405
- * force alongside it. Ordering is not load-bearing (the deletes run
406
- * concurrently; see purgeTenant).
407
- *
408
- * `mastra_workflow_snapshot` is deliberately absent: it rides the same range but
409
- * over `run_id`, paired with artifact deletion and an app-owned index, so it
410
- * keeps its own block. `mastra_background_tasks` rides the range over
411
- * its own `run_id` — the originating run's tenant-salted id, always present on a
412
- * task row — without artifacts or an app index, so it lives here. Tables no
413
- * feature writes yet (`mastra_scorers`) are absent because nothing salts their
414
- * ids yet — the schema-guard's inventory pin is what forces that decision when a
415
- * feature adopts one.
416
- */
417
- export declare const TENANT_RANGE_PURGE_TABLES: readonly TenantRangePurgeTable[];
418
- /**
419
- * The `PurgeTenantResult` field a metadata-filtered table reports into. Schedule
420
- * schedule rows key on slugified ids (`agent_<slug>`/`schedule_<slug>`), NOT
421
- * tenant-salted ids, so the `[tid_, tid\x60)` range predicate cannot reach them —
422
- * the tenant lives in `metadata.tenantId`. This is the second
423
- * offboarding kind alongside the range counter: a feature adopting a metadata-keyed
424
- * domain adds its counter HERE, its row to TENANT_METADATA_PURGE_TABLES, and its
425
- * PurgeTenantResult field in the same change, pinned the same way.
426
- */
427
- export type TenantMetadataPurgeCounter = 'schedules' | 'scheduleTriggers';
428
- /** One table purgeTenant reaps by `json_extract(metadata, '$.tenantId') = ?`. */
429
- export interface TenantMetadataPurgeTable {
430
- /** The PurgeTenantResult field this table's deleted-row count lands in. */
431
- counter: TenantMetadataPurgeCounter;
432
- /** Unprefixed table name; purgeTenant applies the host's tablePrefix. */
433
- table: string;
434
- }
435
- /**
436
- * The metadata-filtered purge inventory — the offboarding coverage for
437
- * tables whose tenant is a JSON `metadata.tenantId` (stamped by the schedules
438
- * facade at create + the tick on every trigger), not a salted id column. Both
439
- * schedule tables are here: schedule rows and their trigger history. The DELETE is
440
- * `WHERE json_extract(metadata, '$.tenantId') = ?` (the same SQLite json_extract
441
- * the run-snapshot purge already uses on `snapshot`), so a NULL/absent metadata
442
- * never matches — every row our facade/tick writes carries it, so this reaps them
443
- * all. Ordering is not load-bearing (deletes run concurrently; see purgeTenant).
444
- */
445
- export declare const TENANT_METADATA_PURGE_TABLES: readonly TenantMetadataPurgeTable[];
446
- /**
447
- * Complete tenant offboarding: reaps EVERY tenant-keyed store — snapshot
448
- * rows of ANY status (a tenant's suspended-and-abandoned runs are never
449
- * eligible for the terminal-only retention purge at any age), the tenant's
450
- * agent-memory rows (threads/messages/resources — salted per
451
- * docs/agent-memory-tenancy.md, so the same range predicate is exact), the
452
- * tenant's approval records (titles, summaries, payloads, decider
453
- * identities), and its R2 artifacts.
454
- *
455
- * The snapshot predicate is a range over the tenant-salted runId:
456
- * `run_id >= '<tid>_' AND run_id < '<tid>' || CHAR(0x60)`. tenantId is
457
- * revalidated against the tenant-ID pattern here — not for injection safety (every query is
458
- * parameter-bound) but for RANGE-EXACTNESS: the predicate selects exactly one
459
- * tenant only because the charset excludes every character in [0x5F, 0x60]
460
- * ('_' is 0x5F; its successor 0x60, backtick, closes the range under BINARY
461
- * collation). 'abc' can never sweep 'abcdefg'.
462
- *
463
- * PURGE POLICY (the race): this deletes SUSPENDED rows, and a reviewer
464
- * approving at that moment would resume against a vanishing row (absorbed:
465
- * the runtime's pre-check throws before any step re-executes — pinned by the
466
- * purge-race regression test). Only purge tenants whose tokens have already
467
- * expired, so no live caller can be mid-resume by construction — or purge at
468
- * the tenant's own explicit request (the showcase's self-service /demo/reset).
469
- * That caller, uniquely, can race ITSELF: a run started between the artifact
470
- * SELECT and the snapshot DELETE is reaped by the DELETE (which re-reads the
471
- * range) with its artifacts unenumerated, and the three statements are not one
472
- * transaction — an R2 delete can never join a SQL one — so a mid-purge failure
473
- * leaves it partially applied. Both are pinned in d1-storage.test.ts. Neither
474
- * can escape the requester's own tenant: the range predicate is exact.
475
- */
476
- export declare function purgeTenant(db: SnapshotDatabase, options: PurgeTenantOptions): Promise<PurgeTenantResult>;
477
339
  /** Rows affected by a D1 write, read from its `{ meta: { changes } }` envelope. */
478
340
  export declare function d1Changes(result: unknown): number;
479
341
  //# sourceMappingURL=d1-storage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"d1-storage.d.ts","sourceRoot":"","sources":["../../src/do-runner/d1-storage.ts"],"names":[],"mappings":"AASA,OAAO,EACL,oBAAoB,EACpB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,MAAM,WAAW,gBAAgB;IAC/B,iDAAiD;IACjD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,gDAAgD;IAChD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,gBAAgB,GACxB,oBAAoB,CAwBtB;AAcD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAAC;CAC3C;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC;IAC9C,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACxB,GAAG,CAAC,CAAC,GAAG,OAAO,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,CAAC,EAAE,CAAA;KAAE,CAAC,CAAC;CAC/C;AAED,qFAAqF;AACrF,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,UAA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