openloops 0.3.5 → 0.4.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 (217) hide show
  1. package/README.md +9 -8
  2. package/dist/db/index.d.ts +1 -0
  3. package/dist/db/index.js +3 -1
  4. package/dist/db/index.mjs +1 -0
  5. package/dist/db/indexes/automation-runs.d.ts +2 -0
  6. package/dist/db/indexes/automation-runs.js +33 -0
  7. package/dist/db/indexes/automation-runs.mjs +10 -0
  8. package/dist/db/indexes/automations.d.ts +2 -0
  9. package/dist/db/indexes/{agentic-jobs.js → automations.js} +6 -6
  10. package/dist/db/indexes/{agentic-jobs.mjs → automations.mjs} +2 -2
  11. package/dist/db/indexes/index.js +6 -4
  12. package/dist/db/indexes/index.mjs +6 -4
  13. package/dist/db/indexes/revoked-tokens.d.ts +2 -0
  14. package/dist/db/indexes/{agentic-job-runs.js → revoked-tokens.js} +8 -9
  15. package/dist/db/indexes/revoked-tokens.mjs +8 -0
  16. package/dist/db/migrations/automations.d.ts +12 -0
  17. package/dist/db/migrations/automations.js +70 -0
  18. package/dist/db/migrations/automations.mjs +47 -0
  19. package/dist/services/authentication/entities/index.d.ts +1 -0
  20. package/dist/services/authentication/entities/index.js +22 -0
  21. package/dist/services/authentication/entities/index.mjs +1 -0
  22. package/dist/services/authentication/entities/revoked-token.entity.d.ts +17 -0
  23. package/dist/services/authentication/entities/revoked-token.entity.js +67 -0
  24. package/dist/services/authentication/entities/revoked-token.entity.mjs +44 -0
  25. package/dist/services/authentication/index.d.ts +1 -0
  26. package/dist/services/authentication/index.js +3 -1
  27. package/dist/services/authentication/index.mjs +1 -0
  28. package/dist/services/authentication/module.d.ts +4 -0
  29. package/dist/services/authentication/module.js +16 -2
  30. package/dist/services/authentication/module.mjs +13 -1
  31. package/dist/services/authentication/repositories/index.d.ts +1 -0
  32. package/dist/services/{agentic-jobs → authentication}/repositories/index.js +2 -4
  33. package/dist/services/authentication/repositories/index.mjs +1 -0
  34. package/dist/services/authentication/repositories/revoked-token.repository.d.ts +7 -0
  35. package/dist/services/authentication/repositories/revoked-token.repository.js +55 -0
  36. package/dist/services/authentication/repositories/revoked-token.repository.mjs +26 -0
  37. package/dist/services/authentication/use-cases/is-token-revoked.use-case.d.ts +15 -0
  38. package/dist/services/authentication/use-cases/is-token-revoked.use-case.js +55 -0
  39. package/dist/services/authentication/use-cases/is-token-revoked.use-case.mjs +26 -0
  40. package/dist/services/authentication/use-cases/revoke-token.use-case.d.ts +14 -0
  41. package/dist/services/authentication/use-cases/revoke-token.use-case.js +65 -0
  42. package/dist/services/authentication/use-cases/revoke-token.use-case.mjs +36 -0
  43. package/dist/services/automations/entities/automation-run.entity.d.ts +46 -0
  44. package/dist/services/{agentic-jobs/entities/agentic-job-run.entity.js → automations/entities/automation-run.entity.js} +22 -14
  45. package/dist/services/{agentic-jobs/entities/agentic-job-run.entity.mjs → automations/entities/automation-run.entity.mjs} +18 -10
  46. package/dist/services/automations/entities/automation.entity.d.ts +38 -0
  47. package/dist/services/{agentic-jobs/entities/agentic-job.entity.js → automations/entities/automation.entity.js} +17 -17
  48. package/dist/services/{agentic-jobs/entities/agentic-job.entity.mjs → automations/entities/automation.entity.mjs} +13 -13
  49. package/dist/services/automations/entities/index.d.ts +4 -0
  50. package/dist/services/{agentic-jobs → automations}/entities/index.js +6 -4
  51. package/dist/services/automations/entities/index.mjs +4 -0
  52. package/dist/services/automations/entities/trigger.d.ts +11 -0
  53. package/dist/services/automations/entities/trigger.js +49 -0
  54. package/dist/services/automations/entities/trigger.mjs +26 -0
  55. package/dist/services/automations/index.d.ts +5 -0
  56. package/dist/services/{agentic-jobs → automations}/index.js +9 -7
  57. package/dist/services/automations/index.mjs +5 -0
  58. package/dist/services/automations/module.d.ts +41 -0
  59. package/dist/services/automations/module.js +167 -0
  60. package/dist/services/automations/module.mjs +125 -0
  61. package/dist/services/automations/repositories/automation-run.repository.d.ts +14 -0
  62. package/dist/services/{agentic-jobs/repositories/agentic-job-run.repository.js → automations/repositories/automation-run.repository.js} +23 -11
  63. package/dist/services/{agentic-jobs/repositories/agentic-job-run.repository.mjs → automations/repositories/automation-run.repository.mjs} +19 -7
  64. package/dist/services/automations/repositories/automation.repository.d.ts +27 -0
  65. package/dist/services/{agentic-jobs/repositories/agentic-job.repository.js → automations/repositories/automation.repository.js} +17 -17
  66. package/dist/services/{agentic-jobs/repositories/agentic-job.repository.mjs → automations/repositories/automation.repository.mjs} +13 -13
  67. package/dist/services/automations/repositories/index.d.ts +2 -0
  68. package/dist/services/automations/repositories/index.js +24 -0
  69. package/dist/services/automations/repositories/index.mjs +2 -0
  70. package/dist/services/automations/runner/automation-runner.d.ts +49 -0
  71. package/dist/services/{agentic-jobs/runner/agentic-job-runner.js → automations/runner/automation-runner.js} +55 -45
  72. package/dist/services/{agentic-jobs/runner/agentic-job-runner.mjs → automations/runner/automation-runner.mjs} +50 -40
  73. package/dist/services/{agentic-jobs/use-cases/attach-agentic-job-run-chat.use-case.d.ts → automations/use-cases/attach-automation-run-chat.use-case.d.ts} +6 -6
  74. package/dist/services/{agentic-jobs/use-cases/attach-agentic-job-run-chat.use-case.js → automations/use-cases/attach-automation-run-chat.use-case.js} +14 -14
  75. package/dist/services/automations/use-cases/attach-automation-run-chat.use-case.mjs +29 -0
  76. package/dist/services/automations/use-cases/claim-due-automations.use-case.d.ts +28 -0
  77. package/dist/services/{agentic-jobs/use-cases/claim-due-agentic-jobs.use-case.js → automations/use-cases/claim-due-automations.use-case.js} +32 -43
  78. package/dist/services/automations/use-cases/claim-due-automations.use-case.mjs +70 -0
  79. package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.d.ts +27 -0
  80. package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.js +106 -0
  81. package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.mjs +77 -0
  82. package/dist/services/automations/use-cases/create-automation.use-case.d.ts +14 -0
  83. package/dist/services/{agentic-jobs/use-cases/create-agentic-job.use-case.js → automations/use-cases/create-automation.use-case.js} +24 -25
  84. package/dist/services/automations/use-cases/create-automation.use-case.mjs +43 -0
  85. package/dist/services/{agentic-jobs/use-cases/delete-agentic-job.use-case.d.ts → automations/use-cases/delete-automation.use-case.d.ts} +6 -6
  86. package/dist/services/{agentic-jobs/use-cases/delete-agentic-job.use-case.js → automations/use-cases/delete-automation.use-case.js} +17 -17
  87. package/dist/services/automations/use-cases/delete-automation.use-case.mjs +36 -0
  88. package/dist/services/{agentic-jobs/use-cases/finish-agentic-job-run.use-case.d.ts → automations/use-cases/finish-automation-run.use-case.d.ts} +8 -8
  89. package/dist/services/{agentic-jobs/use-cases/finish-agentic-job-run.use-case.js → automations/use-cases/finish-automation-run.use-case.js} +20 -20
  90. package/dist/services/automations/use-cases/finish-automation-run.use-case.mjs +46 -0
  91. package/dist/services/{agentic-jobs/use-cases/get-agentic-job-by-id.use-case.d.ts → automations/use-cases/get-automation-by-id.use-case.d.ts} +6 -6
  92. package/dist/services/{agentic-jobs/use-cases/get-agentic-job-by-id.use-case.js → automations/use-cases/get-automation-by-id.use-case.js} +13 -13
  93. package/dist/services/automations/use-cases/get-automation-by-id.use-case.mjs +26 -0
  94. package/dist/services/automations/use-cases/issue-automation-event-token.use-case.d.ts +17 -0
  95. package/dist/services/automations/use-cases/issue-automation-event-token.use-case.js +59 -0
  96. package/dist/services/automations/use-cases/issue-automation-event-token.use-case.mjs +30 -0
  97. package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-job.use-case.d.ts → automations/use-cases/list-automation-runs-by-automation.use-case.d.ts} +7 -7
  98. package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-job.use-case.js → automations/use-cases/list-automation-runs-by-automation.use-case.js} +15 -15
  99. package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.mjs +28 -0
  100. package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-user.use-case.d.ts → automations/use-cases/list-automation-runs-by-user.use-case.d.ts} +7 -7
  101. package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-user.use-case.js → automations/use-cases/list-automation-runs-by-user.use-case.js} +14 -14
  102. package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-user.use-case.mjs → automations/use-cases/list-automation-runs-by-user.use-case.mjs} +11 -11
  103. package/dist/services/{agentic-jobs/use-cases/list-agentic-jobs-by-user.use-case.d.ts → automations/use-cases/list-automations-by-user.use-case.d.ts} +6 -6
  104. package/dist/services/{agentic-jobs/use-cases/list-agentic-jobs-by-user.use-case.js → automations/use-cases/list-automations-by-user.use-case.js} +14 -14
  105. package/dist/services/{agentic-jobs/use-cases/list-agentic-jobs-by-user.use-case.mjs → automations/use-cases/list-automations-by-user.use-case.mjs} +11 -11
  106. package/dist/services/{agentic-jobs/use-cases/preview-agentic-job-runs.use-case.d.ts → automations/use-cases/preview-automation-runs.use-case.d.ts} +1 -1
  107. package/dist/services/{agentic-jobs/use-cases/preview-agentic-job-runs.use-case.js → automations/use-cases/preview-automation-runs.use-case.js} +8 -8
  108. package/dist/services/{agentic-jobs/use-cases/preview-agentic-job-runs.use-case.mjs → automations/use-cases/preview-automation-runs.use-case.mjs} +4 -4
  109. package/dist/services/automations/use-cases/receive-automation-event.use-case.d.ts +23 -0
  110. package/dist/services/automations/use-cases/receive-automation-event.use-case.js +97 -0
  111. package/dist/services/automations/use-cases/receive-automation-event.use-case.mjs +68 -0
  112. package/dist/services/{agentic-jobs/use-cases/renew-agentic-job-lease.use-case.d.ts → automations/use-cases/renew-automation-lease.use-case.d.ts} +5 -5
  113. package/dist/services/{agentic-jobs/use-cases/renew-agentic-job-lease.use-case.js → automations/use-cases/renew-automation-lease.use-case.js} +15 -15
  114. package/dist/services/automations/use-cases/renew-automation-lease.use-case.mjs +29 -0
  115. package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.d.ts +16 -0
  116. package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.js +65 -0
  117. package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.mjs +36 -0
  118. package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.d.ts +14 -0
  119. package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.js +63 -0
  120. package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.mjs +34 -0
  121. package/dist/services/automations/use-cases/start-automation-run.use-case.d.ts +21 -0
  122. package/dist/services/{agentic-jobs/use-cases/start-agentic-job-run.use-case.js → automations/use-cases/start-automation-run.use-case.js} +24 -24
  123. package/dist/services/automations/use-cases/start-automation-run.use-case.mjs +38 -0
  124. package/dist/services/automations/use-cases/sync-automation-run.use-case.d.ts +20 -0
  125. package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-run.use-case.js → automations/use-cases/sync-automation-run.use-case.js} +23 -23
  126. package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-run.use-case.mjs → automations/use-cases/sync-automation-run.use-case.mjs} +21 -21
  127. package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-runs.use-case.d.ts → automations/use-cases/sync-automation-runs.use-case.d.ts} +5 -5
  128. package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-runs.use-case.js → automations/use-cases/sync-automation-runs.use-case.js} +16 -16
  129. package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-runs.use-case.mjs → automations/use-cases/sync-automation-runs.use-case.mjs} +13 -13
  130. package/dist/services/automations/use-cases/update-automation.use-case.d.ts +15 -0
  131. package/dist/services/{agentic-jobs/use-cases/update-agentic-job.use-case.js → automations/use-cases/update-automation.use-case.js} +27 -27
  132. package/dist/services/automations/use-cases/update-automation.use-case.mjs +54 -0
  133. package/dist/services/automations/utils/automation-event-error.d.ts +6 -0
  134. package/dist/services/automations/utils/automation-event-error.js +37 -0
  135. package/dist/services/automations/utils/automation-event-error.mjs +14 -0
  136. package/dist/services/automations/utils/automation-fields.d.ts +14 -0
  137. package/dist/services/{agentic-jobs/utils/job-fields.js → automations/utils/automation-fields.js} +8 -10
  138. package/dist/services/{agentic-jobs/utils/job-fields.mjs → automations/utils/automation-fields.mjs} +4 -6
  139. package/dist/services/automations/utils/event-message.d.ts +1 -0
  140. package/dist/services/automations/utils/event-message.js +37 -0
  141. package/dist/services/automations/utils/event-message.mjs +14 -0
  142. package/dist/services/automations/utils/event-token.d.ts +18 -0
  143. package/dist/services/automations/utils/event-token.js +78 -0
  144. package/dist/services/automations/utils/event-token.mjs +43 -0
  145. package/dist/services/automations/utils/open-run.d.ts +14 -0
  146. package/dist/services/{agentic-jobs → automations}/utils/open-run.js +10 -8
  147. package/dist/services/automations/utils/open-run.mjs +26 -0
  148. package/dist/services/automations/utils/previous-run.d.ts +4 -0
  149. package/dist/services/automations/utils/previous-run.js +42 -0
  150. package/dist/services/automations/utils/previous-run.mjs +19 -0
  151. package/dist/services/{agentic-jobs → automations}/utils/settings.d.ts +1 -0
  152. package/dist/services/{agentic-jobs → automations}/utils/settings.js +6 -2
  153. package/dist/services/automations/utils/settings.mjs +13 -0
  154. package/docs/README.md +1 -1
  155. package/docs/agent.md +2 -2
  156. package/docs/authentication.md +18 -1
  157. package/docs/automations.md +341 -0
  158. package/docs/configuration.md +6 -5
  159. package/docs/harness.md +1 -1
  160. package/docs/integration-guide.md +22 -18
  161. package/docs/llms.txt +1 -1
  162. package/docs/mcp-servers.md +1 -1
  163. package/examples/{agentic-jobs/create-agentic-job.ts → automations/create-automation.ts} +10 -7
  164. package/examples/automations/create-event-automation.ts +24 -0
  165. package/examples/{agentic-jobs/list-agentic-job-runs.ts → automations/list-automation-runs.ts} +8 -8
  166. package/examples/automations/list-automations.ts +25 -0
  167. package/examples/{agentic-jobs/preview-agentic-job-runs.ts → automations/preview-automation-runs.ts} +2 -2
  168. package/examples/automations/receive-automation-event.ts +26 -0
  169. package/examples/automations/revoke-automation-event-token.ts +25 -0
  170. package/examples/{agentic-jobs/run-agentic-job-now.ts → automations/run-automation-now.ts} +3 -3
  171. package/examples/{agentic-jobs/run-agentic-job-worker.ts → automations/run-automation-worker.ts} +6 -6
  172. package/examples/{agentic-jobs/update-agentic-job.ts → automations/update-automation.ts} +10 -10
  173. package/package.json +14 -13
  174. package/dist/db/indexes/agentic-job-runs.d.ts +0 -2
  175. package/dist/db/indexes/agentic-job-runs.mjs +0 -9
  176. package/dist/db/indexes/agentic-jobs.d.ts +0 -2
  177. package/dist/services/agentic-jobs/entities/agentic-job-run.entity.d.ts +0 -42
  178. package/dist/services/agentic-jobs/entities/agentic-job.entity.d.ts +0 -39
  179. package/dist/services/agentic-jobs/entities/index.d.ts +0 -3
  180. package/dist/services/agentic-jobs/entities/index.mjs +0 -3
  181. package/dist/services/agentic-jobs/index.d.ts +0 -4
  182. package/dist/services/agentic-jobs/index.mjs +0 -4
  183. package/dist/services/agentic-jobs/module.d.ts +0 -31
  184. package/dist/services/agentic-jobs/module.js +0 -132
  185. package/dist/services/agentic-jobs/module.mjs +0 -95
  186. package/dist/services/agentic-jobs/repositories/agentic-job-run.repository.d.ts +0 -11
  187. package/dist/services/agentic-jobs/repositories/agentic-job.repository.d.ts +0 -27
  188. package/dist/services/agentic-jobs/repositories/index.d.ts +0 -2
  189. package/dist/services/agentic-jobs/repositories/index.mjs +0 -2
  190. package/dist/services/agentic-jobs/runner/agentic-job-runner.d.ts +0 -48
  191. package/dist/services/agentic-jobs/use-cases/attach-agentic-job-run-chat.use-case.mjs +0 -29
  192. package/dist/services/agentic-jobs/use-cases/claim-due-agentic-jobs.use-case.d.ts +0 -29
  193. package/dist/services/agentic-jobs/use-cases/claim-due-agentic-jobs.use-case.mjs +0 -81
  194. package/dist/services/agentic-jobs/use-cases/create-agentic-job.use-case.d.ts +0 -14
  195. package/dist/services/agentic-jobs/use-cases/create-agentic-job.use-case.mjs +0 -44
  196. package/dist/services/agentic-jobs/use-cases/delete-agentic-job.use-case.mjs +0 -36
  197. package/dist/services/agentic-jobs/use-cases/finish-agentic-job-run.use-case.mjs +0 -46
  198. package/dist/services/agentic-jobs/use-cases/get-agentic-job-by-id.use-case.mjs +0 -26
  199. package/dist/services/agentic-jobs/use-cases/list-agentic-job-runs-by-job.use-case.mjs +0 -28
  200. package/dist/services/agentic-jobs/use-cases/renew-agentic-job-lease.use-case.mjs +0 -29
  201. package/dist/services/agentic-jobs/use-cases/start-agentic-job-run.use-case.d.ts +0 -21
  202. package/dist/services/agentic-jobs/use-cases/start-agentic-job-run.use-case.mjs +0 -38
  203. package/dist/services/agentic-jobs/use-cases/sync-agentic-job-run.use-case.d.ts +0 -20
  204. package/dist/services/agentic-jobs/use-cases/update-agentic-job.use-case.d.ts +0 -15
  205. package/dist/services/agentic-jobs/use-cases/update-agentic-job.use-case.mjs +0 -54
  206. package/dist/services/agentic-jobs/utils/job-fields.d.ts +0 -14
  207. package/dist/services/agentic-jobs/utils/open-run.d.ts +0 -12
  208. package/dist/services/agentic-jobs/utils/open-run.mjs +0 -24
  209. package/dist/services/agentic-jobs/utils/settings.mjs +0 -10
  210. package/docs/agentic-jobs.md +0 -217
  211. package/examples/agentic-jobs/list-agentic-jobs.ts +0 -25
  212. /package/dist/services/{agentic-jobs → automations}/entities/recurrence.d.ts +0 -0
  213. /package/dist/services/{agentic-jobs → automations}/entities/recurrence.js +0 -0
  214. /package/dist/services/{agentic-jobs → automations}/entities/recurrence.mjs +0 -0
  215. /package/dist/services/{agentic-jobs → automations}/utils/next-run.d.ts +0 -0
  216. /package/dist/services/{agentic-jobs → automations}/utils/next-run.js +0 -0
  217. /package/dist/services/{agentic-jobs → automations}/utils/next-run.mjs +0 -0
