openloops 0.6.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.
- package/CHANGELOG.md +33 -0
- package/README.md +1 -1
- package/dist/clients/llm/llm-client.mjs +0 -1
- package/dist/clients/llm/llm-error.mjs +0 -1
- package/dist/clients/llm/llm-types.mjs +0 -1
- package/dist/clients/llm/model-resolution.mjs +0 -1
- package/dist/clients/llm/pi-ai-adapter.mjs +0 -1
- package/dist/clients/llm/sampling-rules.mjs +0 -1
- package/dist/clients/serper/serper-client.mjs +0 -1
- package/dist/clients/slack/slack-client.mjs +0 -1
- package/dist/common/base/base.app.d.ts +3 -3
- package/dist/common/base/base.app.mjs +0 -1
- package/dist/common/base/base.entity.d.ts +4 -16
- package/dist/common/base/base.entity.js +11 -39
- package/dist/common/base/base.entity.mjs +11 -40
- package/dist/common/base/base.use-case.d.ts +1 -7
- package/dist/common/base/base.use-case.mjs +0 -1
- package/dist/common/base/current-session.mjs +0 -1
- package/dist/common/base/current-user.mjs +0 -1
- package/dist/common/base/share.mjs +0 -1
- package/dist/common/base/utils/index.d.ts +1 -2
- package/dist/common/base/utils/index.js +2 -4
- package/dist/common/base/utils/index.mjs +1 -2
- package/dist/common/base/utils/is-plain-object.mjs +0 -1
- package/dist/common/base/utils/to-patch.d.ts +9 -0
- package/dist/common/base/utils/to-patch.js +46 -0
- package/dist/common/base/utils/to-patch.mjs +21 -0
- package/dist/common/constants/harness.mjs +0 -1
- package/dist/common/error/http-error.mjs +0 -1
- package/dist/common/error/reportError.mjs +0 -1
- package/dist/common/error/sentry-client.mjs +0 -1
- package/dist/common/helpers/escape-regex.mjs +0 -1
- package/dist/common/helpers/extract-json-from-text.mjs +0 -1
- package/dist/common/helpers/sanitize-string.mjs +0 -1
- package/dist/common/logger/pino.mjs +0 -1
- package/dist/common/repositories/mongo-db.client.mjs +0 -1
- package/dist/common/repositories/mongo-db.repository.d.ts +15 -4
- package/dist/common/repositories/mongo-db.repository.js +44 -15
- package/dist/common/repositories/mongo-db.repository.mjs +44 -16
- package/dist/common/repositories/scope.mjs +0 -1
- package/dist/common/utils/database-name.mjs +0 -1
- package/dist/common/utils/number-setting.mjs +0 -1
- package/dist/common/utils/secret-manager.mjs +0 -1
- package/dist/db/indexes/agent-actions.mjs +0 -1
- package/dist/db/indexes/agent-tasks.mjs +0 -1
- package/dist/db/indexes/agent-traces.mjs +0 -1
- package/dist/db/indexes/automation-runs.mjs +0 -1
- package/dist/db/indexes/automations.mjs +0 -1
- package/dist/db/indexes/chats.mjs +0 -1
- package/dist/db/indexes/index.js +3 -1
- package/dist/db/indexes/index.mjs +3 -2
- package/dist/db/indexes/llm-calls.mjs +0 -1
- package/dist/db/indexes/mcp-servers.mjs +0 -1
- package/dist/db/indexes/refresh-tokens.d.ts +2 -0
- package/dist/{common/decorators/mask-in-logs/index.js → db/indexes/refresh-tokens.js} +16 -5
- package/dist/db/indexes/refresh-tokens.mjs +9 -0
- package/dist/db/indexes/revoked-tokens.mjs +0 -1
- package/dist/db/indexes/workspace-items.mjs +0 -1
- package/dist/db/migrations/automations.mjs +0 -1
- package/dist/guardrails/guard.mjs +0 -1
- package/dist/guardrails/index.mjs +0 -1
- package/dist/guardrails/input/block-card.mjs +0 -1
- package/dist/guardrails/input/block-code.mjs +0 -1
- package/dist/guardrails/input/block-email.mjs +0 -1
- package/dist/guardrails/input/create-block-input-oversize.mjs +0 -1
- package/dist/guardrails/input/diagnostic-sanity.mjs +0 -1
- package/dist/guardrails/input/input-check.mjs +0 -1
- package/dist/harness/agent-loop.mjs +0 -1
- package/dist/harness/agent-state.mjs +0 -1
- package/dist/harness/agent.d.ts +0 -1
- package/dist/harness/agent.js +14 -14
- package/dist/harness/agent.mjs +14 -15
- package/dist/harness/native-tools.mjs +0 -1
- package/dist/harness/skills/approval-request.mjs +0 -1
- package/dist/harness/skills/autonomous-answer.mjs +0 -1
- package/dist/harness/skills/confirmation-gate.mjs +0 -1
- package/dist/harness/skills/mcp-change-review.mjs +0 -1
- package/dist/harness/tool-catalog.mjs +0 -1
- package/dist/harness/tool-pipeline.mjs +0 -1
- package/dist/harness/utils/activity.mjs +0 -1
- package/dist/harness/utils/describe-shape.mjs +0 -1
- package/dist/harness/utils/grounding.mjs +0 -1
- package/dist/harness/utils/rank-tools-by-keywords.mjs +0 -1
- package/dist/harness/workspace.js +7 -7
- package/dist/harness/workspace.mjs +7 -8
- package/dist/loops/agi/loop.mjs +0 -1
- package/dist/loops/agi/skills/reasoning-engine.mjs +0 -1
- package/dist/loops/shared/skills/fast-responder.mjs +0 -1
- package/dist/services/authentication/entities/index.d.ts +1 -0
- package/dist/services/authentication/entities/index.js +3 -1
- package/dist/services/authentication/entities/index.mjs +1 -0
- package/dist/services/authentication/entities/refresh-token.entity.d.ts +25 -0
- package/dist/services/authentication/entities/refresh-token.entity.js +75 -0
- package/dist/services/authentication/entities/refresh-token.entity.mjs +51 -0
- package/dist/services/authentication/entities/revoked-token.entity.mjs +0 -1
- package/dist/services/authentication/helpers/auth-config.d.ts +9 -0
- package/dist/{common/decorators/index.js → services/authentication/helpers/auth-config.js} +19 -5
- package/dist/services/authentication/helpers/auth-config.mjs +12 -0
- package/dist/services/authentication/helpers/session-tokens.d.ts +16 -0
- package/dist/services/authentication/helpers/session-tokens.js +60 -0
- package/dist/services/authentication/helpers/session-tokens.mjs +35 -0
- package/dist/services/authentication/helpers/tokens.d.ts +43 -0
- package/dist/services/authentication/helpers/tokens.js +113 -0
- package/dist/services/authentication/helpers/tokens.mjs +71 -0
- package/dist/services/authentication/index.d.ts +3 -0
- package/dist/services/authentication/index.js +23 -0
- package/dist/services/authentication/index.mjs +11 -0
- package/dist/services/authentication/module.d.ts +12 -3
- package/dist/services/authentication/module.js +40 -7
- package/dist/services/authentication/module.mjs +34 -7
- package/dist/services/authentication/repositories/index.d.ts +1 -0
- package/dist/services/authentication/repositories/index.js +3 -1
- package/dist/services/authentication/repositories/index.mjs +1 -0
- package/dist/services/authentication/repositories/refresh-token.repository.d.ts +10 -0
- package/dist/services/authentication/repositories/refresh-token.repository.js +60 -0
- package/dist/services/authentication/repositories/refresh-token.repository.mjs +36 -0
- package/dist/services/authentication/repositories/revoked-token.repository.js +3 -15
- package/dist/services/authentication/repositories/revoked-token.repository.mjs +3 -10
- package/dist/services/authentication/use-cases/claim-refresh-token.use-case.d.ts +12 -0
- package/dist/services/authentication/use-cases/claim-refresh-token.use-case.js +40 -0
- package/dist/services/authentication/use-cases/claim-refresh-token.use-case.mjs +16 -0
- package/dist/services/authentication/use-cases/create-refresh-token.use-case.d.ts +11 -0
- package/dist/services/authentication/use-cases/create-refresh-token.use-case.js +43 -0
- package/dist/services/authentication/use-cases/create-refresh-token.use-case.mjs +19 -0
- package/dist/services/authentication/use-cases/find-refresh-token-by-hash.use-case.d.ts +11 -0
- package/dist/services/authentication/use-cases/find-refresh-token-by-hash.use-case.js +40 -0
- package/dist/services/authentication/use-cases/find-refresh-token-by-hash.use-case.mjs +16 -0
- package/dist/services/authentication/use-cases/is-token-revoked.use-case.d.ts +6 -8
- package/dist/services/authentication/use-cases/is-token-revoked.use-case.js +4 -18
- package/dist/services/authentication/use-cases/is-token-revoked.use-case.mjs +4 -13
- package/dist/services/authentication/use-cases/issue-password-reset-token.use-case.d.ts +18 -0
- package/dist/services/authentication/use-cases/issue-password-reset-token.use-case.js +49 -0
- package/dist/services/authentication/use-cases/issue-password-reset-token.use-case.mjs +25 -0
- package/dist/services/authentication/use-cases/issue-session.use-case.d.ts +13 -0
- package/dist/services/authentication/use-cases/issue-session.use-case.js +48 -0
- package/dist/services/authentication/use-cases/issue-session.use-case.mjs +24 -0
- package/dist/services/authentication/use-cases/login.use-case.d.ts +11 -11
- package/dist/services/authentication/use-cases/login.use-case.js +18 -54
- package/dist/services/authentication/use-cases/login.use-case.mjs +17 -38
- package/dist/services/authentication/use-cases/logout.use-case.d.ts +14 -0
- package/dist/services/authentication/use-cases/logout.use-case.js +48 -0
- package/dist/services/authentication/use-cases/logout.use-case.mjs +24 -0
- package/dist/services/authentication/use-cases/refresh.use-case.d.ts +23 -0
- package/dist/services/authentication/use-cases/refresh.use-case.js +84 -0
- package/dist/services/authentication/use-cases/refresh.use-case.mjs +60 -0
- package/dist/services/authentication/use-cases/reset-password.use-case.d.ts +15 -0
- package/dist/services/authentication/use-cases/reset-password.use-case.js +61 -0
- package/dist/services/authentication/use-cases/reset-password.use-case.mjs +37 -0
- package/dist/services/authentication/use-cases/revoke-refresh-token-family.use-case.d.ts +11 -0
- package/dist/services/authentication/use-cases/revoke-refresh-token-family.use-case.js +40 -0
- package/dist/services/authentication/use-cases/revoke-refresh-token-family.use-case.mjs +16 -0
- package/dist/services/authentication/use-cases/revoke-token.use-case.d.ts +4 -6
- package/dist/services/authentication/use-cases/revoke-token.use-case.js +12 -26
- package/dist/services/authentication/use-cases/revoke-token.use-case.mjs +10 -19
- package/dist/services/authentication/use-cases/revoke-user-refresh-tokens.use-case.d.ts +13 -0
- package/dist/services/authentication/use-cases/revoke-user-refresh-tokens.use-case.js +40 -0
- package/dist/services/authentication/use-cases/revoke-user-refresh-tokens.use-case.mjs +16 -0
- package/dist/services/automations/entities/automation-run.entity.mjs +0 -1
- package/dist/services/automations/entities/automation.entity.d.ts +1 -0
- package/dist/services/automations/entities/automation.entity.js +2 -1
- package/dist/services/automations/entities/automation.entity.mjs +2 -2
- package/dist/services/automations/entities/recurrence.mjs +0 -1
- package/dist/services/automations/entities/trigger.mjs +0 -1
- package/dist/services/automations/module.d.ts +0 -1
- package/dist/services/automations/module.js +20 -22
- package/dist/services/automations/module.mjs +20 -23
- package/dist/services/automations/repositories/automation-run.repository.js +7 -22
- package/dist/services/automations/repositories/automation-run.repository.mjs +7 -17
- package/dist/services/automations/repositories/automation.repository.js +25 -39
- package/dist/services/automations/repositories/automation.repository.mjs +25 -34
- package/dist/services/automations/runner/automation-runner.js +8 -9
- package/dist/services/automations/runner/automation-runner.mjs +8 -10
- package/dist/services/automations/use-cases/attach-automation-run-chat.use-case.d.ts +4 -6
- package/dist/services/automations/use-cases/attach-automation-run-chat.use-case.js +5 -19
- package/dist/services/automations/use-cases/attach-automation-run-chat.use-case.mjs +5 -14
- package/dist/services/automations/use-cases/claim-due-automations.use-case.d.ts +9 -11
- package/dist/services/automations/use-cases/claim-due-automations.use-case.js +4 -20
- package/dist/services/automations/use-cases/claim-due-automations.use-case.mjs +4 -15
- package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.d.ts +9 -11
- package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.js +4 -20
- package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.mjs +4 -15
- package/dist/services/automations/use-cases/create-automation.use-case.d.ts +4 -6
- package/dist/services/automations/use-cases/create-automation.use-case.js +5 -19
- package/dist/services/automations/use-cases/create-automation.use-case.mjs +5 -14
- package/dist/services/automations/use-cases/delete-automation.use-case.d.ts +6 -6
- package/dist/services/automations/use-cases/delete-automation.use-case.js +8 -22
- package/dist/services/automations/use-cases/delete-automation.use-case.mjs +8 -17
- package/dist/services/automations/use-cases/finish-automation-run.use-case.d.ts +5 -7
- package/dist/services/automations/use-cases/finish-automation-run.use-case.js +5 -20
- package/dist/services/automations/use-cases/finish-automation-run.use-case.mjs +5 -15
- package/dist/services/automations/use-cases/get-automation-by-id.use-case.d.ts +4 -6
- package/dist/services/automations/use-cases/get-automation-by-id.use-case.js +5 -19
- package/dist/services/automations/use-cases/get-automation-by-id.use-case.mjs +5 -14
- package/dist/services/automations/use-cases/issue-automation-event-token.use-case.d.ts +7 -9
- package/dist/services/automations/use-cases/issue-automation-event-token.use-case.js +6 -20
- package/dist/services/automations/use-cases/issue-automation-event-token.use-case.mjs +6 -15
- package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.d.ts +6 -6
- package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.js +5 -19
- package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.mjs +5 -14
- package/dist/services/automations/use-cases/list-automation-runs-by-user.use-case.d.ts +6 -6
- package/dist/services/automations/use-cases/list-automation-runs-by-user.use-case.js +5 -19
- package/dist/services/automations/use-cases/list-automation-runs-by-user.use-case.mjs +5 -14
- package/dist/services/automations/use-cases/list-automations-by-user.use-case.d.ts +6 -6
- package/dist/services/automations/use-cases/list-automations-by-user.use-case.js +5 -19
- package/dist/services/automations/use-cases/list-automations-by-user.use-case.mjs +5 -14
- package/dist/services/automations/use-cases/preview-automation-runs.use-case.d.ts +4 -6
- package/dist/services/automations/use-cases/preview-automation-runs.use-case.js +3 -15
- package/dist/services/automations/use-cases/preview-automation-runs.use-case.mjs +3 -10
- package/dist/services/automations/use-cases/receive-automation-event.use-case.d.ts +8 -10
- package/dist/services/automations/use-cases/receive-automation-event.use-case.js +8 -23
- package/dist/services/automations/use-cases/receive-automation-event.use-case.mjs +8 -18
- package/dist/services/automations/use-cases/renew-automation-lease.use-case.d.ts +6 -8
- package/dist/services/automations/use-cases/renew-automation-lease.use-case.js +4 -18
- package/dist/services/automations/use-cases/renew-automation-lease.use-case.mjs +4 -13
- package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.d.ts +6 -8
- package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.js +8 -21
- package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.mjs +9 -17
- package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.d.ts +4 -6
- package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.js +8 -22
- package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.mjs +8 -17
- package/dist/services/automations/use-cases/start-automation-run.use-case.d.ts +8 -10
- package/dist/services/automations/use-cases/start-automation-run.use-case.js +5 -20
- package/dist/services/automations/use-cases/start-automation-run.use-case.mjs +5 -15
- package/dist/services/automations/use-cases/sync-automation-run.use-case.d.ts +5 -7
- package/dist/services/automations/use-cases/sync-automation-run.use-case.js +12 -27
- package/dist/services/automations/use-cases/sync-automation-run.use-case.mjs +12 -22
- package/dist/services/automations/use-cases/sync-automation-runs.use-case.d.ts +8 -10
- package/dist/services/automations/use-cases/sync-automation-runs.use-case.js +7 -22
- package/dist/services/automations/use-cases/sync-automation-runs.use-case.mjs +7 -17
- package/dist/services/automations/use-cases/update-automation.use-case.d.ts +4 -6
- package/dist/services/automations/use-cases/update-automation.use-case.js +10 -24
- package/dist/services/automations/use-cases/update-automation.use-case.mjs +10 -19
- package/dist/services/automations/utils/automation-event-error.mjs +0 -1
- package/dist/services/automations/utils/automation-fields.mjs +0 -1
- package/dist/services/automations/utils/event-message.mjs +0 -1
- package/dist/services/automations/utils/event-token.d.ts +1 -2
- package/dist/services/automations/utils/event-token.js +9 -35
- package/dist/services/automations/utils/event-token.mjs +9 -25
- package/dist/services/automations/utils/next-run.mjs +0 -1
- package/dist/services/automations/utils/open-run.mjs +0 -1
- package/dist/services/automations/utils/previous-run.js +1 -1
- package/dist/services/automations/utils/previous-run.mjs +1 -2
- package/dist/services/automations/utils/runner-scope.mjs +0 -1
- package/dist/services/automations/utils/settings.mjs +0 -1
- package/dist/services/chats/entities/chat-message.entity.mjs +0 -1
- package/dist/services/chats/entities/chat-settings.entity.mjs +0 -1
- package/dist/services/chats/entities/chat.entity.d.ts +1 -0
- package/dist/services/chats/entities/chat.entity.js +3 -2
- package/dist/services/chats/entities/chat.entity.mjs +3 -3
- package/dist/services/chats/module.d.ts +0 -1
- package/dist/services/chats/module.js +5 -7
- package/dist/services/chats/module.mjs +5 -8
- package/dist/services/chats/repositories/chat.repository.js +5 -20
- package/dist/services/chats/repositories/chat.repository.mjs +5 -15
- package/dist/services/chats/use-cases/create-chat.use-case.d.ts +4 -6
- package/dist/services/chats/use-cases/create-chat.use-case.js +5 -19
- package/dist/services/chats/use-cases/create-chat.use-case.mjs +5 -14
- package/dist/services/chats/use-cases/delete-chat.use-case.d.ts +6 -6
- package/dist/services/chats/use-cases/delete-chat.use-case.js +8 -22
- package/dist/services/chats/use-cases/delete-chat.use-case.mjs +8 -17
- package/dist/services/chats/use-cases/get-chat-by-id.use-case.d.ts +4 -6
- package/dist/services/chats/use-cases/get-chat-by-id.use-case.js +6 -20
- package/dist/services/chats/use-cases/get-chat-by-id.use-case.mjs +6 -15
- package/dist/services/chats/use-cases/interrupt-execution.use-case.d.ts +4 -6
- package/dist/services/chats/use-cases/interrupt-execution.use-case.js +6 -20
- package/dist/services/chats/use-cases/interrupt-execution.use-case.mjs +6 -15
- package/dist/services/chats/use-cases/list-chats-by-props.use-case.d.ts +6 -6
- package/dist/services/chats/use-cases/list-chats-by-props.use-case.js +5 -19
- package/dist/services/chats/use-cases/list-chats-by-props.use-case.mjs +5 -14
- package/dist/services/chats/use-cases/list-chats-by-user.use-case.d.ts +6 -6
- package/dist/services/chats/use-cases/list-chats-by-user.use-case.js +5 -19
- package/dist/services/chats/use-cases/list-chats-by-user.use-case.mjs +5 -14
- package/dist/services/chats/use-cases/update-chat.use-case.d.ts +5 -6
- package/dist/services/chats/use-cases/update-chat.use-case.js +8 -26
- package/dist/services/chats/use-cases/update-chat.use-case.mjs +8 -21
- package/dist/services/chats/utils/deprecated-activity.mjs +0 -1
- package/dist/services/llmcalls/entities/llmcall.entity.mjs +0 -1
- package/dist/services/llmcalls/module.d.ts +0 -1
- package/dist/services/llmcalls/module.js +4 -6
- package/dist/services/llmcalls/module.mjs +4 -7
- package/dist/services/llmcalls/repositories/llmcall.repository.js +5 -20
- package/dist/services/llmcalls/repositories/llmcall.repository.mjs +5 -15
- package/dist/services/llmcalls/use-cases/create-llmcall.use-case.d.ts +4 -6
- package/dist/services/llmcalls/use-cases/create-llmcall.use-case.js +5 -19
- package/dist/services/llmcalls/use-cases/create-llmcall.use-case.mjs +5 -14
- package/dist/services/llmcalls/use-cases/delete-llmcall.use-case.d.ts +6 -6
- package/dist/services/llmcalls/use-cases/delete-llmcall.use-case.js +8 -22
- package/dist/services/llmcalls/use-cases/delete-llmcall.use-case.mjs +8 -17
- package/dist/services/llmcalls/use-cases/get-llm-usage-by-chat.use-case.d.ts +4 -6
- package/dist/services/llmcalls/use-cases/get-llm-usage-by-chat.use-case.js +5 -19
- package/dist/services/llmcalls/use-cases/get-llm-usage-by-chat.use-case.mjs +5 -14
- package/dist/services/llmcalls/use-cases/get-llm-usage-by-message.use-case.d.ts +4 -6
- package/dist/services/llmcalls/use-cases/get-llm-usage-by-message.use-case.js +5 -19
- package/dist/services/llmcalls/use-cases/get-llm-usage-by-message.use-case.mjs +5 -14
- package/dist/services/llmcalls/use-cases/get-llm-usage-stats.use-case.d.ts +4 -6
- package/dist/services/llmcalls/use-cases/get-llm-usage-stats.use-case.js +5 -19
- package/dist/services/llmcalls/use-cases/get-llm-usage-stats.use-case.mjs +5 -14
- package/dist/services/llmcalls/use-cases/get-llmcall-by-id.use-case.d.ts +4 -6
- package/dist/services/llmcalls/use-cases/get-llmcall-by-id.use-case.js +6 -20
- package/dist/services/llmcalls/use-cases/get-llmcall-by-id.use-case.mjs +6 -15
- package/dist/services/llmcalls/use-cases/list-llmcalls-by-props.use-case.d.ts +6 -6
- package/dist/services/llmcalls/use-cases/list-llmcalls-by-props.use-case.js +5 -19
- package/dist/services/llmcalls/use-cases/list-llmcalls-by-props.use-case.mjs +5 -14
- package/dist/services/llmcalls/use-cases/update-llmcall.use-case.d.ts +4 -6
- package/dist/services/llmcalls/use-cases/update-llmcall.use-case.js +7 -21
- package/dist/services/llmcalls/use-cases/update-llmcall.use-case.mjs +7 -16
- package/dist/services/llmcalls/utils/usage-periods.mjs +0 -1
- package/dist/services/llmcalls/utils/usage-totals.mjs +0 -1
- package/dist/services/mcp-servers/entities/mcp-manifest.mjs +0 -1
- package/dist/services/mcp-servers/entities/mcpserver.entity.mjs +0 -1
- package/dist/services/mcp-servers/module.d.ts +0 -1
- package/dist/services/mcp-servers/module.js +8 -10
- package/dist/services/mcp-servers/module.mjs +8 -11
- package/dist/services/mcp-servers/repositories/mcpserver.repository.js +5 -21
- package/dist/services/mcp-servers/repositories/mcpserver.repository.mjs +5 -16
- package/dist/services/mcp-servers/use-cases/create-mcpserver.use-case.d.ts +5 -7
- package/dist/services/mcp-servers/use-cases/create-mcpserver.use-case.js +5 -21
- package/dist/services/mcp-servers/use-cases/create-mcpserver.use-case.mjs +5 -16
- package/dist/services/mcp-servers/use-cases/decide-mcpserver-trust.use-case.d.ts +4 -6
- package/dist/services/mcp-servers/use-cases/decide-mcpserver-trust.use-case.js +7 -21
- package/dist/services/mcp-servers/use-cases/decide-mcpserver-trust.use-case.mjs +7 -16
- package/dist/services/mcp-servers/use-cases/delete-mcpserver.use-case.d.ts +6 -6
- package/dist/services/mcp-servers/use-cases/delete-mcpserver.use-case.js +8 -22
- package/dist/services/mcp-servers/use-cases/delete-mcpserver.use-case.mjs +8 -17
- package/dist/services/mcp-servers/use-cases/get-mcpserver-by-id.use-case.d.ts +4 -6
- package/dist/services/mcp-servers/use-cases/get-mcpserver-by-id.use-case.js +5 -19
- package/dist/services/mcp-servers/use-cases/get-mcpserver-by-id.use-case.mjs +5 -14
- package/dist/services/mcp-servers/use-cases/list-all-mcpservers-by-user.use-case.d.ts +6 -6
- package/dist/services/mcp-servers/use-cases/list-all-mcpservers-by-user.use-case.js +5 -19
- package/dist/services/mcp-servers/use-cases/list-all-mcpservers-by-user.use-case.mjs +5 -14
- package/dist/services/mcp-servers/use-cases/list-mcpservers-by-user.use-case.d.ts +6 -6
- package/dist/services/mcp-servers/use-cases/list-mcpservers-by-user.use-case.js +5 -19
- package/dist/services/mcp-servers/use-cases/list-mcpservers-by-user.use-case.mjs +5 -14
- package/dist/services/mcp-servers/use-cases/update-mcpserver.use-case.d.ts +5 -7
- package/dist/services/mcp-servers/use-cases/update-mcpserver.use-case.js +9 -25
- package/dist/services/mcp-servers/use-cases/update-mcpserver.use-case.mjs +9 -20
- package/dist/services/mcp-servers/use-cases/verify-mcpserver-connection.use-case.d.ts +4 -6
- package/dist/services/mcp-servers/use-cases/verify-mcpserver-connection.use-case.js +9 -23
- package/dist/services/mcp-servers/use-cases/verify-mcpserver-connection.use-case.mjs +9 -18
- package/dist/services/tasks/entities/agent-action.entity.mjs +0 -1
- package/dist/services/tasks/entities/agent-task.entity.mjs +0 -1
- package/dist/services/tasks/module.d.ts +0 -1
- package/dist/services/tasks/module.js +7 -9
- package/dist/services/tasks/module.mjs +7 -10
- package/dist/services/tasks/repositories/agent-action.repository.js +5 -21
- package/dist/services/tasks/repositories/agent-action.repository.mjs +5 -16
- package/dist/services/tasks/repositories/agent-task.repository.js +5 -21
- package/dist/services/tasks/repositories/agent-task.repository.mjs +5 -16
- package/dist/services/tasks/use-cases/create-agent-action.use-case.d.ts +4 -6
- package/dist/services/tasks/use-cases/create-agent-action.use-case.js +5 -19
- package/dist/services/tasks/use-cases/create-agent-action.use-case.mjs +5 -14
- package/dist/services/tasks/use-cases/create-agent-task.use-case.d.ts +4 -6
- package/dist/services/tasks/use-cases/create-agent-task.use-case.js +5 -19
- package/dist/services/tasks/use-cases/create-agent-task.use-case.mjs +5 -14
- package/dist/services/tasks/use-cases/get-agent-task-by-id.use-case.d.ts +4 -6
- package/dist/services/tasks/use-cases/get-agent-task-by-id.use-case.js +5 -19
- package/dist/services/tasks/use-cases/get-agent-task-by-id.use-case.mjs +5 -14
- package/dist/services/tasks/use-cases/list-agent-actions-by-task.use-case.d.ts +6 -6
- package/dist/services/tasks/use-cases/list-agent-actions-by-task.use-case.js +5 -19
- package/dist/services/tasks/use-cases/list-agent-actions-by-task.use-case.mjs +5 -14
- package/dist/services/tasks/use-cases/list-agent-tasks-by-chat.use-case.d.ts +6 -6
- package/dist/services/tasks/use-cases/list-agent-tasks-by-chat.use-case.js +5 -19
- package/dist/services/tasks/use-cases/list-agent-tasks-by-chat.use-case.mjs +5 -14
- package/dist/services/tasks/use-cases/update-agent-action.use-case.d.ts +4 -6
- package/dist/services/tasks/use-cases/update-agent-action.use-case.js +6 -20
- package/dist/services/tasks/use-cases/update-agent-action.use-case.mjs +6 -15
- package/dist/services/tasks/use-cases/update-agent-task.use-case.d.ts +4 -6
- package/dist/services/tasks/use-cases/update-agent-task.use-case.js +6 -20
- package/dist/services/tasks/use-cases/update-agent-task.use-case.mjs +6 -15
- package/dist/services/traces/entities/agent-trace-entry.entity.mjs +0 -1
- package/dist/services/traces/module.d.ts +0 -1
- package/dist/services/traces/module.js +2 -4
- package/dist/services/traces/module.mjs +2 -5
- package/dist/services/traces/repositories/agent-trace.repository.js +3 -15
- package/dist/services/traces/repositories/agent-trace.repository.mjs +3 -10
- package/dist/services/traces/use-cases/create-agent-traces.use-case.d.ts +6 -8
- package/dist/services/traces/use-cases/create-agent-traces.use-case.js +5 -19
- package/dist/services/traces/use-cases/create-agent-traces.use-case.mjs +5 -14
- package/dist/services/traces/use-cases/list-agent-traces-by-chat.use-case.d.ts +6 -6
- package/dist/services/traces/use-cases/list-agent-traces-by-chat.use-case.js +5 -19
- package/dist/services/traces/use-cases/list-agent-traces-by-chat.use-case.mjs +5 -14
- package/dist/services/users/entities/user-acquisition.js +2 -2
- package/dist/services/users/entities/user-acquisition.mjs +2 -3
- package/dist/services/users/entities/user-country.js +2 -2
- package/dist/services/users/entities/user-country.mjs +2 -3
- package/dist/services/users/entities/user-currency.js +2 -2
- package/dist/services/users/entities/user-currency.mjs +2 -3
- package/dist/services/users/entities/user-default-model.js +2 -2
- package/dist/services/users/entities/user-default-model.mjs +2 -3
- package/dist/services/users/entities/user-email.value-object.mjs +0 -1
- package/dist/services/users/entities/user-language.js +2 -2
- package/dist/services/users/entities/user-language.mjs +2 -3
- package/dist/services/users/entities/user-marketing.js +2 -2
- package/dist/services/users/entities/user-marketing.mjs +2 -3
- package/dist/services/users/entities/user-notification-preferences.mjs +0 -1
- package/dist/services/users/entities/user-password.value-object.mjs +0 -1
- package/dist/services/users/entities/user-permissions.mjs +0 -1
- package/dist/services/users/entities/user-preferences.mjs +0 -1
- package/dist/services/users/entities/user-report-preferences.mjs +0 -1
- package/dist/services/users/entities/user-report-schedule.mjs +0 -1
- package/dist/services/users/entities/user-timezone.js +2 -2
- package/dist/services/users/entities/user-timezone.mjs +2 -3
- package/dist/services/users/entities/user.entity.d.ts +1 -0
- package/dist/services/users/entities/user.entity.js +9 -22
- package/dist/services/users/entities/user.entity.mjs +9 -17
- package/dist/services/users/module.d.ts +2 -1
- package/dist/services/users/module.js +12 -7
- package/dist/services/users/module.mjs +11 -8
- package/dist/services/users/repositories/user.repository.d.ts +2 -0
- package/dist/services/users/repositories/user.repository.js +11 -20
- package/dist/services/users/repositories/user.repository.mjs +11 -15
- package/dist/services/users/use-cases/change-password.use-case.d.ts +15 -0
- package/dist/services/users/use-cases/change-password.use-case.js +52 -0
- package/dist/services/users/use-cases/change-password.use-case.mjs +28 -0
- package/dist/services/users/use-cases/create-user.use-case.d.ts +4 -6
- package/dist/services/users/use-cases/create-user.use-case.js +5 -19
- package/dist/services/users/use-cases/create-user.use-case.mjs +5 -14
- package/dist/services/users/use-cases/delete-user.use-case.d.ts +6 -6
- package/dist/services/users/use-cases/delete-user.use-case.js +8 -22
- package/dist/services/users/use-cases/delete-user.use-case.mjs +8 -17
- package/dist/services/users/use-cases/get-user-by-id.use-case.d.ts +4 -6
- package/dist/services/users/use-cases/get-user-by-id.use-case.js +6 -20
- package/dist/services/users/use-cases/get-user-by-id.use-case.mjs +6 -15
- package/dist/services/users/use-cases/list-users-by-props.use-case.d.ts +6 -6
- package/dist/services/users/use-cases/list-users-by-props.use-case.js +5 -19
- package/dist/services/users/use-cases/list-users-by-props.use-case.mjs +5 -14
- package/dist/services/users/use-cases/update-user.use-case.d.ts +4 -6
- package/dist/services/users/use-cases/update-user.use-case.js +9 -22
- package/dist/services/users/use-cases/update-user.use-case.mjs +9 -17
- package/dist/services/users/utils/default-model.mjs +0 -1
- package/dist/services/workspaces/entities/workspace-item.entity.mjs +0 -1
- package/dist/services/workspaces/module.d.ts +0 -1
- package/dist/services/workspaces/module.js +5 -7
- package/dist/services/workspaces/module.mjs +5 -8
- package/dist/services/workspaces/repositories/workspace-item.repository.js +5 -20
- package/dist/services/workspaces/repositories/workspace-item.repository.mjs +5 -15
- package/dist/services/workspaces/use-cases/delete-workspace-item.use-case.d.ts +6 -8
- package/dist/services/workspaces/use-cases/delete-workspace-item.use-case.js +7 -21
- package/dist/services/workspaces/use-cases/delete-workspace-item.use-case.mjs +7 -16
- package/dist/services/workspaces/use-cases/get-workspace-item.use-case.d.ts +4 -6
- package/dist/services/workspaces/use-cases/get-workspace-item.use-case.js +6 -20
- package/dist/services/workspaces/use-cases/get-workspace-item.use-case.mjs +6 -15
- package/dist/services/workspaces/use-cases/list-workspace-items.use-case.d.ts +6 -6
- package/dist/services/workspaces/use-cases/list-workspace-items.use-case.js +5 -19
- package/dist/services/workspaces/use-cases/list-workspace-items.use-case.mjs +5 -14
- package/dist/services/workspaces/use-cases/save-workspace-item.use-case.d.ts +4 -6
- package/dist/services/workspaces/use-cases/save-workspace-item.use-case.js +10 -24
- package/dist/services/workspaces/use-cases/save-workspace-item.use-case.mjs +10 -19
- package/dist/services/workspaces/use-cases/search-workspace-items.use-case.d.ts +6 -6
- package/dist/services/workspaces/use-cases/search-workspace-items.use-case.js +5 -19
- package/dist/services/workspaces/use-cases/search-workspace-items.use-case.mjs +5 -14
- package/dist/skills/call-modes.mjs +0 -1
- package/dist/skills/runtime-context.mjs +0 -1
- package/dist/skills/shared/shared-rules.mjs +0 -1
- package/dist/skills/skill.js +1 -2
- package/dist/skills/skill.mjs +1 -3
- package/dist/tools/core/call-ai/call-ai.skill.mjs +0 -1
- package/dist/tools/core/call-ai/call-ai.tool.mjs +0 -1
- package/dist/tools/core/slack/send-slack-message.tool.mjs +0 -1
- package/dist/tools/core/web-search/web-search.tool.mjs +0 -1
- package/dist/tools/tool.mjs +0 -1
- package/docs/authentication.md +95 -16
- package/docs/authorization.md +1 -1
- package/docs/automations.md +6 -5
- package/docs/chats.md +1 -1
- package/docs/configuration.md +1 -1
- package/docs/integration-guide.md +2 -2
- package/docs/mcp-servers.md +1 -1
- package/docs/usage.md +5 -5
- package/docs/users.md +1 -1
- package/examples/authentication/login.ts +1 -1
- package/examples/automations/create-automation.ts +1 -1
- package/examples/automations/create-event-automation.ts +2 -2
- package/examples/automations/list-automation-runs.ts +2 -2
- package/examples/automations/list-automations.ts +1 -1
- package/examples/automations/preview-automation-runs.ts +1 -1
- package/examples/automations/receive-automation-event.ts +1 -1
- package/examples/automations/revoke-automation-event-token.ts +2 -2
- package/examples/automations/update-automation.ts +2 -2
- package/examples/chats/get-chat-by-id.ts +2 -2
- package/examples/chats/list-autonomous-chats.ts +1 -1
- package/examples/chats/list-chats.ts +1 -1
- package/examples/mcps/decide-mcp.ts +3 -3
- package/examples/mcps/list-all-mcps.ts +1 -1
- package/examples/mcps/verify-mcp.ts +1 -1
- package/examples/usage/get-chat-usage.ts +2 -2
- package/examples/usage/get-message-usage.ts +2 -2
- package/examples/usage/get-usage-stats-by-range.ts +1 -1
- package/examples/usage/get-usage-stats.ts +3 -3
- package/examples/users/set-default-model.ts +1 -1
- package/package.json +2 -4
- package/dist/chunk-CF3WOMB3.mjs +0 -16
- package/dist/common/base/utils/delete-empty-fields.d.ts +0 -1
- package/dist/common/base/utils/delete-empty-fields.js +0 -66
- package/dist/common/base/utils/delete-empty-fields.mjs +0 -43
- package/dist/common/base/utils/flatten-object.d.ts +0 -1
- package/dist/common/base/utils/flatten-object.js +0 -45
- package/dist/common/base/utils/flatten-object.mjs +0 -22
- package/dist/common/decorators/index.d.ts +0 -1
- package/dist/common/decorators/index.mjs +0 -1
- package/dist/common/decorators/mask-in-logs/index.d.ts +0 -1
- package/dist/common/decorators/mask-in-logs/index.mjs +0 -1
- package/dist/common/decorators/mask-in-logs/mask-in-logs.d.ts +0 -2
- package/dist/common/decorators/mask-in-logs/mask-in-logs.js +0 -53
- package/dist/common/decorators/mask-in-logs/mask-in-logs.mjs +0 -29
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseUseCase, BaseUseCaseParams } from '../../../common/base/base.use-case.js';
|
|
2
|
+
import { RefreshTokenRepository } from '../repositories';
|
|
3
|
+
export interface Params extends BaseUseCaseParams {
|
|
4
|
+
userId: string;
|
|
5
|
+
now: Date;
|
|
6
|
+
exceptFamilyId?: string;
|
|
7
|
+
}
|
|
8
|
+
export type Output = void;
|
|
9
|
+
export declare class RevokeUserRefreshTokensUseCase extends BaseUseCase<Params, Output> {
|
|
10
|
+
private readonly refreshTokenRepository;
|
|
11
|
+
constructor(refreshTokenRepository?: RefreshTokenRepository);
|
|
12
|
+
execute(params: Params): Promise<Output>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 revoke_user_refresh_tokens_use_case_exports = {};
|
|
20
|
+
__export(revoke_user_refresh_tokens_use_case_exports, {
|
|
21
|
+
RevokeUserRefreshTokensUseCase: () => RevokeUserRefreshTokensUseCase
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(revoke_user_refresh_tokens_use_case_exports);
|
|
24
|
+
var import_base = require("../../../common/base/base.use-case.js");
|
|
25
|
+
var import_repositories = require("../../../common/repositories/index.js");
|
|
26
|
+
var import_repositories2 = require("../repositories");
|
|
27
|
+
class RevokeUserRefreshTokensUseCase extends import_base.BaseUseCase {
|
|
28
|
+
constructor(refreshTokenRepository = new import_repositories2.RefreshTokenRepository()) {
|
|
29
|
+
super();
|
|
30
|
+
this.refreshTokenRepository = refreshTokenRepository;
|
|
31
|
+
}
|
|
32
|
+
refreshTokenRepository;
|
|
33
|
+
async execute(params) {
|
|
34
|
+
await this.refreshTokenRepository.revokeUser(params.userId, params.now, params.scope ?? import_repositories.Scope.system("refresh tokens: every session of a user is revoked, also after a password reset without a session"), params.exceptFamilyId);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
RevokeUserRefreshTokensUseCase
|
|
40
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseUseCase } from "../../../common/base/base.use-case.js";
|
|
2
|
+
import { Scope } from "../../../common/repositories/index.js";
|
|
3
|
+
import { RefreshTokenRepository } from "../repositories";
|
|
4
|
+
class RevokeUserRefreshTokensUseCase extends BaseUseCase {
|
|
5
|
+
constructor(refreshTokenRepository = new RefreshTokenRepository()) {
|
|
6
|
+
super();
|
|
7
|
+
this.refreshTokenRepository = refreshTokenRepository;
|
|
8
|
+
}
|
|
9
|
+
refreshTokenRepository;
|
|
10
|
+
async execute(params) {
|
|
11
|
+
await this.refreshTokenRepository.revokeUser(params.userId, params.now, params.scope ?? Scope.system("refresh tokens: every session of a user is revoked, also after a password reset without a session"), params.exceptFamilyId);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
RevokeUserRefreshTokensUseCase
|
|
16
|
+
};
|
|
@@ -31,6 +31,7 @@ export declare class Automation extends BaseEntity {
|
|
|
31
31
|
lockedBy?: string | undefined;
|
|
32
32
|
lockedUntil?: Date | undefined;
|
|
33
33
|
activeRunId?: ObjectId | undefined;
|
|
34
|
+
clearedFields: Record<string, ''>;
|
|
34
35
|
static fromJSON(props: AutomationProps): Automation;
|
|
35
36
|
constructor(props: AutomationProps, name?: string | undefined, instructions?: string | undefined, triggers?: AutomationTriggers | undefined, eventTokenVersion?: number | undefined, modelProvider?: string | undefined, modelName?: string | undefined, lastRunAt?: Date | undefined, lastRunStatus?: AutomationRunStatus | undefined, lockedBy?: string | undefined, lockedUntil?: Date | undefined, activeRunId?: ObjectId | undefined);
|
|
36
37
|
toJSON(): AutomationProps;
|
|
@@ -63,6 +63,7 @@ class Automation extends import_base.BaseEntity {
|
|
|
63
63
|
lockedBy;
|
|
64
64
|
lockedUntil;
|
|
65
65
|
activeRunId;
|
|
66
|
+
clearedFields = {};
|
|
66
67
|
static fromJSON(props) {
|
|
67
68
|
return new Automation(
|
|
68
69
|
props,
|
|
@@ -103,7 +104,7 @@ class Automation extends import_base.BaseEntity {
|
|
|
103
104
|
schedule.nextRunAt = next;
|
|
104
105
|
} else {
|
|
105
106
|
delete schedule.nextRunAt;
|
|
106
|
-
this.
|
|
107
|
+
this.clearedFields["triggers.schedule.nextRunAt"] = "";
|
|
107
108
|
}
|
|
108
109
|
return this;
|
|
109
110
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "../../../chunk-CF3WOMB3.mjs";
|
|
2
1
|
import { BaseEntity } from "../../../common/base/base.entity.js";
|
|
3
2
|
import { computeNextRun } from "../utils/next-run";
|
|
4
3
|
const toDate = (value) => {
|
|
@@ -41,6 +40,7 @@ class Automation extends BaseEntity {
|
|
|
41
40
|
lockedBy;
|
|
42
41
|
lockedUntil;
|
|
43
42
|
activeRunId;
|
|
43
|
+
clearedFields = {};
|
|
44
44
|
static fromJSON(props) {
|
|
45
45
|
return new Automation(
|
|
46
46
|
props,
|
|
@@ -81,7 +81,7 @@ class Automation extends BaseEntity {
|
|
|
81
81
|
schedule.nextRunAt = next;
|
|
82
82
|
} else {
|
|
83
83
|
delete schedule.nextRunAt;
|
|
84
|
-
this.
|
|
84
|
+
this.clearedFields["triggers.schedule.nextRunAt"] = "";
|
|
85
85
|
}
|
|
86
86
|
return this;
|
|
87
87
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
1
|
import { Params as CParams, Output as COutput } from './use-cases/create-automation.use-case';
|
|
3
2
|
import { Params as UParams, Output as UOutput } from './use-cases/update-automation.use-case';
|
|
4
3
|
import { Params as GParams, Output as GOutput } from './use-cases/get-automation-by-id.use-case';
|
|
@@ -40,8 +40,6 @@ __export(module_exports, {
|
|
|
40
40
|
updateAutomation: () => updateAutomation
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(module_exports);
|
|
43
|
-
var import_reflect_metadata = require("reflect-metadata");
|
|
44
|
-
var import_tsyringe = require("tsyringe");
|
|
45
43
|
var import_create_automation = require("./use-cases/create-automation.use-case");
|
|
46
44
|
var import_update_automation = require("./use-cases/update-automation.use-case");
|
|
47
45
|
var import_get_automation_by_id = require("./use-cases/get-automation-by-id.use-case");
|
|
@@ -63,83 +61,83 @@ var import_rotate_automation_event_tokens = require("./use-cases/rotate-automati
|
|
|
63
61
|
var import_receive_automation_event = require("./use-cases/receive-automation-event.use-case");
|
|
64
62
|
var import_claim_queued_automation_runs = require("./use-cases/claim-queued-automation-runs.use-case");
|
|
65
63
|
async function createAutomation(props) {
|
|
66
|
-
const createAutomationUseCase =
|
|
64
|
+
const createAutomationUseCase = new import_create_automation.CreateAutomationUseCase();
|
|
67
65
|
return createAutomationUseCase.execute(props);
|
|
68
66
|
}
|
|
69
67
|
async function updateAutomation(props) {
|
|
70
|
-
const updateAutomationUseCase =
|
|
68
|
+
const updateAutomationUseCase = new import_update_automation.UpdateAutomationUseCase();
|
|
71
69
|
return updateAutomationUseCase.execute(props);
|
|
72
70
|
}
|
|
73
71
|
async function getAutomationById(props) {
|
|
74
|
-
const getAutomationByIdUseCase =
|
|
72
|
+
const getAutomationByIdUseCase = new import_get_automation_by_id.GetAutomationByIdUseCase();
|
|
75
73
|
return getAutomationByIdUseCase.execute(props);
|
|
76
74
|
}
|
|
77
75
|
async function listAutomationsByUser(props) {
|
|
78
|
-
const listAutomationsByUserUseCase =
|
|
76
|
+
const listAutomationsByUserUseCase = new import_list_automations_by_user.ListAutomationsByUserUseCase();
|
|
79
77
|
return listAutomationsByUserUseCase.execute(props);
|
|
80
78
|
}
|
|
81
79
|
async function deleteAutomation(props) {
|
|
82
|
-
const deleteAutomationUseCase =
|
|
80
|
+
const deleteAutomationUseCase = new import_delete_automation.DeleteAutomationUseCase();
|
|
83
81
|
return deleteAutomationUseCase.execute(props);
|
|
84
82
|
}
|
|
85
83
|
async function previewAutomationRuns(props) {
|
|
86
|
-
const previewAutomationRunsUseCase =
|
|
84
|
+
const previewAutomationRunsUseCase = new import_preview_automation_runs.PreviewAutomationRunsUseCase();
|
|
87
85
|
return previewAutomationRunsUseCase.execute(props);
|
|
88
86
|
}
|
|
89
87
|
async function listAutomationRunsByAutomation(props) {
|
|
90
|
-
const listAutomationRunsByAutomationUseCase =
|
|
88
|
+
const listAutomationRunsByAutomationUseCase = new import_list_automation_runs_by_automation.ListAutomationRunsByAutomationUseCase();
|
|
91
89
|
return listAutomationRunsByAutomationUseCase.execute(props);
|
|
92
90
|
}
|
|
93
91
|
async function listAutomationRunsByUser(props) {
|
|
94
|
-
const listAutomationRunsByUserUseCase =
|
|
92
|
+
const listAutomationRunsByUserUseCase = new import_list_automation_runs_by_user.ListAutomationRunsByUserUseCase();
|
|
95
93
|
return listAutomationRunsByUserUseCase.execute(props);
|
|
96
94
|
}
|
|
97
95
|
async function claimDueAutomations(props) {
|
|
98
|
-
const claimDueAutomationsUseCase =
|
|
96
|
+
const claimDueAutomationsUseCase = new import_claim_due_automations.ClaimDueAutomationsUseCase();
|
|
99
97
|
return claimDueAutomationsUseCase.execute(props);
|
|
100
98
|
}
|
|
101
99
|
async function startAutomationRun(props) {
|
|
102
|
-
const startAutomationRunUseCase =
|
|
100
|
+
const startAutomationRunUseCase = new import_start_automation_run.StartAutomationRunUseCase();
|
|
103
101
|
return startAutomationRunUseCase.execute(props);
|
|
104
102
|
}
|
|
105
103
|
async function finishAutomationRun(props) {
|
|
106
|
-
const finishAutomationRunUseCase =
|
|
104
|
+
const finishAutomationRunUseCase = new import_finish_automation_run.FinishAutomationRunUseCase();
|
|
107
105
|
return finishAutomationRunUseCase.execute(props);
|
|
108
106
|
}
|
|
109
107
|
async function syncAutomationRun(props) {
|
|
110
|
-
const syncAutomationRunUseCase =
|
|
108
|
+
const syncAutomationRunUseCase = new import_sync_automation_run.SyncAutomationRunUseCase();
|
|
111
109
|
return syncAutomationRunUseCase.execute(props);
|
|
112
110
|
}
|
|
113
111
|
async function syncAutomationRuns(props = {}) {
|
|
114
|
-
const syncAutomationRunsUseCase =
|
|
112
|
+
const syncAutomationRunsUseCase = new import_sync_automation_runs.SyncAutomationRunsUseCase();
|
|
115
113
|
return syncAutomationRunsUseCase.execute(props);
|
|
116
114
|
}
|
|
117
115
|
async function attachAutomationRunChat(props) {
|
|
118
|
-
const attachAutomationRunChatUseCase =
|
|
116
|
+
const attachAutomationRunChatUseCase = new import_attach_automation_run_chat.AttachAutomationRunChatUseCase();
|
|
119
117
|
return attachAutomationRunChatUseCase.execute(props);
|
|
120
118
|
}
|
|
121
119
|
async function renewAutomationLease(props) {
|
|
122
|
-
const renewAutomationLeaseUseCase =
|
|
120
|
+
const renewAutomationLeaseUseCase = new import_renew_automation_lease.RenewAutomationLeaseUseCase();
|
|
123
121
|
return renewAutomationLeaseUseCase.execute(props);
|
|
124
122
|
}
|
|
125
123
|
async function issueAutomationEventToken(props) {
|
|
126
|
-
const issueAutomationEventTokenUseCase =
|
|
124
|
+
const issueAutomationEventTokenUseCase = new import_issue_automation_event_token.IssueAutomationEventTokenUseCase();
|
|
127
125
|
return issueAutomationEventTokenUseCase.execute(props);
|
|
128
126
|
}
|
|
129
127
|
async function revokeAutomationEventToken(props) {
|
|
130
|
-
const revokeAutomationEventTokenUseCase =
|
|
128
|
+
const revokeAutomationEventTokenUseCase = new import_revoke_automation_event_token.RevokeAutomationEventTokenUseCase();
|
|
131
129
|
return revokeAutomationEventTokenUseCase.execute(props);
|
|
132
130
|
}
|
|
133
131
|
async function rotateAutomationEventTokens(props) {
|
|
134
|
-
const rotateAutomationEventTokensUseCase =
|
|
132
|
+
const rotateAutomationEventTokensUseCase = new import_rotate_automation_event_tokens.RotateAutomationEventTokensUseCase();
|
|
135
133
|
return rotateAutomationEventTokensUseCase.execute(props);
|
|
136
134
|
}
|
|
137
135
|
async function receiveAutomationEvent(props) {
|
|
138
|
-
const receiveAutomationEventUseCase =
|
|
136
|
+
const receiveAutomationEventUseCase = new import_receive_automation_event.ReceiveAutomationEventUseCase();
|
|
139
137
|
return receiveAutomationEventUseCase.execute(props);
|
|
140
138
|
}
|
|
141
139
|
async function claimQueuedAutomationRuns(props) {
|
|
142
|
-
const claimQueuedAutomationRunsUseCase =
|
|
140
|
+
const claimQueuedAutomationRunsUseCase = new import_claim_queued_automation_runs.ClaimQueuedAutomationRunsUseCase();
|
|
143
141
|
return claimQueuedAutomationRunsUseCase.execute(props);
|
|
144
142
|
}
|
|
145
143
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import "../../chunk-CF3WOMB3.mjs";
|
|
2
|
-
import "reflect-metadata";
|
|
3
|
-
import { container } from "tsyringe";
|
|
4
1
|
import { CreateAutomationUseCase } from "./use-cases/create-automation.use-case";
|
|
5
2
|
import { UpdateAutomationUseCase } from "./use-cases/update-automation.use-case";
|
|
6
3
|
import { GetAutomationByIdUseCase } from "./use-cases/get-automation-by-id.use-case";
|
|
@@ -22,83 +19,83 @@ import { RotateAutomationEventTokensUseCase } from "./use-cases/rotate-automatio
|
|
|
22
19
|
import { ReceiveAutomationEventUseCase } from "./use-cases/receive-automation-event.use-case";
|
|
23
20
|
import { ClaimQueuedAutomationRunsUseCase } from "./use-cases/claim-queued-automation-runs.use-case";
|
|
24
21
|
async function createAutomation(props) {
|
|
25
|
-
const createAutomationUseCase =
|
|
22
|
+
const createAutomationUseCase = new CreateAutomationUseCase();
|
|
26
23
|
return createAutomationUseCase.execute(props);
|
|
27
24
|
}
|
|
28
25
|
async function updateAutomation(props) {
|
|
29
|
-
const updateAutomationUseCase =
|
|
26
|
+
const updateAutomationUseCase = new UpdateAutomationUseCase();
|
|
30
27
|
return updateAutomationUseCase.execute(props);
|
|
31
28
|
}
|
|
32
29
|
async function getAutomationById(props) {
|
|
33
|
-
const getAutomationByIdUseCase =
|
|
30
|
+
const getAutomationByIdUseCase = new GetAutomationByIdUseCase();
|
|
34
31
|
return getAutomationByIdUseCase.execute(props);
|
|
35
32
|
}
|
|
36
33
|
async function listAutomationsByUser(props) {
|
|
37
|
-
const listAutomationsByUserUseCase =
|
|
34
|
+
const listAutomationsByUserUseCase = new ListAutomationsByUserUseCase();
|
|
38
35
|
return listAutomationsByUserUseCase.execute(props);
|
|
39
36
|
}
|
|
40
37
|
async function deleteAutomation(props) {
|
|
41
|
-
const deleteAutomationUseCase =
|
|
38
|
+
const deleteAutomationUseCase = new DeleteAutomationUseCase();
|
|
42
39
|
return deleteAutomationUseCase.execute(props);
|
|
43
40
|
}
|
|
44
41
|
async function previewAutomationRuns(props) {
|
|
45
|
-
const previewAutomationRunsUseCase =
|
|
42
|
+
const previewAutomationRunsUseCase = new PreviewAutomationRunsUseCase();
|
|
46
43
|
return previewAutomationRunsUseCase.execute(props);
|
|
47
44
|
}
|
|
48
45
|
async function listAutomationRunsByAutomation(props) {
|
|
49
|
-
const listAutomationRunsByAutomationUseCase =
|
|
46
|
+
const listAutomationRunsByAutomationUseCase = new ListAutomationRunsByAutomationUseCase();
|
|
50
47
|
return listAutomationRunsByAutomationUseCase.execute(props);
|
|
51
48
|
}
|
|
52
49
|
async function listAutomationRunsByUser(props) {
|
|
53
|
-
const listAutomationRunsByUserUseCase =
|
|
50
|
+
const listAutomationRunsByUserUseCase = new ListAutomationRunsByUserUseCase();
|
|
54
51
|
return listAutomationRunsByUserUseCase.execute(props);
|
|
55
52
|
}
|
|
56
53
|
async function claimDueAutomations(props) {
|
|
57
|
-
const claimDueAutomationsUseCase =
|
|
54
|
+
const claimDueAutomationsUseCase = new ClaimDueAutomationsUseCase();
|
|
58
55
|
return claimDueAutomationsUseCase.execute(props);
|
|
59
56
|
}
|
|
60
57
|
async function startAutomationRun(props) {
|
|
61
|
-
const startAutomationRunUseCase =
|
|
58
|
+
const startAutomationRunUseCase = new StartAutomationRunUseCase();
|
|
62
59
|
return startAutomationRunUseCase.execute(props);
|
|
63
60
|
}
|
|
64
61
|
async function finishAutomationRun(props) {
|
|
65
|
-
const finishAutomationRunUseCase =
|
|
62
|
+
const finishAutomationRunUseCase = new FinishAutomationRunUseCase();
|
|
66
63
|
return finishAutomationRunUseCase.execute(props);
|
|
67
64
|
}
|
|
68
65
|
async function syncAutomationRun(props) {
|
|
69
|
-
const syncAutomationRunUseCase =
|
|
66
|
+
const syncAutomationRunUseCase = new SyncAutomationRunUseCase();
|
|
70
67
|
return syncAutomationRunUseCase.execute(props);
|
|
71
68
|
}
|
|
72
69
|
async function syncAutomationRuns(props = {}) {
|
|
73
|
-
const syncAutomationRunsUseCase =
|
|
70
|
+
const syncAutomationRunsUseCase = new SyncAutomationRunsUseCase();
|
|
74
71
|
return syncAutomationRunsUseCase.execute(props);
|
|
75
72
|
}
|
|
76
73
|
async function attachAutomationRunChat(props) {
|
|
77
|
-
const attachAutomationRunChatUseCase =
|
|
74
|
+
const attachAutomationRunChatUseCase = new AttachAutomationRunChatUseCase();
|
|
78
75
|
return attachAutomationRunChatUseCase.execute(props);
|
|
79
76
|
}
|
|
80
77
|
async function renewAutomationLease(props) {
|
|
81
|
-
const renewAutomationLeaseUseCase =
|
|
78
|
+
const renewAutomationLeaseUseCase = new RenewAutomationLeaseUseCase();
|
|
82
79
|
return renewAutomationLeaseUseCase.execute(props);
|
|
83
80
|
}
|
|
84
81
|
async function issueAutomationEventToken(props) {
|
|
85
|
-
const issueAutomationEventTokenUseCase =
|
|
82
|
+
const issueAutomationEventTokenUseCase = new IssueAutomationEventTokenUseCase();
|
|
86
83
|
return issueAutomationEventTokenUseCase.execute(props);
|
|
87
84
|
}
|
|
88
85
|
async function revokeAutomationEventToken(props) {
|
|
89
|
-
const revokeAutomationEventTokenUseCase =
|
|
86
|
+
const revokeAutomationEventTokenUseCase = new RevokeAutomationEventTokenUseCase();
|
|
90
87
|
return revokeAutomationEventTokenUseCase.execute(props);
|
|
91
88
|
}
|
|
92
89
|
async function rotateAutomationEventTokens(props) {
|
|
93
|
-
const rotateAutomationEventTokensUseCase =
|
|
90
|
+
const rotateAutomationEventTokensUseCase = new RotateAutomationEventTokensUseCase();
|
|
94
91
|
return rotateAutomationEventTokensUseCase.execute(props);
|
|
95
92
|
}
|
|
96
93
|
async function receiveAutomationEvent(props) {
|
|
97
|
-
const receiveAutomationEventUseCase =
|
|
94
|
+
const receiveAutomationEventUseCase = new ReceiveAutomationEventUseCase();
|
|
98
95
|
return receiveAutomationEventUseCase.execute(props);
|
|
99
96
|
}
|
|
100
97
|
async function claimQueuedAutomationRuns(props) {
|
|
101
|
-
const claimQueuedAutomationRunsUseCase =
|
|
98
|
+
const claimQueuedAutomationRunsUseCase = new ClaimQueuedAutomationRunsUseCase();
|
|
102
99
|
return claimQueuedAutomationRunsUseCase.execute(props);
|
|
103
100
|
}
|
|
104
101
|
export {
|
|
@@ -16,40 +16,28 @@ 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 automation_run_repository_exports = {};
|
|
28
20
|
__export(automation_run_repository_exports, {
|
|
29
21
|
AutomationRunRepository: () => AutomationRunRepository
|
|
30
22
|
});
|
|
31
23
|
module.exports = __toCommonJS(automation_run_repository_exports);
|
|
32
|
-
var import_tsyringe = require("tsyringe");
|
|
33
24
|
var import_mongodb = require("mongodb");
|
|
25
|
+
var import_utils = require("../../../common/base/utils/index.js");
|
|
34
26
|
var import_repositories = require("../../../common/repositories/index.js");
|
|
35
27
|
var import_database_name = require("../../../common/utils/database-name.js");
|
|
36
|
-
|
|
28
|
+
class AutomationRunRepository {
|
|
37
29
|
_ = new import_repositories.MongoRepository({
|
|
38
30
|
database: (0, import_database_name.getDatabaseName)(),
|
|
39
31
|
collection: "automation_runs",
|
|
40
32
|
scoped: true
|
|
41
33
|
});
|
|
42
34
|
async create(run, scope) {
|
|
43
|
-
const { _id, ownerId, createdAt, createdBy } = await this._.createOne({ payload: run.
|
|
35
|
+
const { _id, ownerId, createdAt, createdBy } = await this._.createOne({ payload: run.toJSON(), scope });
|
|
44
36
|
Object.assign(run, { _id, ownerId, createdAt, createdBy });
|
|
45
37
|
return run;
|
|
46
38
|
}
|
|
47
39
|
async update(run, scope) {
|
|
48
|
-
return await this._.
|
|
49
|
-
scope,
|
|
50
|
-
where: { _id: run._id },
|
|
51
|
-
payload: run.toFlatDocument()
|
|
52
|
-
});
|
|
40
|
+
return await this._.patchOne({ scope, where: { _id: run._id }, ...(0, import_utils.entityPatch)(run) });
|
|
53
41
|
}
|
|
54
42
|
async findById(id, scope) {
|
|
55
43
|
return await this._.findOne({ scope, where: { _id: this._.parseId(id) } });
|
|
@@ -70,16 +58,13 @@ let AutomationRunRepository = class {
|
|
|
70
58
|
return await this._.count({ scope, where: { automationId: new import_mongodb.ObjectId(automationId), status: "queued" } });
|
|
71
59
|
}
|
|
72
60
|
async claimQueued(id, fields, scope) {
|
|
73
|
-
return await this._.
|
|
61
|
+
return await this._.patchOne({
|
|
74
62
|
scope,
|
|
75
63
|
where: { _id: this._.parseId(id), status: "queued" },
|
|
76
|
-
|
|
64
|
+
set: { ...fields, status: "running" }
|
|
77
65
|
});
|
|
78
66
|
}
|
|
79
|
-
}
|
|
80
|
-
AutomationRunRepository = __decorateClass([
|
|
81
|
-
(0, import_tsyringe.autoInjectable)()
|
|
82
|
-
], AutomationRunRepository);
|
|
67
|
+
}
|
|
83
68
|
// Annotate the CommonJS export names for ESM import in node:
|
|
84
69
|
0 && (module.exports = {
|
|
85
70
|
AutomationRunRepository
|
|
@@ -1,27 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__decorateClass
|
|
3
|
-
} from "../../../chunk-CF3WOMB3.mjs";
|
|
4
|
-
import { autoInjectable } from "tsyringe";
|
|
5
1
|
import { ObjectId } from "mongodb";
|
|
2
|
+
import { entityPatch } from "../../../common/base/utils/index.js";
|
|
6
3
|
import { MongoRepository } from "../../../common/repositories/index.js";
|
|
7
4
|
import { getDatabaseName } from "../../../common/utils/database-name.js";
|
|
8
|
-
|
|
5
|
+
class AutomationRunRepository {
|
|
9
6
|
_ = new MongoRepository({
|
|
10
7
|
database: getDatabaseName(),
|
|
11
8
|
collection: "automation_runs",
|
|
12
9
|
scoped: true
|
|
13
10
|
});
|
|
14
11
|
async create(run, scope) {
|
|
15
|
-
const { _id, ownerId, createdAt, createdBy } = await this._.createOne({ payload: run.
|
|
12
|
+
const { _id, ownerId, createdAt, createdBy } = await this._.createOne({ payload: run.toJSON(), scope });
|
|
16
13
|
Object.assign(run, { _id, ownerId, createdAt, createdBy });
|
|
17
14
|
return run;
|
|
18
15
|
}
|
|
19
16
|
async update(run, scope) {
|
|
20
|
-
return await this._.
|
|
21
|
-
scope,
|
|
22
|
-
where: { _id: run._id },
|
|
23
|
-
payload: run.toFlatDocument()
|
|
24
|
-
});
|
|
17
|
+
return await this._.patchOne({ scope, where: { _id: run._id }, ...entityPatch(run) });
|
|
25
18
|
}
|
|
26
19
|
async findById(id, scope) {
|
|
27
20
|
return await this._.findOne({ scope, where: { _id: this._.parseId(id) } });
|
|
@@ -42,16 +35,13 @@ let AutomationRunRepository = class {
|
|
|
42
35
|
return await this._.count({ scope, where: { automationId: new ObjectId(automationId), status: "queued" } });
|
|
43
36
|
}
|
|
44
37
|
async claimQueued(id, fields, scope) {
|
|
45
|
-
return await this._.
|
|
38
|
+
return await this._.patchOne({
|
|
46
39
|
scope,
|
|
47
40
|
where: { _id: this._.parseId(id), status: "queued" },
|
|
48
|
-
|
|
41
|
+
set: { ...fields, status: "running" }
|
|
49
42
|
});
|
|
50
43
|
}
|
|
51
|
-
}
|
|
52
|
-
AutomationRunRepository = __decorateClass([
|
|
53
|
-
autoInjectable()
|
|
54
|
-
], AutomationRunRepository);
|
|
44
|
+
}
|
|
55
45
|
export {
|
|
56
46
|
AutomationRunRepository
|
|
57
47
|
};
|
|
@@ -16,42 +16,29 @@ 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 automation_repository_exports = {};
|
|
28
20
|
__export(automation_repository_exports, {
|
|
29
21
|
AutomationRepository: () => AutomationRepository
|
|
30
22
|
});
|
|
31
23
|
module.exports = __toCommonJS(automation_repository_exports);
|
|
32
|
-
var import_tsyringe = require("tsyringe");
|
|
33
24
|
var import_mongodb = require("mongodb");
|
|
25
|
+
var import_utils = require("../../../common/base/utils/index.js");
|
|
34
26
|
var import_repositories = require("../../../common/repositories/index.js");
|
|
35
27
|
var import_database_name = require("../../../common/utils/database-name.js");
|
|
36
|
-
|
|
28
|
+
class AutomationRepository {
|
|
37
29
|
_ = new import_repositories.MongoRepository({
|
|
38
30
|
database: (0, import_database_name.getDatabaseName)(),
|
|
39
31
|
collection: "automations",
|
|
40
32
|
scoped: true
|
|
41
33
|
});
|
|
42
34
|
async create(automation, scope) {
|
|
43
|
-
const { _id, ownerId, createdAt, createdBy } = await this._.createOne({ payload: automation.
|
|
35
|
+
const { _id, ownerId, createdAt, createdBy } = await this._.createOne({ payload: automation.toJSON(), scope });
|
|
44
36
|
Object.assign(automation, { _id, ownerId, createdAt, createdBy });
|
|
45
37
|
return automation;
|
|
46
38
|
}
|
|
47
39
|
async update(automation, scope, options) {
|
|
48
40
|
if (options && typeof options.expectedVersion !== "number") throw new Error("[AutomationRepository] The expected version is required to check for conflicts");
|
|
49
|
-
return await this._.
|
|
50
|
-
scope,
|
|
51
|
-
where: { _id: automation._id },
|
|
52
|
-
payload: automation.toFlatDocument(),
|
|
53
|
-
expectedVersion: options?.expectedVersion
|
|
54
|
-
});
|
|
41
|
+
return await this._.patchOne({ scope, where: { _id: automation._id }, ...(0, import_utils.entityPatch)(automation), expectedVersion: options?.expectedVersion });
|
|
55
42
|
}
|
|
56
43
|
async findById(id, scope) {
|
|
57
44
|
return await this._.findOne({ scope, where: { _id: this._.parseId(id) } });
|
|
@@ -60,7 +47,7 @@ let AutomationRepository = class {
|
|
|
60
47
|
return await this._.findMany({ scope, where: { ownerId: new import_mongodb.ObjectId(ownerId) }, options });
|
|
61
48
|
}
|
|
62
49
|
async softDeleteById(id, scope) {
|
|
63
|
-
return await this._.softDelete({ scope, where: { _id: this._.parseId(id) },
|
|
50
|
+
return await this._.softDelete({ scope, where: { _id: this._.parseId(id) }, unset: { "triggers.schedule.nextRunAt": "" } });
|
|
64
51
|
}
|
|
65
52
|
async deleteById(id, scope) {
|
|
66
53
|
return await this._.deleteOne({ scope, where: { _id: this._.parseId(id) } });
|
|
@@ -74,65 +61,64 @@ let AutomationRepository = class {
|
|
|
74
61
|
}
|
|
75
62
|
async claim(params, scope) {
|
|
76
63
|
const { id, workerId, now, leaseMs, nextRunAt } = params;
|
|
77
|
-
return await this._.
|
|
64
|
+
return await this._.patchOne({
|
|
78
65
|
scope,
|
|
79
66
|
where: { _id: this._.parseId(id), "triggers.schedule.enabled": true, "triggers.schedule.nextRunAt": { $lte: now }, ...this.unlocked(now) },
|
|
80
|
-
|
|
67
|
+
set: {
|
|
81
68
|
lockedBy: workerId,
|
|
82
69
|
lockedUntil: new Date(now.getTime() + leaseMs),
|
|
83
|
-
...nextRunAt ? { "triggers.schedule.nextRunAt": nextRunAt } : {
|
|
84
|
-
}
|
|
70
|
+
...nextRunAt ? { "triggers.schedule.nextRunAt": nextRunAt } : {}
|
|
71
|
+
},
|
|
72
|
+
unset: nextRunAt ? {} : { "triggers.schedule.nextRunAt": "" }
|
|
85
73
|
});
|
|
86
74
|
}
|
|
87
75
|
async claimManual(params, scope) {
|
|
88
76
|
const { id, workerId, now, leaseMs } = params;
|
|
89
|
-
return await this._.
|
|
77
|
+
return await this._.patchOne({
|
|
90
78
|
scope,
|
|
91
79
|
where: { _id: this._.parseId(id), ...this.unlocked(now) },
|
|
92
|
-
|
|
80
|
+
set: { lockedBy: workerId, lockedUntil: new Date(now.getTime() + leaseMs) }
|
|
93
81
|
});
|
|
94
82
|
}
|
|
95
83
|
async setActiveRun(id, workerId, runId, scope) {
|
|
96
|
-
return await this._.
|
|
84
|
+
return await this._.patchOne({
|
|
97
85
|
scope,
|
|
98
86
|
where: { _id: this._.parseId(id), lockedBy: workerId },
|
|
99
|
-
|
|
87
|
+
set: { activeRunId: this._.parseId(runId) }
|
|
100
88
|
});
|
|
101
89
|
}
|
|
102
90
|
async settleRun(id, runId, status, at, scope) {
|
|
103
|
-
return await this._.
|
|
91
|
+
return await this._.patchOne({
|
|
104
92
|
scope,
|
|
105
93
|
where: { _id: this._.parseId(id), activeRunId: this._.parseId(runId) },
|
|
106
|
-
|
|
94
|
+
set: { lastRunStatus: status, lastRunAt: at },
|
|
95
|
+
unset: { activeRunId: "" }
|
|
107
96
|
});
|
|
108
97
|
}
|
|
109
98
|
async renewLease(id, workerId, until, scope) {
|
|
110
|
-
return await this._.
|
|
99
|
+
return await this._.patchOne({
|
|
111
100
|
scope,
|
|
112
101
|
where: { _id: this._.parseId(id), lockedBy: workerId },
|
|
113
|
-
|
|
102
|
+
set: { lockedUntil: until }
|
|
114
103
|
});
|
|
115
104
|
}
|
|
116
105
|
async release(id, workerId, result, scope) {
|
|
117
106
|
const { activeRunId, lastRunAt, lastRunStatus } = result;
|
|
118
|
-
return await this._.
|
|
107
|
+
return await this._.patchOne({
|
|
119
108
|
scope,
|
|
120
109
|
where: { _id: this._.parseId(id), lockedBy: workerId },
|
|
121
|
-
|
|
110
|
+
set: {
|
|
122
111
|
...lastRunAt ? { lastRunAt } : {},
|
|
123
112
|
...lastRunStatus ? { lastRunStatus } : {},
|
|
124
|
-
...activeRunId ? { activeRunId } : {}
|
|
125
|
-
|
|
126
|
-
}
|
|
113
|
+
...activeRunId ? { activeRunId } : {}
|
|
114
|
+
},
|
|
115
|
+
unset: { lockedBy: "", lockedUntil: "", ...activeRunId ? {} : { activeRunId: "" } }
|
|
127
116
|
});
|
|
128
117
|
}
|
|
129
118
|
unlocked(now) {
|
|
130
119
|
return { $or: [{ lockedUntil: { $exists: false } }, { lockedUntil: null }, { lockedUntil: { $lte: now } }] };
|
|
131
120
|
}
|
|
132
|
-
}
|
|
133
|
-
AutomationRepository = __decorateClass([
|
|
134
|
-
(0, import_tsyringe.autoInjectable)()
|
|
135
|
-
], AutomationRepository);
|
|
121
|
+
}
|
|
136
122
|
// Annotate the CommonJS export names for ESM import in node:
|
|
137
123
|
0 && (module.exports = {
|
|
138
124
|
AutomationRepository
|