openloops 0.5.0 → 0.7.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 (547) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +3 -2
  3. package/dist/clients/llm/llm-client.mjs +0 -1
  4. package/dist/clients/llm/llm-error.mjs +0 -1
  5. package/dist/clients/llm/llm-types.mjs +0 -1
  6. package/dist/clients/llm/model-resolution.mjs +0 -1
  7. package/dist/clients/llm/pi-ai-adapter.mjs +0 -1
  8. package/dist/clients/llm/sampling-rules.mjs +0 -1
  9. package/dist/clients/serper/serper-client.mjs +0 -1
  10. package/dist/clients/slack/slack-client.mjs +0 -1
  11. package/dist/common/base/base.app.d.ts +3 -3
  12. package/dist/common/base/base.app.mjs +0 -1
  13. package/dist/common/base/base.entity.d.ts +7 -25
  14. package/dist/common/base/base.entity.js +26 -133
  15. package/dist/common/base/base.entity.mjs +26 -128
  16. package/dist/common/base/base.use-case.d.ts +3 -7
  17. package/dist/common/base/base.use-case.mjs +0 -1
  18. package/dist/common/base/current-session.mjs +0 -1
  19. package/dist/common/base/current-user.mjs +0 -1
  20. package/dist/common/base/index.d.ts +1 -0
  21. package/dist/common/base/index.js +3 -1
  22. package/dist/common/base/index.mjs +1 -0
  23. package/dist/common/base/share.d.ts +12 -0
  24. package/dist/common/base/share.js +45 -0
  25. package/dist/common/base/share.mjs +20 -0
  26. package/dist/common/base/utils/index.d.ts +1 -2
  27. package/dist/common/base/utils/index.js +2 -4
  28. package/dist/common/base/utils/index.mjs +1 -2
  29. package/dist/common/base/utils/is-plain-object.mjs +0 -1
  30. package/dist/common/base/utils/to-patch.d.ts +9 -0
  31. package/dist/common/base/utils/to-patch.js +46 -0
  32. package/dist/common/base/utils/to-patch.mjs +21 -0
  33. package/dist/common/constants/harness.mjs +0 -1
  34. package/dist/common/error/http-error.mjs +0 -1
  35. package/dist/common/error/reportError.mjs +0 -1
  36. package/dist/common/error/sentry-client.mjs +0 -1
  37. package/dist/common/helpers/escape-regex.mjs +0 -1
  38. package/dist/common/helpers/extract-json-from-text.mjs +0 -1
  39. package/dist/common/helpers/sanitize-string.mjs +0 -1
  40. package/dist/common/logger/pino.mjs +0 -1
  41. package/dist/common/repositories/index.d.ts +1 -0
  42. package/dist/common/repositories/index.js +3 -1
  43. package/dist/common/repositories/index.mjs +1 -0
  44. package/dist/common/repositories/mongo-db.client.mjs +0 -1
  45. package/dist/common/repositories/mongo-db.repository.d.ts +42 -11
  46. package/dist/common/repositories/mongo-db.repository.js +152 -42
  47. package/dist/common/repositories/mongo-db.repository.mjs +152 -43
  48. package/dist/common/repositories/scope.d.ts +19 -0
  49. package/dist/common/repositories/scope.js +63 -0
  50. package/dist/common/repositories/scope.mjs +39 -0
  51. package/dist/common/utils/database-name.mjs +0 -1
  52. package/dist/common/utils/number-setting.mjs +0 -1
  53. package/dist/common/utils/secret-manager.mjs +0 -1
  54. package/dist/db/indexes/agent-actions.mjs +0 -1
  55. package/dist/db/indexes/agent-tasks.mjs +0 -1
  56. package/dist/db/indexes/agent-traces.mjs +0 -1
  57. package/dist/db/indexes/automation-runs.mjs +0 -1
  58. package/dist/db/indexes/automations.mjs +0 -1
  59. package/dist/db/indexes/chats.mjs +0 -1
  60. package/dist/db/indexes/index.js +3 -1
  61. package/dist/db/indexes/index.mjs +3 -2
  62. package/dist/db/indexes/llm-calls.mjs +0 -1
  63. package/dist/db/indexes/mcp-servers.mjs +0 -1
  64. package/dist/db/indexes/refresh-tokens.d.ts +2 -0
  65. package/dist/{common/decorators/admin-only/index.js → db/indexes/refresh-tokens.js} +16 -5
  66. package/dist/db/indexes/refresh-tokens.mjs +9 -0
  67. package/dist/db/indexes/revoked-tokens.mjs +0 -1
  68. package/dist/db/indexes/workspace-items.mjs +0 -1
  69. package/dist/db/migrations/automations.mjs +0 -1
  70. package/dist/guardrails/guard.mjs +0 -1
  71. package/dist/guardrails/index.mjs +0 -1
  72. package/dist/guardrails/input/block-card.mjs +0 -1
  73. package/dist/guardrails/input/block-code.mjs +0 -1
  74. package/dist/guardrails/input/block-email.mjs +0 -1
  75. package/dist/guardrails/input/create-block-input-oversize.mjs +0 -1
  76. package/dist/guardrails/input/diagnostic-sanity.mjs +0 -1
  77. package/dist/guardrails/input/input-check.mjs +0 -1
  78. package/dist/harness/agent-loop.mjs +0 -1
  79. package/dist/harness/agent-state.mjs +0 -1
  80. package/dist/harness/agent.d.ts +0 -1
  81. package/dist/harness/agent.js +14 -14
  82. package/dist/harness/agent.mjs +14 -15
  83. package/dist/harness/native-tools.mjs +0 -1
  84. package/dist/harness/skills/approval-request.mjs +0 -1
  85. package/dist/harness/skills/autonomous-answer.mjs +0 -1
  86. package/dist/harness/skills/confirmation-gate.mjs +0 -1
  87. package/dist/harness/skills/mcp-change-review.mjs +0 -1
  88. package/dist/harness/tool-catalog.mjs +0 -1
  89. package/dist/harness/tool-pipeline.mjs +0 -1
  90. package/dist/harness/utils/activity.mjs +0 -1
  91. package/dist/harness/utils/describe-shape.mjs +0 -1
  92. package/dist/harness/utils/grounding.mjs +0 -1
  93. package/dist/harness/utils/rank-tools-by-keywords.mjs +0 -1
  94. package/dist/harness/workspace.js +7 -7
  95. package/dist/harness/workspace.mjs +7 -8
  96. package/dist/loops/agi/loop.mjs +0 -1
  97. package/dist/loops/agi/skills/reasoning-engine.mjs +0 -1
  98. package/dist/loops/shared/skills/fast-responder.mjs +0 -1
  99. package/dist/services/authentication/entities/index.d.ts +1 -0
  100. package/dist/services/authentication/entities/index.js +3 -1
  101. package/dist/services/authentication/entities/index.mjs +1 -0
  102. package/dist/services/authentication/entities/refresh-token.entity.d.ts +25 -0
  103. package/dist/services/authentication/entities/refresh-token.entity.js +75 -0
  104. package/dist/services/authentication/entities/refresh-token.entity.mjs +51 -0
  105. package/dist/services/authentication/entities/revoked-token.entity.mjs +0 -1
  106. package/dist/services/authentication/helpers/auth-config.d.ts +9 -0
  107. package/dist/{common/decorators/owner-only/index.js → services/authentication/helpers/auth-config.js} +19 -5
  108. package/dist/services/authentication/helpers/auth-config.mjs +12 -0
  109. package/dist/services/authentication/helpers/session-tokens.d.ts +16 -0
  110. package/dist/services/authentication/helpers/session-tokens.js +60 -0
  111. package/dist/services/authentication/helpers/session-tokens.mjs +35 -0
  112. package/dist/services/authentication/helpers/tokens.d.ts +43 -0
  113. package/dist/services/authentication/helpers/tokens.js +113 -0
  114. package/dist/services/authentication/helpers/tokens.mjs +71 -0
  115. package/dist/services/authentication/index.d.ts +3 -0
  116. package/dist/services/authentication/index.js +23 -0
  117. package/dist/services/authentication/index.mjs +11 -0
  118. package/dist/services/authentication/module.d.ts +12 -3
  119. package/dist/services/authentication/module.js +40 -7
  120. package/dist/services/authentication/module.mjs +34 -7
  121. package/dist/services/authentication/repositories/index.d.ts +1 -0
  122. package/dist/services/authentication/repositories/index.js +3 -1
  123. package/dist/services/authentication/repositories/index.mjs +1 -0
  124. package/dist/services/authentication/repositories/refresh-token.repository.d.ts +10 -0
  125. package/dist/services/authentication/repositories/refresh-token.repository.js +60 -0
  126. package/dist/services/authentication/repositories/refresh-token.repository.mjs +36 -0
  127. package/dist/services/authentication/repositories/revoked-token.repository.d.ts +3 -3
  128. package/dist/services/authentication/repositories/revoked-token.repository.js +9 -20
  129. package/dist/services/authentication/repositories/revoked-token.repository.mjs +9 -15
  130. package/dist/services/authentication/use-cases/claim-refresh-token.use-case.d.ts +12 -0
  131. package/dist/services/authentication/use-cases/claim-refresh-token.use-case.js +40 -0
  132. package/dist/services/authentication/use-cases/claim-refresh-token.use-case.mjs +16 -0
  133. package/dist/services/authentication/use-cases/create-refresh-token.use-case.d.ts +11 -0
  134. package/dist/services/authentication/use-cases/create-refresh-token.use-case.js +43 -0
  135. package/dist/services/authentication/use-cases/create-refresh-token.use-case.mjs +19 -0
  136. package/dist/services/authentication/use-cases/find-refresh-token-by-hash.use-case.d.ts +11 -0
  137. package/dist/services/authentication/use-cases/find-refresh-token-by-hash.use-case.js +40 -0
  138. package/dist/services/authentication/use-cases/find-refresh-token-by-hash.use-case.mjs +16 -0
  139. package/dist/services/authentication/use-cases/is-token-revoked.use-case.d.ts +6 -8
  140. package/dist/services/authentication/use-cases/is-token-revoked.use-case.js +6 -19
  141. package/dist/services/authentication/use-cases/is-token-revoked.use-case.mjs +6 -14
  142. package/dist/services/authentication/use-cases/issue-password-reset-token.use-case.d.ts +18 -0
  143. package/dist/services/authentication/use-cases/issue-password-reset-token.use-case.js +49 -0
  144. package/dist/services/authentication/use-cases/issue-password-reset-token.use-case.mjs +25 -0
  145. package/dist/services/authentication/use-cases/issue-session.use-case.d.ts +13 -0
  146. package/dist/services/authentication/use-cases/issue-session.use-case.js +48 -0
  147. package/dist/services/authentication/use-cases/issue-session.use-case.mjs +24 -0
  148. package/dist/services/authentication/use-cases/login.use-case.d.ts +11 -11
  149. package/dist/services/authentication/use-cases/login.use-case.js +18 -53
  150. package/dist/services/authentication/use-cases/login.use-case.mjs +18 -38
  151. package/dist/services/authentication/use-cases/logout.use-case.d.ts +14 -0
  152. package/dist/services/authentication/use-cases/logout.use-case.js +48 -0
  153. package/dist/services/authentication/use-cases/logout.use-case.mjs +24 -0
  154. package/dist/services/authentication/use-cases/refresh.use-case.d.ts +23 -0
  155. package/dist/services/authentication/use-cases/refresh.use-case.js +84 -0
  156. package/dist/services/authentication/use-cases/refresh.use-case.mjs +60 -0
  157. package/dist/services/authentication/use-cases/reset-password.use-case.d.ts +15 -0
  158. package/dist/services/authentication/use-cases/reset-password.use-case.js +61 -0
  159. package/dist/services/authentication/use-cases/reset-password.use-case.mjs +37 -0
  160. package/dist/services/authentication/use-cases/revoke-refresh-token-family.use-case.d.ts +11 -0
  161. package/dist/services/authentication/use-cases/revoke-refresh-token-family.use-case.js +40 -0
  162. package/dist/services/authentication/use-cases/revoke-refresh-token-family.use-case.mjs +16 -0
  163. package/dist/services/authentication/use-cases/revoke-token.use-case.d.ts +4 -6
  164. package/dist/services/authentication/use-cases/revoke-token.use-case.js +12 -25
  165. package/dist/services/authentication/use-cases/revoke-token.use-case.mjs +11 -19
  166. package/dist/services/authentication/use-cases/revoke-user-refresh-tokens.use-case.d.ts +13 -0
  167. package/dist/services/authentication/use-cases/revoke-user-refresh-tokens.use-case.js +40 -0
  168. package/dist/services/authentication/use-cases/revoke-user-refresh-tokens.use-case.mjs +16 -0
  169. package/dist/services/automations/entities/automation-run.entity.mjs +0 -1
  170. package/dist/services/automations/entities/automation.entity.d.ts +1 -0
  171. package/dist/services/automations/entities/automation.entity.js +2 -1
  172. package/dist/services/automations/entities/automation.entity.mjs +2 -2
  173. package/dist/services/automations/entities/recurrence.mjs +0 -1
  174. package/dist/services/automations/entities/trigger.mjs +0 -1
  175. package/dist/services/automations/module.d.ts +0 -1
  176. package/dist/services/automations/module.js +20 -22
  177. package/dist/services/automations/module.mjs +20 -23
  178. package/dist/services/automations/repositories/automation-run.repository.d.ts +10 -10
  179. package/dist/services/automations/repositories/automation-run.repository.js +26 -38
  180. package/dist/services/automations/repositories/automation-run.repository.mjs +26 -33
  181. package/dist/services/automations/repositories/automation.repository.d.ts +14 -13
  182. package/dist/services/automations/repositories/automation.repository.js +52 -54
  183. package/dist/services/automations/repositories/automation.repository.mjs +52 -49
  184. package/dist/services/automations/runner/automation-runner.d.ts +3 -0
  185. package/dist/services/automations/runner/automation-runner.js +8 -9
  186. package/dist/services/automations/runner/automation-runner.mjs +8 -10
  187. package/dist/services/automations/use-cases/attach-automation-run-chat.use-case.d.ts +4 -6
  188. package/dist/services/automations/use-cases/attach-automation-run-chat.use-case.js +8 -21
  189. package/dist/services/automations/use-cases/attach-automation-run-chat.use-case.mjs +8 -16
  190. package/dist/services/automations/use-cases/claim-due-automations.use-case.d.ts +9 -11
  191. package/dist/services/automations/use-cases/claim-due-automations.use-case.js +11 -26
  192. package/dist/services/automations/use-cases/claim-due-automations.use-case.mjs +11 -21
  193. package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.d.ts +9 -11
  194. package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.js +13 -28
  195. package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.mjs +13 -23
  196. package/dist/services/automations/use-cases/create-automation.use-case.d.ts +4 -6
  197. package/dist/services/automations/use-cases/create-automation.use-case.js +7 -22
  198. package/dist/services/automations/use-cases/create-automation.use-case.mjs +6 -16
  199. package/dist/services/automations/use-cases/delete-automation.use-case.d.ts +6 -6
  200. package/dist/services/automations/use-cases/delete-automation.use-case.js +10 -27
  201. package/dist/services/automations/use-cases/delete-automation.use-case.mjs +9 -21
  202. package/dist/services/automations/use-cases/finish-automation-run.use-case.d.ts +5 -7
  203. package/dist/services/automations/use-cases/finish-automation-run.use-case.js +9 -23
  204. package/dist/services/automations/use-cases/finish-automation-run.use-case.mjs +9 -18
  205. package/dist/services/automations/use-cases/get-automation-by-id.use-case.d.ts +4 -6
  206. package/dist/services/automations/use-cases/get-automation-by-id.use-case.js +8 -21
  207. package/dist/services/automations/use-cases/get-automation-by-id.use-case.mjs +7 -15
  208. package/dist/services/automations/use-cases/issue-automation-event-token.use-case.d.ts +7 -9
  209. package/dist/services/automations/use-cases/issue-automation-event-token.use-case.js +8 -22
  210. package/dist/services/automations/use-cases/issue-automation-event-token.use-case.mjs +7 -16
  211. package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.d.ts +6 -6
  212. package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.js +8 -20
  213. package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.mjs +8 -15
  214. package/dist/services/automations/use-cases/list-automation-runs-by-user.use-case.d.ts +6 -6
  215. package/dist/services/automations/use-cases/list-automation-runs-by-user.use-case.js +7 -19
  216. package/dist/services/automations/use-cases/list-automation-runs-by-user.use-case.mjs +7 -14
  217. package/dist/services/automations/use-cases/list-automations-by-user.use-case.d.ts +6 -6
  218. package/dist/services/automations/use-cases/list-automations-by-user.use-case.js +7 -19
  219. package/dist/services/automations/use-cases/list-automations-by-user.use-case.mjs +7 -14
  220. package/dist/services/automations/use-cases/preview-automation-runs.use-case.d.ts +4 -6
  221. package/dist/services/automations/use-cases/preview-automation-runs.use-case.js +3 -15
  222. package/dist/services/automations/use-cases/preview-automation-runs.use-case.mjs +3 -10
  223. package/dist/services/automations/use-cases/receive-automation-event.use-case.d.ts +8 -10
  224. package/dist/services/automations/use-cases/receive-automation-event.use-case.js +15 -29
  225. package/dist/services/automations/use-cases/receive-automation-event.use-case.mjs +15 -24
  226. package/dist/services/automations/use-cases/renew-automation-lease.use-case.d.ts +6 -8
  227. package/dist/services/automations/use-cases/renew-automation-lease.use-case.js +6 -19
  228. package/dist/services/automations/use-cases/renew-automation-lease.use-case.mjs +6 -14
  229. package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.d.ts +6 -8
  230. package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.js +10 -23
  231. package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.mjs +10 -18
  232. package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.d.ts +4 -6
  233. package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.js +11 -25
  234. package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.mjs +10 -19
  235. package/dist/services/automations/use-cases/start-automation-run.use-case.d.ts +8 -10
  236. package/dist/services/automations/use-cases/start-automation-run.use-case.js +12 -25
  237. package/dist/services/automations/use-cases/start-automation-run.use-case.mjs +12 -20
  238. package/dist/services/automations/use-cases/sync-automation-run.use-case.d.ts +5 -7
  239. package/dist/services/automations/use-cases/sync-automation-run.use-case.js +13 -27
  240. package/dist/services/automations/use-cases/sync-automation-run.use-case.mjs +13 -22
  241. package/dist/services/automations/use-cases/sync-automation-runs.use-case.d.ts +8 -10
  242. package/dist/services/automations/use-cases/sync-automation-runs.use-case.js +8 -22
  243. package/dist/services/automations/use-cases/sync-automation-runs.use-case.mjs +8 -17
  244. package/dist/services/automations/use-cases/update-automation.use-case.d.ts +4 -6
  245. package/dist/services/automations/use-cases/update-automation.use-case.js +13 -26
  246. package/dist/services/automations/use-cases/update-automation.use-case.mjs +12 -20
  247. package/dist/services/automations/utils/automation-event-error.mjs +0 -1
  248. package/dist/services/automations/utils/automation-fields.mjs +0 -1
  249. package/dist/services/automations/utils/event-message.mjs +0 -1
  250. package/dist/services/automations/utils/event-token.d.ts +1 -2
  251. package/dist/services/automations/utils/event-token.js +9 -35
  252. package/dist/services/automations/utils/event-token.mjs +9 -25
  253. package/dist/services/automations/utils/next-run.mjs +0 -1
  254. package/dist/services/automations/utils/open-run.d.ts +2 -0
  255. package/dist/services/automations/utils/open-run.js +2 -2
  256. package/dist/services/automations/utils/open-run.mjs +2 -3
  257. package/dist/services/automations/utils/previous-run.js +4 -3
  258. package/dist/services/automations/utils/previous-run.mjs +4 -4
  259. package/dist/services/automations/utils/runner-scope.d.ts +3 -0
  260. package/dist/{common/base/utils/flatten-object.js → services/automations/utils/runner-scope.js} +10 -23
  261. package/dist/services/automations/utils/runner-scope.mjs +7 -0
  262. package/dist/services/automations/utils/settings.mjs +0 -1
  263. package/dist/services/chats/entities/chat-message.entity.mjs +0 -1
  264. package/dist/services/chats/entities/chat-settings.entity.mjs +0 -1
  265. package/dist/services/chats/entities/chat.entity.d.ts +1 -0
  266. package/dist/services/chats/entities/chat.entity.js +3 -2
  267. package/dist/services/chats/entities/chat.entity.mjs +3 -3
  268. package/dist/services/chats/module.d.ts +0 -1
  269. package/dist/services/chats/module.js +5 -7
  270. package/dist/services/chats/module.mjs +5 -8
  271. package/dist/services/chats/repositories/chat.repository.d.ts +7 -6
  272. package/dist/services/chats/repositories/chat.repository.js +19 -29
  273. package/dist/services/chats/repositories/chat.repository.mjs +19 -24
  274. package/dist/services/chats/use-cases/create-chat.use-case.d.ts +4 -6
  275. package/dist/services/chats/use-cases/create-chat.use-case.js +7 -22
  276. package/dist/services/chats/use-cases/create-chat.use-case.mjs +6 -16
  277. package/dist/services/chats/use-cases/delete-chat.use-case.d.ts +6 -6
  278. package/dist/services/chats/use-cases/delete-chat.use-case.js +10 -26
  279. package/dist/services/chats/use-cases/delete-chat.use-case.mjs +9 -20
  280. package/dist/services/chats/use-cases/get-chat-by-id.use-case.d.ts +4 -6
  281. package/dist/services/chats/use-cases/get-chat-by-id.use-case.js +8 -21
  282. package/dist/services/chats/use-cases/get-chat-by-id.use-case.mjs +8 -16
  283. package/dist/services/chats/use-cases/interrupt-execution.use-case.d.ts +4 -6
  284. package/dist/services/chats/use-cases/interrupt-execution.use-case.js +8 -24
  285. package/dist/services/chats/use-cases/interrupt-execution.use-case.mjs +7 -18
  286. package/dist/services/chats/use-cases/list-chats-by-props.use-case.d.ts +6 -6
  287. package/dist/services/chats/use-cases/list-chats-by-props.use-case.js +7 -20
  288. package/dist/services/chats/use-cases/list-chats-by-props.use-case.mjs +7 -15
  289. package/dist/services/chats/use-cases/list-chats-by-user.use-case.d.ts +6 -6
  290. package/dist/services/chats/use-cases/list-chats-by-user.use-case.js +7 -19
  291. package/dist/services/chats/use-cases/list-chats-by-user.use-case.mjs +7 -14
  292. package/dist/services/chats/use-cases/update-chat.use-case.d.ts +5 -6
  293. package/dist/services/chats/use-cases/update-chat.use-case.js +10 -30
  294. package/dist/services/chats/use-cases/update-chat.use-case.mjs +9 -24
  295. package/dist/services/chats/utils/deprecated-activity.mjs +0 -1
  296. package/dist/services/llmcalls/entities/llmcall.entity.mjs +0 -1
  297. package/dist/services/llmcalls/module.d.ts +0 -1
  298. package/dist/services/llmcalls/module.js +4 -6
  299. package/dist/services/llmcalls/module.mjs +4 -7
  300. package/dist/services/llmcalls/repositories/llmcall.repository.d.ts +7 -6
  301. package/dist/services/llmcalls/repositories/llmcall.repository.js +19 -29
  302. package/dist/services/llmcalls/repositories/llmcall.repository.mjs +19 -24
  303. package/dist/services/llmcalls/use-cases/create-llmcall.use-case.d.ts +4 -6
  304. package/dist/services/llmcalls/use-cases/create-llmcall.use-case.js +7 -22
  305. package/dist/services/llmcalls/use-cases/create-llmcall.use-case.mjs +6 -16
  306. package/dist/services/llmcalls/use-cases/delete-llmcall.use-case.d.ts +6 -6
  307. package/dist/services/llmcalls/use-cases/delete-llmcall.use-case.js +10 -26
  308. package/dist/services/llmcalls/use-cases/delete-llmcall.use-case.mjs +9 -20
  309. package/dist/services/llmcalls/use-cases/get-llm-usage-by-chat.use-case.d.ts +4 -6
  310. package/dist/services/llmcalls/use-cases/get-llm-usage-by-chat.use-case.js +8 -21
  311. package/dist/services/llmcalls/use-cases/get-llm-usage-by-chat.use-case.mjs +7 -15
  312. package/dist/services/llmcalls/use-cases/get-llm-usage-by-message.use-case.d.ts +4 -6
  313. package/dist/services/llmcalls/use-cases/get-llm-usage-by-message.use-case.js +8 -21
  314. package/dist/services/llmcalls/use-cases/get-llm-usage-by-message.use-case.mjs +7 -15
  315. package/dist/services/llmcalls/use-cases/get-llm-usage-stats.use-case.d.ts +4 -6
  316. package/dist/services/llmcalls/use-cases/get-llm-usage-stats.use-case.js +6 -19
  317. package/dist/services/llmcalls/use-cases/get-llm-usage-stats.use-case.mjs +6 -14
  318. package/dist/services/llmcalls/use-cases/get-llmcall-by-id.use-case.d.ts +4 -6
  319. package/dist/services/llmcalls/use-cases/get-llmcall-by-id.use-case.js +9 -21
  320. package/dist/services/llmcalls/use-cases/get-llmcall-by-id.use-case.mjs +8 -15
  321. package/dist/services/llmcalls/use-cases/list-llmcalls-by-props.use-case.d.ts +6 -6
  322. package/dist/services/llmcalls/use-cases/list-llmcalls-by-props.use-case.js +7 -20
  323. package/dist/services/llmcalls/use-cases/list-llmcalls-by-props.use-case.mjs +7 -15
  324. package/dist/services/llmcalls/use-cases/update-llmcall.use-case.d.ts +4 -6
  325. package/dist/services/llmcalls/use-cases/update-llmcall.use-case.js +9 -25
  326. package/dist/services/llmcalls/use-cases/update-llmcall.use-case.mjs +8 -19
  327. package/dist/services/llmcalls/utils/usage-periods.mjs +0 -1
  328. package/dist/services/llmcalls/utils/usage-totals.mjs +0 -1
  329. package/dist/services/mcp-servers/entities/mcp-manifest.mjs +0 -1
  330. package/dist/services/mcp-servers/entities/mcpserver.entity.mjs +0 -1
  331. package/dist/services/mcp-servers/module.d.ts +0 -1
  332. package/dist/services/mcp-servers/module.js +8 -10
  333. package/dist/services/mcp-servers/module.mjs +8 -11
  334. package/dist/services/mcp-servers/repositories/mcpserver.repository.d.ts +8 -7
  335. package/dist/services/mcp-servers/repositories/mcpserver.repository.js +21 -31
  336. package/dist/services/mcp-servers/repositories/mcpserver.repository.mjs +21 -26
  337. package/dist/services/mcp-servers/use-cases/create-mcpserver.use-case.d.ts +5 -7
  338. package/dist/services/mcp-servers/use-cases/create-mcpserver.use-case.js +7 -24
  339. package/dist/services/mcp-servers/use-cases/create-mcpserver.use-case.mjs +6 -18
  340. package/dist/services/mcp-servers/use-cases/decide-mcpserver-trust.use-case.d.ts +4 -6
  341. package/dist/services/mcp-servers/use-cases/decide-mcpserver-trust.use-case.js +11 -26
  342. package/dist/services/mcp-servers/use-cases/decide-mcpserver-trust.use-case.mjs +10 -20
  343. package/dist/services/mcp-servers/use-cases/delete-mcpserver.use-case.d.ts +6 -6
  344. package/dist/services/mcp-servers/use-cases/delete-mcpserver.use-case.js +10 -26
  345. package/dist/services/mcp-servers/use-cases/delete-mcpserver.use-case.mjs +9 -20
  346. package/dist/services/mcp-servers/use-cases/get-mcpserver-by-id.use-case.d.ts +4 -6
  347. package/dist/services/mcp-servers/use-cases/get-mcpserver-by-id.use-case.js +8 -21
  348. package/dist/services/mcp-servers/use-cases/get-mcpserver-by-id.use-case.mjs +7 -15
  349. package/dist/services/mcp-servers/use-cases/list-all-mcpservers-by-user.use-case.d.ts +6 -6
  350. package/dist/services/mcp-servers/use-cases/list-all-mcpservers-by-user.use-case.js +7 -20
  351. package/dist/services/mcp-servers/use-cases/list-all-mcpservers-by-user.use-case.mjs +6 -14
  352. package/dist/services/mcp-servers/use-cases/list-mcpservers-by-user.use-case.d.ts +6 -6
  353. package/dist/services/mcp-servers/use-cases/list-mcpservers-by-user.use-case.js +5 -19
  354. package/dist/services/mcp-servers/use-cases/list-mcpservers-by-user.use-case.mjs +5 -14
  355. package/dist/services/mcp-servers/use-cases/update-mcpserver.use-case.d.ts +5 -7
  356. package/dist/services/mcp-servers/use-cases/update-mcpserver.use-case.js +12 -31
  357. package/dist/services/mcp-servers/use-cases/update-mcpserver.use-case.mjs +11 -25
  358. package/dist/services/mcp-servers/use-cases/verify-mcpserver-connection.use-case.d.ts +4 -6
  359. package/dist/services/mcp-servers/use-cases/verify-mcpserver-connection.use-case.js +13 -27
  360. package/dist/services/mcp-servers/use-cases/verify-mcpserver-connection.use-case.mjs +12 -21
  361. package/dist/services/tasks/entities/agent-action.entity.mjs +0 -1
  362. package/dist/services/tasks/entities/agent-task.entity.mjs +0 -1
  363. package/dist/services/tasks/module.d.ts +0 -1
  364. package/dist/services/tasks/module.js +7 -9
  365. package/dist/services/tasks/module.mjs +7 -10
  366. package/dist/services/tasks/repositories/agent-action.repository.d.ts +4 -4
  367. package/dist/services/tasks/repositories/agent-action.repository.js +12 -26
  368. package/dist/services/tasks/repositories/agent-action.repository.mjs +12 -21
  369. package/dist/services/tasks/repositories/agent-task.repository.d.ts +5 -5
  370. package/dist/services/tasks/repositories/agent-task.repository.js +14 -28
  371. package/dist/services/tasks/repositories/agent-task.repository.mjs +14 -23
  372. package/dist/services/tasks/use-cases/create-agent-action.use-case.d.ts +4 -6
  373. package/dist/services/tasks/use-cases/create-agent-action.use-case.js +7 -22
  374. package/dist/services/tasks/use-cases/create-agent-action.use-case.mjs +6 -16
  375. package/dist/services/tasks/use-cases/create-agent-task.use-case.d.ts +4 -6
  376. package/dist/services/tasks/use-cases/create-agent-task.use-case.js +7 -22
  377. package/dist/services/tasks/use-cases/create-agent-task.use-case.mjs +6 -16
  378. package/dist/services/tasks/use-cases/get-agent-task-by-id.use-case.d.ts +4 -6
  379. package/dist/services/tasks/use-cases/get-agent-task-by-id.use-case.js +8 -21
  380. package/dist/services/tasks/use-cases/get-agent-task-by-id.use-case.mjs +7 -15
  381. package/dist/services/tasks/use-cases/list-agent-actions-by-task.use-case.d.ts +6 -6
  382. package/dist/services/tasks/use-cases/list-agent-actions-by-task.use-case.js +8 -20
  383. package/dist/services/tasks/use-cases/list-agent-actions-by-task.use-case.mjs +8 -15
  384. package/dist/services/tasks/use-cases/list-agent-tasks-by-chat.use-case.d.ts +6 -6
  385. package/dist/services/tasks/use-cases/list-agent-tasks-by-chat.use-case.js +8 -20
  386. package/dist/services/tasks/use-cases/list-agent-tasks-by-chat.use-case.mjs +8 -15
  387. package/dist/services/tasks/use-cases/update-agent-action.use-case.d.ts +4 -6
  388. package/dist/services/tasks/use-cases/update-agent-action.use-case.js +8 -24
  389. package/dist/services/tasks/use-cases/update-agent-action.use-case.mjs +7 -18
  390. package/dist/services/tasks/use-cases/update-agent-task.use-case.d.ts +4 -6
  391. package/dist/services/tasks/use-cases/update-agent-task.use-case.js +8 -24
  392. package/dist/services/tasks/use-cases/update-agent-task.use-case.mjs +7 -18
  393. package/dist/services/traces/entities/agent-trace-entry.entity.mjs +0 -1
  394. package/dist/services/traces/module.d.ts +0 -1
  395. package/dist/services/traces/module.js +2 -4
  396. package/dist/services/traces/module.mjs +2 -5
  397. package/dist/services/traces/repositories/agent-trace.repository.d.ts +3 -3
  398. package/dist/services/traces/repositories/agent-trace.repository.js +8 -19
  399. package/dist/services/traces/repositories/agent-trace.repository.mjs +8 -14
  400. package/dist/services/traces/use-cases/create-agent-traces.use-case.d.ts +6 -8
  401. package/dist/services/traces/use-cases/create-agent-traces.use-case.js +8 -26
  402. package/dist/services/traces/use-cases/create-agent-traces.use-case.mjs +7 -20
  403. package/dist/services/traces/use-cases/list-agent-traces-by-chat.use-case.d.ts +6 -6
  404. package/dist/services/traces/use-cases/list-agent-traces-by-chat.use-case.js +8 -20
  405. package/dist/services/traces/use-cases/list-agent-traces-by-chat.use-case.mjs +8 -15
  406. package/dist/services/users/entities/user-acquisition.js +4 -17
  407. package/dist/services/users/entities/user-acquisition.mjs +4 -12
  408. package/dist/services/users/entities/user-country.js +2 -2
  409. package/dist/services/users/entities/user-country.mjs +2 -3
  410. package/dist/services/users/entities/user-currency.js +2 -2
  411. package/dist/services/users/entities/user-currency.mjs +2 -3
  412. package/dist/services/users/entities/user-default-model.js +2 -2
  413. package/dist/services/users/entities/user-default-model.mjs +2 -3
  414. package/dist/services/users/entities/user-email.value-object.mjs +0 -1
  415. package/dist/services/users/entities/user-language.js +2 -2
  416. package/dist/services/users/entities/user-language.mjs +2 -3
  417. package/dist/services/users/entities/user-marketing.js +4 -17
  418. package/dist/services/users/entities/user-marketing.mjs +4 -12
  419. package/dist/services/users/entities/user-notification-preferences.mjs +0 -1
  420. package/dist/services/users/entities/user-password.value-object.mjs +0 -1
  421. package/dist/services/users/entities/user-permissions.mjs +0 -1
  422. package/dist/services/users/entities/user-preferences.mjs +0 -1
  423. package/dist/services/users/entities/user-report-preferences.mjs +0 -1
  424. package/dist/services/users/entities/user-report-schedule.mjs +0 -1
  425. package/dist/services/users/entities/user-timezone.js +2 -2
  426. package/dist/services/users/entities/user-timezone.mjs +2 -3
  427. package/dist/services/users/entities/user.entity.d.ts +1 -0
  428. package/dist/services/users/entities/user.entity.js +9 -25
  429. package/dist/services/users/entities/user.entity.mjs +9 -20
  430. package/dist/services/users/module.d.ts +2 -1
  431. package/dist/services/users/module.js +12 -7
  432. package/dist/services/users/module.mjs +11 -8
  433. package/dist/services/users/repositories/user.repository.d.ts +10 -7
  434. package/dist/services/users/repositories/user.repository.js +34 -29
  435. package/dist/services/users/repositories/user.repository.mjs +34 -24
  436. package/dist/services/users/use-cases/change-password.use-case.d.ts +15 -0
  437. package/dist/services/users/use-cases/change-password.use-case.js +52 -0
  438. package/dist/services/users/use-cases/change-password.use-case.mjs +28 -0
  439. package/dist/services/users/use-cases/create-user.use-case.d.ts +4 -7
  440. package/dist/services/users/use-cases/create-user.use-case.js +8 -22
  441. package/dist/services/users/use-cases/create-user.use-case.mjs +7 -16
  442. package/dist/services/users/use-cases/delete-user.use-case.d.ts +6 -6
  443. package/dist/services/users/use-cases/delete-user.use-case.js +10 -26
  444. package/dist/services/users/use-cases/delete-user.use-case.mjs +9 -20
  445. package/dist/services/users/use-cases/get-user-by-id.use-case.d.ts +4 -6
  446. package/dist/services/users/use-cases/get-user-by-id.use-case.js +9 -21
  447. package/dist/services/users/use-cases/get-user-by-id.use-case.mjs +8 -15
  448. package/dist/services/users/use-cases/list-users-by-props.use-case.d.ts +6 -6
  449. package/dist/services/users/use-cases/list-users-by-props.use-case.js +7 -20
  450. package/dist/services/users/use-cases/list-users-by-props.use-case.mjs +7 -15
  451. package/dist/services/users/use-cases/update-user.use-case.d.ts +4 -6
  452. package/dist/services/users/use-cases/update-user.use-case.js +11 -26
  453. package/dist/services/users/use-cases/update-user.use-case.mjs +10 -20
  454. package/dist/services/users/utils/default-model.mjs +0 -1
  455. package/dist/services/workspaces/entities/workspace-item.entity.mjs +0 -1
  456. package/dist/services/workspaces/module.d.ts +0 -1
  457. package/dist/services/workspaces/module.js +5 -7
  458. package/dist/services/workspaces/module.mjs +5 -8
  459. package/dist/services/workspaces/repositories/workspace-item.repository.d.ts +8 -8
  460. package/dist/services/workspaces/repositories/workspace-item.repository.js +20 -32
  461. package/dist/services/workspaces/repositories/workspace-item.repository.mjs +20 -27
  462. package/dist/services/workspaces/use-cases/delete-workspace-item.use-case.d.ts +6 -8
  463. package/dist/services/workspaces/use-cases/delete-workspace-item.use-case.js +11 -22
  464. package/dist/services/workspaces/use-cases/delete-workspace-item.use-case.mjs +10 -16
  465. package/dist/services/workspaces/use-cases/get-workspace-item.use-case.d.ts +4 -6
  466. package/dist/services/workspaces/use-cases/get-workspace-item.use-case.js +8 -21
  467. package/dist/services/workspaces/use-cases/get-workspace-item.use-case.mjs +7 -15
  468. package/dist/services/workspaces/use-cases/list-workspace-items.use-case.d.ts +6 -6
  469. package/dist/services/workspaces/use-cases/list-workspace-items.use-case.js +7 -19
  470. package/dist/services/workspaces/use-cases/list-workspace-items.use-case.mjs +7 -14
  471. package/dist/services/workspaces/use-cases/save-workspace-item.use-case.d.ts +4 -6
  472. package/dist/services/workspaces/use-cases/save-workspace-item.use-case.js +14 -28
  473. package/dist/services/workspaces/use-cases/save-workspace-item.use-case.mjs +13 -22
  474. package/dist/services/workspaces/use-cases/search-workspace-items.use-case.d.ts +6 -6
  475. package/dist/services/workspaces/use-cases/search-workspace-items.use-case.js +7 -19
  476. package/dist/services/workspaces/use-cases/search-workspace-items.use-case.mjs +7 -14
  477. package/dist/skills/call-modes.mjs +0 -1
  478. package/dist/skills/runtime-context.mjs +0 -1
  479. package/dist/skills/shared/shared-rules.mjs +0 -1
  480. package/dist/skills/skill.js +1 -2
  481. package/dist/skills/skill.mjs +1 -3
  482. package/dist/tools/core/call-ai/call-ai.skill.mjs +0 -1
  483. package/dist/tools/core/call-ai/call-ai.tool.mjs +0 -1
  484. package/dist/tools/core/slack/send-slack-message.tool.mjs +0 -1
  485. package/dist/tools/core/web-search/web-search.tool.mjs +0 -1
  486. package/dist/tools/tool.mjs +0 -1
  487. package/docs/README.md +2 -1
  488. package/docs/authentication.md +95 -16
  489. package/docs/authorization.md +77 -0
  490. package/docs/automations.md +10 -9
  491. package/docs/chats.md +1 -1
  492. package/docs/configuration.md +1 -1
  493. package/docs/integration-guide.md +9 -11
  494. package/docs/llms.txt +1 -0
  495. package/docs/mcp-servers.md +1 -1
  496. package/docs/usage.md +5 -5
  497. package/docs/users.md +7 -5
  498. package/examples/authentication/login.ts +1 -1
  499. package/examples/automations/create-automation.ts +1 -1
  500. package/examples/automations/create-event-automation.ts +2 -2
  501. package/examples/automations/list-automation-runs.ts +4 -2
  502. package/examples/automations/list-automations.ts +1 -1
  503. package/examples/automations/preview-automation-runs.ts +1 -1
  504. package/examples/automations/receive-automation-event.ts +1 -1
  505. package/examples/automations/revoke-automation-event-token.ts +2 -2
  506. package/examples/automations/run-automation-now.ts +3 -1
  507. package/examples/automations/update-automation.ts +2 -2
  508. package/examples/chats/delete-chat.ts +1 -1
  509. package/examples/chats/get-chat-by-id.ts +2 -2
  510. package/examples/chats/list-autonomous-chats.ts +1 -1
  511. package/examples/chats/list-chats.ts +1 -1
  512. package/examples/mcps/decide-mcp.ts +3 -3
  513. package/examples/mcps/list-all-mcps.ts +1 -1
  514. package/examples/mcps/verify-mcp.ts +1 -1
  515. package/examples/usage/get-chat-usage.ts +2 -2
  516. package/examples/usage/get-message-usage.ts +2 -2
  517. package/examples/usage/get-usage-stats-by-range.ts +1 -1
  518. package/examples/usage/get-usage-stats.ts +3 -3
  519. package/examples/users/create-user.ts +2 -1
  520. package/examples/users/list-users.ts +1 -0
  521. package/examples/users/set-default-model.ts +1 -1
  522. package/package.json +2 -4
  523. package/dist/chunk-CF3WOMB3.mjs +0 -16
  524. package/dist/common/base/utils/delete-empty-fields.d.ts +0 -1
  525. package/dist/common/base/utils/delete-empty-fields.js +0 -66
  526. package/dist/common/base/utils/delete-empty-fields.mjs +0 -43
  527. package/dist/common/base/utils/flatten-object.d.ts +0 -1
  528. package/dist/common/base/utils/flatten-object.mjs +0 -22
  529. package/dist/common/decorators/admin-only/admin-only.d.ts +0 -2
  530. package/dist/common/decorators/admin-only/admin-only.js +0 -52
  531. package/dist/common/decorators/admin-only/admin-only.mjs +0 -28
  532. package/dist/common/decorators/admin-only/index.d.ts +0 -1
  533. package/dist/common/decorators/admin-only/index.mjs +0 -1
  534. package/dist/common/decorators/index.d.ts +0 -3
  535. package/dist/common/decorators/index.js +0 -26
  536. package/dist/common/decorators/index.mjs +0 -3
  537. package/dist/common/decorators/mask-in-logs/index.d.ts +0 -1
  538. package/dist/common/decorators/mask-in-logs/index.js +0 -22
  539. package/dist/common/decorators/mask-in-logs/index.mjs +0 -1
  540. package/dist/common/decorators/mask-in-logs/mask-in-logs.d.ts +0 -2
  541. package/dist/common/decorators/mask-in-logs/mask-in-logs.js +0 -53
  542. package/dist/common/decorators/mask-in-logs/mask-in-logs.mjs +0 -29
  543. package/dist/common/decorators/owner-only/index.d.ts +0 -1
  544. package/dist/common/decorators/owner-only/index.mjs +0 -1
  545. package/dist/common/decorators/owner-only/owner-only.d.ts +0 -2
  546. package/dist/common/decorators/owner-only/owner-only.js +0 -52
  547. package/dist/common/decorators/owner-only/owner-only.mjs +0 -28