package/README.md CHANGED
@@ -40,7 +40,7 @@ A model alone only chats. The harness is what lets it act, safely, for many user
40
40
  | **Transmission** | Takes the model to the outside world | Your tools and MCP servers, found on demand and validated before they run. See [tools](docs/tools.md) and [MCP servers](docs/mcp-servers.md) |
41
41
  | **Brakes** | Stops the agent when it should stop | Confirmation of destructive tools, approval of MCP servers, input guardrails, timeouts and a budget per task. See [guardrails](docs/guardrails.md) and [the harness](docs/harness.md) |
42
42
  | **Logbook** | Remembers and records everything | Chats, tasks, every tool call, traces, and usage and cost per call. See [chats](docs/chats.md) and [usage](docs/usage.md) |
43
- | **Steering** | Decides how the agent is driven | Interactive and autonomous runs, scheduled jobs, stopping a run, and the model per chat and per user. See [the Agent](docs/agent.md), [agentic jobs](docs/agentic-jobs.md) and [configuration](docs/configuration.md) |
43
+ | **Steering** | Decides how the agent is driven | Interactive and autonomous runs, scheduled automations, stopping a run, and the model per chat and per user. See [the Agent](docs/agent.md), [automations](docs/automations.md) and [configuration](docs/configuration.md) |
44
44
 
