@agentuity/core 1.0.33 → 1.0.35
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/dist/index.d.ts +2 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -15
- package/dist/index.js.map +1 -1
- package/dist/services/adapter.d.ts +57 -22
- package/dist/services/adapter.d.ts.map +1 -1
- package/dist/services/adapter.js +52 -1
- package/dist/services/adapter.js.map +1 -1
- package/dist/services/api.d.ts +222 -0
- package/dist/services/api.d.ts.map +1 -0
- package/dist/services/api.js +662 -0
- package/dist/services/api.js.map +1 -0
- package/dist/services/apikey/create.d.ts +34 -0
- package/dist/services/apikey/create.d.ts.map +1 -0
- package/dist/services/apikey/create.js +29 -0
- package/dist/services/apikey/create.js.map +1 -0
- package/dist/services/apikey/delete.d.ts.map +1 -0
- package/dist/services/apikey/delete.js.map +1 -0
- package/dist/services/apikey/get.d.ts.map +1 -0
- package/dist/services/apikey/get.js.map +1 -0
- package/dist/services/apikey/index.d.ts.map +1 -0
- package/dist/services/apikey/index.js.map +1 -0
- package/dist/services/apikey/list.d.ts +65 -0
- package/dist/services/apikey/list.d.ts.map +1 -0
- package/dist/services/apikey/list.js +50 -0
- package/dist/services/apikey/list.js.map +1 -0
- package/dist/services/apikey/util.d.ts.map +1 -0
- package/dist/services/apikey/util.js.map +1 -0
- package/dist/services/config.d.ts +22 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/config.js +55 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/db/index.d.ts +6 -0
- package/dist/services/db/index.d.ts.map +1 -0
- package/dist/services/db/index.js +6 -0
- package/dist/services/db/index.js.map +1 -0
- package/dist/services/db/logs.d.ts.map +1 -0
- package/dist/services/db/logs.js.map +1 -0
- package/dist/services/db/query.d.ts +40 -0
- package/dist/services/db/query.d.ts.map +1 -0
- package/dist/services/db/query.js +55 -0
- package/dist/services/db/query.js.map +1 -0
- package/dist/services/db/stats.d.ts +146 -0
- package/dist/services/db/stats.d.ts.map +1 -0
- package/dist/services/db/stats.js +94 -0
- package/dist/services/db/stats.js.map +1 -0
- package/dist/services/db/tables.d.ts +50 -0
- package/dist/services/db/tables.d.ts.map +1 -0
- package/dist/services/db/tables.js +64 -0
- package/dist/services/db/tables.js.map +1 -0
- package/dist/services/db/util.d.ts.map +1 -0
- package/dist/services/db/util.js.map +1 -0
- package/dist/services/email/index.d.ts +2 -0
- package/dist/services/email/index.d.ts.map +1 -0
- package/dist/services/email/index.js +2 -0
- package/dist/services/email/index.js.map +1 -0
- package/dist/services/email/service.d.ts +742 -0
- package/dist/services/email/service.d.ts.map +1 -0
- package/dist/services/email/service.js +1107 -0
- package/dist/services/email/service.js.map +1 -0
- package/dist/services/env.d.ts.map +1 -0
- package/dist/services/env.js.map +1 -0
- package/dist/services/eval/events.d.ts +93 -0
- package/dist/services/eval/events.d.ts.map +1 -0
- package/dist/services/eval/events.js +24 -0
- package/dist/services/eval/events.js.map +1 -0
- package/dist/services/eval/get.d.ts.map +1 -0
- package/dist/services/eval/get.js.map +1 -0
- package/dist/services/eval/index.d.ts +6 -0
- package/dist/services/eval/index.d.ts.map +1 -0
- package/dist/services/eval/index.js +6 -0
- package/dist/services/eval/index.js.map +1 -0
- package/dist/services/eval/list.d.ts.map +1 -0
- package/dist/services/eval/list.js.map +1 -0
- package/dist/services/eval/run-get.d.ts.map +1 -0
- package/dist/services/eval/run-get.js.map +1 -0
- package/dist/services/eval/run-list.d.ts.map +1 -0
- package/dist/services/eval/run-list.js.map +1 -0
- package/dist/services/exception.d.ts +28 -9
- package/dist/services/exception.d.ts.map +1 -1
- package/dist/services/exception.js +14 -0
- package/dist/services/exception.js.map +1 -1
- package/dist/services/index.d.ts +26 -12
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +26 -11
- package/dist/services/index.js.map +1 -1
- package/dist/services/keyvalue/index.d.ts +2 -0
- package/dist/services/keyvalue/index.d.ts.map +1 -0
- package/dist/services/keyvalue/index.js +2 -0
- package/dist/services/keyvalue/index.js.map +1 -0
- package/dist/services/keyvalue/service.d.ts +261 -0
- package/dist/services/keyvalue/service.d.ts.map +1 -0
- package/dist/services/keyvalue/service.js +475 -0
- package/dist/services/keyvalue/service.js.map +1 -0
- package/dist/services/logger.d.ts.map +1 -0
- package/dist/services/logger.js.map +1 -0
- package/dist/services/machine/index.d.ts.map +1 -0
- package/dist/services/machine/index.js.map +1 -0
- package/dist/services/machine/machine.d.ts.map +1 -0
- package/dist/services/machine/machine.js +177 -0
- package/dist/services/machine/machine.js.map +1 -0
- package/dist/services/machine/util.d.ts.map +1 -0
- package/dist/services/machine/util.js.map +1 -0
- package/dist/services/org/env-delete.d.ts.map +1 -0
- package/dist/services/org/env-delete.js.map +1 -0
- package/dist/services/org/env-get.d.ts +33 -0
- package/dist/services/org/env-get.d.ts.map +1 -0
- package/dist/services/org/env-get.js +33 -0
- package/dist/services/org/env-get.js.map +1 -0
- package/dist/services/org/env-update.d.ts.map +1 -0
- package/dist/services/org/env-update.js.map +1 -0
- package/dist/services/org/index.d.ts.map +1 -0
- package/dist/services/org/index.js.map +1 -0
- package/dist/services/org/list.d.ts.map +1 -0
- package/dist/services/org/list.js.map +1 -0
- package/dist/services/org/resources.d.ts +150 -0
- package/dist/services/org/resources.d.ts.map +1 -0
- package/dist/services/org/resources.js +111 -0
- package/dist/services/org/resources.js.map +1 -0
- package/dist/services/org/util.d.ts.map +1 -0
- package/dist/services/org/util.js.map +1 -0
- package/dist/services/pagination.d.ts +38 -11
- package/dist/services/pagination.d.ts.map +1 -1
- package/dist/services/pagination.js +30 -1
- package/dist/services/pagination.js.map +1 -1
- package/dist/services/project/agent.d.ts.map +1 -0
- package/dist/services/project/agent.js.map +1 -0
- package/dist/services/project/create.d.ts.map +1 -0
- package/dist/services/project/create.js.map +1 -0
- package/dist/services/project/delete.d.ts.map +1 -0
- package/dist/services/project/delete.js +15 -0
- package/dist/services/project/delete.js.map +1 -0
- package/dist/services/project/deploy.d.ts +468 -0
- package/dist/services/project/deploy.d.ts.map +1 -0
- package/dist/services/project/deploy.js.map +1 -0
- package/dist/services/project/deployment.d.ts.map +1 -0
- package/dist/services/project/deployment.js +180 -0
- package/dist/services/project/deployment.js.map +1 -0
- package/dist/services/project/env-delete.d.ts.map +1 -0
- package/dist/services/project/env-delete.js.map +1 -0
- package/dist/services/project/env-update.d.ts.map +1 -0
- package/dist/services/project/env-update.js.map +1 -0
- package/dist/services/project/exists.d.ts.map +1 -0
- package/dist/services/project/exists.js.map +1 -0
- package/dist/services/project/get.d.ts.map +1 -0
- package/dist/services/project/get.js.map +1 -0
- package/dist/services/project/hostname.d.ts.map +1 -0
- package/dist/services/project/hostname.js +43 -0
- package/dist/services/project/hostname.js.map +1 -0
- package/dist/services/project/index.d.ts.map +1 -0
- package/dist/services/project/index.js.map +1 -0
- package/dist/services/project/list.d.ts.map +1 -0
- package/dist/services/project/list.js.map +1 -0
- package/dist/services/project/malware.d.ts.map +1 -0
- package/dist/services/project/malware.js +57 -0
- package/dist/services/project/malware.js.map +1 -0
- package/dist/services/project/update-region.d.ts.map +1 -0
- package/dist/services/project/update-region.js.map +1 -0
- package/dist/services/project/util.d.ts.map +1 -0
- package/dist/services/project/util.js.map +1 -0
- package/dist/services/queue/analytics.d.ts +261 -0
- package/dist/services/queue/analytics.d.ts.map +1 -0
- package/dist/services/queue/analytics.js +254 -0
- package/dist/services/queue/analytics.js.map +1 -0
- package/dist/services/queue/consumers.d.ts +48 -0
- package/dist/services/queue/consumers.d.ts.map +1 -0
- package/dist/services/queue/consumers.js +43 -0
- package/dist/services/queue/consumers.js.map +1 -0
- package/dist/services/queue/destinations.d.ts +269 -0
- package/dist/services/queue/destinations.d.ts.map +1 -0
- package/dist/services/queue/destinations.js +215 -0
- package/dist/services/queue/destinations.js.map +1 -0
- package/dist/services/queue/dlq.d.ts +170 -0
- package/dist/services/queue/dlq.d.ts.map +1 -0
- package/dist/services/queue/dlq.js.map +1 -0
- package/dist/services/queue/index.d.ts +58 -0
- package/dist/services/queue/index.d.ts.map +1 -0
- package/dist/services/queue/index.js +98 -0
- package/dist/services/queue/index.js.map +1 -0
- package/dist/services/queue/messages.d.ts +511 -0
- package/dist/services/queue/messages.d.ts.map +1 -0
- package/dist/services/queue/messages.js.map +1 -0
- package/dist/services/queue/queues.d.ts +228 -0
- package/dist/services/queue/queues.d.ts.map +1 -0
- package/dist/services/queue/queues.js.map +1 -0
- package/dist/services/queue/service.d.ts +309 -0
- package/dist/services/queue/service.d.ts.map +1 -0
- package/dist/services/queue/service.js +456 -0
- package/dist/services/queue/service.js.map +1 -0
- package/dist/services/queue/sources.d.ts +252 -0
- package/dist/services/queue/sources.d.ts.map +1 -0
- package/dist/services/queue/sources.js +249 -0
- package/dist/services/queue/sources.js.map +1 -0
- package/dist/services/queue/types.d.ts +1335 -0
- package/dist/services/queue/types.d.ts.map +1 -0
- package/dist/services/queue/types.js +1382 -0
- package/dist/services/queue/types.js.map +1 -0
- package/dist/services/queue/util.d.ts +278 -0
- package/dist/services/queue/util.d.ts.map +1 -0
- package/dist/services/queue/util.js +233 -0
- package/dist/services/queue/util.js.map +1 -0
- package/dist/services/queue/validation.d.ts +218 -0
- package/dist/services/queue/validation.d.ts.map +1 -0
- package/dist/services/queue/validation.js +498 -0
- package/dist/services/queue/validation.js.map +1 -0
- package/dist/services/queue/websocket.d.ts +154 -0
- package/dist/services/queue/websocket.d.ts.map +1 -0
- package/dist/services/queue/websocket.js +491 -0
- package/dist/services/queue/websocket.js.map +1 -0
- package/dist/services/region/create.d.ts.map +1 -0
- package/dist/services/region/create.js.map +1 -0
- package/dist/services/region/delete.d.ts.map +1 -0
- package/dist/services/region/delete.js.map +1 -0
- package/dist/services/region/index.d.ts.map +1 -0
- package/dist/services/region/index.js.map +1 -0
- package/dist/services/region/list.d.ts.map +1 -0
- package/dist/services/region/list.js.map +1 -0
- package/dist/services/region/resources.d.ts.map +1 -0
- package/dist/services/region/resources.js.map +1 -0
- package/dist/services/region/util.d.ts.map +1 -0
- package/dist/services/region/util.js.map +1 -0
- package/dist/services/sandbox/cli-list.d.ts +103 -0
- package/dist/services/sandbox/cli-list.d.ts.map +1 -0
- package/dist/services/sandbox/cli-list.js +106 -0
- package/dist/services/sandbox/cli-list.js.map +1 -0
- package/dist/services/sandbox/client.d.ts +173 -0
- package/dist/services/sandbox/client.d.ts.map +1 -0
- package/dist/services/sandbox/client.js +302 -0
- package/dist/services/sandbox/client.js.map +1 -0
- package/dist/services/sandbox/create.d.ts +193 -0
- package/dist/services/sandbox/create.d.ts.map +1 -0
- package/dist/services/sandbox/create.js +215 -0
- package/dist/services/sandbox/create.js.map +1 -0
- package/dist/services/sandbox/destroy.d.ts +23 -0
- package/dist/services/sandbox/destroy.d.ts.map +1 -0
- package/dist/services/sandbox/destroy.js +30 -0
- package/dist/services/sandbox/destroy.js.map +1 -0
- package/dist/services/sandbox/disk-checkpoint.d.ts +108 -0
- package/dist/services/sandbox/disk-checkpoint.d.ts.map +1 -0
- package/dist/services/sandbox/disk-checkpoint.js +124 -0
- package/dist/services/sandbox/disk-checkpoint.js.map +1 -0
- package/dist/services/sandbox/execute.d.ts +96 -0
- package/dist/services/sandbox/execute.d.ts.map +1 -0
- package/dist/services/sandbox/execute.js +109 -0
- package/dist/services/sandbox/execute.js.map +1 -0
- package/dist/services/sandbox/execution.d.ts +145 -0
- package/dist/services/sandbox/execution.d.ts.map +1 -0
- package/dist/services/sandbox/execution.js +113 -0
- package/dist/services/sandbox/execution.js.map +1 -0
- package/dist/services/sandbox/files.d.ts +269 -0
- package/dist/services/sandbox/files.d.ts.map +1 -0
- package/dist/services/sandbox/files.js +454 -0
- package/dist/services/sandbox/files.js.map +1 -0
- package/dist/services/sandbox/get.d.ts +284 -0
- package/dist/services/sandbox/get.d.ts.map +1 -0
- package/dist/services/sandbox/get.js +231 -0
- package/dist/services/sandbox/get.js.map +1 -0
- package/dist/services/sandbox/getStatus.d.ts +20 -0
- package/dist/services/sandbox/getStatus.d.ts.map +1 -0
- package/dist/services/sandbox/getStatus.js +36 -0
- package/dist/services/sandbox/getStatus.js.map +1 -0
- package/dist/services/sandbox/index.d.ts +40 -0
- package/dist/services/sandbox/index.d.ts.map +1 -0
- package/dist/services/sandbox/index.js +21 -0
- package/dist/services/sandbox/index.js.map +1 -0
- package/dist/services/sandbox/list.d.ts +327 -0
- package/dist/services/sandbox/list.d.ts.map +1 -0
- package/dist/services/sandbox/list.js +204 -0
- package/dist/services/sandbox/list.js.map +1 -0
- package/dist/services/sandbox/pause.d.ts +23 -0
- package/dist/services/sandbox/pause.d.ts.map +1 -0
- package/dist/services/sandbox/pause.js +30 -0
- package/dist/services/sandbox/pause.js.map +1 -0
- package/dist/services/sandbox/resolve.d.ts +75 -0
- package/dist/services/sandbox/resolve.d.ts.map +1 -0
- package/dist/services/sandbox/resolve.js +76 -0
- package/dist/services/sandbox/resolve.js.map +1 -0
- package/dist/services/sandbox/resume.d.ts +23 -0
- package/dist/services/sandbox/resume.d.ts.map +1 -0
- package/dist/services/sandbox/resume.js +30 -0
- package/dist/services/sandbox/resume.js.map +1 -0
- package/dist/services/sandbox/run.d.ts +71 -0
- package/dist/services/sandbox/run.d.ts.map +1 -0
- package/dist/services/sandbox/run.js +355 -0
- package/dist/services/sandbox/run.js.map +1 -0
- package/dist/services/sandbox/runtime.d.ts +94 -0
- package/dist/services/sandbox/runtime.d.ts.map +1 -0
- package/dist/services/sandbox/runtime.js +82 -0
- package/dist/services/sandbox/runtime.js.map +1 -0
- package/dist/services/sandbox/snapshot-build.d.ts.map +1 -0
- package/dist/services/sandbox/snapshot-build.js.map +1 -0
- package/dist/services/sandbox/snapshot.d.ts +596 -0
- package/dist/services/sandbox/snapshot.d.ts.map +1 -0
- package/dist/services/sandbox/snapshot.js +612 -0
- package/dist/services/sandbox/snapshot.js.map +1 -0
- package/dist/services/sandbox/types.d.ts +851 -0
- package/dist/services/sandbox/types.d.ts.map +1 -0
- package/dist/services/sandbox/types.js +674 -0
- package/dist/services/sandbox/types.js.map +1 -0
- package/dist/services/sandbox/util.d.ts +295 -0
- package/dist/services/sandbox/util.d.ts.map +1 -0
- package/dist/services/sandbox/util.js +233 -0
- package/dist/services/sandbox/util.js.map +1 -0
- package/dist/services/schedule/index.d.ts +2 -0
- package/dist/services/schedule/index.d.ts.map +1 -0
- package/dist/services/schedule/index.js +2 -0
- package/dist/services/schedule/index.js.map +1 -0
- package/dist/services/schedule/service.d.ts +439 -0
- package/dist/services/schedule/service.d.ts.map +1 -0
- package/dist/services/schedule/service.js +701 -0
- package/dist/services/schedule/service.js.map +1 -0
- package/dist/services/session/events.d.ts +127 -0
- package/dist/services/session/events.d.ts.map +1 -0
- package/dist/services/session/events.js +42 -0
- package/dist/services/session/events.js.map +1 -0
- package/dist/services/session/get.d.ts +170 -0
- package/dist/services/session/get.d.ts.map +1 -0
- package/dist/services/session/get.js.map +1 -0
- package/dist/services/session/index.d.ts +5 -0
- package/dist/services/session/index.d.ts.map +1 -0
- package/dist/services/session/index.js +5 -0
- package/dist/services/session/index.js.map +1 -0
- package/dist/services/session/list.d.ts +150 -0
- package/dist/services/session/list.d.ts.map +1 -0
- package/dist/services/session/list.js +117 -0
- package/dist/services/session/list.js.map +1 -0
- package/dist/services/session/logs.d.ts.map +1 -0
- package/dist/services/session/logs.js.map +1 -0
- package/dist/services/session/util.d.ts.map +1 -0
- package/dist/services/session/util.js.map +1 -0
- package/dist/services/stats.d.ts +261 -0
- package/dist/services/stats.d.ts.map +1 -0
- package/dist/services/stats.js +181 -0
- package/dist/services/stats.js.map +1 -0
- package/dist/services/storage/config.d.ts.map +1 -0
- package/dist/services/storage/config.js.map +1 -0
- package/dist/services/storage/index.d.ts.map +1 -0
- package/dist/services/storage/index.js.map +1 -0
- package/dist/services/storage/objects.d.ts +158 -0
- package/dist/services/storage/objects.d.ts.map +1 -0
- package/dist/services/storage/objects.js +161 -0
- package/dist/services/storage/objects.js.map +1 -0
- package/dist/services/storage/types.d.ts.map +1 -0
- package/dist/services/storage/types.js.map +1 -0
- package/dist/services/storage/util.d.ts.map +1 -0
- package/dist/services/storage/util.js.map +1 -0
- package/dist/services/stream/get.d.ts.map +1 -0
- package/dist/services/stream/get.js.map +1 -0
- package/dist/services/stream/index.d.ts +5 -0
- package/dist/services/stream/index.d.ts.map +1 -0
- package/dist/services/stream/index.js +5 -0
- package/dist/services/stream/index.js.map +1 -0
- package/dist/services/stream/list.d.ts +96 -0
- package/dist/services/stream/list.d.ts.map +1 -0
- package/dist/services/stream/list.js +92 -0
- package/dist/services/stream/list.js.map +1 -0
- package/dist/services/stream/service.d.ts +264 -0
- package/dist/services/stream/service.d.ts.map +1 -0
- package/dist/services/stream/service.js +631 -0
- package/dist/services/stream/service.js.map +1 -0
- package/dist/services/stream/util.d.ts.map +1 -0
- package/dist/services/stream/util.js.map +1 -0
- package/dist/services/task/index.d.ts +2 -0
- package/dist/services/task/index.d.ts.map +1 -0
- package/dist/services/task/index.js +2 -0
- package/dist/services/task/index.js.map +1 -0
- package/dist/services/task/service.d.ts +1491 -0
- package/dist/services/task/service.d.ts.map +1 -0
- package/dist/services/task/service.js +1887 -0
- package/dist/services/task/service.js.map +1 -0
- package/dist/services/thread/delete.d.ts.map +1 -0
- package/dist/services/thread/delete.js.map +1 -0
- package/dist/services/thread/get.d.ts.map +1 -0
- package/dist/services/thread/get.js.map +1 -0
- package/dist/services/thread/index.d.ts.map +1 -0
- package/dist/services/thread/index.js.map +1 -0
- package/dist/services/thread/list.d.ts +75 -0
- package/dist/services/thread/list.d.ts.map +1 -0
- package/dist/services/thread/list.js +65 -0
- package/dist/services/thread/list.js.map +1 -0
- package/dist/services/thread/util.d.ts.map +1 -0
- package/dist/services/thread/util.js.map +1 -0
- package/dist/services/user/index.d.ts.map +1 -0
- package/dist/services/user/index.js.map +1 -0
- package/dist/services/user/util.d.ts.map +1 -0
- package/dist/services/user/util.js.map +1 -0
- package/dist/services/user/whoami.d.ts.map +1 -0
- package/dist/services/user/whoami.js.map +1 -0
- package/dist/services/vector/index.d.ts +2 -0
- package/dist/services/vector/index.d.ts.map +1 -0
- package/dist/services/vector/index.js +2 -0
- package/dist/services/vector/index.js.map +1 -0
- package/dist/services/vector/service.d.ts +459 -0
- package/dist/services/vector/service.d.ts.map +1 -0
- package/dist/services/vector/service.js +707 -0
- package/dist/services/vector/service.js.map +1 -0
- package/dist/services/webhook/analytics.d.ts +77 -0
- package/dist/services/webhook/analytics.d.ts.map +1 -0
- package/dist/services/webhook/analytics.js +56 -0
- package/dist/services/webhook/analytics.js.map +1 -0
- package/dist/services/webhook/deliveries.d.ts +94 -0
- package/dist/services/webhook/deliveries.d.ts.map +1 -0
- package/dist/services/webhook/deliveries.js.map +1 -0
- package/dist/services/webhook/destinations.d.ts +140 -0
- package/dist/services/webhook/destinations.d.ts.map +1 -0
- package/dist/services/webhook/destinations.js.map +1 -0
- package/dist/services/webhook/index.d.ts +43 -0
- package/dist/services/webhook/index.d.ts.map +1 -0
- package/dist/services/webhook/index.js +64 -0
- package/dist/services/webhook/index.js.map +1 -0
- package/dist/services/webhook/receipts.d.ts.map +1 -0
- package/dist/services/webhook/receipts.js.map +1 -0
- package/dist/services/webhook/service.d.ts +374 -0
- package/dist/services/webhook/service.d.ts.map +1 -0
- package/dist/services/webhook/service.js +663 -0
- package/dist/services/webhook/service.js.map +1 -0
- package/dist/services/webhook/types.d.ts +182 -0
- package/dist/services/webhook/types.d.ts.map +1 -0
- package/dist/services/webhook/types.js +188 -0
- package/dist/services/webhook/types.js.map +1 -0
- package/dist/services/webhook/util.d.ts.map +1 -0
- package/dist/services/webhook/util.js.map +1 -0
- package/dist/services/webhook/webhooks.d.ts +150 -0
- package/dist/services/webhook/webhooks.d.ts.map +1 -0
- package/dist/services/webhook/webhooks.js.map +1 -0
- package/package.json +59 -7
- package/src/index.ts +6 -247
- package/src/services/adapter.ts +69 -24
- package/src/services/api.ts +951 -0
- package/src/services/apikey/create.ts +48 -0
- package/src/services/apikey/list.ts +66 -0
- package/src/services/config.ts +65 -0
- package/src/services/db/index.ts +42 -0
- package/src/services/db/query.ts +69 -0
- package/src/services/db/stats.ts +121 -0
- package/src/services/db/tables.ts +94 -0
- package/src/services/email/index.ts +1 -0
- package/src/services/email/service.ts +1476 -0
- package/src/services/eval/index.ts +29 -0
- package/src/services/exception.ts +16 -7
- package/src/services/index.ts +29 -28
- package/src/services/keyvalue/index.ts +1 -0
- package/src/services/keyvalue/service.ts +677 -0
- package/src/services/machine/machine.ts +228 -0
- package/src/services/org/env-get.ts +48 -0
- package/src/services/org/resources.ts +140 -0
- package/src/services/pagination.ts +40 -11
- package/src/services/project/delete.ts +27 -0
- package/src/services/project/deploy.ts +433 -0
- package/src/services/project/deployment.ts +250 -0
- package/src/services/project/hostname.ts +79 -0
- package/src/services/project/malware.ts +85 -0
- package/src/services/queue/analytics.ts +343 -0
- package/src/services/queue/consumers.ts +56 -0
- package/src/services/queue/destinations.ts +329 -0
- package/src/services/queue/index.ts +339 -0
- package/src/services/queue/service.ts +634 -0
- package/src/services/queue/sources.ts +364 -0
- package/src/services/queue/types.ts +1666 -0
- package/src/services/queue/util.ts +275 -0
- package/src/services/queue/validation.ts +541 -0
- package/src/services/queue/websocket.ts +578 -0
- package/src/services/sandbox/cli-list.ts +117 -0
- package/src/services/sandbox/client.ts +435 -0
- package/src/services/sandbox/create.ts +249 -0
- package/src/services/sandbox/destroy.ts +43 -0
- package/src/services/sandbox/disk-checkpoint.ts +184 -0
- package/src/services/sandbox/execute.ts +134 -0
- package/src/services/sandbox/execution.ts +144 -0
- package/src/services/sandbox/files.ts +608 -0
- package/src/services/sandbox/get.ts +262 -0
- package/src/services/sandbox/getStatus.ts +51 -0
- package/src/services/sandbox/index.ts +230 -0
- package/src/services/sandbox/list.ts +234 -0
- package/src/services/sandbox/pause.ts +41 -0
- package/src/services/sandbox/resolve.ts +96 -0
- package/src/services/sandbox/resume.ts +41 -0
- package/src/services/sandbox/run.ts +441 -0
- package/src/services/sandbox/runtime.ts +106 -0
- package/src/services/sandbox/snapshot.ts +791 -0
- package/src/services/sandbox/types.ts +798 -0
- package/src/services/sandbox/util.ts +279 -0
- package/src/services/schedule/index.ts +1 -0
- package/src/services/schedule/service.ts +814 -0
- package/src/services/session/get.ts +108 -0
- package/src/services/session/index.ts +4 -0
- package/src/services/session/list.ts +143 -0
- package/src/services/stats.ts +232 -0
- package/src/services/storage/objects.ts +256 -0
- package/src/services/stream/index.ts +14 -0
- package/src/services/stream/list.ts +105 -0
- package/src/services/stream/service.ts +929 -0
- package/src/services/task/index.ts +1 -0
- package/src/services/task/service.ts +2573 -0
- package/src/services/thread/list.ts +81 -0
- package/src/services/vector/index.ts +1 -0
- package/src/services/vector/service.ts +1242 -0
- package/src/services/webhook/analytics.ts +80 -0
- package/src/services/webhook/index.ts +160 -0
- package/src/services/webhook/service.ts +900 -0
- package/src/services/webhook/types.ts +277 -0
- package/dist/api/api.d.ts +0 -226
- package/dist/api/api.d.ts.map +0 -1
- package/dist/api/api.js +0 -635
- package/dist/api/api.js.map +0 -1
- package/dist/api/apikey/create.d.ts +0 -33
- package/dist/api/apikey/create.d.ts.map +0 -1
- package/dist/api/apikey/create.js +0 -23
- package/dist/api/apikey/create.js.map +0 -1
- package/dist/api/apikey/delete.d.ts.map +0 -1
- package/dist/api/apikey/delete.js.map +0 -1
- package/dist/api/apikey/get.d.ts.map +0 -1
- package/dist/api/apikey/get.js.map +0 -1
- package/dist/api/apikey/index.d.ts.map +0 -1
- package/dist/api/apikey/index.js.map +0 -1
- package/dist/api/apikey/list.d.ts +0 -64
- package/dist/api/apikey/list.d.ts.map +0 -1
- package/dist/api/apikey/list.js +0 -46
- package/dist/api/apikey/list.js.map +0 -1
- package/dist/api/apikey/util.d.ts.map +0 -1
- package/dist/api/apikey/util.js.map +0 -1
- package/dist/api/config.d.ts +0 -20
- package/dist/api/config.d.ts.map +0 -1
- package/dist/api/config.js +0 -43
- package/dist/api/config.js.map +0 -1
- package/dist/api/db/index.d.ts +0 -5
- package/dist/api/db/index.d.ts.map +0 -1
- package/dist/api/db/index.js +0 -5
- package/dist/api/db/index.js.map +0 -1
- package/dist/api/db/logs.d.ts.map +0 -1
- package/dist/api/db/logs.js.map +0 -1
- package/dist/api/db/query.d.ts +0 -39
- package/dist/api/db/query.d.ts.map +0 -1
- package/dist/api/db/query.js +0 -49
- package/dist/api/db/query.js.map +0 -1
- package/dist/api/db/tables.d.ts +0 -49
- package/dist/api/db/tables.d.ts.map +0 -1
- package/dist/api/db/tables.js +0 -59
- package/dist/api/db/tables.js.map +0 -1
- package/dist/api/db/util.d.ts.map +0 -1
- package/dist/api/db/util.js.map +0 -1
- package/dist/api/env.d.ts.map +0 -1
- package/dist/api/env.js.map +0 -1
- package/dist/api/eval/get.d.ts.map +0 -1
- package/dist/api/eval/get.js.map +0 -1
- package/dist/api/eval/index.d.ts +0 -5
- package/dist/api/eval/index.d.ts.map +0 -1
- package/dist/api/eval/index.js +0 -5
- package/dist/api/eval/index.js.map +0 -1
- package/dist/api/eval/list.d.ts.map +0 -1
- package/dist/api/eval/list.js.map +0 -1
- package/dist/api/eval/run-get.d.ts.map +0 -1
- package/dist/api/eval/run-get.js.map +0 -1
- package/dist/api/eval/run-list.d.ts.map +0 -1
- package/dist/api/eval/run-list.js.map +0 -1
- package/dist/api/index.d.ts +0 -21
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js +0 -21
- package/dist/api/index.js.map +0 -1
- package/dist/api/logger.d.ts.map +0 -1
- package/dist/api/logger.js.map +0 -1
- package/dist/api/machine/index.d.ts.map +0 -1
- package/dist/api/machine/index.js.map +0 -1
- package/dist/api/machine/machine.d.ts.map +0 -1
- package/dist/api/machine/machine.js +0 -109
- package/dist/api/machine/machine.js.map +0 -1
- package/dist/api/machine/util.d.ts.map +0 -1
- package/dist/api/machine/util.js.map +0 -1
- package/dist/api/org/env-delete.d.ts.map +0 -1
- package/dist/api/org/env-delete.js.map +0 -1
- package/dist/api/org/env-get.d.ts +0 -33
- package/dist/api/org/env-get.d.ts.map +0 -1
- package/dist/api/org/env-get.js +0 -26
- package/dist/api/org/env-get.js.map +0 -1
- package/dist/api/org/env-update.d.ts.map +0 -1
- package/dist/api/org/env-update.js.map +0 -1
- package/dist/api/org/index.d.ts.map +0 -1
- package/dist/api/org/index.js.map +0 -1
- package/dist/api/org/list.d.ts.map +0 -1
- package/dist/api/org/list.js.map +0 -1
- package/dist/api/org/resources.d.ts +0 -141
- package/dist/api/org/resources.d.ts.map +0 -1
- package/dist/api/org/resources.js +0 -97
- package/dist/api/org/resources.js.map +0 -1
- package/dist/api/org/util.d.ts.map +0 -1
- package/dist/api/org/util.js.map +0 -1
- package/dist/api/project/agent.d.ts.map +0 -1
- package/dist/api/project/agent.js.map +0 -1
- package/dist/api/project/create.d.ts.map +0 -1
- package/dist/api/project/create.js.map +0 -1
- package/dist/api/project/delete.d.ts.map +0 -1
- package/dist/api/project/delete.js +0 -13
- package/dist/api/project/delete.js.map +0 -1
- package/dist/api/project/deploy.d.ts +0 -490
- package/dist/api/project/deploy.d.ts.map +0 -1
- package/dist/api/project/deploy.js.map +0 -1
- package/dist/api/project/deployment.d.ts.map +0 -1
- package/dist/api/project/deployment.js +0 -127
- package/dist/api/project/deployment.js.map +0 -1
- package/dist/api/project/env-delete.d.ts.map +0 -1
- package/dist/api/project/env-delete.js.map +0 -1
- package/dist/api/project/env-update.d.ts.map +0 -1
- package/dist/api/project/env-update.js.map +0 -1
- package/dist/api/project/exists.d.ts.map +0 -1
- package/dist/api/project/exists.js.map +0 -1
- package/dist/api/project/get.d.ts.map +0 -1
- package/dist/api/project/get.js.map +0 -1
- package/dist/api/project/hostname.d.ts.map +0 -1
- package/dist/api/project/hostname.js +0 -37
- package/dist/api/project/hostname.js.map +0 -1
- package/dist/api/project/index.d.ts.map +0 -1
- package/dist/api/project/index.js.map +0 -1
- package/dist/api/project/list.d.ts.map +0 -1
- package/dist/api/project/list.js.map +0 -1
- package/dist/api/project/malware.d.ts.map +0 -1
- package/dist/api/project/malware.js +0 -42
- package/dist/api/project/malware.js.map +0 -1
- package/dist/api/project/update-region.d.ts.map +0 -1
- package/dist/api/project/update-region.js.map +0 -1
- package/dist/api/project/util.d.ts.map +0 -1
- package/dist/api/project/util.js.map +0 -1
- package/dist/api/queue/analytics.d.ts +0 -250
- package/dist/api/queue/analytics.d.ts.map +0 -1
- package/dist/api/queue/analytics.js +0 -233
- package/dist/api/queue/analytics.js.map +0 -1
- package/dist/api/queue/destinations.d.ts +0 -202
- package/dist/api/queue/destinations.d.ts.map +0 -1
- package/dist/api/queue/destinations.js +0 -168
- package/dist/api/queue/destinations.js.map +0 -1
- package/dist/api/queue/dlq.d.ts +0 -168
- package/dist/api/queue/dlq.d.ts.map +0 -1
- package/dist/api/queue/dlq.js.map +0 -1
- package/dist/api/queue/index.d.ts +0 -56
- package/dist/api/queue/index.d.ts.map +0 -1
- package/dist/api/queue/index.js +0 -90
- package/dist/api/queue/index.js.map +0 -1
- package/dist/api/queue/messages.d.ts +0 -503
- package/dist/api/queue/messages.d.ts.map +0 -1
- package/dist/api/queue/messages.js.map +0 -1
- package/dist/api/queue/queues.d.ts +0 -226
- package/dist/api/queue/queues.d.ts.map +0 -1
- package/dist/api/queue/queues.js.map +0 -1
- package/dist/api/queue/sources.d.ts +0 -202
- package/dist/api/queue/sources.d.ts.map +0 -1
- package/dist/api/queue/sources.js +0 -202
- package/dist/api/queue/sources.js.map +0 -1
- package/dist/api/queue/types.d.ts +0 -1218
- package/dist/api/queue/types.d.ts.map +0 -1
- package/dist/api/queue/types.js +0 -1002
- package/dist/api/queue/types.js.map +0 -1
- package/dist/api/queue/util.d.ts +0 -278
- package/dist/api/queue/util.d.ts.map +0 -1
- package/dist/api/queue/util.js +0 -233
- package/dist/api/queue/util.js.map +0 -1
- package/dist/api/queue/validation.d.ts +0 -247
- package/dist/api/queue/validation.d.ts.map +0 -1
- package/dist/api/queue/validation.js +0 -513
- package/dist/api/queue/validation.js.map +0 -1
- package/dist/api/queue/websocket.d.ts +0 -172
- package/dist/api/queue/websocket.d.ts.map +0 -1
- package/dist/api/queue/websocket.js +0 -396
- package/dist/api/queue/websocket.js.map +0 -1
- package/dist/api/region/create.d.ts.map +0 -1
- package/dist/api/region/create.js.map +0 -1
- package/dist/api/region/delete.d.ts.map +0 -1
- package/dist/api/region/delete.js.map +0 -1
- package/dist/api/region/index.d.ts.map +0 -1
- package/dist/api/region/index.js.map +0 -1
- package/dist/api/region/list.d.ts.map +0 -1
- package/dist/api/region/list.js.map +0 -1
- package/dist/api/region/resources.d.ts.map +0 -1
- package/dist/api/region/resources.js.map +0 -1
- package/dist/api/region/util.d.ts.map +0 -1
- package/dist/api/region/util.js.map +0 -1
- package/dist/api/sandbox/cli-list.d.ts +0 -114
- package/dist/api/sandbox/cli-list.d.ts.map +0 -1
- package/dist/api/sandbox/cli-list.js +0 -71
- package/dist/api/sandbox/cli-list.js.map +0 -1
- package/dist/api/sandbox/client.d.ts +0 -192
- package/dist/api/sandbox/client.d.ts.map +0 -1
- package/dist/api/sandbox/client.js +0 -262
- package/dist/api/sandbox/client.js.map +0 -1
- package/dist/api/sandbox/create.d.ts +0 -118
- package/dist/api/sandbox/create.d.ts.map +0 -1
- package/dist/api/sandbox/create.js +0 -211
- package/dist/api/sandbox/create.js.map +0 -1
- package/dist/api/sandbox/destroy.d.ts +0 -22
- package/dist/api/sandbox/destroy.d.ts.map +0 -1
- package/dist/api/sandbox/destroy.js +0 -25
- package/dist/api/sandbox/destroy.js.map +0 -1
- package/dist/api/sandbox/disk-checkpoint.d.ts +0 -104
- package/dist/api/sandbox/disk-checkpoint.d.ts.map +0 -1
- package/dist/api/sandbox/disk-checkpoint.js +0 -104
- package/dist/api/sandbox/disk-checkpoint.js.map +0 -1
- package/dist/api/sandbox/execute.d.ts +0 -69
- package/dist/api/sandbox/execute.d.ts.map +0 -1
- package/dist/api/sandbox/execute.js +0 -103
- package/dist/api/sandbox/execute.js.map +0 -1
- package/dist/api/sandbox/execution.d.ts +0 -169
- package/dist/api/sandbox/execution.d.ts.map +0 -1
- package/dist/api/sandbox/execution.js +0 -118
- package/dist/api/sandbox/execution.js.map +0 -1
- package/dist/api/sandbox/files.d.ts +0 -261
- package/dist/api/sandbox/files.d.ts.map +0 -1
- package/dist/api/sandbox/files.js +0 -386
- package/dist/api/sandbox/files.js.map +0 -1
- package/dist/api/sandbox/get.d.ts +0 -283
- package/dist/api/sandbox/get.d.ts.map +0 -1
- package/dist/api/sandbox/get.js +0 -215
- package/dist/api/sandbox/get.js.map +0 -1
- package/dist/api/sandbox/getStatus.d.ts +0 -16
- package/dist/api/sandbox/getStatus.d.ts.map +0 -1
- package/dist/api/sandbox/getStatus.js +0 -32
- package/dist/api/sandbox/getStatus.js.map +0 -1
- package/dist/api/sandbox/index.d.ts +0 -39
- package/dist/api/sandbox/index.d.ts.map +0 -1
- package/dist/api/sandbox/index.js +0 -20
- package/dist/api/sandbox/index.js.map +0 -1
- package/dist/api/sandbox/list.d.ts +0 -293
- package/dist/api/sandbox/list.d.ts.map +0 -1
- package/dist/api/sandbox/list.js +0 -191
- package/dist/api/sandbox/list.js.map +0 -1
- package/dist/api/sandbox/pause.d.ts +0 -22
- package/dist/api/sandbox/pause.d.ts.map +0 -1
- package/dist/api/sandbox/pause.js +0 -25
- package/dist/api/sandbox/pause.js.map +0 -1
- package/dist/api/sandbox/resolve.d.ts +0 -82
- package/dist/api/sandbox/resolve.d.ts.map +0 -1
- package/dist/api/sandbox/resolve.js +0 -71
- package/dist/api/sandbox/resolve.js.map +0 -1
- package/dist/api/sandbox/resume.d.ts +0 -22
- package/dist/api/sandbox/resume.d.ts.map +0 -1
- package/dist/api/sandbox/resume.js +0 -25
- package/dist/api/sandbox/resume.js.map +0 -1
- package/dist/api/sandbox/run.d.ts +0 -28
- package/dist/api/sandbox/run.d.ts.map +0 -1
- package/dist/api/sandbox/run.js +0 -342
- package/dist/api/sandbox/run.js.map +0 -1
- package/dist/api/sandbox/runtime.d.ts +0 -83
- package/dist/api/sandbox/runtime.d.ts.map +0 -1
- package/dist/api/sandbox/runtime.js +0 -78
- package/dist/api/sandbox/runtime.js.map +0 -1
- package/dist/api/sandbox/snapshot-build.d.ts.map +0 -1
- package/dist/api/sandbox/snapshot-build.js.map +0 -1
- package/dist/api/sandbox/snapshot.d.ts +0 -595
- package/dist/api/sandbox/snapshot.d.ts.map +0 -1
- package/dist/api/sandbox/snapshot.js +0 -598
- package/dist/api/sandbox/snapshot.js.map +0 -1
- package/dist/api/sandbox/util.d.ts +0 -284
- package/dist/api/sandbox/util.d.ts.map +0 -1
- package/dist/api/sandbox/util.js +0 -210
- package/dist/api/sandbox/util.js.map +0 -1
- package/dist/api/services/index.d.ts +0 -2
- package/dist/api/services/index.d.ts.map +0 -1
- package/dist/api/services/index.js +0 -2
- package/dist/api/services/index.js.map +0 -1
- package/dist/api/services/stats.d.ts +0 -263
- package/dist/api/services/stats.d.ts.map +0 -1
- package/dist/api/services/stats.js +0 -144
- package/dist/api/services/stats.js.map +0 -1
- package/dist/api/session/get.d.ts +0 -169
- package/dist/api/session/get.d.ts.map +0 -1
- package/dist/api/session/get.js.map +0 -1
- package/dist/api/session/index.d.ts +0 -4
- package/dist/api/session/index.d.ts.map +0 -1
- package/dist/api/session/index.js +0 -4
- package/dist/api/session/index.js.map +0 -1
- package/dist/api/session/list.d.ts +0 -143
- package/dist/api/session/list.d.ts.map +0 -1
- package/dist/api/session/list.js +0 -91
- package/dist/api/session/list.js.map +0 -1
- package/dist/api/session/logs.d.ts.map +0 -1
- package/dist/api/session/logs.js.map +0 -1
- package/dist/api/session/util.d.ts.map +0 -1
- package/dist/api/session/util.js.map +0 -1
- package/dist/api/storage/config.d.ts.map +0 -1
- package/dist/api/storage/config.js.map +0 -1
- package/dist/api/storage/index.d.ts.map +0 -1
- package/dist/api/storage/index.js.map +0 -1
- package/dist/api/storage/objects.d.ts +0 -155
- package/dist/api/storage/objects.d.ts.map +0 -1
- package/dist/api/storage/objects.js +0 -148
- package/dist/api/storage/objects.js.map +0 -1
- package/dist/api/storage/types.d.ts.map +0 -1
- package/dist/api/storage/types.js.map +0 -1
- package/dist/api/storage/util.d.ts.map +0 -1
- package/dist/api/storage/util.js.map +0 -1
- package/dist/api/stream/get.d.ts.map +0 -1
- package/dist/api/stream/get.js.map +0 -1
- package/dist/api/stream/index.d.ts +0 -4
- package/dist/api/stream/index.d.ts.map +0 -1
- package/dist/api/stream/index.js +0 -4
- package/dist/api/stream/index.js.map +0 -1
- package/dist/api/stream/list.d.ts +0 -120
- package/dist/api/stream/list.d.ts.map +0 -1
- package/dist/api/stream/list.js +0 -77
- package/dist/api/stream/list.js.map +0 -1
- package/dist/api/stream/util.d.ts.map +0 -1
- package/dist/api/stream/util.js.map +0 -1
- package/dist/api/thread/delete.d.ts.map +0 -1
- package/dist/api/thread/delete.js.map +0 -1
- package/dist/api/thread/get.d.ts.map +0 -1
- package/dist/api/thread/get.js.map +0 -1
- package/dist/api/thread/index.d.ts.map +0 -1
- package/dist/api/thread/index.js.map +0 -1
- package/dist/api/thread/list.d.ts +0 -69
- package/dist/api/thread/list.d.ts.map +0 -1
- package/dist/api/thread/list.js +0 -51
- package/dist/api/thread/list.js.map +0 -1
- package/dist/api/thread/util.d.ts.map +0 -1
- package/dist/api/thread/util.js.map +0 -1
- package/dist/api/user/index.d.ts.map +0 -1
- package/dist/api/user/index.js.map +0 -1
- package/dist/api/user/util.d.ts.map +0 -1
- package/dist/api/user/util.js.map +0 -1
- package/dist/api/user/whoami.d.ts.map +0 -1
- package/dist/api/user/whoami.js.map +0 -1
- package/dist/api/webhook/deliveries.d.ts +0 -94
- package/dist/api/webhook/deliveries.d.ts.map +0 -1
- package/dist/api/webhook/deliveries.js.map +0 -1
- package/dist/api/webhook/destinations.d.ts +0 -136
- package/dist/api/webhook/destinations.d.ts.map +0 -1
- package/dist/api/webhook/destinations.js.map +0 -1
- package/dist/api/webhook/index.d.ts +0 -41
- package/dist/api/webhook/index.d.ts.map +0 -1
- package/dist/api/webhook/index.js +0 -59
- package/dist/api/webhook/index.js.map +0 -1
- package/dist/api/webhook/receipts.d.ts.map +0 -1
- package/dist/api/webhook/receipts.js.map +0 -1
- package/dist/api/webhook/types.d.ts +0 -249
- package/dist/api/webhook/types.d.ts.map +0 -1
- package/dist/api/webhook/types.js +0 -221
- package/dist/api/webhook/types.js.map +0 -1
- package/dist/api/webhook/util.d.ts.map +0 -1
- package/dist/api/webhook/util.js.map +0 -1
- package/dist/api/webhook/webhooks.d.ts +0 -146
- package/dist/api/webhook/webhooks.d.ts.map +0 -1
- package/dist/api/webhook/webhooks.js.map +0 -1
- package/dist/services/email.d.ts +0 -901
- package/dist/services/email.d.ts.map +0 -1
- package/dist/services/email.js +0 -722
- package/dist/services/email.js.map +0 -1
- package/dist/services/evalrun.d.ts +0 -93
- package/dist/services/evalrun.d.ts.map +0 -1
- package/dist/services/evalrun.js +0 -24
- package/dist/services/evalrun.js.map +0 -1
- package/dist/services/keyvalue.d.ts +0 -283
- package/dist/services/keyvalue.d.ts.map +0 -1
- package/dist/services/keyvalue.js +0 -305
- package/dist/services/keyvalue.js.map +0 -1
- package/dist/services/queue.d.ts +0 -361
- package/dist/services/queue.d.ts.map +0 -1
- package/dist/services/queue.js +0 -308
- package/dist/services/queue.js.map +0 -1
- package/dist/services/sandbox.d.ts +0 -1241
- package/dist/services/sandbox.d.ts.map +0 -1
- package/dist/services/sandbox.js +0 -6
- package/dist/services/sandbox.js.map +0 -1
- package/dist/services/schedule.d.ts +0 -501
- package/dist/services/schedule.d.ts.map +0 -1
- package/dist/services/schedule.js +0 -425
- package/dist/services/schedule.js.map +0 -1
- package/dist/services/session.d.ts +0 -127
- package/dist/services/session.d.ts.map +0 -1
- package/dist/services/session.js +0 -42
- package/dist/services/session.js.map +0 -1
- package/dist/services/stream.d.ts +0 -293
- package/dist/services/stream.d.ts.map +0 -1
- package/dist/services/stream.js +0 -500
- package/dist/services/stream.js.map +0 -1
- package/dist/services/task.d.ts +0 -1337
- package/dist/services/task.d.ts.map +0 -1
- package/dist/services/task.js +0 -1397
- package/dist/services/task.js.map +0 -1
- package/dist/services/vector.d.ts +0 -498
- package/dist/services/vector.d.ts.map +0 -1
- package/dist/services/vector.js +0 -381
- package/dist/services/vector.js.map +0 -1
- package/dist/services/webhook.d.ts +0 -454
- package/dist/services/webhook.d.ts.map +0 -1
- package/dist/services/webhook.js +0 -589
- package/dist/services/webhook.js.map +0 -1
- package/src/api/api.ts +0 -931
- package/src/api/apikey/create.ts +0 -41
- package/src/api/apikey/list.ts +0 -64
- package/src/api/config.ts +0 -60
- package/src/api/db/index.ts +0 -27
- package/src/api/db/query.ts +0 -67
- package/src/api/db/tables.ts +0 -92
- package/src/api/eval/index.ts +0 -28
- package/src/api/index.ts +0 -20
- package/src/api/machine/machine.ts +0 -160
- package/src/api/org/env-get.ts +0 -43
- package/src/api/org/resources.ts +0 -140
- package/src/api/project/delete.ts +0 -25
- package/src/api/project/deploy.ts +0 -458
- package/src/api/project/deployment.ts +0 -195
- package/src/api/project/hostname.ts +0 -73
- package/src/api/project/malware.ts +0 -68
- package/src/api/queue/analytics.ts +0 -311
- package/src/api/queue/destinations.ts +0 -259
- package/src/api/queue/index.ts +0 -308
- package/src/api/queue/sources.ts +0 -294
- package/src/api/queue/types.ts +0 -1325
- package/src/api/queue/util.ts +0 -275
- package/src/api/queue/validation.ts +0 -560
- package/src/api/queue/websocket.ts +0 -521
- package/src/api/sandbox/cli-list.ts +0 -127
- package/src/api/sandbox/client.ts +0 -460
- package/src/api/sandbox/create.ts +0 -256
- package/src/api/sandbox/destroy.ts +0 -41
- package/src/api/sandbox/disk-checkpoint.ts +0 -179
- package/src/api/sandbox/execute.ts +0 -132
- package/src/api/sandbox/execution.ts +0 -183
- package/src/api/sandbox/files.ts +0 -596
- package/src/api/sandbox/get.ts +0 -249
- package/src/api/sandbox/getStatus.ts +0 -54
- package/src/api/sandbox/index.ts +0 -211
- package/src/api/sandbox/list.ts +0 -224
- package/src/api/sandbox/pause.ts +0 -39
- package/src/api/sandbox/resolve.ts +0 -98
- package/src/api/sandbox/resume.ts +0 -39
- package/src/api/sandbox/run.ts +0 -439
- package/src/api/sandbox/runtime.ts +0 -104
- package/src/api/sandbox/snapshot.ts +0 -781
- package/src/api/sandbox/util.ts +0 -275
- package/src/api/services/index.ts +0 -1
- package/src/api/services/stats.ts +0 -213
- package/src/api/session/get.ts +0 -106
- package/src/api/session/index.ts +0 -3
- package/src/api/session/list.ts +0 -136
- package/src/api/storage/objects.ts +0 -250
- package/src/api/stream/index.ts +0 -3
- package/src/api/stream/list.ts +0 -127
- package/src/api/thread/list.ts +0 -76
- package/src/api/webhook/index.ts +0 -133
- package/src/api/webhook/types.ts +0 -309
- package/src/services/email.ts +0 -1410
- package/src/services/keyvalue.ts +0 -620
- package/src/services/queue.ts +0 -603
- package/src/services/sandbox.ts +0 -1466
- package/src/services/schedule.ts +0 -763
- package/src/services/stream.ts +0 -886
- package/src/services/task.ts +0 -2611
- package/src/services/vector.ts +0 -1119
- package/src/services/webhook.ts +0 -921
- /package/dist/{api → services}/apikey/delete.d.ts +0 -0
- /package/dist/{api → services}/apikey/delete.js +0 -0
- /package/dist/{api → services}/apikey/get.d.ts +0 -0
- /package/dist/{api → services}/apikey/get.js +0 -0
- /package/dist/{api → services}/apikey/index.d.ts +0 -0
- /package/dist/{api → services}/apikey/index.js +0 -0
- /package/dist/{api → services}/apikey/util.d.ts +0 -0
- /package/dist/{api → services}/apikey/util.js +0 -0
- /package/dist/{api → services}/db/logs.d.ts +0 -0
- /package/dist/{api → services}/db/logs.js +0 -0
- /package/dist/{api → services}/db/util.d.ts +0 -0
- /package/dist/{api → services}/db/util.js +0 -0
- /package/dist/{api → services}/env.d.ts +0 -0
- /package/dist/{api → services}/env.js +0 -0
- /package/dist/{api → services}/eval/get.d.ts +0 -0
- /package/dist/{api → services}/eval/get.js +0 -0
- /package/dist/{api → services}/eval/list.d.ts +0 -0
- /package/dist/{api → services}/eval/list.js +0 -0
- /package/dist/{api → services}/eval/run-get.d.ts +0 -0
- /package/dist/{api → services}/eval/run-get.js +0 -0
- /package/dist/{api → services}/eval/run-list.d.ts +0 -0
- /package/dist/{api → services}/eval/run-list.js +0 -0
- /package/dist/{api → services}/logger.d.ts +0 -0
- /package/dist/{api → services}/logger.js +0 -0
- /package/dist/{api → services}/machine/index.d.ts +0 -0
- /package/dist/{api → services}/machine/index.js +0 -0
- /package/dist/{api → services}/machine/machine.d.ts +0 -0
- /package/dist/{api → services}/machine/util.d.ts +0 -0
- /package/dist/{api → services}/machine/util.js +0 -0
- /package/dist/{api → services}/org/env-delete.d.ts +0 -0
- /package/dist/{api → services}/org/env-delete.js +0 -0
- /package/dist/{api → services}/org/env-update.d.ts +0 -0
- /package/dist/{api → services}/org/env-update.js +0 -0
- /package/dist/{api → services}/org/index.d.ts +0 -0
- /package/dist/{api → services}/org/index.js +0 -0
- /package/dist/{api → services}/org/list.d.ts +0 -0
- /package/dist/{api → services}/org/list.js +0 -0
- /package/dist/{api → services}/org/util.d.ts +0 -0
- /package/dist/{api → services}/org/util.js +0 -0
- /package/dist/{api → services}/project/agent.d.ts +0 -0
- /package/dist/{api → services}/project/agent.js +0 -0
- /package/dist/{api → services}/project/create.d.ts +0 -0
- /package/dist/{api → services}/project/create.js +0 -0
- /package/dist/{api → services}/project/delete.d.ts +0 -0
- /package/dist/{api → services}/project/deploy.js +0 -0
- /package/dist/{api → services}/project/deployment.d.ts +0 -0
- /package/dist/{api → services}/project/env-delete.d.ts +0 -0
- /package/dist/{api → services}/project/env-delete.js +0 -0
- /package/dist/{api → services}/project/env-update.d.ts +0 -0
- /package/dist/{api → services}/project/env-update.js +0 -0
- /package/dist/{api → services}/project/exists.d.ts +0 -0
- /package/dist/{api → services}/project/exists.js +0 -0
- /package/dist/{api → services}/project/get.d.ts +0 -0
- /package/dist/{api → services}/project/get.js +0 -0
- /package/dist/{api → services}/project/hostname.d.ts +0 -0
- /package/dist/{api → services}/project/index.d.ts +0 -0
- /package/dist/{api → services}/project/index.js +0 -0
- /package/dist/{api → services}/project/list.d.ts +0 -0
- /package/dist/{api → services}/project/list.js +0 -0
- /package/dist/{api → services}/project/malware.d.ts +0 -0
- /package/dist/{api → services}/project/update-region.d.ts +0 -0
- /package/dist/{api → services}/project/update-region.js +0 -0
- /package/dist/{api → services}/project/util.d.ts +0 -0
- /package/dist/{api → services}/project/util.js +0 -0
- /package/dist/{api → services}/queue/dlq.js +0 -0
- /package/dist/{api → services}/queue/messages.js +0 -0
- /package/dist/{api → services}/queue/queues.js +0 -0
- /package/dist/{api → services}/region/create.d.ts +0 -0
- /package/dist/{api → services}/region/create.js +0 -0
- /package/dist/{api → services}/region/delete.d.ts +0 -0
- /package/dist/{api → services}/region/delete.js +0 -0
- /package/dist/{api → services}/region/index.d.ts +0 -0
- /package/dist/{api → services}/region/index.js +0 -0
- /package/dist/{api → services}/region/list.d.ts +0 -0
- /package/dist/{api → services}/region/list.js +0 -0
- /package/dist/{api → services}/region/resources.d.ts +0 -0
- /package/dist/{api → services}/region/resources.js +0 -0
- /package/dist/{api → services}/region/util.d.ts +0 -0
- /package/dist/{api → services}/region/util.js +0 -0
- /package/dist/{api → services}/sandbox/snapshot-build.d.ts +0 -0
- /package/dist/{api → services}/sandbox/snapshot-build.js +0 -0
- /package/dist/{api → services}/session/get.js +0 -0
- /package/dist/{api → services}/session/logs.d.ts +0 -0
- /package/dist/{api → services}/session/logs.js +0 -0
- /package/dist/{api → services}/session/util.d.ts +0 -0
- /package/dist/{api → services}/session/util.js +0 -0
- /package/dist/{api → services}/storage/config.d.ts +0 -0
- /package/dist/{api → services}/storage/config.js +0 -0
- /package/dist/{api → services}/storage/index.d.ts +0 -0
- /package/dist/{api → services}/storage/index.js +0 -0
- /package/dist/{api → services}/storage/types.d.ts +0 -0
- /package/dist/{api → services}/storage/types.js +0 -0
- /package/dist/{api → services}/storage/util.d.ts +0 -0
- /package/dist/{api → services}/storage/util.js +0 -0
- /package/dist/{api → services}/stream/get.d.ts +0 -0
- /package/dist/{api → services}/stream/get.js +0 -0
- /package/dist/{api → services}/stream/util.d.ts +0 -0
- /package/dist/{api → services}/stream/util.js +0 -0
- /package/dist/{api → services}/thread/delete.d.ts +0 -0
- /package/dist/{api → services}/thread/delete.js +0 -0
- /package/dist/{api → services}/thread/get.d.ts +0 -0
- /package/dist/{api → services}/thread/get.js +0 -0
- /package/dist/{api → services}/thread/index.d.ts +0 -0
- /package/dist/{api → services}/thread/index.js +0 -0
- /package/dist/{api → services}/thread/util.d.ts +0 -0
- /package/dist/{api → services}/thread/util.js +0 -0
- /package/dist/{api → services}/user/index.d.ts +0 -0
- /package/dist/{api → services}/user/index.js +0 -0
- /package/dist/{api → services}/user/util.d.ts +0 -0
- /package/dist/{api → services}/user/util.js +0 -0
- /package/dist/{api → services}/user/whoami.d.ts +0 -0
- /package/dist/{api → services}/user/whoami.js +0 -0
- /package/dist/{api → services}/webhook/deliveries.js +0 -0
- /package/dist/{api → services}/webhook/destinations.js +0 -0
- /package/dist/{api → services}/webhook/receipts.d.ts +0 -0
- /package/dist/{api → services}/webhook/receipts.js +0 -0
- /package/dist/{api → services}/webhook/util.d.ts +0 -0
- /package/dist/{api → services}/webhook/util.js +0 -0
- /package/dist/{api → services}/webhook/webhooks.js +0 -0
- /package/src/{api → services}/api-example.md +0 -0
- /package/src/{api → services}/apikey/delete.ts +0 -0
- /package/src/{api → services}/apikey/get.ts +0 -0
- /package/src/{api → services}/apikey/index.ts +0 -0
- /package/src/{api → services}/apikey/util.ts +0 -0
- /package/src/{api → services}/db/logs.ts +0 -0
- /package/src/{api → services}/db/util.ts +0 -0
- /package/src/{api → services}/env.ts +0 -0
- /package/src/services/{evalrun.ts → eval/events.ts} +0 -0
- /package/src/{api → services}/eval/get.ts +0 -0
- /package/src/{api → services}/eval/list.ts +0 -0
- /package/src/{api → services}/eval/run-get.ts +0 -0
- /package/src/{api → services}/eval/run-list.ts +0 -0
- /package/src/{api → services}/logger.ts +0 -0
- /package/src/{api → services}/machine/index.ts +0 -0
- /package/src/{api → services}/machine/util.ts +0 -0
- /package/src/{api → services}/org/env-delete.ts +0 -0
- /package/src/{api → services}/org/env-update.ts +0 -0
- /package/src/{api → services}/org/index.ts +0 -0
- /package/src/{api → services}/org/list.ts +0 -0
- /package/src/{api → services}/org/util.ts +0 -0
- /package/src/{api → services}/project/agent.ts +0 -0
- /package/src/{api → services}/project/create.ts +0 -0
- /package/src/{api → services}/project/env-delete.ts +0 -0
- /package/src/{api → services}/project/env-update.ts +0 -0
- /package/src/{api → services}/project/exists.ts +0 -0
- /package/src/{api → services}/project/get.ts +0 -0
- /package/src/{api → services}/project/index.ts +0 -0
- /package/src/{api → services}/project/list.ts +0 -0
- /package/src/{api → services}/project/update-region.ts +0 -0
- /package/src/{api → services}/project/util.ts +0 -0
- /package/src/{api → services}/queue/dlq.ts +0 -0
- /package/src/{api → services}/queue/messages.ts +0 -0
- /package/src/{api → services}/queue/queues.ts +0 -0
- /package/src/{api → services}/region/create.ts +0 -0
- /package/src/{api → services}/region/delete.ts +0 -0
- /package/src/{api → services}/region/index.ts +0 -0
- /package/src/{api → services}/region/list.ts +0 -0
- /package/src/{api → services}/region/resources.ts +0 -0
- /package/src/{api → services}/region/util.ts +0 -0
- /package/src/{api → services}/sandbox/snapshot-build.ts +0 -0
- /package/src/services/{session.ts → session/events.ts} +0 -0
- /package/src/{api → services}/session/logs.ts +0 -0
- /package/src/{api → services}/session/util.ts +0 -0
- /package/src/{api → services}/storage/config.ts +0 -0
- /package/src/{api → services}/storage/index.ts +0 -0
- /package/src/{api → services}/storage/types.ts +0 -0
- /package/src/{api → services}/storage/util.ts +0 -0
- /package/src/{api → services}/stream/get.ts +0 -0
- /package/src/{api → services}/stream/util.ts +0 -0
- /package/src/{api → services}/thread/delete.ts +0 -0
- /package/src/{api → services}/thread/get.ts +0 -0
- /package/src/{api → services}/thread/index.ts +0 -0
- /package/src/{api → services}/thread/util.ts +0 -0
- /package/src/{api → services}/user/index.ts +0 -0
- /package/src/{api → services}/user/util.ts +0 -0
- /package/src/{api → services}/user/whoami.ts +0 -0
- /package/src/{api → services}/webhook/deliveries.ts +0 -0
- /package/src/{api → services}/webhook/destinations.ts +0 -0
- /package/src/{api → services}/webhook/receipts.ts +0 -0
- /package/src/{api → services}/webhook/util.ts +0 -0
- /package/src/{api → services}/webhook/webhooks.ts +0 -0
|
@@ -0,0 +1,900 @@
|
|
|
1
|
+
import { FetchAdapter } from '../adapter.ts';
|
|
2
|
+
import { buildUrl, toServiceException } from '../_util.ts';
|
|
3
|
+
import { StructuredError } from '../../error.ts';
|
|
4
|
+
import type {
|
|
5
|
+
CreateWebhookDestinationRequest,
|
|
6
|
+
CreateWebhookRequest,
|
|
7
|
+
UpdateWebhookRequest,
|
|
8
|
+
Webhook,
|
|
9
|
+
WebhookDelivery,
|
|
10
|
+
WebhookDestination,
|
|
11
|
+
WebhookOrgAnalytics,
|
|
12
|
+
WebhookReceipt,
|
|
13
|
+
} from './types.ts';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creates an {@link AbortSignal} that will abort after the specified timeout.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Falls back to a manual `AbortController` + `setTimeout` if `AbortSignal.timeout`
|
|
20
|
+
* is not available in the runtime.
|
|
21
|
+
*
|
|
22
|
+
* @param ms - Timeout in milliseconds
|
|
23
|
+
* @returns An abort signal that triggers after `ms` milliseconds
|
|
24
|
+
*
|
|
25
|
+
* @default 30000
|
|
26
|
+
*/
|
|
27
|
+
function createTimeoutSignal(ms = 30_000): AbortSignal {
|
|
28
|
+
if (typeof AbortSignal.timeout === 'function') {
|
|
29
|
+
return AbortSignal.timeout(ms);
|
|
30
|
+
}
|
|
31
|
+
const controller = new AbortController();
|
|
32
|
+
const timer = setTimeout(() => controller.abort(), ms);
|
|
33
|
+
controller.signal.addEventListener('abort', () => clearTimeout(timer), { once: true });
|
|
34
|
+
return controller.signal;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Parameters for creating a new webhook.
|
|
39
|
+
*/
|
|
40
|
+
export type CreateWebhookParams = CreateWebhookRequest;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Parameters for updating a webhook.
|
|
44
|
+
*/
|
|
45
|
+
export type UpdateWebhookParams = UpdateWebhookRequest;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Parameters for creating a new webhook destination.
|
|
49
|
+
*/
|
|
50
|
+
export type CreateWebhookDestinationParams = CreateWebhookDestinationRequest;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Paginated list of webhooks.
|
|
54
|
+
*/
|
|
55
|
+
export type WebhookListResult = {
|
|
56
|
+
/** Array of webhooks. */
|
|
57
|
+
webhooks: Webhook[];
|
|
58
|
+
|
|
59
|
+
/** Total number of webhooks. */
|
|
60
|
+
total: number;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Result of fetching a single webhook, including its configured destinations.
|
|
65
|
+
*/
|
|
66
|
+
export type WebhookGetResult = {
|
|
67
|
+
/** The requested webhook. */
|
|
68
|
+
webhook: Webhook;
|
|
69
|
+
|
|
70
|
+
/** Array of destinations configured for this webhook. */
|
|
71
|
+
destinations: WebhookDestination[];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Result of creating a webhook.
|
|
76
|
+
*/
|
|
77
|
+
export type WebhookCreateResult = {
|
|
78
|
+
/** The newly created webhook. */
|
|
79
|
+
webhook: Webhook;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Result of updating a webhook.
|
|
84
|
+
*/
|
|
85
|
+
export type UpdateWebhookResult = {
|
|
86
|
+
/** The updated webhook. */
|
|
87
|
+
webhook: Webhook;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Result of creating a webhook destination.
|
|
92
|
+
*/
|
|
93
|
+
export type CreateDestinationResult = {
|
|
94
|
+
/** The newly created destination. */
|
|
95
|
+
destination: WebhookDestination;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* List of destinations for a webhook.
|
|
100
|
+
*/
|
|
101
|
+
export type ListDestinationsResult = {
|
|
102
|
+
/** Array of destinations. */
|
|
103
|
+
destinations: WebhookDestination[];
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* List of receipts (incoming requests) for a webhook.
|
|
108
|
+
*/
|
|
109
|
+
export type WebhookReceiptListResult = {
|
|
110
|
+
/** Array of receipt records. */
|
|
111
|
+
receipts: WebhookReceipt[];
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* List of delivery attempts for a webhook.
|
|
116
|
+
*/
|
|
117
|
+
export type WebhookDeliveryListResult = {
|
|
118
|
+
/** Array of delivery records. */
|
|
119
|
+
deliveries: WebhookDelivery[];
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Internal API success response envelope for webhook operations.
|
|
124
|
+
*/
|
|
125
|
+
type WebhookSuccessResponse<T> = {
|
|
126
|
+
success: true;
|
|
127
|
+
data: T;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Internal API error response envelope for webhook operations.
|
|
132
|
+
*/
|
|
133
|
+
type WebhookErrorResponse = {
|
|
134
|
+
success: false;
|
|
135
|
+
message: string;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Discriminated union of API success and error responses for webhook operations.
|
|
140
|
+
*/
|
|
141
|
+
type WebhookResponse<T> = WebhookSuccessResponse<T> | WebhookErrorResponse;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Thrown when the API returns a success HTTP status but the response body indicates failure.
|
|
145
|
+
*/
|
|
146
|
+
const WebhookResponseError = StructuredError('WebhookResponseError')<{
|
|
147
|
+
status: number;
|
|
148
|
+
}>();
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Client for the Agentuity Webhook service.
|
|
152
|
+
*
|
|
153
|
+
* Provides methods for creating and managing webhook endpoints that can receive
|
|
154
|
+
* HTTP requests and forward them to configured destinations. The service supports:
|
|
155
|
+
*
|
|
156
|
+
* - **Webhooks**: Named endpoints with unique ingest URLs
|
|
157
|
+
* - **Destinations**: URL-based targets that receive forwarded payloads
|
|
158
|
+
* - **Receipts**: Records of incoming HTTP requests for auditing
|
|
159
|
+
* - **Deliveries**: Records of forwarding attempts with retry support
|
|
160
|
+
*
|
|
161
|
+
* When an HTTP request hits a webhook's ingest URL, it is recorded as a receipt
|
|
162
|
+
* and then delivered to all configured destinations. Failed deliveries can be
|
|
163
|
+
* retried via {@link WebhookService.retryDelivery}.
|
|
164
|
+
*
|
|
165
|
+
* All methods are instrumented with OpenTelemetry spans for observability.
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* const webhooks = new WebhookService(baseUrl, adapter);
|
|
170
|
+
*
|
|
171
|
+
* // Create a webhook
|
|
172
|
+
* const { webhook } = await webhooks.create({ name: 'GitHub Events' });
|
|
173
|
+
* console.log('Ingest URL:', webhook.url);
|
|
174
|
+
*
|
|
175
|
+
* // Add a destination
|
|
176
|
+
* await webhooks.createDestination(webhook.id, {
|
|
177
|
+
* type: 'url',
|
|
178
|
+
* config: { url: 'https://example.com/handle-github' },
|
|
179
|
+
* });
|
|
180
|
+
*
|
|
181
|
+
* // Check delivery history
|
|
182
|
+
* const { deliveries } = await webhooks.listDeliveries(webhook.id);
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
export class WebhookService {
|
|
186
|
+
#adapter: FetchAdapter;
|
|
187
|
+
#baseUrl: string;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Creates a new WebhookService instance.
|
|
191
|
+
*
|
|
192
|
+
* @param baseUrl - The base URL of the webhook API
|
|
193
|
+
* @param adapter - The HTTP fetch adapter used for making API requests
|
|
194
|
+
*/
|
|
195
|
+
constructor(baseUrl: string, adapter: FetchAdapter) {
|
|
196
|
+
this.#adapter = adapter;
|
|
197
|
+
this.#baseUrl = baseUrl;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Unwrap a potentially nested response envelope. Some API responses wrap the data
|
|
202
|
+
* in an additional `{ data: T }` layer; this method normalizes both shapes.
|
|
203
|
+
*
|
|
204
|
+
* @param raw - The raw response data to unwrap
|
|
205
|
+
* @returns The unwrapped data of type `T`
|
|
206
|
+
*/
|
|
207
|
+
#unwrap<T>(raw: unknown): T {
|
|
208
|
+
if (raw !== null && typeof raw === 'object' && 'data' in raw) {
|
|
209
|
+
return (raw as Record<string, unknown>).data as T;
|
|
210
|
+
}
|
|
211
|
+
return raw as T;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Create a new webhook endpoint.
|
|
216
|
+
*
|
|
217
|
+
* @param params - The webhook creation parameters including name and optional description
|
|
218
|
+
* @returns The newly created webhook with its unique ingest URL
|
|
219
|
+
* @throws {@link ServiceException} if the API request fails
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* const { webhook } = await webhooks.create({
|
|
224
|
+
* name: 'Stripe Events',
|
|
225
|
+
* description: 'Receives payment webhooks from Stripe',
|
|
226
|
+
* });
|
|
227
|
+
* console.log('Ingest URL:', webhook.url);
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
async create(params: CreateWebhookParams): Promise<WebhookCreateResult> {
|
|
231
|
+
const url = buildUrl(this.#baseUrl, '/webhook/create');
|
|
232
|
+
const signal = createTimeoutSignal();
|
|
233
|
+
const res = await this.#adapter.invoke<WebhookResponse<Webhook>>(url, {
|
|
234
|
+
method: 'POST',
|
|
235
|
+
signal,
|
|
236
|
+
body: JSON.stringify(params),
|
|
237
|
+
contentType: 'application/json',
|
|
238
|
+
telemetry: {
|
|
239
|
+
name: 'agentuity.webhook.create',
|
|
240
|
+
attributes: {
|
|
241
|
+
name: params.name,
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
if (res.ok) {
|
|
247
|
+
if (res.data.success) {
|
|
248
|
+
return { webhook: res.data.data };
|
|
249
|
+
}
|
|
250
|
+
throw new WebhookResponseError({ status: res.response.status, message: res.data.message });
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
throw await toServiceException('POST', url, res.response);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* List all webhooks with optional pagination.
|
|
258
|
+
*
|
|
259
|
+
* @param params - Optional pagination parameters
|
|
260
|
+
* @returns Paginated list of webhooks with total count
|
|
261
|
+
* @throws {@link ServiceException} if the API request fails
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```typescript
|
|
265
|
+
* const { webhooks, total } = await webhooks.list({ limit: 10, offset: 0 });
|
|
266
|
+
* console.log(`Showing ${webhooks.length} of ${total} webhooks`);
|
|
267
|
+
* for (const wh of webhooks) {
|
|
268
|
+
* console.log(`${wh.name}: ${wh.url}`);
|
|
269
|
+
* }
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
async list(params?: { limit?: number; offset?: number }): Promise<WebhookListResult> {
|
|
273
|
+
const qs = new URLSearchParams();
|
|
274
|
+
if (params?.limit !== undefined) {
|
|
275
|
+
qs.set('limit', String(params.limit));
|
|
276
|
+
}
|
|
277
|
+
if (params?.offset !== undefined) {
|
|
278
|
+
qs.set('offset', String(params.offset));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const path = qs.toString() ? `/webhook/list?${qs.toString()}` : '/webhook/list';
|
|
282
|
+
const url = buildUrl(this.#baseUrl, path);
|
|
283
|
+
const signal = createTimeoutSignal();
|
|
284
|
+
const res = await this.#adapter.invoke<WebhookResponse<Webhook[]>>(url, {
|
|
285
|
+
method: 'GET',
|
|
286
|
+
signal,
|
|
287
|
+
telemetry: {
|
|
288
|
+
name: 'agentuity.webhook.list',
|
|
289
|
+
attributes: {
|
|
290
|
+
limit: String(params?.limit ?? ''),
|
|
291
|
+
offset: String(params?.offset ?? ''),
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
if (res.ok) {
|
|
297
|
+
if (res.data.success) {
|
|
298
|
+
const unwrapped = this.#unwrap<Webhook[] | { data: Webhook[]; total: number }>(
|
|
299
|
+
res.data.data
|
|
300
|
+
);
|
|
301
|
+
if (Array.isArray(unwrapped)) {
|
|
302
|
+
return { webhooks: unwrapped, total: unwrapped.length };
|
|
303
|
+
}
|
|
304
|
+
const arr = Array.isArray(unwrapped.data) ? unwrapped.data : [];
|
|
305
|
+
return { webhooks: arr, total: unwrapped.total ?? arr.length };
|
|
306
|
+
}
|
|
307
|
+
throw new WebhookResponseError({ status: res.response.status, message: res.data.message });
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
throw await toServiceException('GET', url, res.response);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Get a webhook by its ID, including its configured destinations.
|
|
315
|
+
*
|
|
316
|
+
* @param webhookId - The unique webhook identifier
|
|
317
|
+
* @returns The webhook and its list of destinations
|
|
318
|
+
* @throws {@link ServiceException} if the API request fails
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* ```typescript
|
|
322
|
+
* const { webhook, destinations } = await webhooks.get('wh_abc123');
|
|
323
|
+
* console.log(`${webhook.name} has ${destinations.length} destination(s)`);
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
async get(webhookId: string): Promise<WebhookGetResult> {
|
|
327
|
+
const url = buildUrl(this.#baseUrl, `/webhook/get/${encodeURIComponent(webhookId)}`);
|
|
328
|
+
const signal = createTimeoutSignal();
|
|
329
|
+
const res = await this.#adapter.invoke<WebhookResponse<Webhook>>(url, {
|
|
330
|
+
method: 'GET',
|
|
331
|
+
signal,
|
|
332
|
+
telemetry: {
|
|
333
|
+
name: 'agentuity.webhook.get',
|
|
334
|
+
attributes: {
|
|
335
|
+
webhookId,
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
if (res.ok) {
|
|
341
|
+
if (res.data.success) {
|
|
342
|
+
const { destinations } = await this.listDestinations(webhookId);
|
|
343
|
+
return { webhook: res.data.data, destinations };
|
|
344
|
+
}
|
|
345
|
+
throw new WebhookResponseError({ status: res.response.status, message: res.data.message });
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
throw await toServiceException('GET', url, res.response);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Update a webhook's name and/or description.
|
|
353
|
+
*
|
|
354
|
+
* @param webhookId - The unique webhook identifier
|
|
355
|
+
* @param params - Fields to update; only provided fields are changed
|
|
356
|
+
* @returns The updated webhook
|
|
357
|
+
* @throws {@link ServiceException} if the API request fails
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```typescript
|
|
361
|
+
* const { webhook } = await webhooks.update('wh_abc123', {
|
|
362
|
+
* name: 'GitHub Events (Production)',
|
|
363
|
+
* description: 'Production webhook for GitHub push events',
|
|
364
|
+
* });
|
|
365
|
+
* console.log('Updated:', webhook.name);
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
368
|
+
async update(webhookId: string, params: UpdateWebhookParams): Promise<UpdateWebhookResult> {
|
|
369
|
+
const url = buildUrl(this.#baseUrl, `/webhook/update/${encodeURIComponent(webhookId)}`);
|
|
370
|
+
const signal = createTimeoutSignal();
|
|
371
|
+
const res = await this.#adapter.invoke<WebhookResponse<Webhook>>(url, {
|
|
372
|
+
method: 'PUT',
|
|
373
|
+
signal,
|
|
374
|
+
body: JSON.stringify(params),
|
|
375
|
+
contentType: 'application/json',
|
|
376
|
+
telemetry: {
|
|
377
|
+
name: 'agentuity.webhook.update',
|
|
378
|
+
attributes: {
|
|
379
|
+
webhookId,
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
if (res.ok) {
|
|
385
|
+
if (res.data.success) {
|
|
386
|
+
return { webhook: res.data.data };
|
|
387
|
+
}
|
|
388
|
+
throw new WebhookResponseError({ status: res.response.status, message: res.data.message });
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
throw await toServiceException('PUT', url, res.response);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Delete a webhook and all its associated destinations, receipts, and deliveries.
|
|
396
|
+
*
|
|
397
|
+
* @param webhookId - The unique webhook identifier
|
|
398
|
+
* @throws {@link ServiceException} if the API request fails
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
* ```typescript
|
|
402
|
+
* await webhooks.delete('wh_abc123');
|
|
403
|
+
* console.log('Webhook deleted');
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
async delete(webhookId: string): Promise<void> {
|
|
407
|
+
const url = buildUrl(this.#baseUrl, `/webhook/delete/${encodeURIComponent(webhookId)}`);
|
|
408
|
+
const signal = createTimeoutSignal();
|
|
409
|
+
const res = await this.#adapter.invoke<WebhookResponse<null>>(url, {
|
|
410
|
+
method: 'DELETE',
|
|
411
|
+
signal,
|
|
412
|
+
telemetry: {
|
|
413
|
+
name: 'agentuity.webhook.delete',
|
|
414
|
+
attributes: {
|
|
415
|
+
webhookId,
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
if (res.ok) {
|
|
421
|
+
if (res.data?.success !== false) {
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
throw new WebhookResponseError({
|
|
425
|
+
status: res.response.status,
|
|
426
|
+
message: res.data?.message ?? 'Delete failed',
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
throw await toServiceException('DELETE', url, res.response);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Create a new destination for a webhook. When the webhook receives a request,
|
|
435
|
+
* the payload will be forwarded to this destination.
|
|
436
|
+
*
|
|
437
|
+
* @param webhookId - The ID of the parent webhook
|
|
438
|
+
* @param params - Destination configuration including type and type-specific config
|
|
439
|
+
* @returns The newly created destination
|
|
440
|
+
* @throws {@link ServiceException} if the API request fails
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
* ```typescript
|
|
444
|
+
* const { destination } = await webhooks.createDestination('wh_abc123', {
|
|
445
|
+
* type: 'url',
|
|
446
|
+
* config: {
|
|
447
|
+
* url: 'https://example.com/webhook-handler',
|
|
448
|
+
* headers: { 'X-Custom-Header': 'my-value' },
|
|
449
|
+
* },
|
|
450
|
+
* });
|
|
451
|
+
* console.log('Destination created:', destination.id);
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
454
|
+
async createDestination(
|
|
455
|
+
webhookId: string,
|
|
456
|
+
params: CreateWebhookDestinationParams
|
|
457
|
+
): Promise<CreateDestinationResult> {
|
|
458
|
+
const url = buildUrl(
|
|
459
|
+
this.#baseUrl,
|
|
460
|
+
`/webhook/destination-create/${encodeURIComponent(webhookId)}`
|
|
461
|
+
);
|
|
462
|
+
const signal = createTimeoutSignal();
|
|
463
|
+
const res = await this.#adapter.invoke<WebhookResponse<WebhookDestination>>(url, {
|
|
464
|
+
method: 'POST',
|
|
465
|
+
signal,
|
|
466
|
+
body: JSON.stringify(params),
|
|
467
|
+
contentType: 'application/json',
|
|
468
|
+
telemetry: {
|
|
469
|
+
name: 'agentuity.webhook.createDestination',
|
|
470
|
+
attributes: {
|
|
471
|
+
webhookId,
|
|
472
|
+
type: params.type,
|
|
473
|
+
},
|
|
474
|
+
},
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
if (res.ok) {
|
|
478
|
+
if (res.data.success) {
|
|
479
|
+
return { destination: res.data.data };
|
|
480
|
+
}
|
|
481
|
+
throw new WebhookResponseError({ status: res.response.status, message: res.data.message });
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
throw await toServiceException('POST', url, res.response);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* List all destinations configured for a webhook.
|
|
489
|
+
*
|
|
490
|
+
* @param webhookId - The ID of the webhook
|
|
491
|
+
* @returns List of destinations
|
|
492
|
+
* @throws {@link ServiceException} if the API request fails
|
|
493
|
+
*
|
|
494
|
+
* @example
|
|
495
|
+
* ```typescript
|
|
496
|
+
* const { destinations } = await webhooks.listDestinations('wh_abc123');
|
|
497
|
+
* for (const dest of destinations) {
|
|
498
|
+
* console.log(`${dest.type}: ${JSON.stringify(dest.config)}`);
|
|
499
|
+
* }
|
|
500
|
+
* ```
|
|
501
|
+
*/
|
|
502
|
+
async listDestinations(webhookId: string): Promise<ListDestinationsResult> {
|
|
503
|
+
const url = buildUrl(
|
|
504
|
+
this.#baseUrl,
|
|
505
|
+
`/webhook/destination-list/${encodeURIComponent(webhookId)}`
|
|
506
|
+
);
|
|
507
|
+
const signal = createTimeoutSignal();
|
|
508
|
+
const res = await this.#adapter.invoke<WebhookResponse<WebhookDestination[]>>(url, {
|
|
509
|
+
method: 'GET',
|
|
510
|
+
signal,
|
|
511
|
+
telemetry: {
|
|
512
|
+
name: 'agentuity.webhook.listDestinations',
|
|
513
|
+
attributes: {
|
|
514
|
+
webhookId,
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
if (res.ok) {
|
|
520
|
+
if (res.data.success) {
|
|
521
|
+
return { destinations: Array.isArray(res.data.data) ? res.data.data : [] };
|
|
522
|
+
}
|
|
523
|
+
throw new WebhookResponseError({ status: res.response.status, message: res.data.message });
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
throw await toServiceException('GET', url, res.response);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Delete a destination from a webhook.
|
|
531
|
+
*
|
|
532
|
+
* @param webhookId - The ID of the parent webhook
|
|
533
|
+
* @param destinationId - The ID of the destination to delete
|
|
534
|
+
* @throws {@link ServiceException} if the API request fails
|
|
535
|
+
*
|
|
536
|
+
* @example
|
|
537
|
+
* ```typescript
|
|
538
|
+
* await webhooks.deleteDestination('wh_abc123', 'dest_xyz789');
|
|
539
|
+
* console.log('Destination deleted');
|
|
540
|
+
* ```
|
|
541
|
+
*/
|
|
542
|
+
async deleteDestination(webhookId: string, destinationId: string): Promise<void> {
|
|
543
|
+
const url = buildUrl(
|
|
544
|
+
this.#baseUrl,
|
|
545
|
+
`/webhook/destination-delete/${encodeURIComponent(webhookId)}/${encodeURIComponent(destinationId)}`
|
|
546
|
+
);
|
|
547
|
+
const signal = createTimeoutSignal();
|
|
548
|
+
const res = await this.#adapter.invoke<WebhookResponse<null>>(url, {
|
|
549
|
+
method: 'DELETE',
|
|
550
|
+
signal,
|
|
551
|
+
telemetry: {
|
|
552
|
+
name: 'agentuity.webhook.deleteDestination',
|
|
553
|
+
attributes: {
|
|
554
|
+
webhookId,
|
|
555
|
+
destinationId,
|
|
556
|
+
},
|
|
557
|
+
},
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
if (res.ok) {
|
|
561
|
+
if (res.data?.success !== false) {
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
throw new WebhookResponseError({
|
|
565
|
+
status: res.response.status,
|
|
566
|
+
message: res.data?.message ?? 'Delete destination failed',
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
throw await toServiceException('DELETE', url, res.response);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* List receipts (records of incoming HTTP requests) for a webhook.
|
|
575
|
+
*
|
|
576
|
+
* @param webhookId - The ID of the webhook
|
|
577
|
+
* @param params - Optional pagination parameters
|
|
578
|
+
* @returns List of receipt records
|
|
579
|
+
* @throws {@link ServiceException} if the API request fails
|
|
580
|
+
*
|
|
581
|
+
* @example
|
|
582
|
+
* ```typescript
|
|
583
|
+
* const { receipts } = await webhooks.listReceipts('wh_abc123', {
|
|
584
|
+
* limit: 50,
|
|
585
|
+
* });
|
|
586
|
+
* for (const receipt of receipts) {
|
|
587
|
+
* console.log(`${receipt.date}: ${JSON.stringify(receipt.headers)}`);
|
|
588
|
+
* }
|
|
589
|
+
* ```
|
|
590
|
+
*/
|
|
591
|
+
async listReceipts(
|
|
592
|
+
webhookId: string,
|
|
593
|
+
params?: { limit?: number; offset?: number }
|
|
594
|
+
): Promise<WebhookReceiptListResult> {
|
|
595
|
+
const qs = new URLSearchParams();
|
|
596
|
+
if (params?.limit !== undefined) {
|
|
597
|
+
qs.set('limit', String(params.limit));
|
|
598
|
+
}
|
|
599
|
+
if (params?.offset !== undefined) {
|
|
600
|
+
qs.set('offset', String(params.offset));
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
const basePath = `/webhook/receipt-list/${encodeURIComponent(webhookId)}`;
|
|
604
|
+
const path = qs.toString() ? `${basePath}?${qs.toString()}` : basePath;
|
|
605
|
+
const url = buildUrl(this.#baseUrl, path);
|
|
606
|
+
const signal = createTimeoutSignal();
|
|
607
|
+
const res = await this.#adapter.invoke<WebhookResponse<WebhookReceipt[]>>(url, {
|
|
608
|
+
method: 'GET',
|
|
609
|
+
signal,
|
|
610
|
+
telemetry: {
|
|
611
|
+
name: 'agentuity.webhook.listReceipts',
|
|
612
|
+
attributes: {
|
|
613
|
+
webhookId,
|
|
614
|
+
limit: String(params?.limit ?? ''),
|
|
615
|
+
offset: String(params?.offset ?? ''),
|
|
616
|
+
},
|
|
617
|
+
},
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
if (res.ok) {
|
|
621
|
+
if (res.data.success) {
|
|
622
|
+
return { receipts: Array.isArray(res.data.data) ? res.data.data : [] };
|
|
623
|
+
}
|
|
624
|
+
throw new WebhookResponseError({ status: res.response.status, message: res.data.message });
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
throw await toServiceException('GET', url, res.response);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Get a single receipt by its ID, including the full payload.
|
|
632
|
+
*
|
|
633
|
+
* @param webhookId - The ID of the webhook
|
|
634
|
+
* @param receiptId - The unique receipt identifier
|
|
635
|
+
* @returns The receipt record with headers and payload
|
|
636
|
+
* @throws {@link ServiceException} if the API request fails
|
|
637
|
+
*
|
|
638
|
+
* @example
|
|
639
|
+
* ```typescript
|
|
640
|
+
* const receipt = await webhooks.getReceipt('wh_abc123', 'rcpt_def456');
|
|
641
|
+
* console.log('Payload:', receipt.payload);
|
|
642
|
+
* console.log('Headers:', receipt.headers);
|
|
643
|
+
* ```
|
|
644
|
+
*/
|
|
645
|
+
async getReceipt(webhookId: string, receiptId: string): Promise<WebhookReceipt> {
|
|
646
|
+
const url = buildUrl(
|
|
647
|
+
this.#baseUrl,
|
|
648
|
+
`/webhook/receipt-get/${encodeURIComponent(webhookId)}/${encodeURIComponent(receiptId)}`
|
|
649
|
+
);
|
|
650
|
+
const signal = createTimeoutSignal();
|
|
651
|
+
const res = await this.#adapter.invoke<WebhookResponse<WebhookReceipt>>(url, {
|
|
652
|
+
method: 'GET',
|
|
653
|
+
signal,
|
|
654
|
+
telemetry: {
|
|
655
|
+
name: 'agentuity.webhook.getReceipt',
|
|
656
|
+
attributes: {
|
|
657
|
+
webhookId,
|
|
658
|
+
receiptId,
|
|
659
|
+
},
|
|
660
|
+
},
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
if (res.ok) {
|
|
664
|
+
if (res.data.success) {
|
|
665
|
+
return res.data.data;
|
|
666
|
+
}
|
|
667
|
+
throw new WebhookResponseError({ status: res.response.status, message: res.data.message });
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
throw await toServiceException('GET', url, res.response);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* List delivery attempts for a webhook with optional pagination.
|
|
675
|
+
*
|
|
676
|
+
* @param webhookId - The ID of the webhook
|
|
677
|
+
* @param params - Optional pagination parameters
|
|
678
|
+
* @returns List of delivery records showing forwarding status
|
|
679
|
+
* @throws {@link ServiceException} if the API request fails
|
|
680
|
+
*
|
|
681
|
+
* @example
|
|
682
|
+
* ```typescript
|
|
683
|
+
* const { deliveries } = await webhooks.listDeliveries('wh_abc123');
|
|
684
|
+
* for (const d of deliveries) {
|
|
685
|
+
* console.log(`${d.status} → dest ${d.webhook_destination_id} (retries: ${d.retries})`);
|
|
686
|
+
* }
|
|
687
|
+
* ```
|
|
688
|
+
*/
|
|
689
|
+
async listDeliveries(
|
|
690
|
+
webhookId: string,
|
|
691
|
+
params?: { limit?: number; offset?: number }
|
|
692
|
+
): Promise<WebhookDeliveryListResult> {
|
|
693
|
+
const qs = new URLSearchParams();
|
|
694
|
+
if (params?.limit !== undefined) {
|
|
695
|
+
qs.set('limit', String(params.limit));
|
|
696
|
+
}
|
|
697
|
+
if (params?.offset !== undefined) {
|
|
698
|
+
qs.set('offset', String(params.offset));
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
const basePath = `/webhook/delivery-list/${encodeURIComponent(webhookId)}`;
|
|
702
|
+
const path = qs.toString() ? `${basePath}?${qs.toString()}` : basePath;
|
|
703
|
+
const url = buildUrl(this.#baseUrl, path);
|
|
704
|
+
const signal = createTimeoutSignal();
|
|
705
|
+
const res = await this.#adapter.invoke<WebhookResponse<WebhookDelivery[]>>(url, {
|
|
706
|
+
method: 'GET',
|
|
707
|
+
signal,
|
|
708
|
+
telemetry: {
|
|
709
|
+
name: 'agentuity.webhook.listDeliveries',
|
|
710
|
+
attributes: {
|
|
711
|
+
webhookId,
|
|
712
|
+
limit: String(params?.limit ?? ''),
|
|
713
|
+
offset: String(params?.offset ?? ''),
|
|
714
|
+
},
|
|
715
|
+
},
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
if (res.ok) {
|
|
719
|
+
if (res.data.success) {
|
|
720
|
+
return { deliveries: Array.isArray(res.data.data) ? res.data.data : [] };
|
|
721
|
+
}
|
|
722
|
+
throw new WebhookResponseError({ status: res.response.status, message: res.data.message });
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
throw await toServiceException('GET', url, res.response);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Retry a failed delivery attempt. Only deliveries with `'failed'` status can be retried.
|
|
730
|
+
*
|
|
731
|
+
* @param webhookId - The ID of the parent webhook
|
|
732
|
+
* @param deliveryId - The ID of the failed delivery to retry
|
|
733
|
+
* @throws {@link ServiceException} if the API request fails
|
|
734
|
+
*
|
|
735
|
+
* @example
|
|
736
|
+
* ```typescript
|
|
737
|
+
* // Find and retry failed deliveries
|
|
738
|
+
* const { deliveries } = await webhooks.listDeliveries('wh_abc123');
|
|
739
|
+
* for (const d of deliveries) {
|
|
740
|
+
* if (d.status === 'failed') {
|
|
741
|
+
* await webhooks.retryDelivery('wh_abc123', d.id);
|
|
742
|
+
* console.log('Retrying delivery:', d.id);
|
|
743
|
+
* }
|
|
744
|
+
* }
|
|
745
|
+
* ```
|
|
746
|
+
*/
|
|
747
|
+
async retryDelivery(webhookId: string, deliveryId: string): Promise<void> {
|
|
748
|
+
const url = buildUrl(
|
|
749
|
+
this.#baseUrl,
|
|
750
|
+
`/webhook/delivery-retry/${encodeURIComponent(webhookId)}/${encodeURIComponent(deliveryId)}`
|
|
751
|
+
);
|
|
752
|
+
const signal = createTimeoutSignal();
|
|
753
|
+
const res = await this.#adapter.invoke<WebhookResponse<null>>(url, {
|
|
754
|
+
method: 'POST',
|
|
755
|
+
signal,
|
|
756
|
+
telemetry: {
|
|
757
|
+
name: 'agentuity.webhook.retryDelivery',
|
|
758
|
+
attributes: {
|
|
759
|
+
webhookId,
|
|
760
|
+
deliveryId,
|
|
761
|
+
},
|
|
762
|
+
},
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
if (res.ok) {
|
|
766
|
+
if (res.data?.success !== false) {
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
throw new WebhookResponseError({
|
|
770
|
+
status: res.response.status,
|
|
771
|
+
message: res.data?.message ?? 'Retry delivery failed',
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
throw await toServiceException('POST', url, res.response);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Get org-level webhook analytics summary.
|
|
780
|
+
*
|
|
781
|
+
* Returns total received, delivered, and failed counts for all webhooks
|
|
782
|
+
* in the org within the specified time period.
|
|
783
|
+
*
|
|
784
|
+
* @param options - Analytics options (start, end, granularity)
|
|
785
|
+
* @returns Org-level webhook analytics with period and summary
|
|
786
|
+
* @throws {@link ServiceException} if the API request fails
|
|
787
|
+
*/
|
|
788
|
+
async getOrgAnalytics(options?: {
|
|
789
|
+
start?: string;
|
|
790
|
+
end?: string;
|
|
791
|
+
granularity?: string;
|
|
792
|
+
}): Promise<WebhookOrgAnalytics> {
|
|
793
|
+
const params = new URLSearchParams();
|
|
794
|
+
if (options?.start) params.set('start', options.start);
|
|
795
|
+
if (options?.end) params.set('end', options.end);
|
|
796
|
+
if (options?.granularity) params.set('granularity', options.granularity);
|
|
797
|
+
const query = params.toString();
|
|
798
|
+
const path = query ? `/webhook/analytics/org?${query}` : '/webhook/analytics/org';
|
|
799
|
+
const url = buildUrl(this.#baseUrl, path);
|
|
800
|
+
const signal = createTimeoutSignal();
|
|
801
|
+
const res = await this.#adapter.invoke<
|
|
802
|
+
WebhookResponse<{
|
|
803
|
+
analytics: {
|
|
804
|
+
period: { start: string; end: string };
|
|
805
|
+
summary: { total_received: number; total_delivered: number; total_failed: number };
|
|
806
|
+
};
|
|
807
|
+
}>
|
|
808
|
+
>(url, {
|
|
809
|
+
method: 'GET',
|
|
810
|
+
signal,
|
|
811
|
+
telemetry: { name: 'agentuity.webhook.analytics.org' },
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
if (res.ok) {
|
|
815
|
+
if (res.data.success) {
|
|
816
|
+
const unwrapped = this.#unwrap<{
|
|
817
|
+
analytics: {
|
|
818
|
+
period: { start: string; end: string };
|
|
819
|
+
summary: {
|
|
820
|
+
total_received: number;
|
|
821
|
+
total_delivered: number;
|
|
822
|
+
total_failed: number;
|
|
823
|
+
};
|
|
824
|
+
};
|
|
825
|
+
}>(res.data.data);
|
|
826
|
+
return unwrapped.analytics;
|
|
827
|
+
}
|
|
828
|
+
throw new WebhookResponseError({ status: res.response.status, message: res.data.message });
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
throw await toServiceException('GET', url, res.response);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Get org-level webhook time series data.
|
|
836
|
+
*
|
|
837
|
+
* Returns time-bucketed received, delivered, and failed counts for all webhooks
|
|
838
|
+
* in the org within the specified time period.
|
|
839
|
+
*
|
|
840
|
+
* @param options - Analytics options (start, end, granularity)
|
|
841
|
+
* @returns Webhook time series data with period and series array
|
|
842
|
+
* @throws {@link ServiceException} if the API request fails
|
|
843
|
+
*/
|
|
844
|
+
async getOrgTimeSeries(options?: {
|
|
845
|
+
start?: string;
|
|
846
|
+
end?: string;
|
|
847
|
+
granularity?: string;
|
|
848
|
+
}): Promise<{
|
|
849
|
+
period: { start: string; end: string; granularity?: string };
|
|
850
|
+
series: Array<{ timestamp: string; received: number; delivered: number; failed: number }>;
|
|
851
|
+
}> {
|
|
852
|
+
const params = new URLSearchParams();
|
|
853
|
+
if (options?.start) params.set('start', options.start);
|
|
854
|
+
if (options?.end) params.set('end', options.end);
|
|
855
|
+
if (options?.granularity) params.set('granularity', options.granularity);
|
|
856
|
+
const query = params.toString();
|
|
857
|
+
const path = query
|
|
858
|
+
? `/webhook/analytics/org/timeseries?${query}`
|
|
859
|
+
: '/webhook/analytics/org/timeseries';
|
|
860
|
+
const url = buildUrl(this.#baseUrl, path);
|
|
861
|
+
const signal = createTimeoutSignal();
|
|
862
|
+
const res = await this.#adapter.invoke<
|
|
863
|
+
WebhookResponse<{
|
|
864
|
+
timeseries: {
|
|
865
|
+
period: { start: string; end: string; granularity?: string };
|
|
866
|
+
series: Array<{
|
|
867
|
+
timestamp: string;
|
|
868
|
+
received: number;
|
|
869
|
+
delivered: number;
|
|
870
|
+
failed: number;
|
|
871
|
+
}>;
|
|
872
|
+
};
|
|
873
|
+
}>
|
|
874
|
+
>(url, {
|
|
875
|
+
method: 'GET',
|
|
876
|
+
signal,
|
|
877
|
+
telemetry: { name: 'agentuity.webhook.analytics.org.timeseries' },
|
|
878
|
+
});
|
|
879
|
+
|
|
880
|
+
if (res.ok) {
|
|
881
|
+
if (res.data.success) {
|
|
882
|
+
const unwrapped = this.#unwrap<{
|
|
883
|
+
timeseries: {
|
|
884
|
+
period: { start: string; end: string; granularity?: string };
|
|
885
|
+
series: Array<{
|
|
886
|
+
timestamp: string;
|
|
887
|
+
received: number;
|
|
888
|
+
delivered: number;
|
|
889
|
+
failed: number;
|
|
890
|
+
}>;
|
|
891
|
+
};
|
|
892
|
+
}>(res.data.data);
|
|
893
|
+
return unwrapped.timeseries;
|
|
894
|
+
}
|
|
895
|
+
throw new WebhookResponseError({ status: res.response.status, message: res.data.message });
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
throw await toServiceException('GET', url, res.response);
|
|
899
|
+
}
|
|
900
|
+
}
|