@@ -16,39 +16,26 @@ 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 __decorateClass = (decorators, target, key, kind) => {
20
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
21
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
22
- if (decorator = decorators[i])
23
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
24
- if (kind && result) __defProp(target, key, result);
25
- return result;
26
- };
27
- var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
28
19
  var list_chats_by_props_use_case_exports = {};
29
20
  __export(list_chats_by_props_use_case_exports, {
30
21
  ListChatsByPropsUseCase: () => ListChatsByPropsUseCase
31
22
  });
32
23
  module.exports = __toCommonJS(list_chats_by_props_use_case_exports);
33
- var import_tsyringe = require("tsyringe");
24
+ var import_repositories = require("../../../common/repositories/index.js");
34
25
  var import_base = require("../../../common/base/base.use-case.js");
35
26
  var import_repositories2 = require("../repositories");
36
- let ListChatsByPropsUseCase = class extends import_base.BaseUseCase {
37
- constructor(chatRepository) {
27
+ class ListChatsByPropsUseCase extends import_base.BaseUseCase {
28
+ constructor(chatRepository = new import_repositories2.ChatRepository()) {
38
29
  super();
39
30
  this.chatRepository = chatRepository;
40
31
  }
41
32
  chatRepository;
42
33
  async execute(params) {
43
- const { where, options } = params;
44
- const result = await this.chatRepository?.findByProps(where, options || {});
45
- return { data: result?.items, hasMore: result?.hasMore };
34
+ const { where, options, currentUser } = params;
35
+ const result = await this.chatRepository.findByProps(where, options || {}, params.scope ?? import_repositories.Scope.asAdmin(currentUser));
36
+ return { items: result?.items ?? [], hasMore: result?.hasMore ?? false };
46
37
  }
47
- };
48
- ListChatsByPropsUseCase = __decorateClass([
49
- (0, import_tsyringe.autoInjectable)(),
50
- __decorateParam(0, (0, import_tsyringe.inject)(import_repositories2.ChatRepository))
51
- ], ListChatsByPropsUseCase);
38
+ }
52
39
  // Annotate the CommonJS export names for ESM import in node:
53
40
  0 && (module.exports = {
54
41
  ListChatsByPropsUseCase
@@ -1,26 +1,18 @@
1
- import {
2
- __decorateClass,
3
- __decorateParam
4
- } from "../../../chunk-CF3WOMB3.mjs";
5
- import { autoInjectable, inject } from "tsyringe";
1
+ import { Scope } from "../../../common/repositories/index.js";
6
2
  import { BaseUseCase } from "../../../common/base/base.use-case.js";
7
3
  import { ChatRepository } from "../repositories";
8
- let ListChatsByPropsUseCase = class extends BaseUseCase {
9
- constructor(chatRepository) {
4
+ class ListChatsByPropsUseCase extends BaseUseCase {
5
+ constructor(chatRepository = new ChatRepository()) {
10
6
  super();
11
7
  this.chatRepository = chatRepository;
12
8
  }
13
9
  chatRepository;
14
10
  async execute(params) {
15
- const { where, options } = params;
16
- const result = await this.chatRepository?.findByProps(where, options || {});
17
- return { data: result?.items, hasMore: result?.hasMore };
11
+ const { where, options, currentUser } = params;
12
+ const result = await this.chatRepository.findByProps(where, options || {}, params.scope ?? Scope.asAdmin(currentUser));
13
+ return { items: result?.items ?? [], hasMore: result?.hasMore ?? false };
18
14
  }
19
- };
20
- ListChatsByPropsUseCase = __decorateClass([
21
- autoInjectable(),
22
- __decorateParam(0, inject(ChatRepository))
23
- ], ListChatsByPropsUseCase);
15
+ }
24
16
  export {
25
17
  ListChatsByPropsUseCase
26
18
  };
@@ -1,5 +1,5 @@
1
1
  import { QueryOptions } from '../../../common/repositories/index.js';
2
- import { BaseUseCase, BaseUseCaseParams, BaseUseCaseOutput } from '../../../common/base/base.use-case.js';
2
+ import { BaseUseCase, BaseUseCaseParams } from '../../../common/base/base.use-case.js';
3
3
  import { ChatRepository } from '../repositories';
4
4
  import { ChatProps, ExecutionMode } from '../entities';
5
5
  export interface Params extends BaseUseCaseParams {
@@ -8,12 +8,12 @@ export interface Params extends BaseUseCaseParams {
8
8
  search?: string;
9
9
  options?: QueryOptions;
10
10
  }
11
- export interface Output extends BaseUseCaseOutput {
12
- data: ChatProps[] | null | undefined;
13
- hasMore?: boolean;
11
+ export interface Output {
12
+ items: ChatProps[];
13
+ hasMore: boolean;
14
14
  }
15
15
  export declare class ListChatsByUserUseCase extends BaseUseCase<Params, Output> {
16
- private readonly chatRepository?;
17
- constructor(chatRepository?: ChatRepository | undefined);
16
+ private readonly chatRepository;
17
+ constructor(chatRepository?: ChatRepository);
18
18
  execute(params: Params): Promise<Output>;
19
19
  }
@@ -16,27 +16,18 @@ 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 __decorateClass = (decorators, target, key, kind) => {
20
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
21
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
22
- if (decorator = decorators[i])
23
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
24
- if (kind && result) __defProp(target, key, result);
25
- return result;
26
- };
27
- var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
28
19
  var list_chats_by_user_use_case_exports = {};
29
20
  __export(list_chats_by_user_use_case_exports, {
30
21
  ListChatsByUserUseCase: () => ListChatsByUserUseCase
31
22
  });
32
23
  module.exports = __toCommonJS(list_chats_by_user_use_case_exports);
33
- var import_tsyringe = require("tsyringe");
34
24
  var import_mongodb = require("mongodb");
25
+ var import_repositories = require("../../../common/repositories/index.js");
35
26
  var import_helpers = require("../../../common/helpers/index.js");
36
27
  var import_base = require("../../../common/base/base.use-case.js");
37
28
  var import_repositories2 = require("../repositories");
38
- let ListChatsByUserUseCase = class extends import_base.BaseUseCase {
39
- constructor(chatRepository) {
29
+ class ListChatsByUserUseCase extends import_base.BaseUseCase {
30
+ constructor(chatRepository = new import_repositories2.ChatRepository()) {
40
31
  super();
41
32
  this.chatRepository = chatRepository;
42
33
  }
@@ -45,7 +36,8 @@ let ListChatsByUserUseCase = class extends import_base.BaseUseCase {
45
36
  const { options, executionMode, search, currentUser } = params;
46
37
  const { page = 1, limit: pageSize = 10 } = options || {};
47
38
  const term = (0, import_helpers.escapeRegex)(search?.trim());
48
- const result = await this.chatRepository?._.findManyPaginated({
39
+ const result = await this.chatRepository._.findManyPaginated({
40
+ scope: params.scope ?? import_repositories.Scope.canView(currentUser),
49
41
  where: {
50
42
  ownerId: new import_mongodb.ObjectId(currentUser?.userId),
51
43
  ...executionMode === "autonomous" ? { "settings.executionMode": "autonomous" } : {},
@@ -54,13 +46,9 @@ let ListChatsByUserUseCase = class extends import_base.BaseUseCase {
54
46
  },
55
47
  options: { page, limit: pageSize, sortBy: { updatedAt: -1 } }
56
48
  });
57
- return { data: result?.items, hasMore: result?.hasMore };
49
+ return { items: result?.items ?? [], hasMore: result?.hasMore ?? false };
58
50
  }
59
- };
60
- ListChatsByUserUseCase = __decorateClass([
61
- (0, import_tsyringe.autoInjectable)(),
62
- __decorateParam(0, (0, import_tsyringe.inject)(import_repositories2.ChatRepository))
63
- ], ListChatsByUserUseCase);
51
+ }
64
52
  // Annotate the CommonJS export names for ESM import in node:
65
53
  0 && (module.exports = {
66
54
  ListChatsByUserUseCase
@@ -1,14 +1,10 @@
1
- import {
2
- __decorateClass,
3
- __decorateParam
4
- } from "../../../chunk-CF3WOMB3.mjs";
5
- import { autoInjectable, inject } from "tsyringe";
6
1
  import { ObjectId } from "mongodb";
2
+ import { Scope } from "../../../common/repositories/index.js";
7
3
  import { escapeRegex } from "../../../common/helpers/index.js";
8
4
  import { BaseUseCase } from "../../../common/base/base.use-case.js";
9
5
  import { ChatRepository } from "../repositories";
10
- let ListChatsByUserUseCase = class extends BaseUseCase {
11
- constructor(chatRepository) {
6
+ class ListChatsByUserUseCase extends BaseUseCase {
7
+ constructor(chatRepository = new ChatRepository()) {
12
8
  super();
13
9
  this.chatRepository = chatRepository;
14
10
  }
@@ -17,7 +13,8 @@ let ListChatsByUserUseCase = class extends BaseUseCase {
17
13
  const { options, executionMode, search, currentUser } = params;
18
14
  const { page = 1, limit: pageSize = 10 } = options || {};
19
15
  const term = escapeRegex(search?.trim());
20
- const result = await this.chatRepository?._.findManyPaginated({
16
+ const result = await this.chatRepository._.findManyPaginated({
17
+ scope: params.scope ?? Scope.canView(currentUser),
21
18
  where: {
22
19
  ownerId: new ObjectId(currentUser?.userId),
23
20
  ...executionMode === "autonomous" ? { "settings.executionMode": "autonomous" } : {},
@@ -26,13 +23,9 @@ let ListChatsByUserUseCase = class extends BaseUseCase {
26
23
  },
27
24
  options: { page, limit: pageSize, sortBy: { updatedAt: -1 } }
28
25
  });
29
- return { data: result?.items, hasMore: result?.hasMore };
26
+ return { items: result?.items ?? [], hasMore: result?.hasMore ?? false };
30
27
  }
31
- };
32
- ListChatsByUserUseCase = __decorateClass([
33
- autoInjectable(),
34
- __decorateParam(0, inject(ChatRepository))
35
- ], ListChatsByUserUseCase);
28
+ }
36
29
  export {
37
30
  ListChatsByUserUseCase
38
31
  };
@@ -1,15 +1,14 @@
1
- import { BaseUseCase, BaseUseCaseParams, BaseUseCaseOutput } from '../../../common/base/base.use-case.js';
1
+ import { BaseUseCase, BaseUseCaseParams } from '../../../common/base/base.use-case.js';
2
2
  import { ChatRepository } from '../repositories';
3
3
  import { ChatProps } from '../entities';
4
4
  export interface Params extends BaseUseCaseParams {
5
5
  id: string;
6
6
  payload?: ChatProps;
7
+ unset?: Record<string, ''>;
7
8
  }
8
- export interface Output extends BaseUseCaseOutput {
9
- data: ChatProps;
10
- }
9
+ export type Output = ChatProps;
11
10
  export declare class UpdateChatUseCase extends BaseUseCase<Params, Output> {
12
- private readonly chatRepository?;
13
- constructor(chatRepository?: ChatRepository | undefined);
11
+ private readonly chatRepository;
12
+ constructor(chatRepository?: ChatRepository);
14
13
  execute(params: Params): Promise<Output>;
15
14
  }
@@ -16,32 +16,23 @@ 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 __decorateClass = (decorators, target, key, kind) => {
20
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
21
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
22
- if (decorator = decorators[i])
23
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
24
- if (kind && result) __defProp(target, key, result);
25
- return result;
26
- };
27
- var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
28
19
  var update_chat_use_case_exports = {};
29
20
  __export(update_chat_use_case_exports, {
30
21
  UpdateChatUseCase: () => UpdateChatUseCase
31
22
  });
32
23
  module.exports = __toCommonJS(update_chat_use_case_exports);
33
- var import_tsyringe = require("tsyringe");
34
24
  var import_base = require("../../../common/base/base.use-case.js");
35
- var import_repositories = require("../repositories");
25
+ var import_repositories = require("../../../common/repositories/index.js");
26
+ var import_repositories2 = require("../repositories");
36
27
  var import_entities = require("../entities");
37
- let UpdateChatUseCase = class extends import_base.BaseUseCase {
38
- constructor(chatRepository) {
28
+ class UpdateChatUseCase extends import_base.BaseUseCase {
29
+ constructor(chatRepository = new import_repositories2.ChatRepository()) {
39
30
  super();
40
31
  this.chatRepository = chatRepository;
41
32
  }
42
33
  chatRepository;
43
34
  async execute(params) {
44
- const { payload, id, currentUser } = params;
35
+ const { payload, unset, id, currentUser } = params;
45
36
  if (!id) {
46
37
  throw new Error("Id is required for updating Chat");
47
38
  }
@@ -49,23 +40,12 @@ let UpdateChatUseCase = class extends import_base.BaseUseCase {
49
40
  throw new Error("Payload is required for updating Chat");
50
41
  }
51
42
  const chat = import_entities.Chat.fromJSON({ ...payload, _id: id });
52
- chat.setUpdatedBy(currentUser);
53
- if (payload.toUnset) {
54
- const flat = chat.toFlatDocument();
55
- const fields = Object.keys(payload.toUnset).filter((field) => flat[field] === void 0);
56
- if (fields.length) chat.unset(fields);
57
- }
58
- const result = await this.chatRepository?.update(chat);
59
- if (!result) {
60
- throw new Error("Chat not found or update failed");
61
- }
62
- return { data: result };
43
+ Object.assign(chat.clearedFields, unset);
44
+ const result = await this.chatRepository.update(chat, params.scope ?? import_repositories.Scope.canEdit(currentUser));
45
+ if (!result) this.throwHttpError({ statusCode: 404, errorMessage: "{{resource_not_found}}" });
46
+ return result;
63
47
  }
64
- };
65
- UpdateChatUseCase = __decorateClass([
66
- (0, import_tsyringe.autoInjectable)(),
67
- __decorateParam(0, (0, import_tsyringe.inject)(import_repositories.ChatRepository))
68
- ], UpdateChatUseCase);
48
+ }
69
49
  // Annotate the CommonJS export names for ESM import in node:
70
50
  0 && (module.exports = {
71
51
  UpdateChatUseCase
@@ -1,19 +1,15 @@
1
- import {
2
- __decorateClass,
3
- __decorateParam
4
- } from "../../../chunk-CF3WOMB3.mjs";
5
- import { autoInjectable, inject } from "tsyringe";
6
1
  import { BaseUseCase } from "../../../common/base/base.use-case.js";
2
+ import { Scope } from "../../../common/repositories/index.js";
7
3
  import { ChatRepository } from "../repositories";
8
4
  import { Chat } from "../entities";
9
- let UpdateChatUseCase = class extends BaseUseCase {
10
- constructor(chatRepository) {
5
+ class UpdateChatUseCase extends BaseUseCase {
6
+ constructor(chatRepository = new ChatRepository()) {
11
7
  super();
12
8
  this.chatRepository = chatRepository;
13
9
  }
14
10
  chatRepository;
15
11
  async execute(params) {
16
- const { payload, id, currentUser } = params;
12
+ const { payload, unset, id, currentUser } = params;
17
13
  if (!id) {
18
14
  throw new Error("Id is required for updating Chat");
19
15
  }
@@ -21,23 +17,12 @@ let UpdateChatUseCase = class extends BaseUseCase {
21
17
  throw new Error("Payload is required for updating Chat");
22
18
  }
23
19
  const chat = Chat.fromJSON({ ...payload, _id: id });
24
- chat.setUpdatedBy(currentUser);
25
- if (payload.toUnset) {
26
- const flat = chat.toFlatDocument();
27
- const fields = Object.keys(payload.toUnset).filter((field) => flat[field] === void 0);
28
- if (fields.length) chat.unset(fields);
29
- }
30
- const result = await this.chatRepository?.update(chat);
31
- if (!result) {
32
- throw new Error("Chat not found or update failed");
33
- }
34
- return { data: result };
20
+ Object.assign(chat.clearedFields, unset);
21
+ const result = await this.chatRepository.update(chat, params.scope ?? Scope.canEdit(currentUser));
22
+ if (!result) this.throwHttpError({ statusCode: 404, errorMessage: "{{resource_not_found}}" });
23
+ return result;
35
24
  }
36
- };
37
- UpdateChatUseCase = __decorateClass([
38
- autoInjectable(),
39
- __decorateParam(0, inject(ChatRepository))
40
- ], UpdateChatUseCase);
25
+ }
41
26
  export {
42
27
  UpdateChatUseCase
43
28
  };
@@ -1,4 +1,3 @@
1
- import "../../../chunk-CF3WOMB3.mjs";
2
1
  const WORDS = [
3
2
  "Thinking",
4
3
  "Computing",
@@ -1,4 +1,3 @@
1
- import "../../../chunk-CF3WOMB3.mjs";
2
1
  import { BaseEntity } from "../../../common/base/base.entity.js";
3
2
  class LLMCall extends BaseEntity {
4
3
  constructor(props, origin, answerId, sessionId, costInUsd, response) {
@@ -1,4 +1,3 @@
1
- import 'reflect-metadata';
2
1
  import { Params as MParams, Output as MOutput } from './use-cases/get-llm-usage-by-message.use-case';
3
2
  import { Params as HParams, Output as HOutput } from './use-cases/get-llm-usage-by-chat.use-case';
4
3
  import { Params as SParams, Output as SOutput } from './use-cases/get-llm-usage-stats.use-case';
@@ -24,26 +24,24 @@ __export(module_exports, {
24
24
  getLLMUsageStats: () => getLLMUsageStats
25
25
  });
26
26
  module.exports = __toCommonJS(module_exports);
27
- var import_reflect_metadata = require("reflect-metadata");
28
- var import_tsyringe = require("tsyringe");
29
27
  var import_get_llm_usage_by_message = require("./use-cases/get-llm-usage-by-message.use-case");
30
28
  var import_get_llm_usage_by_chat = require("./use-cases/get-llm-usage-by-chat.use-case");
31
29
  var import_get_llm_usage_stats = require("./use-cases/get-llm-usage-stats.use-case");
32
30
  var import_create_llmcall = require("./use-cases/create-llmcall.use-case");
33
31
  async function getLLMUsageByMessage(props) {
34
- const getLLMUsageByMessageUseCase = import_tsyringe.container.resolve(import_get_llm_usage_by_message.GetLLMUsageByMessageUseCase);
32
+ const getLLMUsageByMessageUseCase = new import_get_llm_usage_by_message.GetLLMUsageByMessageUseCase();
35
33
  return getLLMUsageByMessageUseCase.execute(props);
36
34
  }
37
35
  async function getLLMUsageByChat(props) {
38
- const getLLMUsageByChatUseCase = import_tsyringe.container.resolve(import_get_llm_usage_by_chat.GetLLMUsageByChatUseCase);
36
+ const getLLMUsageByChatUseCase = new import_get_llm_usage_by_chat.GetLLMUsageByChatUseCase();
39
37
  return getLLMUsageByChatUseCase.execute(props);
40
38
  }
41
39
  async function getLLMUsageStats(props) {
42
- const getLLMUsageStatsUseCase = import_tsyringe.container.resolve(import_get_llm_usage_stats.GetLLMUsageStatsUseCase);
40
+ const getLLMUsageStatsUseCase = new import_get_llm_usage_stats.GetLLMUsageStatsUseCase();
43
41
  return getLLMUsageStatsUseCase.execute(props);
44
42
  }
45
43
  async function createLLMCall(props) {
46
- const createLLMCall2 = import_tsyringe.container.resolve(import_create_llmcall.CreateLLMCallUseCase);
44
+ const createLLMCall2 = new import_create_llmcall.CreateLLMCallUseCase();
47
45
  return createLLMCall2.execute(props);
48
46
  }
49
47
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,24 +1,21 @@
1
- import "../../chunk-CF3WOMB3.mjs";
2
- import "reflect-metadata";
3
- import { container } from "tsyringe";
4
1
  import { GetLLMUsageByMessageUseCase } from "./use-cases/get-llm-usage-by-message.use-case";
5
2
  import { GetLLMUsageByChatUseCase } from "./use-cases/get-llm-usage-by-chat.use-case";
6
3
  import { GetLLMUsageStatsUseCase } from "./use-cases/get-llm-usage-stats.use-case";
7
4
  import { CreateLLMCallUseCase } from "./use-cases/create-llmcall.use-case";
8
5
  async function getLLMUsageByMessage(props) {
9
- const getLLMUsageByMessageUseCase = container.resolve(GetLLMUsageByMessageUseCase);
6
+ const getLLMUsageByMessageUseCase = new GetLLMUsageByMessageUseCase();
10
7
  return getLLMUsageByMessageUseCase.execute(props);
11
8
  }
12
9
  async function getLLMUsageByChat(props) {
13
- const getLLMUsageByChatUseCase = container.resolve(GetLLMUsageByChatUseCase);
10
+ const getLLMUsageByChatUseCase = new GetLLMUsageByChatUseCase();
14
11
  return getLLMUsageByChatUseCase.execute(props);
15
12
  }
16
13
  async function getLLMUsageStats(props) {
17
- const getLLMUsageStatsUseCase = container.resolve(GetLLMUsageStatsUseCase);
14
+ const getLLMUsageStatsUseCase = new GetLLMUsageStatsUseCase();
18
15
  return getLLMUsageStatsUseCase.execute(props);
19
16
  }
20
17
  async function createLLMCall(props) {
21
- const createLLMCall2 = container.resolve(CreateLLMCallUseCase);
18
+ const createLLMCall2 = new CreateLLMCallUseCase();
22
19
  return createLLMCall2.execute(props);
23
20
  }
24
21
  export {
@@ -1,12 +1,13 @@
1
- import { MongoRepository, QueryOptions } from '../../../common/repositories/index.js';
1
+ import { MongoRepository, QueryOptions, Scope } from '../../../common/repositories/index.js';
2
2
  import { LLMCall, LLMCallProps } from '../entities';
3
3
  export declare class LLMCallRepository {
4
4
  readonly _: MongoRepository<LLMCallProps>;
5
- create(llmCall: LLMCall): Promise<LLMCall>;
6
- update(llmCall: LLMCall): Promise<LLMCallProps | null>;
7
- findById(id: string): Promise<LLMCallProps | null>;
8
- deleteById(id: string): Promise<number>;
9
- findByProps(where: LLMCallProps, options?: QueryOptions): Promise<{
5
+ create(llmCall: LLMCall, scope: Scope): Promise<LLMCall>;
6
+ update(llmCall: LLMCall, scope: Scope): Promise<LLMCallProps | null>;
7
+ findById(id: string, scope: Scope): Promise<LLMCallProps | null>;
8
+ softDeleteById(id: string, scope: Scope): Promise<LLMCallProps | null>;
9
+ deleteById(id: string, scope: Scope): Promise<number>;
10
+ findByProps(where: LLMCallProps, scope: Scope, options?: QueryOptions): Promise<{
10
11
  items: LLMCallProps[];
11
12
  hasMore: boolean;
12
13
  }>;
@@ -16,51 +16,41 @@ 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 __decorateClass = (decorators, target, key, kind) => {
20
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
21
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
22
- if (decorator = decorators[i])
23
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
24
- if (kind && result) __defProp(target, key, result);
25
- return result;
26
- };
27
19
  var llmcall_repository_exports = {};
28
20
  __export(llmcall_repository_exports, {
29
21
  LLMCallRepository: () => LLMCallRepository
30
22
  });
31
23
  module.exports = __toCommonJS(llmcall_repository_exports);
32
- var import_tsyringe = require("tsyringe");
24
+ var import_utils = require("../../../common/base/utils/index.js");
33
25
  var import_repositories = require("../../../common/repositories/index.js");
34
26
  var import_database_name = require("../../../common/utils/database-name.js");
35
- let LLMCallRepository = class {
27
+ class LLMCallRepository {
36
28
  _ = new import_repositories.MongoRepository({
37
29
  database: (0, import_database_name.getDatabaseName)(),
38
- collection: "llm_calls"
30
+ collection: "llm_calls",
31
+ scoped: true
39
32
  });
40
- async create(llmCall) {
41
- const id = await this._.createOne({ payload: llmCall.toDocument() });
42
- id && llmCall.setId(id);
33
+ async create(llmCall, scope) {
34
+ const { _id, ownerId, createdAt, createdBy } = await this._.createOne({ payload: llmCall.toJSON(), scope });
35
+ Object.assign(llmCall, { _id, ownerId, createdAt, createdBy });
43
36
  return llmCall;
44
37
  }
45
- async update(llmCall) {
46
- return await this._.updateOne({
47
- where: { _id: llmCall._id },
48
- payload: llmCall.toFlatDocument()
49
- });
38
+ async update(llmCall, scope) {
39
+ return await this._.patchOne({ scope, where: { _id: llmCall._id }, ...(0, import_utils.entityPatch)(llmCall) });
50
40
  }
51
- async findById(id) {
52
- return await this._.findOne({ where: { _id: this._.parseId(id) } });
41
+ async findById(id, scope) {
42
+ return await this._.findOne({ scope, where: { _id: this._.parseId(id) } });
53
43
  }
54
- async deleteById(id) {
55
- return await this._.deleteOne({ where: { _id: this._.parseId(id) } });
44
+ async softDeleteById(id, scope) {
45
+ return await this._.softDelete({ scope, where: { _id: this._.parseId(id) } });
56
46
  }
57
- async findByProps(where, options) {
58
- return await this._.findManyPaginated({ where, options });
47
+ async deleteById(id, scope) {
48
+ return await this._.deleteOne({ scope, where: { _id: this._.parseId(id) } });
59
49
  }
60
- };
61
- LLMCallRepository = __decorateClass([
62
- (0, import_tsyringe.autoInjectable)()
63
- ], LLMCallRepository);
50
+ async findByProps(where, scope, options) {
51
+ return await this._.findManyPaginated({ scope, where, options });
52
+ }
53
+ }
64
54
  // Annotate the CommonJS export names for ESM import in node:
65
55
  0 && (module.exports = {
66
56
  LLMCallRepository
@@ -1,38 +1,33 @@
1
- import {
2
- __decorateClass
3
- } from "../../../chunk-CF3WOMB3.mjs";
4
- import { autoInjectable } from "tsyringe";
1
+ import { entityPatch } from "../../../common/base/utils/index.js";
5
2
  import { MongoRepository } from "../../../common/repositories/index.js";
6
3
  import { getDatabaseName } from "../../../common/utils/database-name.js";
7
- let LLMCallRepository = class {
4
+ class LLMCallRepository {
8
5
  _ = new MongoRepository({
9
6
  database: getDatabaseName(),
10
- collection: "llm_calls"
7
+ collection: "llm_calls",
8
+ scoped: true
11
9
  });
12
- async create(llmCall) {
13
- const id = await this._.createOne({ payload: llmCall.toDocument() });
14
- id && llmCall.setId(id);
10
+ async create(llmCall, scope) {
11
+ const { _id, ownerId, createdAt, createdBy } = await this._.createOne({ payload: llmCall.toJSON(), scope });
12
+ Object.assign(llmCall, { _id, ownerId, createdAt, createdBy });
15
13
  return llmCall;
16
14
  }
17
- async update(llmCall) {
18
- return await this._.updateOne({
19
- where: { _id: llmCall._id },
20
- payload: llmCall.toFlatDocument()
21
- });
15
+ async update(llmCall, scope) {
16
+ return await this._.patchOne({ scope, where: { _id: llmCall._id }, ...entityPatch(llmCall) });
22
17
  }
23
- async findById(id) {
24
- return await this._.findOne({ where: { _id: this._.parseId(id) } });
18
+ async findById(id, scope) {
19
+ return await this._.findOne({ scope, where: { _id: this._.parseId(id) } });
25
20
  }
26
- async deleteById(id) {
27
- return await this._.deleteOne({ where: { _id: this._.parseId(id) } });
21
+ async softDeleteById(id, scope) {
22
+ return await this._.softDelete({ scope, where: { _id: this._.parseId(id) } });
28
23
  }
29
- async findByProps(where, options) {
30
- return await this._.findManyPaginated({ where, options });
24
+ async deleteById(id, scope) {
25
+ return await this._.deleteOne({ scope, where: { _id: this._.parseId(id) } });
31
26
  }
32
- };
33
- LLMCallRepository = __decorateClass([
34
- autoInjectable()
35
- ], LLMCallRepository);
27
+ async findByProps(where, scope, options) {
28
+ return await this._.findManyPaginated({ scope, where, options });
29
+ }
30
+ }
36
31
  export {
37
32
  LLMCallRepository
38
33
  };
@@ -1,14 +1,12 @@
1
- import { BaseUseCase, BaseUseCaseParams, BaseUseCaseOutput } from '../../../common/base/base.use-case.js';
1
+ import { BaseUseCase, BaseUseCaseParams } from '../../../common/base/base.use-case.js';
2
2
  import { LLMCallProps } from '../entities';
3
3
  import { LLMCallRepository } from '../repositories';
4
4
  export interface Params extends BaseUseCaseParams {
5
5
  payload?: LLMCallProps;
6
6
  }
7
- export interface Output extends BaseUseCaseOutput {
8
- data: LLMCallProps | null;
9
- }
7
+ export type Output = LLMCallProps;
10
8
  export declare class CreateLLMCallUseCase extends BaseUseCase<Params, Output> {
11
- private readonly llmCallRepository?;
12
- constructor(llmCallRepository?: LLMCallRepository | undefined);
9
+ private readonly llmCallRepository;
10
+ constructor(llmCallRepository?: LLMCallRepository);
13
11
  execute(params: Params): Promise<Output>;
14
12
  }