45
45
  ## Why it is a good harness
46
46
 
@@ -56,7 +56,7 @@ Not adjectives, mechanisms that you can read in the code and in the tests:
56
56
 
57
57
  ## Building a backend with it
58
58
 
59
- If you or your coding agent are going to build the backend that uses `openloops`, start with the [integration guide](docs/integration-guide.md). It lists which endpoint calls which use case, what authorization is left to you (the package has no HTTP layer), how to run agents and scheduled jobs, and a security checklist. The whole documentation is also shipped inside the package, in `node_modules/openloops/docs`, with an index for tools in [`docs/llms.txt`](docs/llms.txt).
59
+ If you or your coding agent are going to build the backend that uses `openloops`, start with the [integration guide](docs/integration-guide.md). It lists which endpoint calls which use case, what authorization is left to you (the package has no HTTP layer), how to run agents and scheduled automations, and a security checklist. The whole documentation is also shipped inside the package, in `node_modules/openloops/docs`, with an index for tools in [`docs/llms.txt`](docs/llms.txt).
60
60
 
61
61
  To make sure that your coding agent reads it in every session, add this to the `CLAUDE.md` or `AGENTS.md` of your backend:
62
62
 
@@ -104,7 +104,7 @@ You know the pattern: before you write a single line of what your agent actually
104
104
  - **Safe tool execution.** Arguments are validated against the tool's schema, destructive tools wait for the user's confirmation, identical failing calls are blocked, identifiers the model invented are rejected before they reach a real system, and large outputs are kept out of the prompt. LLM calls retry with backoff and wait out rate limits.
