openloops 0.3.5 → 0.4.1
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 +34 -0
- package/README.md +10 -8
- package/dist/common/repositories/mongo-db.repository.d.ts +6 -1
- package/dist/common/repositories/mongo-db.repository.js +13 -5
- package/dist/common/repositories/mongo-db.repository.mjs +13 -5
- package/dist/db/index.d.ts +1 -0
- package/dist/db/index.js +3 -1
- package/dist/db/index.mjs +1 -0
- package/dist/db/indexes/automation-runs.d.ts +2 -0
- package/dist/db/indexes/automation-runs.js +33 -0
- package/dist/db/indexes/automation-runs.mjs +10 -0
- package/dist/db/indexes/automations.d.ts +2 -0
- package/dist/db/indexes/{agentic-jobs.js → automations.js} +6 -6
- package/dist/db/indexes/{agentic-jobs.mjs → automations.mjs} +2 -2
- package/dist/db/indexes/index.js +6 -4
- package/dist/db/indexes/index.mjs +6 -4
- package/dist/db/indexes/revoked-tokens.d.ts +2 -0
- package/dist/db/indexes/{agentic-job-runs.js → revoked-tokens.js} +8 -9
- package/dist/db/indexes/revoked-tokens.mjs +8 -0
- package/dist/db/migrations/automations.d.ts +12 -0
- package/dist/db/migrations/automations.js +70 -0
- package/dist/db/migrations/automations.mjs +47 -0
- package/dist/services/authentication/entities/index.d.ts +1 -0
- package/dist/services/authentication/entities/index.js +22 -0
- package/dist/services/authentication/entities/index.mjs +1 -0
- package/dist/services/authentication/entities/revoked-token.entity.d.ts +17 -0
- package/dist/services/authentication/entities/revoked-token.entity.js +67 -0
- package/dist/services/authentication/entities/revoked-token.entity.mjs +44 -0
- package/dist/services/authentication/index.d.ts +1 -0
- package/dist/services/authentication/index.js +3 -1
- package/dist/services/authentication/index.mjs +1 -0
- package/dist/services/authentication/module.d.ts +4 -0
- package/dist/services/authentication/module.js +16 -2
- package/dist/services/authentication/module.mjs +13 -1
- package/dist/services/authentication/repositories/index.d.ts +1 -0
- package/dist/services/{agentic-jobs → authentication}/repositories/index.js +2 -4
- package/dist/services/authentication/repositories/index.mjs +1 -0
- package/dist/services/authentication/repositories/revoked-token.repository.d.ts +7 -0
- package/dist/services/authentication/repositories/revoked-token.repository.js +55 -0
- package/dist/services/authentication/repositories/revoked-token.repository.mjs +26 -0
- package/dist/services/authentication/use-cases/is-token-revoked.use-case.d.ts +15 -0
- package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-job.use-case.js → authentication/use-cases/is-token-revoked.use-case.js} +16 -18
- package/dist/services/authentication/use-cases/is-token-revoked.use-case.mjs +26 -0
- package/dist/services/authentication/use-cases/revoke-token.use-case.d.ts +14 -0
- package/dist/services/authentication/use-cases/revoke-token.use-case.js +65 -0
- package/dist/services/authentication/use-cases/revoke-token.use-case.mjs +36 -0
- package/dist/services/automations/entities/automation-run.entity.d.ts +46 -0
- package/dist/services/{agentic-jobs/entities/agentic-job-run.entity.js → automations/entities/automation-run.entity.js} +22 -14
- package/dist/services/{agentic-jobs/entities/agentic-job-run.entity.mjs → automations/entities/automation-run.entity.mjs} +18 -10
- package/dist/services/automations/entities/automation.entity.d.ts +38 -0
- package/dist/services/{agentic-jobs/entities/agentic-job.entity.js → automations/entities/automation.entity.js} +17 -17
- package/dist/services/{agentic-jobs/entities/agentic-job.entity.mjs → automations/entities/automation.entity.mjs} +13 -13
- package/dist/services/automations/entities/index.d.ts +4 -0
- package/dist/services/{agentic-jobs → automations}/entities/index.js +6 -4
- package/dist/services/automations/entities/index.mjs +4 -0
- package/dist/services/automations/entities/trigger.d.ts +11 -0
- package/dist/services/automations/entities/trigger.js +49 -0
- package/dist/services/automations/entities/trigger.mjs +26 -0
- package/dist/services/automations/index.d.ts +5 -0
- package/dist/services/{agentic-jobs → automations}/index.js +9 -7
- package/dist/services/automations/index.mjs +5 -0
- package/dist/services/automations/module.d.ts +41 -0
- package/dist/services/automations/module.js +167 -0
- package/dist/services/automations/module.mjs +125 -0
- package/dist/services/automations/repositories/automation-run.repository.d.ts +14 -0
- package/dist/services/{agentic-jobs/repositories/agentic-job-run.repository.js → automations/repositories/automation-run.repository.js} +23 -11
- package/dist/services/{agentic-jobs/repositories/agentic-job-run.repository.mjs → automations/repositories/automation-run.repository.mjs} +19 -7
- package/dist/services/automations/repositories/automation.repository.d.ts +27 -0
- package/dist/services/{agentic-jobs/repositories/agentic-job.repository.js → automations/repositories/automation.repository.js} +17 -17
- package/dist/services/{agentic-jobs/repositories/agentic-job.repository.mjs → automations/repositories/automation.repository.mjs} +13 -13
- package/dist/services/automations/repositories/index.d.ts +2 -0
- package/dist/services/automations/repositories/index.js +24 -0
- package/dist/services/automations/repositories/index.mjs +2 -0
- package/dist/services/automations/runner/automation-runner.d.ts +49 -0
- package/dist/services/{agentic-jobs/runner/agentic-job-runner.js → automations/runner/automation-runner.js} +55 -45
- package/dist/services/{agentic-jobs/runner/agentic-job-runner.mjs → automations/runner/automation-runner.mjs} +50 -40
- package/dist/services/{agentic-jobs/use-cases/attach-agentic-job-run-chat.use-case.d.ts → automations/use-cases/attach-automation-run-chat.use-case.d.ts} +6 -6
- package/dist/services/{agentic-jobs/use-cases/attach-agentic-job-run-chat.use-case.js → automations/use-cases/attach-automation-run-chat.use-case.js} +14 -14
- package/dist/services/automations/use-cases/attach-automation-run-chat.use-case.mjs +29 -0
- package/dist/services/automations/use-cases/claim-due-automations.use-case.d.ts +28 -0
- package/dist/services/{agentic-jobs/use-cases/claim-due-agentic-jobs.use-case.js → automations/use-cases/claim-due-automations.use-case.js} +32 -43
- package/dist/services/automations/use-cases/claim-due-automations.use-case.mjs +70 -0
- package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.d.ts +27 -0
- package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.js +106 -0
- package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.mjs +77 -0
- package/dist/services/automations/use-cases/create-automation.use-case.d.ts +14 -0
- package/dist/services/{agentic-jobs/use-cases/create-agentic-job.use-case.js → automations/use-cases/create-automation.use-case.js} +24 -25
- package/dist/services/automations/use-cases/create-automation.use-case.mjs +43 -0
- package/dist/services/{agentic-jobs/use-cases/delete-agentic-job.use-case.d.ts → automations/use-cases/delete-automation.use-case.d.ts} +6 -6
- package/dist/services/{agentic-jobs/use-cases/delete-agentic-job.use-case.js → automations/use-cases/delete-automation.use-case.js} +17 -17
- package/dist/services/automations/use-cases/delete-automation.use-case.mjs +36 -0
- package/dist/services/{agentic-jobs/use-cases/finish-agentic-job-run.use-case.d.ts → automations/use-cases/finish-automation-run.use-case.d.ts} +8 -8
- package/dist/services/{agentic-jobs/use-cases/finish-agentic-job-run.use-case.js → automations/use-cases/finish-automation-run.use-case.js} +20 -20
- package/dist/services/automations/use-cases/finish-automation-run.use-case.mjs +46 -0
- package/dist/services/{agentic-jobs/use-cases/get-agentic-job-by-id.use-case.d.ts → automations/use-cases/get-automation-by-id.use-case.d.ts} +6 -6
- package/dist/services/{agentic-jobs/use-cases/get-agentic-job-by-id.use-case.js → automations/use-cases/get-automation-by-id.use-case.js} +13 -13
- package/dist/services/automations/use-cases/get-automation-by-id.use-case.mjs +26 -0
- package/dist/services/automations/use-cases/issue-automation-event-token.use-case.d.ts +17 -0
- package/dist/services/automations/use-cases/issue-automation-event-token.use-case.js +59 -0
- package/dist/services/automations/use-cases/issue-automation-event-token.use-case.mjs +30 -0
- package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.d.ts +17 -0
- package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.js +61 -0
- package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.mjs +32 -0
- package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-user.use-case.d.ts → automations/use-cases/list-automation-runs-by-user.use-case.d.ts} +8 -7
- package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-user.use-case.js → automations/use-cases/list-automation-runs-by-user.use-case.js} +19 -15
- package/dist/services/automations/use-cases/list-automation-runs-by-user.use-case.mjs +32 -0
- package/dist/services/{agentic-jobs/use-cases/list-agentic-jobs-by-user.use-case.d.ts → automations/use-cases/list-automations-by-user.use-case.d.ts} +7 -6
- package/dist/services/{agentic-jobs/use-cases/list-agentic-jobs-by-user.use-case.js → automations/use-cases/list-automations-by-user.use-case.js} +19 -15
- package/dist/services/automations/use-cases/list-automations-by-user.use-case.mjs +32 -0
- package/dist/services/{agentic-jobs/use-cases/preview-agentic-job-runs.use-case.d.ts → automations/use-cases/preview-automation-runs.use-case.d.ts} +1 -1
- package/dist/services/{agentic-jobs/use-cases/preview-agentic-job-runs.use-case.js → automations/use-cases/preview-automation-runs.use-case.js} +8 -8
- package/dist/services/{agentic-jobs/use-cases/preview-agentic-job-runs.use-case.mjs → automations/use-cases/preview-automation-runs.use-case.mjs} +4 -4
- package/dist/services/automations/use-cases/receive-automation-event.use-case.d.ts +23 -0
- package/dist/services/automations/use-cases/receive-automation-event.use-case.js +97 -0
- package/dist/services/automations/use-cases/receive-automation-event.use-case.mjs +68 -0
- package/dist/services/{agentic-jobs/use-cases/renew-agentic-job-lease.use-case.d.ts → automations/use-cases/renew-automation-lease.use-case.d.ts} +5 -5
- package/dist/services/{agentic-jobs/use-cases/renew-agentic-job-lease.use-case.js → automations/use-cases/renew-automation-lease.use-case.js} +15 -15
- package/dist/services/automations/use-cases/renew-automation-lease.use-case.mjs +29 -0
- package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.d.ts +16 -0
- package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.js +65 -0
- package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.mjs +36 -0
- package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.d.ts +14 -0
- package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.js +63 -0
- package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.mjs +34 -0
- package/dist/services/automations/use-cases/start-automation-run.use-case.d.ts +21 -0
- package/dist/services/{agentic-jobs/use-cases/start-agentic-job-run.use-case.js → automations/use-cases/start-automation-run.use-case.js} +24 -24
- package/dist/services/automations/use-cases/start-automation-run.use-case.mjs +38 -0
- package/dist/services/automations/use-cases/sync-automation-run.use-case.d.ts +20 -0
- package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-run.use-case.js → automations/use-cases/sync-automation-run.use-case.js} +23 -23
- package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-run.use-case.mjs → automations/use-cases/sync-automation-run.use-case.mjs} +21 -21
- package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-runs.use-case.d.ts → automations/use-cases/sync-automation-runs.use-case.d.ts} +5 -5
- package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-runs.use-case.js → automations/use-cases/sync-automation-runs.use-case.js} +16 -16
- package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-runs.use-case.mjs → automations/use-cases/sync-automation-runs.use-case.mjs} +13 -13
- package/dist/services/automations/use-cases/update-automation.use-case.d.ts +15 -0
- package/dist/services/{agentic-jobs/use-cases/update-agentic-job.use-case.js → automations/use-cases/update-automation.use-case.js} +27 -27
- package/dist/services/automations/use-cases/update-automation.use-case.mjs +54 -0
- package/dist/services/automations/utils/automation-event-error.d.ts +6 -0
- package/dist/services/automations/utils/automation-event-error.js +37 -0
- package/dist/services/automations/utils/automation-event-error.mjs +14 -0
- package/dist/services/automations/utils/automation-fields.d.ts +14 -0
- package/dist/services/{agentic-jobs/utils/job-fields.js → automations/utils/automation-fields.js} +8 -10
- package/dist/services/{agentic-jobs/utils/job-fields.mjs → automations/utils/automation-fields.mjs} +4 -6
- package/dist/services/automations/utils/event-message.d.ts +1 -0
- package/dist/services/automations/utils/event-message.js +37 -0
- package/dist/services/automations/utils/event-message.mjs +14 -0
- package/dist/services/automations/utils/event-token.d.ts +18 -0
- package/dist/services/automations/utils/event-token.js +78 -0
- package/dist/services/automations/utils/event-token.mjs +43 -0
- package/dist/services/automations/utils/open-run.d.ts +14 -0
- package/dist/services/{agentic-jobs → automations}/utils/open-run.js +10 -8
- package/dist/services/automations/utils/open-run.mjs +26 -0
- package/dist/services/automations/utils/previous-run.d.ts +4 -0
- package/dist/services/automations/utils/previous-run.js +42 -0
- package/dist/services/automations/utils/previous-run.mjs +19 -0
- package/dist/services/{agentic-jobs → automations}/utils/settings.d.ts +1 -0
- package/dist/services/{agentic-jobs → automations}/utils/settings.js +6 -2
- package/dist/services/automations/utils/settings.mjs +13 -0
- package/dist/services/chats/use-cases/list-chats-by-user.use-case.d.ts +1 -0
- package/dist/services/chats/use-cases/list-chats-by-user.use-case.js +2 -2
- package/dist/services/chats/use-cases/list-chats-by-user.use-case.mjs +2 -2
- package/dist/services/mcp-servers/use-cases/list-mcpservers-by-user.use-case.d.ts +1 -0
- package/dist/services/mcp-servers/use-cases/list-mcpservers-by-user.use-case.js +2 -2
- package/dist/services/mcp-servers/use-cases/list-mcpservers-by-user.use-case.mjs +2 -2
- package/docs/README.md +1 -1
- package/docs/agent.md +2 -2
- package/docs/authentication.md +18 -1
- package/docs/automations.md +388 -0
- package/docs/chats.md +1 -1
- package/docs/configuration.md +6 -5
- package/docs/harness.md +1 -1
- package/docs/integration-guide.md +22 -18
- package/docs/llms.txt +1 -1
- package/docs/mcp-servers.md +1 -1
- package/examples/{agentic-jobs/create-agentic-job.ts → automations/create-automation.ts} +10 -7
- package/examples/automations/create-event-automation.ts +24 -0
- package/examples/{agentic-jobs/list-agentic-job-runs.ts → automations/list-automation-runs.ts} +8 -8
- package/examples/automations/list-automations.ts +25 -0
- package/examples/{agentic-jobs/preview-agentic-job-runs.ts → automations/preview-automation-runs.ts} +2 -2
- package/examples/automations/receive-automation-event.ts +26 -0
- package/examples/automations/revoke-automation-event-token.ts +25 -0
- package/examples/{agentic-jobs/run-agentic-job-now.ts → automations/run-automation-now.ts} +3 -3
- package/examples/{agentic-jobs/run-agentic-job-worker.ts → automations/run-automation-worker.ts} +6 -6
- package/examples/{agentic-jobs/update-agentic-job.ts → automations/update-automation.ts} +10 -10
- package/package.json +16 -14
- package/dist/db/indexes/agentic-job-runs.d.ts +0 -2
- package/dist/db/indexes/agentic-job-runs.mjs +0 -9
- package/dist/db/indexes/agentic-jobs.d.ts +0 -2
- package/dist/services/agentic-jobs/entities/agentic-job-run.entity.d.ts +0 -42
- package/dist/services/agentic-jobs/entities/agentic-job.entity.d.ts +0 -39
- package/dist/services/agentic-jobs/entities/index.d.ts +0 -3
- package/dist/services/agentic-jobs/entities/index.mjs +0 -3
- package/dist/services/agentic-jobs/index.d.ts +0 -4
- package/dist/services/agentic-jobs/index.mjs +0 -4
- package/dist/services/agentic-jobs/module.d.ts +0 -31
- package/dist/services/agentic-jobs/module.js +0 -132
- package/dist/services/agentic-jobs/module.mjs +0 -95
- package/dist/services/agentic-jobs/repositories/agentic-job-run.repository.d.ts +0 -11
- package/dist/services/agentic-jobs/repositories/agentic-job.repository.d.ts +0 -27
- package/dist/services/agentic-jobs/repositories/index.d.ts +0 -2
- package/dist/services/agentic-jobs/repositories/index.mjs +0 -2
- package/dist/services/agentic-jobs/runner/agentic-job-runner.d.ts +0 -48
- package/dist/services/agentic-jobs/use-cases/attach-agentic-job-run-chat.use-case.mjs +0 -29
- package/dist/services/agentic-jobs/use-cases/claim-due-agentic-jobs.use-case.d.ts +0 -29
- package/dist/services/agentic-jobs/use-cases/claim-due-agentic-jobs.use-case.mjs +0 -81
- package/dist/services/agentic-jobs/use-cases/create-agentic-job.use-case.d.ts +0 -14
- package/dist/services/agentic-jobs/use-cases/create-agentic-job.use-case.mjs +0 -44
- package/dist/services/agentic-jobs/use-cases/delete-agentic-job.use-case.mjs +0 -36
- package/dist/services/agentic-jobs/use-cases/finish-agentic-job-run.use-case.mjs +0 -46
- package/dist/services/agentic-jobs/use-cases/get-agentic-job-by-id.use-case.mjs +0 -26
- package/dist/services/agentic-jobs/use-cases/list-agentic-job-runs-by-job.use-case.d.ts +0 -16
- package/dist/services/agentic-jobs/use-cases/list-agentic-job-runs-by-job.use-case.mjs +0 -28
- package/dist/services/agentic-jobs/use-cases/list-agentic-job-runs-by-user.use-case.mjs +0 -28
- package/dist/services/agentic-jobs/use-cases/list-agentic-jobs-by-user.use-case.mjs +0 -28
- package/dist/services/agentic-jobs/use-cases/renew-agentic-job-lease.use-case.mjs +0 -29
- package/dist/services/agentic-jobs/use-cases/start-agentic-job-run.use-case.d.ts +0 -21
- package/dist/services/agentic-jobs/use-cases/start-agentic-job-run.use-case.mjs +0 -38
- package/dist/services/agentic-jobs/use-cases/sync-agentic-job-run.use-case.d.ts +0 -20
- package/dist/services/agentic-jobs/use-cases/update-agentic-job.use-case.d.ts +0 -15
- package/dist/services/agentic-jobs/use-cases/update-agentic-job.use-case.mjs +0 -54
- package/dist/services/agentic-jobs/utils/job-fields.d.ts +0 -14
- package/dist/services/agentic-jobs/utils/open-run.d.ts +0 -12
- package/dist/services/agentic-jobs/utils/open-run.mjs +0 -24
- package/dist/services/agentic-jobs/utils/settings.mjs +0 -10
- package/docs/agentic-jobs.md +0 -217
- package/examples/agentic-jobs/list-agentic-jobs.ts +0 -25
- /package/dist/services/{agentic-jobs → automations}/entities/recurrence.d.ts +0 -0
- /package/dist/services/{agentic-jobs → automations}/entities/recurrence.js +0 -0
- /package/dist/services/{agentic-jobs → automations}/entities/recurrence.mjs +0 -0
- /package/dist/services/{agentic-jobs → automations}/utils/next-run.d.ts +0 -0
- /package/dist/services/{agentic-jobs → automations}/utils/next-run.js +0 -0
- /package/dist/services/{agentic-jobs → automations}/utils/next-run.mjs +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import "../../../chunk-CF3WOMB3.mjs";
|
|
2
|
+
import { BaseEntity } from "../../../common/base/base.entity.js";
|
|
3
|
+
const toDate = (value) => {
|
|
4
|
+
if (!value) return void 0;
|
|
5
|
+
const date = new Date(value);
|
|
6
|
+
if (Number.isNaN(date.getTime())) throw new Error("{{value_must_be_a_date}}");
|
|
7
|
+
return date;
|
|
8
|
+
};
|
|
9
|
+
class RevokedToken extends BaseEntity {
|
|
10
|
+
constructor(props, jti, audience, subject, expiresAt) {
|
|
11
|
+
super(props);
|
|
12
|
+
this.props = props;
|
|
13
|
+
this.jti = jti;
|
|
14
|
+
this.audience = audience;
|
|
15
|
+
this.subject = subject;
|
|
16
|
+
this.expiresAt = expiresAt;
|
|
17
|
+
}
|
|
18
|
+
props;
|
|
19
|
+
jti;
|
|
20
|
+
audience;
|
|
21
|
+
subject;
|
|
22
|
+
expiresAt;
|
|
23
|
+
static fromJSON(props) {
|
|
24
|
+
return new RevokedToken(
|
|
25
|
+
props,
|
|
26
|
+
props.jti || void 0,
|
|
27
|
+
props.audience || void 0,
|
|
28
|
+
props.subject || void 0,
|
|
29
|
+
toDate(props.expiresAt)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
toJSON() {
|
|
33
|
+
return {
|
|
34
|
+
...super.toJSON(),
|
|
35
|
+
jti: this.jti,
|
|
36
|
+
audience: this.audience,
|
|
37
|
+
subject: this.subject,
|
|
38
|
+
expiresAt: this.expiresAt
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
RevokedToken
|
|
44
|
+
};
|
|
@@ -16,7 +16,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
var authentication_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(authentication_exports);
|
|
18
18
|
__reExport(authentication_exports, require("./module"), module.exports);
|
|
19
|
+
__reExport(authentication_exports, require("./entities"), module.exports);
|
|
19
20
|
// Annotate the CommonJS export names for ESM import in node:
|
|
20
21
|
0 && (module.exports = {
|
|
21
|
-
...require("./module")
|
|
22
|
+
...require("./module"),
|
|
23
|
+
...require("./entities")
|
|
22
24
|
});
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { Params as LParams, Output as LOutput } from './use-cases/login.use-case';
|
|
3
|
+
import { Params as RParams, Output as ROutput } from './use-cases/revoke-token.use-case';
|
|
4
|
+
import { Params as IParams, Output as IOutput } from './use-cases/is-token-revoked.use-case';
|
|
3
5
|
export declare function login(props: LParams): Promise<LOutput>;
|
|
6
|
+
export declare function revokeToken(props: RParams): Promise<ROutput>;
|
|
7
|
+
export declare function isTokenRevoked(props: IParams): Promise<IOutput>;
|
|
@@ -18,17 +18,31 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var module_exports = {};
|
|
20
20
|
__export(module_exports, {
|
|
21
|
-
|
|
21
|
+
isTokenRevoked: () => isTokenRevoked,
|
|
22
|
+
login: () => login,
|
|
23
|
+
revokeToken: () => revokeToken
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(module_exports);
|
|
24
26
|
var import_reflect_metadata = require("reflect-metadata");
|
|
25
27
|
var import_tsyringe = require("tsyringe");
|
|
26
28
|
var import_login = require("./use-cases/login.use-case");
|
|
29
|
+
var import_revoke_token = require("./use-cases/revoke-token.use-case");
|
|
30
|
+
var import_is_token_revoked = require("./use-cases/is-token-revoked.use-case");
|
|
27
31
|
async function login(props) {
|
|
28
32
|
const loginUseCase = import_tsyringe.container.resolve(import_login.LoginUseCase);
|
|
29
33
|
return loginUseCase.execute(props);
|
|
30
34
|
}
|
|
35
|
+
async function revokeToken(props) {
|
|
36
|
+
const revokeTokenUseCase = import_tsyringe.container.resolve(import_revoke_token.RevokeTokenUseCase);
|
|
37
|
+
return revokeTokenUseCase.execute(props);
|
|
38
|
+
}
|
|
39
|
+
async function isTokenRevoked(props) {
|
|
40
|
+
const isTokenRevokedUseCase = import_tsyringe.container.resolve(import_is_token_revoked.IsTokenRevokedUseCase);
|
|
41
|
+
return isTokenRevokedUseCase.execute(props);
|
|
42
|
+
}
|
|
31
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
44
|
0 && (module.exports = {
|
|
33
|
-
|
|
45
|
+
isTokenRevoked,
|
|
46
|
+
login,
|
|
47
|
+
revokeToken
|
|
34
48
|
});
|
|
@@ -2,10 +2,22 @@ import "../../chunk-CF3WOMB3.mjs";
|
|
|
2
2
|
import "reflect-metadata";
|
|
3
3
|
import { container } from "tsyringe";
|
|
4
4
|
import { LoginUseCase } from "./use-cases/login.use-case";
|
|
5
|
+
import { RevokeTokenUseCase } from "./use-cases/revoke-token.use-case";
|
|
6
|
+
import { IsTokenRevokedUseCase } from "./use-cases/is-token-revoked.use-case";
|
|
5
7
|
async function login(props) {
|
|
6
8
|
const loginUseCase = container.resolve(LoginUseCase);
|
|
7
9
|
return loginUseCase.execute(props);
|
|
8
10
|
}
|
|
11
|
+
async function revokeToken(props) {
|
|
12
|
+
const revokeTokenUseCase = container.resolve(RevokeTokenUseCase);
|
|
13
|
+
return revokeTokenUseCase.execute(props);
|
|
14
|
+
}
|
|
15
|
+
async function isTokenRevoked(props) {
|
|
16
|
+
const isTokenRevokedUseCase = container.resolve(IsTokenRevokedUseCase);
|
|
17
|
+
return isTokenRevokedUseCase.execute(props);
|
|
18
|
+
}
|
|
9
19
|
export {
|
|
10
|
-
|
|
20
|
+
isTokenRevoked,
|
|
21
|
+
login,
|
|
22
|
+
revokeToken
|
|
11
23
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './revoked-token.repository';
|
|
@@ -15,10 +15,8 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
15
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
16
|
var repositories_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(repositories_exports);
|
|
18
|
-
__reExport(repositories_exports, require("./
|
|
19
|
-
__reExport(repositories_exports, require("./agentic-job-run.repository"), module.exports);
|
|
18
|
+
__reExport(repositories_exports, require("./revoked-token.repository"), module.exports);
|
|
20
19
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21
20
|
0 && (module.exports = {
|
|
22
|
-
...require("./
|
|
23
|
-
...require("./agentic-job-run.repository")
|
|
21
|
+
...require("./revoked-token.repository")
|
|
24
22
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./revoked-token.repository";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MongoRepository } from '../../../common/repositories/index.js';
|
|
2
|
+
import { RevokedToken, RevokedTokenProps } from '../entities';
|
|
3
|
+
export declare class RevokedTokenRepository {
|
|
4
|
+
readonly _: MongoRepository<RevokedTokenProps>;
|
|
5
|
+
create(token: RevokedToken): Promise<RevokedToken>;
|
|
6
|
+
findByJti(jti: string): Promise<RevokedTokenProps | null>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 __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 revoked_token_repository_exports = {};
|
|
28
|
+
__export(revoked_token_repository_exports, {
|
|
29
|
+
RevokedTokenRepository: () => RevokedTokenRepository
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(revoked_token_repository_exports);
|
|
32
|
+
var import_tsyringe = require("tsyringe");
|
|
33
|
+
var import_repositories = require("../../../common/repositories/index.js");
|
|
34
|
+
var import_database_name = require("../../../common/utils/database-name.js");
|
|
35
|
+
let RevokedTokenRepository = class {
|
|
36
|
+
_ = new import_repositories.MongoRepository({
|
|
37
|
+
database: (0, import_database_name.getDatabaseName)(),
|
|
38
|
+
collection: "revoked_tokens"
|
|
39
|
+
});
|
|
40
|
+
async create(token) {
|
|
41
|
+
const id = await this._.createOne({ payload: token.toDocument() });
|
|
42
|
+
id && token.setId(id);
|
|
43
|
+
return token;
|
|
44
|
+
}
|
|
45
|
+
async findByJti(jti) {
|
|
46
|
+
return await this._.findOne({ where: { jti } });
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
RevokedTokenRepository = __decorateClass([
|
|
50
|
+
(0, import_tsyringe.autoInjectable)()
|
|
51
|
+
], RevokedTokenRepository);
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
RevokedTokenRepository
|
|
55
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__decorateClass
|
|
3
|
+
} from "../../../chunk-CF3WOMB3.mjs";
|
|
4
|
+
import { autoInjectable } from "tsyringe";
|
|
5
|
+
import { MongoRepository } from "../../../common/repositories/index.js";
|
|
6
|
+
import { getDatabaseName } from "../../../common/utils/database-name.js";
|
|
7
|
+
let RevokedTokenRepository = class {
|
|
8
|
+
_ = new MongoRepository({
|
|
9
|
+
database: getDatabaseName(),
|
|
10
|
+
collection: "revoked_tokens"
|
|
11
|
+
});
|
|
12
|
+
async create(token) {
|
|
13
|
+
const id = await this._.createOne({ payload: token.toDocument() });
|
|
14
|
+
id && token.setId(id);
|
|
15
|
+
return token;
|
|
16
|
+
}
|
|
17
|
+
async findByJti(jti) {
|
|
18
|
+
return await this._.findOne({ where: { jti } });
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
RevokedTokenRepository = __decorateClass([
|
|
22
|
+
autoInjectable()
|
|
23
|
+
], RevokedTokenRepository);
|
|
24
|
+
export {
|
|
25
|
+
RevokedTokenRepository
|
|
26
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseUseCase, BaseUseCaseParams, BaseUseCaseOutput } from '../../../common/base/base.use-case.js';
|
|
2
|
+
import { RevokedTokenRepository } from '../repositories';
|
|
3
|
+
export interface Params extends BaseUseCaseParams {
|
|
4
|
+
jti: string;
|
|
5
|
+
}
|
|
6
|
+
export interface Output extends BaseUseCaseOutput {
|
|
7
|
+
data: {
|
|
8
|
+
revoked: boolean;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare class IsTokenRevokedUseCase extends BaseUseCase<Params, Output> {
|
|
12
|
+
private readonly revokedTokenRepository?;
|
|
13
|
+
constructor(revokedTokenRepository?: RevokedTokenRepository | undefined);
|
|
14
|
+
execute(params: Params): Promise<Output>;
|
|
15
|
+
}
|
|
@@ -25,33 +25,31 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
25
25
|
return result;
|
|
26
26
|
};
|
|
27
27
|
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
28
|
-
var
|
|
29
|
-
__export(
|
|
30
|
-
|
|
28
|
+
var is_token_revoked_use_case_exports = {};
|
|
29
|
+
__export(is_token_revoked_use_case_exports, {
|
|
30
|
+
IsTokenRevokedUseCase: () => IsTokenRevokedUseCase
|
|
31
31
|
});
|
|
32
|
-
module.exports = __toCommonJS(
|
|
32
|
+
module.exports = __toCommonJS(is_token_revoked_use_case_exports);
|
|
33
33
|
var import_tsyringe = require("tsyringe");
|
|
34
34
|
var import_base = require("../../../common/base/base.use-case.js");
|
|
35
|
-
var
|
|
36
|
-
let
|
|
37
|
-
constructor(
|
|
35
|
+
var import_repositories = require("../repositories");
|
|
36
|
+
let IsTokenRevokedUseCase = class extends import_base.BaseUseCase {
|
|
37
|
+
constructor(revokedTokenRepository) {
|
|
38
38
|
super();
|
|
39
|
-
this.
|
|
39
|
+
this.revokedTokenRepository = revokedTokenRepository;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
revokedTokenRepository;
|
|
42
42
|
async execute(params) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const results = await this.agenticJobRunRepository?.findByJob(jobId, { page, limit, sortBy });
|
|
47
|
-
return { data: results ?? [] };
|
|
43
|
+
if (!params.jti) throw new Error("The jti is required");
|
|
44
|
+
const found = await this.revokedTokenRepository.findByJti(params.jti);
|
|
45
|
+
return { data: { revoked: Boolean(found) } };
|
|
48
46
|
}
|
|
49
47
|
};
|
|
50
|
-
|
|
48
|
+
IsTokenRevokedUseCase = __decorateClass([
|
|
51
49
|
(0, import_tsyringe.autoInjectable)(),
|
|
52
|
-
__decorateParam(0, (0, import_tsyringe.inject)(
|
|
53
|
-
],
|
|
50
|
+
__decorateParam(0, (0, import_tsyringe.inject)(import_repositories.RevokedTokenRepository))
|
|
51
|
+
], IsTokenRevokedUseCase);
|
|
54
52
|
// Annotate the CommonJS export names for ESM import in node:
|
|
55
53
|
0 && (module.exports = {
|
|
56
|
-
|
|
54
|
+
IsTokenRevokedUseCase
|
|
57
55
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__decorateClass,
|
|
3
|
+
__decorateParam
|
|
4
|
+
} from "../../../chunk-CF3WOMB3.mjs";
|
|
5
|
+
import { autoInjectable, inject } from "tsyringe";
|
|
6
|
+
import { BaseUseCase } from "../../../common/base/base.use-case.js";
|
|
7
|
+
import { RevokedTokenRepository } from "../repositories";
|
|
8
|
+
let IsTokenRevokedUseCase = class extends BaseUseCase {
|
|
9
|
+
constructor(revokedTokenRepository) {
|
|
10
|
+
super();
|
|
11
|
+
this.revokedTokenRepository = revokedTokenRepository;
|
|
12
|
+
}
|
|
13
|
+
revokedTokenRepository;
|
|
14
|
+
async execute(params) {
|
|
15
|
+
if (!params.jti) throw new Error("The jti is required");
|
|
16
|
+
const found = await this.revokedTokenRepository.findByJti(params.jti);
|
|
17
|
+
return { data: { revoked: Boolean(found) } };
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
IsTokenRevokedUseCase = __decorateClass([
|
|
21
|
+
autoInjectable(),
|
|
22
|
+
__decorateParam(0, inject(RevokedTokenRepository))
|
|
23
|
+
], IsTokenRevokedUseCase);
|
|
24
|
+
export {
|
|
25
|
+
IsTokenRevokedUseCase
|
|
26
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseUseCase, BaseUseCaseParams, BaseUseCaseOutput } from '../../../common/base/base.use-case.js';
|
|
2
|
+
import { RevokedTokenProps } from '../entities';
|
|
3
|
+
import { RevokedTokenRepository } from '../repositories';
|
|
4
|
+
export interface Params extends BaseUseCaseParams {
|
|
5
|
+
payload?: Pick<RevokedTokenProps, 'jti' | 'audience' | 'subject' | 'expiresAt'>;
|
|
6
|
+
}
|
|
7
|
+
export interface Output extends BaseUseCaseOutput {
|
|
8
|
+
data: RevokedTokenProps;
|
|
9
|
+
}
|
|
10
|
+
export declare class RevokeTokenUseCase extends BaseUseCase<Params, Output> {
|
|
11
|
+
private readonly revokedTokenRepository?;
|
|
12
|
+
constructor(revokedTokenRepository?: RevokedTokenRepository | undefined);
|
|
13
|
+
execute(params: Params): Promise<Output>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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 __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
|
+
var revoke_token_use_case_exports = {};
|
|
29
|
+
__export(revoke_token_use_case_exports, {
|
|
30
|
+
RevokeTokenUseCase: () => RevokeTokenUseCase
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(revoke_token_use_case_exports);
|
|
33
|
+
var import_tsyringe = require("tsyringe");
|
|
34
|
+
var import_base = require("../../../common/base/base.use-case.js");
|
|
35
|
+
var import_entities = require("../entities");
|
|
36
|
+
var import_repositories = require("../repositories");
|
|
37
|
+
let RevokeTokenUseCase = class extends import_base.BaseUseCase {
|
|
38
|
+
constructor(revokedTokenRepository) {
|
|
39
|
+
super();
|
|
40
|
+
this.revokedTokenRepository = revokedTokenRepository;
|
|
41
|
+
}
|
|
42
|
+
revokedTokenRepository;
|
|
43
|
+
async execute(params) {
|
|
44
|
+
const { payload, currentUser } = params;
|
|
45
|
+
if (!payload?.jti || !payload.audience || !payload.subject) throw new Error("The jti, the audience and the subject are required to revoke a token");
|
|
46
|
+
const existing = await this.revokedTokenRepository.findByJti(payload.jti);
|
|
47
|
+
if (existing) return { data: existing };
|
|
48
|
+
const revoked = import_entities.RevokedToken.fromJSON({ jti: payload.jti, audience: payload.audience, subject: payload.subject, expiresAt: payload.expiresAt });
|
|
49
|
+
revoked.setCreatedBy(currentUser);
|
|
50
|
+
try {
|
|
51
|
+
await this.revokedTokenRepository.create(revoked);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
if (error?.code !== 11e3) throw error;
|
|
54
|
+
}
|
|
55
|
+
return { data: revoked.toJSON() };
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
RevokeTokenUseCase = __decorateClass([
|
|
59
|
+
(0, import_tsyringe.autoInjectable)(),
|
|
60
|
+
__decorateParam(0, (0, import_tsyringe.inject)(import_repositories.RevokedTokenRepository))
|
|
61
|
+
], RevokeTokenUseCase);
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
RevokeTokenUseCase
|
|
65
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__decorateClass,
|
|
3
|
+
__decorateParam
|
|
4
|
+
} from "../../../chunk-CF3WOMB3.mjs";
|
|
5
|
+
import { autoInjectable, inject } from "tsyringe";
|
|
6
|
+
import { BaseUseCase } from "../../../common/base/base.use-case.js";
|
|
7
|
+
import { RevokedToken } from "../entities";
|
|
8
|
+
import { RevokedTokenRepository } from "../repositories";
|
|
9
|
+
let RevokeTokenUseCase = class extends BaseUseCase {
|
|
10
|
+
constructor(revokedTokenRepository) {
|
|
11
|
+
super();
|
|
12
|
+
this.revokedTokenRepository = revokedTokenRepository;
|
|
13
|
+
}
|
|
14
|
+
revokedTokenRepository;
|
|
15
|
+
async execute(params) {
|
|
16
|
+
const { payload, currentUser } = params;
|
|
17
|
+
if (!payload?.jti || !payload.audience || !payload.subject) throw new Error("The jti, the audience and the subject are required to revoke a token");
|
|
18
|
+
const existing = await this.revokedTokenRepository.findByJti(payload.jti);
|
|
19
|
+
if (existing) return { data: existing };
|
|
20
|
+
const revoked = RevokedToken.fromJSON({ jti: payload.jti, audience: payload.audience, subject: payload.subject, expiresAt: payload.expiresAt });
|
|
21
|
+
revoked.setCreatedBy(currentUser);
|
|
22
|
+
try {
|
|
23
|
+
await this.revokedTokenRepository.create(revoked);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
if (error?.code !== 11e3) throw error;
|
|
26
|
+
}
|
|
27
|
+
return { data: revoked.toJSON() };
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
RevokeTokenUseCase = __decorateClass([
|
|
31
|
+
autoInjectable(),
|
|
32
|
+
__decorateParam(0, inject(RevokedTokenRepository))
|
|
33
|
+
], RevokeTokenUseCase);
|
|
34
|
+
export {
|
|
35
|
+
RevokeTokenUseCase
|
|
36
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ObjectId } from 'mongodb';
|
|
2
|
+
import { BaseEntity, BaseEntityProps } from '../../../common/base/base.entity.js';
|
|
3
|
+
export type AutomationRunStatus = 'queued' | 'running' | 'completed' | 'paused' | 'failed' | 'skipped';
|
|
4
|
+
export type AutomationRunTrigger = 'schedule' | 'manual' | 'event';
|
|
5
|
+
export interface AutomationRunError {
|
|
6
|
+
code?: string;
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AutomationRunProps extends BaseEntityProps {
|
|
10
|
+
automationId?: string | ObjectId;
|
|
11
|
+
chatId?: string | ObjectId;
|
|
12
|
+
trigger?: AutomationRunTrigger;
|
|
13
|
+
status?: AutomationRunStatus;
|
|
14
|
+
scheduledFor?: string | Date;
|
|
15
|
+
startedAt?: string | Date;
|
|
16
|
+
finishedAt?: string | Date;
|
|
17
|
+
instructions?: string;
|
|
18
|
+
modelProvider?: string;
|
|
19
|
+
modelName?: string;
|
|
20
|
+
error?: AutomationRunError;
|
|
21
|
+
skipReason?: string;
|
|
22
|
+
workerId?: string;
|
|
23
|
+
payload?: string;
|
|
24
|
+
idempotencyKey?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class AutomationRun extends BaseEntity {
|
|
27
|
+
private readonly props;
|
|
28
|
+
automationId?: ObjectId | undefined;
|
|
29
|
+
chatId?: ObjectId | undefined;
|
|
30
|
+
trigger?: AutomationRunTrigger | undefined;
|
|
31
|
+
status?: AutomationRunStatus | undefined;
|
|
32
|
+
scheduledFor?: Date | undefined;
|
|
33
|
+
startedAt?: Date | undefined;
|
|
34
|
+
finishedAt?: Date | undefined;
|
|
35
|
+
instructions?: string | undefined;
|
|
36
|
+
modelProvider?: string | undefined;
|
|
37
|
+
modelName?: string | undefined;
|
|
38
|
+
error?: AutomationRunError | undefined;
|
|
39
|
+
skipReason?: string | undefined;
|
|
40
|
+
workerId?: string | undefined;
|
|
41
|
+
payload?: string | undefined;
|
|
42
|
+
idempotencyKey?: string | undefined;
|
|
43
|
+
static fromJSON(props: AutomationRunProps): AutomationRun;
|
|
44
|
+
constructor(props: AutomationRunProps, automationId?: ObjectId | undefined, chatId?: ObjectId | undefined, trigger?: AutomationRunTrigger | undefined, status?: AutomationRunStatus | undefined, scheduledFor?: Date | undefined, startedAt?: Date | undefined, finishedAt?: Date | undefined, instructions?: string | undefined, modelProvider?: string | undefined, modelName?: string | undefined, error?: AutomationRunError | undefined, skipReason?: string | undefined, workerId?: string | undefined, payload?: string | undefined, idempotencyKey?: string | undefined);
|
|
45
|
+
toJSON(): AutomationRunProps;
|
|
46
|
+
}
|
|
@@ -16,11 +16,11 @@ 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
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var automation_run_entity_exports = {};
|
|
20
|
+
__export(automation_run_entity_exports, {
|
|
21
|
+
AutomationRun: () => AutomationRun
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(automation_run_entity_exports);
|
|
24
24
|
var import_base = require("../../../common/base/base.entity.js");
|
|
25
25
|
const toDate = (value) => {
|
|
26
26
|
if (!value) return void 0;
|
|
@@ -28,11 +28,11 @@ const toDate = (value) => {
|
|
|
28
28
|
if (Number.isNaN(date.getTime())) throw new Error("{{value_must_be_a_date}}");
|
|
29
29
|
return date;
|
|
30
30
|
};
|
|
31
|
-
class
|
|
32
|
-
constructor(props,
|
|
31
|
+
class AutomationRun extends import_base.BaseEntity {
|
|
32
|
+
constructor(props, automationId, chatId, trigger, status, scheduledFor, startedAt, finishedAt, instructions, modelProvider, modelName, error, skipReason, workerId, payload, idempotencyKey) {
|
|
33
33
|
super(props);
|
|
34
34
|
this.props = props;
|
|
35
|
-
this.
|
|
35
|
+
this.automationId = automationId;
|
|
36
36
|
this.chatId = chatId;
|
|
37
37
|
this.trigger = trigger;
|
|
38
38
|
this.status = status;
|
|
@@ -45,9 +45,11 @@ class AgenticJobRun extends import_base.BaseEntity {
|
|
|
45
45
|
this.error = error;
|
|
46
46
|
this.skipReason = skipReason;
|
|
47
47
|
this.workerId = workerId;
|
|
48
|
+
this.payload = payload;
|
|
49
|
+
this.idempotencyKey = idempotencyKey;
|
|
48
50
|
}
|
|
49
51
|
props;
|
|
50
|
-
|
|
52
|
+
automationId;
|
|
51
53
|
chatId;
|
|
52
54
|
trigger;
|
|
53
55
|
status;
|
|
@@ -60,10 +62,12 @@ class AgenticJobRun extends import_base.BaseEntity {
|
|
|
60
62
|
error;
|
|
61
63
|
skipReason;
|
|
62
64
|
workerId;
|
|
65
|
+
payload;
|
|
66
|
+
idempotencyKey;
|
|
63
67
|
static fromJSON(props) {
|
|
64
|
-
return new
|
|
68
|
+
return new AutomationRun(
|
|
65
69
|
props,
|
|
66
|
-
import_base.BaseEntity.toObjectId(props.
|
|
70
|
+
import_base.BaseEntity.toObjectId(props.automationId),
|
|
67
71
|
import_base.BaseEntity.toObjectId(props.chatId),
|
|
68
72
|
props.trigger,
|
|
69
73
|
props.status,
|
|
@@ -75,13 +79,15 @@ class AgenticJobRun extends import_base.BaseEntity {
|
|
|
75
79
|
props.modelName || void 0,
|
|
76
80
|
props.error,
|
|
77
81
|
props.skipReason || void 0,
|
|
78
|
-
props.workerId || void 0
|
|
82
|
+
props.workerId || void 0,
|
|
83
|
+
props.payload || void 0,
|
|
84
|
+
props.idempotencyKey || void 0
|
|
79
85
|
);
|
|
80
86
|
}
|
|
81
87
|
toJSON() {
|
|
82
88
|
return {
|
|
83
89
|
...super.toJSON(),
|
|
84
|
-
|
|
90
|
+
automationId: this.automationId,
|
|
85
91
|
chatId: this.chatId,
|
|
86
92
|
trigger: this.trigger,
|
|
87
93
|
status: this.status,
|
|
@@ -93,11 +99,13 @@ class AgenticJobRun extends import_base.BaseEntity {
|
|
|
93
99
|
modelName: this.modelName,
|
|
94
100
|
error: this.error,
|
|
95
101
|
skipReason: this.skipReason,
|
|
96
|
-
workerId: this.workerId
|
|
102
|
+
workerId: this.workerId,
|
|
103
|
+
payload: this.payload,
|
|
104
|
+
idempotencyKey: this.idempotencyKey
|
|
97
105
|
};
|
|
98
106
|
}
|
|
99
107
|
}
|
|
100
108
|
// Annotate the CommonJS export names for ESM import in node:
|
|
101
109
|
0 && (module.exports = {
|
|
102
|
-
|
|
110
|
+
AutomationRun
|
|
103
111
|
});
|