105
105
  - **Native MCP support with a trust flow.** Connect any MCP server and its tools become regular tools. Each server must be approved by the user before its first tool runs, and a server that changes its tools is reviewed again, so a third party cannot quietly change what your agent does.
106
106
  - **Autonomous runs.** The same agent can work without a person in the chat, for scheduled tasks. Whatever needs the user pauses the run in the chat, and the user answers there to continue. See [autonomous mode](docs/agent.md#autonomous-mode).
107
- - **Agentic jobs.** Schedule tasks that the agent runs by itself, daily, weekly, monthly or once, in the timezone of the user. A worker runs what is due, safely across several instances, and keeps a history of every run with its chat. See [agentic jobs](docs/agentic-jobs.md).
107
+ - **Automations.** Tasks that the agent runs by itself, on a schedule (daily, weekly, monthly or once, in the timezone of the user) or when another system sends an event, with signed tokens that can be revoked and a queue per automation. A worker runs what is due, safely across several instances, and keeps a history of every run with its chat. See [automations](docs/automations.md).
108
108
  - **Guardrails.** Input guards block messages with card numbers, emails, code or anything you define, before the model sees them. See [guardrails](docs/guardrails.md).
109
109
  - **Usage and cost tracking.** Every LLM call is recorded. Get the tokens and cost of a chat or an answer, and per-user statistics by model and by period. See [usage](docs/usage.md).
110
110
  - **Users and authentication included.** User management and login with tokens, so you don't need a parallel system just to have an identity to hand the `Agent`.
@@ -219,8 +219,9 @@ LLM_FALLBACK_PROVIDER=
219
219
  LLM_FALLBACK_MODEL=
220
220
 
221
221
  # Optional, in milliseconds
222
- AGENTIC_JOBS_POLL_INTERVAL_MS=
223
- AGENTIC_JOBS_LEASE_MS=
222
+ AUTOMATIONS_POLL_INTERVAL_MS=
223
+ AUTOMATIONS_LEASE_MS=
224
+ AUTOMATIONS_MAX_QUEUED_RUNS=
224
225
  LLM_CALL_TIMEOUT_MS=
225
226
  MCP_TOOL_TIMEOUT_MS=
226
227
 
@@ -261,7 +262,7 @@ Neither requires any code changes. They're opt-in purely through environment var
261
262
 
262
263
  ## More examples
263
264
 
264
- Every pattern above, and a lot more, lives as a runnable example in [`examples/`](examples), organized by domain: `run-agent`, `loops`, `tools`, `guardrails`, `agentic-jobs`, `mcps`, `chats`, `usage`, `users`, and `authentication`.
265
+ Every pattern above, and a lot more, lives as a runnable example in [`examples/`](examples), organized by domain: `run-agent`, `loops`, `tools`, `guardrails`, `automations`, `mcps`, `chats`, `usage`, `users`, and `authentication`.
265
266
 
266
267
  ## Package structure
267
268
 
@@ -275,7 +276,7 @@ Every pattern above, and a lot more, lives as a runnable example in [`examples/`
275
276
  | `openloops/skills` | `Skill`, for writing LLM-backed reasoning steps inside a loop |
276
277
  | `openloops/guardrails` | `Guard` and the ready-made input guards |
277
278
  | `openloops/mcps` | MCP server management, connection check and trust decisions |
278
- | `openloops/agentic-jobs` | Scheduled tasks, their runs and the runner that executes them |
279
+ | `openloops/automations` | Scheduled and event tasks, their runs and the runner that executes them |
279
280
  | `openloops/chats` | Chats and their messages: list, read, update, delete |
280
281
  | `openloops/users` | User management |
281
282
  | `openloops/authentication` | Login and token issuing |
@@ -295,7 +296,7 @@ Every pattern above, and a lot more, lives as a runnable example in [`examples/`
295
296
  - [Skills](docs/skills.md)
296
297
  - [Guardrails](docs/guardrails.md)
297
298
  - [MCP servers](docs/mcp-servers.md)
298
- - [Agentic jobs](docs/agentic-jobs.md)
299
+ - [Automations](docs/automations.md)
299
300
  - [Chats](docs/chats.md)
300
301
  - [User management](docs/users.md)
301
302
  - [Authentication](docs/authentication.md)
@@ -1 +1,2 @@
1
1
  export * from './indexes';
2
+ export * from './migrations/automations';
package/dist/db/index.js CHANGED
@@ -16,7 +16,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  var db_exports = {};
17
17
  module.exports = __toCommonJS(db_exports);
18
18
  __reExport(db_exports, require("./indexes"), module.exports);
19
+ __reExport(db_exports, require("./migrations/automations"), module.exports);
19
20
  // Annotate the CommonJS export names for ESM import in node:
20
21
  0 && (module.exports = {
21
- ...require("./indexes")
22
+ ...require("./indexes"),
23
+ ...require("./migrations/automations")
22
24
  });
package/dist/db/index.mjs CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./indexes";
2
+ export * from "./migrations/automations";
@@ -0,0 +1,2 @@
1
+ import { IndexDescription } from 'mongodb';
2
+ export declare const automationRuns: IndexDescription[];
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var automation_runs_exports = {};
20
+ __export(automation_runs_exports, {
21
+ automationRuns: () => automationRuns
22
+ });
23
+ module.exports = __toCommonJS(automation_runs_exports);
24
+ const automationRuns = [
25
+ { key: { automationId: 1, createdAt: -1 } },
26
+ { key: { ownerId: 1, createdAt: -1 } },
27
+ { key: { status: 1, createdAt: 1 } },
28
+ { key: { automationId: 1, idempotencyKey: 1 }, unique: true, partialFilterExpression: { idempotencyKey: { $exists: true } } }
29
+ ];
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ automationRuns
33
+ });
@@ -0,0 +1,10 @@
1
+ import "../../chunk-CF3WOMB3.mjs";
2
+ const automationRuns = [
3
+ { key: { automationId: 1, createdAt: -1 } },
4
+ { key: { ownerId: 1, createdAt: -1 } },
5
+ { key: { status: 1, createdAt: 1 } },
6
+ { key: { automationId: 1, idempotencyKey: 1 }, unique: true, partialFilterExpression: { idempotencyKey: { $exists: true } } }
7
+ ];
8
+ export {
9
+ automationRuns
10
+ };
@@ -0,0 +1,2 @@
1
+ import { IndexDescription } from 'mongodb';
2
+ export declare const automations: IndexDescription[];
@@ -16,16 +16,16 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var agentic_jobs_exports = {};
20
- __export(agentic_jobs_exports, {
21
- agenticJobs: () => agenticJobs
19
+ var automations_exports = {};
20
+ __export(automations_exports, {
21
+ automations: () => automations
22
22
  });
23
- module.exports = __toCommonJS(agentic_jobs_exports);
24
- const agenticJobs = [
23
+ module.exports = __toCommonJS(automations_exports);
24
+ const automations = [
25
25
  { key: { enabled: 1, nextRunAt: 1 } },
26
26
  { key: { ownerId: 1, createdAt: -1 } }
27
27
  ];
28
28
  // Annotate the CommonJS export names for ESM import in node:
29
29
  0 && (module.exports = {
30
- agenticJobs
30
+ automations
31
31
  });
@@ -1,8 +1,8 @@
1
1
  import "../../chunk-CF3WOMB3.mjs";
2
- const agenticJobs = [
2
+ const automations = [
3
3
  { key: { enabled: 1, nextRunAt: 1 } },
4
4
  { key: { ownerId: 1, createdAt: -1 } }
5
5
  ];
6
6
  export {
7
- agenticJobs
7
+ automations
8
8
  };
@@ -29,8 +29,9 @@ var import_agent_actions = require("./agent-actions");
29
29
  var import_agent_traces = require("./agent-traces");
30
30
  var import_workspace_items = require("./workspace-items");
31
31
  var import_mcp_servers = require("./mcp-servers");
32
- var import_agentic_jobs = require("./agentic-jobs");
33
- var import_agentic_job_runs = require("./agentic-job-runs");
32
+ var import_automations = require("./automations");
33
+ var import_automation_runs = require("./automation-runs");
34
+ var import_revoked_tokens = require("./revoked-tokens");
34
35
  const indexes = {
35
36
  llm_calls: import_llm_calls.llmCalls,
36
37
  chats: import_chats.chats,
@@ -39,8 +40,9 @@ const indexes = {
39
40
  agent_traces: import_agent_traces.agentTraces,
40
41
  workspace_items: import_workspace_items.workspaceItems,
41
42
  mcp_servers: import_mcp_servers.mcpServers,
42
- agentic_jobs: import_agentic_jobs.agenticJobs,
43
- agentic_job_runs: import_agentic_job_runs.agenticJobRuns
43
+ automations: import_automations.automations,
44
+ automation_runs: import_automation_runs.automationRuns,
45
+ revoked_tokens: import_revoked_tokens.revokedTokens
44
46
  };
45
47
  async function ensureIndexes(db) {
46
48
  const created = {};
@@ -6,8 +6,9 @@ import { agentActions } from "./agent-actions";
6
6
  import { agentTraces } from "./agent-traces";
7
7
  import { workspaceItems } from "./workspace-items";
8
8
  import { mcpServers } from "./mcp-servers";
9
- import { agenticJobs } from "./agentic-jobs";
10
- import { agenticJobRuns } from "./agentic-job-runs";
9
+ import { automations } from "./automations";
10
+ import { automationRuns } from "./automation-runs";
11
+ import { revokedTokens } from "./revoked-tokens";
11
12
  const indexes = {
12
13
  llm_calls: llmCalls,
13
14
  chats,
@@ -16,8 +17,9 @@ const indexes = {
16
17
  agent_traces: agentTraces,
17
18
  workspace_items: workspaceItems,
18
19
  mcp_servers: mcpServers,
19
- agentic_jobs: agenticJobs,
20
- agentic_job_runs: agenticJobRuns
20
+ automations,
21
+ automation_runs: automationRuns,
22
+ revoked_tokens: revokedTokens
21
23
  };
22
24
  async function ensureIndexes(db) {
23
25
  const created = {};
@@ -0,0 +1,2 @@
1
+ import { IndexDescription } from 'mongodb';
2
+ export declare const revokedTokens: IndexDescription[];
@@ -16,17 +16,16 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var agentic_job_runs_exports = {};
20
- __export(agentic_job_runs_exports, {
21
- agenticJobRuns: () => agenticJobRuns
19
+ var revoked_tokens_exports = {};
20
+ __export(revoked_tokens_exports, {
21
+ revokedTokens: () => revokedTokens
22
22
  });
23
- module.exports = __toCommonJS(agentic_job_runs_exports);
24
- const agenticJobRuns = [
25
- { key: { jobId: 1, createdAt: -1 } },
26
- { key: { ownerId: 1, createdAt: -1 } },
27
- { key: { status: 1, createdAt: 1 } }
23
+ module.exports = __toCommonJS(revoked_tokens_exports);
24
+ const revokedTokens = [
25
+ { key: { jti: 1 }, unique: true },
26
+ { key: { expiresAt: 1 }, expireAfterSeconds: 0 }
28
27
  ];
29
28
  // Annotate the CommonJS export names for ESM import in node:
30
29
  0 && (module.exports = {
31
- agenticJobRuns
30
+ revokedTokens
32
31
  });
@@ -0,0 +1,8 @@
1
+ import "../../chunk-CF3WOMB3.mjs";
2
+ const revokedTokens = [
3
+ { key: { jti: 1 }, unique: true },
4
+ { key: { expiresAt: 1 }, expireAfterSeconds: 0 }
5
+ ];
6
+ export {
7
+ revokedTokens
8
+ };
@@ -0,0 +1,12 @@
1
+ import { Db } from 'mongodb';
2
+ export interface AutomationsMigrationOptions {
3
+ dryRun?: boolean;
4
+ }
5
+ export interface AutomationsMigrationReport {
6
+ dryRun: boolean;
7
+ renamedCollections: string[];
8
+ triggersCreated: number;
9
+ runsUpdated: number;
10
+ droppedIndexes: string[];
11
+ }
12
+ export declare function migrateAutomations(db: Db, options?: AutomationsMigrationOptions): Promise<AutomationsMigrationReport>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var automations_exports = {};
20
+ __export(automations_exports, {
21
+ migrateAutomations: () => migrateAutomations
22
+ });
23
+ module.exports = __toCommonJS(automations_exports);
24
+ var import_indexes = require("../indexes");
25
+ const RENAMES = [
26
+ ["agentic_jobs", "automations"],
27
+ ["agentic_job_runs", "automation_runs"]
28
+ ];
29
+ const OLD_RUN_INDEX = "jobId_1_createdAt_-1";
30
+ const exists = async (db, name) => (await db.listCollections({ name }).toArray()).length > 0;
31
+ async function migrateAutomations(db, options = {}) {
32
+ const dryRun = Boolean(options.dryRun);
33
+ const report = { dryRun, renamedCollections: [], triggersCreated: 0, runsUpdated: 0, droppedIndexes: [] };
34
+ for (const [from, to] of RENAMES) {
35
+ if (!await exists(db, from)) continue;
36
+ if (await exists(db, to)) throw new Error(`Cannot rename ${from} to ${to} because ${to} already exists`);
37
+ if (!dryRun) await db.renameCollection(from, to);
38
+ report.renamedCollections.push(`${from} -> ${to}`);
39
+ }
40
+ const automations = db.collection(dryRun && report.renamedCollections.length ? "agentic_jobs" : "automations");
41
+ const runs = db.collection(dryRun && report.renamedCollections.length ? "agentic_job_runs" : "automation_runs");
42
+ const withoutTrigger = { trigger: { $exists: false }, recurrence: { $exists: true } };
43
+ const withJobId = { jobId: { $exists: true } };
44
+ if (dryRun) {
45
+ report.triggersCreated = await automations.countDocuments(withoutTrigger);
46
+ report.runsUpdated = await runs.countDocuments(withJobId);
47
+ } else {
48
+ const triggers = await automations.updateMany(withoutTrigger, [
49
+ { $set: { trigger: { type: "schedule", recurrence: "$recurrence", timezone: "$timezone" } } },
50
+ { $unset: ["recurrence", "timezone"] }
51
+ ]);
52
+ const moved = await runs.updateMany(withJobId, [
53
+ { $set: { automationId: "$jobId" } },
54
+ { $unset: "jobId" }
55
+ ]);
56
+ report.triggersCreated = triggers.modifiedCount;
57
+ report.runsUpdated = moved.modifiedCount;
58
+ }
59
+ const indexes = await runs.indexes().catch(() => []);
60
+ if (indexes.some((index) => index.name === OLD_RUN_INDEX)) {
61
+ if (!dryRun) await runs.dropIndex(OLD_RUN_INDEX);
62
+ report.droppedIndexes.push(OLD_RUN_INDEX);
63
+ }
64
+ if (!dryRun) await (0, import_indexes.ensureIndexes)(db);
65
+ return report;
66
+ }
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {
69
+ migrateAutomations
70
+ });
@@ -0,0 +1,47 @@
1
+ import "../../chunk-CF3WOMB3.mjs";
2
+ import { ensureIndexes } from "../indexes";
3
+ const RENAMES = [
4
+ ["agentic_jobs", "automations"],
5
+ ["agentic_job_runs", "automation_runs"]
6
+ ];
7
+ const OLD_RUN_INDEX = "jobId_1_createdAt_-1";
8
+ const exists = async (db, name) => (await db.listCollections({ name }).toArray()).length > 0;
9
+ async function migrateAutomations(db, options = {}) {
10
+ const dryRun = Boolean(options.dryRun);
11
+ const report = { dryRun, renamedCollections: [], triggersCreated: 0, runsUpdated: 0, droppedIndexes: [] };
12
+ for (const [from, to] of RENAMES) {
13
+ if (!await exists(db, from)) continue;
14
+ if (await exists(db, to)) throw new Error(`Cannot rename ${from} to ${to} because ${to} already exists`);
15
+ if (!dryRun) await db.renameCollection(from, to);
16
+ report.renamedCollections.push(`${from} -> ${to}`);
17
+ }
18
+ const automations = db.collection(dryRun && report.renamedCollections.length ? "agentic_jobs" : "automations");
19
+ const runs = db.collection(dryRun && report.renamedCollections.length ? "agentic_job_runs" : "automation_runs");
20
+ const withoutTrigger = { trigger: { $exists: false }, recurrence: { $exists: true } };
21
+ const withJobId = { jobId: { $exists: true } };
22
+ if (dryRun) {
23
+ report.triggersCreated = await automations.countDocuments(withoutTrigger);
24
+ report.runsUpdated = await runs.countDocuments(withJobId);
25
+ } else {
26
+ const triggers = await automations.updateMany(withoutTrigger, [
27
+ { $set: { trigger: { type: "schedule", recurrence: "$recurrence", timezone: "$timezone" } } },
28
+ { $unset: ["recurrence", "timezone"] }
29
+ ]);
30
+ const moved = await runs.updateMany(withJobId, [
31
+ { $set: { automationId: "$jobId" } },
32
+ { $unset: "jobId" }
33
+ ]);
34
+ report.triggersCreated = triggers.modifiedCount;
35
+ report.runsUpdated = moved.modifiedCount;
36
+ }
37
+ const indexes = await runs.indexes().catch(() => []);
38
+ if (indexes.some((index) => index.name === OLD_RUN_INDEX)) {
39
+ if (!dryRun) await runs.dropIndex(OLD_RUN_INDEX);
40
+ report.droppedIndexes.push(OLD_RUN_INDEX);
41
+ }
42
+ if (!dryRun) await ensureIndexes(db);
43
+ return report;
44
+ }
45
+ export {
46
+ migrateAutomations
47
+ };
@@ -0,0 +1 @@
1
+ export * from './revoked-token.entity';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var entities_exports = {};
17
+ module.exports = __toCommonJS(entities_exports);
18
+ __reExport(entities_exports, require("./revoked-token.entity"), module.exports);
19
+ // Annotate the CommonJS export names for ESM import in node:
20
+ 0 && (module.exports = {
21
+ ...require("./revoked-token.entity")
22
+ });
@@ -0,0 +1 @@
1
+ export * from "./revoked-token.entity";
@@ -0,0 +1,17 @@
1
+ import { BaseEntity, BaseEntityProps } from '../../../common/base/base.entity.js';
2
+ export interface RevokedTokenProps extends BaseEntityProps {
3
+ jti?: string;
4
+ audience?: string;
5
+ subject?: string;
6
+ expiresAt?: string | Date;
7
+ }
8
+ export declare class RevokedToken extends BaseEntity {
9
+ private readonly props;
10
+ jti?: string | undefined;
11
+ audience?: string | undefined;
12
+ subject?: string | undefined;
13
+ expiresAt?: Date | undefined;
14
+ static fromJSON(props: RevokedTokenProps): RevokedToken;
15
+ constructor(props: RevokedTokenProps, jti?: string | undefined, audience?: string | undefined, subject?: string | undefined, expiresAt?: Date | undefined);
16
+ toJSON(): RevokedTokenProps;
17
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var revoked_token_entity_exports = {};
20
+ __export(revoked_token_entity_exports, {
21
+ RevokedToken: () => RevokedToken
22
+ });
23
+ module.exports = __toCommonJS(revoked_token_entity_exports);
24
+ var import_base = require("../../../common/base/base.entity.js");
25
+ const toDate = (value) => {
26
+ if (!value) return void 0;
27
+ const date = new Date(value);
28
+ if (Number.isNaN(date.getTime())) throw new Error("{{value_must_be_a_date}}");
29
+ return date;
30
+ };
31
+ class RevokedToken extends import_base.BaseEntity {
32
+ constructor(props, jti, audience, subject, expiresAt) {
33
+ super(props);
34
+ this.props = props;
35
+ this.jti = jti;
36
+ this.audience = audience;
37
+ this.subject = subject;
38
+ this.expiresAt = expiresAt;
39
+ }
40
+ props;
41
+ jti;
42
+ audience;
43
+ subject;
44
+ expiresAt;
45
+ static fromJSON(props) {
46
+ return new RevokedToken(
47
+ props,
48
+ props.jti || void 0,
49
+ props.audience || void 0,
50
+ props.subject || void 0,
51
+ toDate(props.expiresAt)
52
+ );
53
+ }
54
+ toJSON() {
55
+ return {
56
+ ...super.toJSON(),
57
+ jti: this.jti,
58
+ audience: this.audience,
59
+ subject: this.subject,
60
+ expiresAt: this.expiresAt
61
+ };
62
+ }
63
+ }
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ RevokedToken
67
+ });
@@ -0,0 +1,44 @@
1
+ import "../../../chunk-CF3WOMB3.mjs";
2
+ import { BaseEntity } from "../../../common/base/base.entity.js";
3
+ const toDate = (value) => {
4
+ if (!value) return void 0;
5
+ const date = new Date(value);
6
+ if (Number.isNaN(date.getTime())) throw new Error("{{value_must_be_a_date}}");
7
+ return date;
8
+ };
9
+ class RevokedToken extends BaseEntity {
10
+ constructor(props, jti, audience, subject, expiresAt) {
11
+ super(props);
12
+ this.props = props;
13
+ this.jti = jti;
14
+ this.audience = audience;
15
+ this.subject = subject;
16
+ this.expiresAt = expiresAt;
17
+ }
18
+ props;
19
+ jti;
20
+ audience;
21
+ subject;
22
+ expiresAt;
23
+ static fromJSON(props) {
24
+ return new RevokedToken(
25
+ props,
26
+ props.jti || void 0,
27
+ props.audience || void 0,
28
+ props.subject || void 0,
29
+ toDate(props.expiresAt)
30
+ );
31
+ }
32
+ toJSON() {
33
+ return {
34
+ ...super.toJSON(),
35
+ jti: this.jti,
36
+ audience: this.audience,
37
+ subject: this.subject,
38
+ expiresAt: this.expiresAt
39
+ };
40
+ }
41
+ }
42
+ export {
43
+ RevokedToken
44
+ };
@@ -1 +1,2 @@
1
1
  export * from './module';
2
+ export * from './entities';
@@ -16,7 +16,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  var authentication_exports = {};
17
17
  module.exports = __toCommonJS(authentication_exports);
18
18
  __reExport(authentication_exports, require("./module"), module.exports);
19
+ __reExport(authentication_exports, require("./entities"), module.exports);
19
20
  // Annotate the CommonJS export names for ESM import in node:
20
21
  0 && (module.exports = {
21
- ...require("./module")
22
+ ...require("./module"),
23
+ ...require("./entities")
22
24
  });
@@ -1 +1,2 @@
1
1
  export * from "./module";
2
+ export * from "./entities";
@@ -1,3 +1,7 @@
1
1
  import 'reflect-metadata';
2
2
  import { Params as LParams, Output as LOutput } from './use-cases/login.use-case';
3
+ import { Params as RParams, Output as ROutput } from './use-cases/revoke-token.use-case';
4
+ import { Params as IParams, Output as IOutput } from './use-cases/is-token-revoked.use-case';
3
5
  export declare function login(props: LParams): Promise<LOutput>;
6
+ export declare function revokeToken(props: RParams): Promise<ROutput>;
7
+ export declare function isTokenRevoked(props: IParams): Promise<IOutput>;
@@ -18,17 +18,31 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var module_exports = {};
20
20
  __export(module_exports, {
21
- login: () => login
21
+ isTokenRevoked: () => isTokenRevoked,
22
+ login: () => login,
23
+ revokeToken: () => revokeToken
22
24
  });
23
25
  module.exports = __toCommonJS(module_exports);
24
26
  var import_reflect_metadata = require("reflect-metadata");
25
27
  var import_tsyringe = require("tsyringe");
26
28
  var import_login = require("./use-cases/login.use-case");
29
+ var import_revoke_token = require("./use-cases/revoke-token.use-case");
30
+ var import_is_token_revoked = require("./use-cases/is-token-revoked.use-case");
27
31
  async function login(props) {
28
32
  const loginUseCase = import_tsyringe.container.resolve(import_login.LoginUseCase);
29
33
  return loginUseCase.execute(props);
30
34
  }
35
+ async function revokeToken(props) {
36
+ const revokeTokenUseCase = import_tsyringe.container.resolve(import_revoke_token.RevokeTokenUseCase);
37
+ return revokeTokenUseCase.execute(props);
38
+ }
39
+ async function isTokenRevoked(props) {
40
+ const isTokenRevokedUseCase = import_tsyringe.container.resolve(import_is_token_revoked.IsTokenRevokedUseCase);
41
+ return isTokenRevokedUseCase.execute(props);
42
+ }
31
43
  // Annotate the CommonJS export names for ESM import in node:
32
44
  0 && (module.exports = {
33
- login
45
+ isTokenRevoked,
46
+ login,
47
+ revokeToken
34
48
  });
@@ -2,10 +2,22 @@ import "../../chunk-CF3WOMB3.mjs";
2
2
  import "reflect-metadata";
3
3
  import { container } from "tsyringe";
4
4
  import { LoginUseCase } from "./use-cases/login.use-case";
5
+ import { RevokeTokenUseCase } from "./use-cases/revoke-token.use-case";
6
+ import { IsTokenRevokedUseCase } from "./use-cases/is-token-revoked.use-case";
5
7
  async function login(props) {
6
8
  const loginUseCase = container.resolve(LoginUseCase);
7
9
  return loginUseCase.execute(props);
8
10
  }
11
+ async function revokeToken(props) {
12
+ const revokeTokenUseCase = container.resolve(RevokeTokenUseCase);
13
+ return revokeTokenUseCase.execute(props);
14
+ }
15
+ async function isTokenRevoked(props) {
16
+ const isTokenRevokedUseCase = container.resolve(IsTokenRevokedUseCase);
17
+ return isTokenRevokedUseCase.execute(props);
18
+ }
9
19
  export {
10
- login
20
+ isTokenRevoked,
21
+ login,
22
+ revokeToken
11
23
  };