@agentuity/server 1.0.32 → 1.0.33
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/api/api.d.ts +1 -227
- package/dist/api/api.d.ts.map +1 -1
- package/dist/api/api.js +1 -637
- package/dist/api/api.js.map +1 -1
- package/dist/api/index.d.ts +1 -17
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -17
- package/dist/api/index.js.map +1 -1
- package/dist/api/org/env-delete.d.ts +1 -22
- package/dist/api/org/env-delete.d.ts.map +1 -1
- package/dist/api/org/env-delete.js +1 -24
- package/dist/api/org/env-delete.js.map +1 -1
- package/dist/api/org/env-get.d.ts +1 -32
- package/dist/api/org/env-get.d.ts.map +1 -1
- package/dist/api/org/env-get.js +1 -25
- package/dist/api/org/env-get.js.map +1 -1
- package/dist/api/org/env-update.d.ts +1 -23
- package/dist/api/org/env-update.d.ts.map +1 -1
- package/dist/api/org/env-update.js +1 -25
- package/dist/api/org/env-update.js.map +1 -1
- package/dist/api/project/get.d.ts +1 -42
- package/dist/api/project/get.d.ts.map +1 -1
- package/dist/api/project/get.js +1 -35
- package/dist/api/project/get.js.map +1 -1
- package/dist/api/project/list.d.ts +1 -47
- package/dist/api/project/list.d.ts.map +1 -1
- package/dist/api/project/list.js +1 -37
- package/dist/api/project/list.js.map +1 -1
- package/dist/api/project/malware.d.ts +1 -70
- package/dist/api/project/malware.d.ts.map +1 -1
- package/dist/api/project/malware.js +1 -41
- package/dist/api/project/malware.js.map +1 -1
- package/dist/api/region/create.d.ts +1 -80
- package/dist/api/region/create.d.ts.map +1 -1
- package/dist/api/region/create.js +1 -176
- package/dist/api/region/create.js.map +1 -1
- package/dist/api/sandbox/client.d.ts +1 -190
- package/dist/api/sandbox/client.d.ts.map +1 -1
- package/dist/api/sandbox/client.js +1 -260
- package/dist/api/sandbox/client.js.map +1 -1
- package/dist/api/sandbox/pause.d.ts +1 -21
- package/dist/api/sandbox/pause.d.ts.map +1 -1
- package/dist/api/sandbox/pause.js +1 -24
- package/dist/api/sandbox/pause.js.map +1 -1
- package/dist/api/sandbox/resume.d.ts +1 -21
- package/dist/api/sandbox/resume.d.ts.map +1 -1
- package/dist/api/sandbox/resume.js +1 -24
- package/dist/api/sandbox/resume.js.map +1 -1
- package/dist/api/sandbox/util.d.ts +1 -284
- package/dist/api/sandbox/util.d.ts.map +1 -1
- package/dist/api/sandbox/util.js +1 -210
- package/dist/api/sandbox/util.js.map +1 -1
- package/dist/api/user/whoami.d.ts +1 -38
- package/dist/api/user/whoami.d.ts.map +1 -1
- package/dist/api/user/whoami.js +1 -26
- package/dist/api/user/whoami.js.map +1 -1
- package/dist/index.d.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -12
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/api/api.ts +1 -936
- package/src/api/index.ts +1 -17
- package/src/api/org/env-delete.ts +1 -37
- package/src/api/org/env-get.ts +1 -43
- package/src/api/org/env-update.ts +1 -38
- package/src/api/project/get.ts +1 -49
- package/src/api/project/list.ts +1 -54
- package/src/api/project/malware.ts +1 -68
- package/src/api/region/create.ts +1 -207
- package/src/api/sandbox/client.ts +1 -460
- package/src/api/sandbox/pause.ts +1 -39
- package/src/api/sandbox/resume.ts +1 -39
- package/src/api/sandbox/util.ts +1 -276
- package/src/api/user/whoami.ts +1 -32
- package/src/index.ts +3 -30
- 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 +0 -19
- package/dist/api/apikey/delete.d.ts.map +0 -1
- package/dist/api/apikey/delete.js +0 -19
- package/dist/api/apikey/delete.js.map +0 -1
- package/dist/api/apikey/get.d.ts +0 -45
- package/dist/api/apikey/get.d.ts.map +0 -1
- package/dist/api/apikey/get.js +0 -36
- package/dist/api/apikey/get.js.map +0 -1
- package/dist/api/apikey/index.d.ts +0 -6
- package/dist/api/apikey/index.d.ts.map +0 -1
- package/dist/api/apikey/index.js +0 -6
- 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 +0 -23
- package/dist/api/apikey/util.d.ts.map +0 -1
- package/dist/api/apikey/util.js +0 -3
- package/dist/api/apikey/util.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 +0 -70
- package/dist/api/db/logs.d.ts.map +0 -1
- package/dist/api/db/logs.js +0 -59
- 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 +0 -31
- package/dist/api/db/util.d.ts.map +0 -1
- package/dist/api/db/util.js +0 -4
- package/dist/api/db/util.js.map +0 -1
- package/dist/api/eval/get.d.ts +0 -36
- package/dist/api/eval/get.d.ts.map +0 -1
- package/dist/api/eval/get.js +0 -23
- 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 +0 -50
- package/dist/api/eval/list.d.ts.map +0 -1
- package/dist/api/eval/list.js +0 -32
- package/dist/api/eval/list.js.map +0 -1
- package/dist/api/eval/run-get.d.ts +0 -48
- package/dist/api/eval/run-get.d.ts.map +0 -1
- package/dist/api/eval/run-get.js +0 -29
- package/dist/api/eval/run-get.js.map +0 -1
- package/dist/api/eval/run-list.d.ts +0 -70
- package/dist/api/eval/run-list.d.ts.map +0 -1
- package/dist/api/eval/run-list.js +0 -42
- package/dist/api/eval/run-list.js.map +0 -1
- package/dist/api/machine/index.d.ts +0 -3
- package/dist/api/machine/index.d.ts.map +0 -1
- package/dist/api/machine/index.js +0 -3
- package/dist/api/machine/index.js.map +0 -1
- package/dist/api/machine/machine.d.ts +0 -192
- 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 +0 -14
- package/dist/api/machine/util.d.ts.map +0 -1
- package/dist/api/machine/util.js +0 -3
- package/dist/api/machine/util.js.map +0 -1
- package/dist/api/org/index.d.ts +0 -7
- package/dist/api/org/index.d.ts.map +0 -1
- package/dist/api/org/index.js +0 -7
- package/dist/api/org/index.js.map +0 -1
- package/dist/api/org/list.d.ts +0 -27
- package/dist/api/org/list.d.ts.map +0 -1
- package/dist/api/org/list.js +0 -22
- 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 +0 -45
- package/dist/api/org/util.d.ts.map +0 -1
- package/dist/api/org/util.js +0 -4
- package/dist/api/org/util.js.map +0 -1
- package/dist/api/project/agent.d.ts +0 -89
- package/dist/api/project/agent.d.ts.map +0 -1
- package/dist/api/project/agent.js +0 -60
- package/dist/api/project/agent.js.map +0 -1
- package/dist/api/project/create.d.ts +0 -37
- package/dist/api/project/create.d.ts.map +0 -1
- package/dist/api/project/create.js +0 -31
- package/dist/api/project/create.js.map +0 -1
- package/dist/api/project/delete.d.ts +0 -15
- 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 +0 -313
- package/dist/api/project/deploy.js.map +0 -1
- package/dist/api/project/deployment.d.ts +0 -237
- 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 +0 -22
- package/dist/api/project/env-delete.d.ts.map +0 -1
- package/dist/api/project/env-delete.js +0 -29
- package/dist/api/project/env-delete.js.map +0 -1
- package/dist/api/project/env-update.d.ts +0 -31
- package/dist/api/project/env-update.d.ts.map +0 -1
- package/dist/api/project/env-update.js +0 -36
- package/dist/api/project/env-update.js.map +0 -1
- package/dist/api/project/exists.d.ts +0 -25
- package/dist/api/project/exists.d.ts.map +0 -1
- package/dist/api/project/exists.js +0 -45
- package/dist/api/project/exists.js.map +0 -1
- package/dist/api/project/hostname.d.ts +0 -25
- 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 +0 -14
- package/dist/api/project/index.d.ts.map +0 -1
- package/dist/api/project/index.js +0 -14
- package/dist/api/project/index.js.map +0 -1
- package/dist/api/project/update-region.d.ts +0 -27
- package/dist/api/project/update-region.d.ts.map +0 -1
- package/dist/api/project/update-region.js +0 -25
- package/dist/api/project/update-region.js.map +0 -1
- package/dist/api/project/util.d.ts +0 -62
- package/dist/api/project/util.d.ts.map +0 -1
- package/dist/api/project/util.js +0 -6
- 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 +0 -166
- 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 +0 -549
- 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 +0 -321
- 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 -235
- 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 -168
- package/dist/api/queue/websocket.d.ts.map +0 -1
- package/dist/api/queue/websocket.js +0 -394
- package/dist/api/queue/websocket.js.map +0 -1
- package/dist/api/region/delete.d.ts +0 -62
- package/dist/api/region/delete.d.ts.map +0 -1
- package/dist/api/region/delete.js +0 -37
- package/dist/api/region/delete.js.map +0 -1
- package/dist/api/region/index.d.ts +0 -5
- package/dist/api/region/index.d.ts.map +0 -1
- package/dist/api/region/index.js +0 -5
- package/dist/api/region/index.js.map +0 -1
- package/dist/api/region/list.d.ts +0 -27
- package/dist/api/region/list.d.ts.map +0 -1
- package/dist/api/region/list.js +0 -22
- package/dist/api/region/list.js.map +0 -1
- package/dist/api/region/resources.d.ts +0 -71
- package/dist/api/region/resources.d.ts.map +0 -1
- package/dist/api/region/resources.js +0 -53
- package/dist/api/region/resources.js.map +0 -1
- package/dist/api/region/util.d.ts +0 -23
- package/dist/api/region/util.d.ts.map +0 -1
- package/dist/api/region/util.js +0 -3
- 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/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/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/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 +0 -48
- package/dist/api/sandbox/snapshot-build.d.ts.map +0 -1
- package/dist/api/sandbox/snapshot-build.js +0 -74
- 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/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 +0 -56
- 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 +0 -40
- package/dist/api/session/logs.d.ts.map +0 -1
- package/dist/api/session/logs.js +0 -28
- package/dist/api/session/logs.js.map +0 -1
- package/dist/api/session/util.d.ts +0 -23
- package/dist/api/session/util.d.ts.map +0 -1
- package/dist/api/session/util.js +0 -3
- package/dist/api/session/util.js.map +0 -1
- package/dist/api/storage/config.d.ts +0 -99
- package/dist/api/storage/config.d.ts.map +0 -1
- package/dist/api/storage/config.js +0 -61
- package/dist/api/storage/config.js.map +0 -1
- package/dist/api/storage/index.d.ts +0 -5
- package/dist/api/storage/index.d.ts.map +0 -1
- package/dist/api/storage/index.js +0 -5
- 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 +0 -161
- package/dist/api/storage/types.d.ts.map +0 -1
- package/dist/api/storage/types.js +0 -141
- package/dist/api/storage/types.js.map +0 -1
- package/dist/api/storage/util.d.ts +0 -48
- package/dist/api/storage/util.d.ts.map +0 -1
- package/dist/api/storage/util.js +0 -8
- package/dist/api/storage/util.js.map +0 -1
- package/dist/api/stream/get.d.ts +0 -58
- package/dist/api/stream/get.d.ts.map +0 -1
- package/dist/api/stream/get.js +0 -40
- 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 +0 -23
- package/dist/api/stream/util.d.ts.map +0 -1
- package/dist/api/stream/util.js +0 -3
- package/dist/api/stream/util.js.map +0 -1
- package/dist/api/thread/delete.d.ts +0 -23
- package/dist/api/thread/delete.d.ts.map +0 -1
- package/dist/api/thread/delete.js +0 -21
- package/dist/api/thread/delete.js.map +0 -1
- package/dist/api/thread/get.d.ts +0 -36
- package/dist/api/thread/get.d.ts.map +0 -1
- package/dist/api/thread/get.js +0 -23
- package/dist/api/thread/get.js.map +0 -1
- package/dist/api/thread/index.d.ts +0 -5
- package/dist/api/thread/index.d.ts.map +0 -1
- package/dist/api/thread/index.js +0 -5
- 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 +0 -23
- package/dist/api/thread/util.d.ts.map +0 -1
- package/dist/api/thread/util.js +0 -3
- package/dist/api/thread/util.js.map +0 -1
- package/dist/api/user/index.d.ts +0 -2
- package/dist/api/user/index.d.ts.map +0 -1
- package/dist/api/user/index.js +0 -2
- package/dist/api/user/index.js.map +0 -1
- package/dist/api/user/util.d.ts +0 -23
- package/dist/api/user/util.d.ts.map +0 -1
- package/dist/api/user/util.js +0 -3
- package/dist/api/user/util.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 +0 -79
- 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 +0 -137
- 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 +0 -77
- package/dist/api/webhook/receipts.d.ts.map +0 -1
- package/dist/api/webhook/receipts.js +0 -78
- 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 +0 -202
- package/dist/api/webhook/util.d.ts.map +0 -1
- package/dist/api/webhook/util.js +0 -201
- 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 +0 -165
- package/dist/api/webhook/webhooks.js.map +0 -1
- package/src/api/api-example.md +0 -164
- package/src/api/apikey/create.ts +0 -41
- package/src/api/apikey/delete.ts +0 -30
- package/src/api/apikey/get.ts +0 -48
- package/src/api/apikey/index.ts +0 -5
- package/src/api/apikey/list.ts +0 -64
- package/src/api/apikey/util.ts +0 -3
- package/src/api/db/index.ts +0 -27
- package/src/api/db/logs.ts +0 -75
- package/src/api/db/query.ts +0 -67
- package/src/api/db/tables.ts +0 -92
- package/src/api/db/util.ts +0 -9
- package/src/api/eval/get.ts +0 -33
- package/src/api/eval/index.ts +0 -28
- package/src/api/eval/list.ts +0 -49
- package/src/api/eval/run-get.ts +0 -39
- package/src/api/eval/run-list.ts +0 -59
- package/src/api/machine/index.ts +0 -2
- package/src/api/machine/machine.ts +0 -160
- package/src/api/machine/util.ts +0 -5
- package/src/api/org/index.ts +0 -6
- package/src/api/org/list.ts +0 -28
- package/src/api/org/resources.ts +0 -140
- package/src/api/org/util.ts +0 -4
- package/src/api/project/agent.ts +0 -86
- package/src/api/project/create.ts +0 -47
- 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/env-delete.ts +0 -45
- package/src/api/project/env-update.ts +0 -55
- package/src/api/project/exists.ts +0 -58
- package/src/api/project/hostname.ts +0 -73
- package/src/api/project/index.ts +0 -13
- package/src/api/project/update-region.ts +0 -44
- package/src/api/project/util.ts +0 -8
- package/src/api/queue/analytics.ts +0 -311
- package/src/api/queue/destinations.ts +0 -259
- package/src/api/queue/dlq.ts +0 -243
- package/src/api/queue/index.ts +0 -308
- package/src/api/queue/messages.ts +0 -784
- package/src/api/queue/queues.ts +0 -460
- package/src/api/queue/sources.ts +0 -294
- package/src/api/queue/types.ts +0 -1325
- package/src/api/queue/util.ts +0 -278
- package/src/api/queue/validation.ts +0 -560
- package/src/api/queue/websocket.ts +0 -514
- package/src/api/region/delete.ts +0 -57
- package/src/api/region/index.ts +0 -4
- package/src/api/region/list.ts +0 -32
- package/src/api/region/resources.ts +0 -69
- package/src/api/region/util.ts +0 -3
- package/src/api/sandbox/cli-list.ts +0 -127
- 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/resolve.ts +0 -98
- package/src/api/sandbox/run.ts +0 -439
- package/src/api/sandbox/runtime.ts +0 -100
- package/src/api/sandbox/snapshot-build.ts +0 -98
- package/src/api/sandbox/snapshot.ts +0 -781
- 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/session/logs.ts +0 -47
- package/src/api/session/util.ts +0 -3
- package/src/api/storage/config.ts +0 -111
- package/src/api/storage/index.ts +0 -4
- package/src/api/storage/objects.ts +0 -250
- package/src/api/storage/types.ts +0 -174
- package/src/api/storage/util.ts +0 -10
- package/src/api/stream/get.ts +0 -51
- package/src/api/stream/index.ts +0 -3
- package/src/api/stream/list.ts +0 -127
- package/src/api/stream/util.ts +0 -3
- package/src/api/thread/delete.ts +0 -31
- package/src/api/thread/get.ts +0 -34
- package/src/api/thread/index.ts +0 -4
- package/src/api/thread/list.ts +0 -76
- package/src/api/thread/util.ts +0 -3
- package/src/api/user/index.ts +0 -1
- package/src/api/user/util.ts +0 -3
- package/src/api/webhook/deliveries.ts +0 -129
- package/src/api/webhook/destinations.ts +0 -224
- package/src/api/webhook/index.ts +0 -133
- package/src/api/webhook/receipts.ts +0 -124
- package/src/api/webhook/types.ts +0 -309
- package/src/api/webhook/util.ts +0 -237
- package/src/api/webhook/webhooks.ts +0 -260
|
@@ -1,781 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { type APIClient, APIResponseSchema, APIResponseSchemaNoData } from '../api.ts';
|
|
3
|
-
import { NPM_PACKAGE_NAME_PATTERN } from './snapshot-build.ts';
|
|
4
|
-
import { API_VERSION, SandboxResponseError, throwSandboxError } from './util.ts';
|
|
5
|
-
|
|
6
|
-
export const SnapshotFileInfoSchema = z
|
|
7
|
-
.object({
|
|
8
|
-
path: z.string().describe('File path within the snapshot'),
|
|
9
|
-
size: z.number().describe('File size in bytes'),
|
|
10
|
-
sha256: z.string().describe('SHA256 hash of the file contents'),
|
|
11
|
-
contentType: z.string().describe('MIME type of the file'),
|
|
12
|
-
mode: z.number().describe('Unix file mode/permissions (e.g., 0o644)'),
|
|
13
|
-
})
|
|
14
|
-
.describe('Information about a file in a snapshot');
|
|
15
|
-
|
|
16
|
-
export const SnapshotOrgInfoSchema = z
|
|
17
|
-
.object({
|
|
18
|
-
id: z.string().describe('Organization ID'),
|
|
19
|
-
name: z.string().describe('Organization name'),
|
|
20
|
-
slug: z.string().nullable().optional().describe('Organization slug for building full name'),
|
|
21
|
-
})
|
|
22
|
-
.describe('Organization information for public snapshots');
|
|
23
|
-
|
|
24
|
-
export const SnapshotUserInfoSchema = z
|
|
25
|
-
.object({
|
|
26
|
-
id: z.string().describe('User ID'),
|
|
27
|
-
firstName: z.string().nullable().optional().describe('User first name'),
|
|
28
|
-
lastName: z.string().nullable().optional().describe('User last name'),
|
|
29
|
-
})
|
|
30
|
-
.describe('User information for private snapshots');
|
|
31
|
-
|
|
32
|
-
export const SnapshotInfoSchema = z
|
|
33
|
-
.object({
|
|
34
|
-
snapshotId: z.string().describe('Unique identifier for the snapshot'),
|
|
35
|
-
runtimeId: z
|
|
36
|
-
.string()
|
|
37
|
-
.nullable()
|
|
38
|
-
.optional()
|
|
39
|
-
.describe('Runtime ID associated with this snapshot'),
|
|
40
|
-
name: z
|
|
41
|
-
.string()
|
|
42
|
-
.describe(
|
|
43
|
-
'Display name for the snapshot (URL-safe: letters, numbers, underscores, dashes)'
|
|
44
|
-
),
|
|
45
|
-
fullName: z
|
|
46
|
-
.string()
|
|
47
|
-
.optional()
|
|
48
|
-
.describe('Full name with org slug for public snapshots (@slug/name:tag)'),
|
|
49
|
-
description: z.string().nullable().optional().describe('Description of the snapshot'),
|
|
50
|
-
message: z.string().nullable().optional().describe('Build message for the snapshot'),
|
|
51
|
-
tag: z.string().nullable().optional().describe('Tag for the snapshot (defaults to "latest")'),
|
|
52
|
-
sizeBytes: z.number().describe('Total size of the snapshot in bytes'),
|
|
53
|
-
fileCount: z.number().describe('Number of files in the snapshot'),
|
|
54
|
-
parentSnapshotId: z
|
|
55
|
-
.string()
|
|
56
|
-
.nullable()
|
|
57
|
-
.optional()
|
|
58
|
-
.describe('ID of the parent snapshot (for incremental snapshots)'),
|
|
59
|
-
public: z.boolean().optional().describe('Whether the snapshot is publicly accessible'),
|
|
60
|
-
orgName: z.string().optional().describe('Organization name (for public snapshots)'),
|
|
61
|
-
orgSlug: z.string().optional().describe('Organization slug (for public snapshots)'),
|
|
62
|
-
org: SnapshotOrgInfoSchema.nullable()
|
|
63
|
-
.optional()
|
|
64
|
-
.describe('Organization details (for public snapshots)'),
|
|
65
|
-
user: SnapshotUserInfoSchema.nullable()
|
|
66
|
-
.optional()
|
|
67
|
-
.describe('User who pushed the snapshot (for private snapshots)'),
|
|
68
|
-
createdAt: z.string().describe('ISO timestamp when the snapshot was created'),
|
|
69
|
-
downloadUrl: z.string().optional().describe('URL to download the snapshot archive'),
|
|
70
|
-
files: z
|
|
71
|
-
.array(SnapshotFileInfoSchema)
|
|
72
|
-
.nullable()
|
|
73
|
-
.optional()
|
|
74
|
-
.describe('List of files in the snapshot'),
|
|
75
|
-
userMetadata: z
|
|
76
|
-
.record(z.string(), z.string())
|
|
77
|
-
.nullable()
|
|
78
|
-
.optional()
|
|
79
|
-
.describe('User-defined metadata key-value pairs'),
|
|
80
|
-
})
|
|
81
|
-
.describe('Detailed information about a snapshot');
|
|
82
|
-
|
|
83
|
-
export const SnapshotCreateResponseSchema = APIResponseSchema(SnapshotInfoSchema);
|
|
84
|
-
export const SnapshotGetResponseSchema = APIResponseSchema(SnapshotInfoSchema);
|
|
85
|
-
export const SnapshotListDataSchema = z
|
|
86
|
-
.object({
|
|
87
|
-
snapshots: z.array(SnapshotInfoSchema).describe('List of snapshot entries'),
|
|
88
|
-
total: z.number().describe('Total number of snapshots matching the query'),
|
|
89
|
-
})
|
|
90
|
-
.describe('Paginated list of snapshots');
|
|
91
|
-
export const SnapshotListResponseSchema = APIResponseSchema(SnapshotListDataSchema);
|
|
92
|
-
export const SnapshotDeleteResponseSchema = APIResponseSchemaNoData();
|
|
93
|
-
|
|
94
|
-
export const SnapshotLineageEntrySchema = z
|
|
95
|
-
.object({
|
|
96
|
-
snapshotId: z.string().describe('Unique identifier for the snapshot'),
|
|
97
|
-
name: z
|
|
98
|
-
.string()
|
|
99
|
-
.describe(
|
|
100
|
-
'Display name for the snapshot (URL-safe: letters, numbers, underscores, dashes)'
|
|
101
|
-
),
|
|
102
|
-
fullName: z
|
|
103
|
-
.string()
|
|
104
|
-
.optional()
|
|
105
|
-
.describe('Full name with org slug for public snapshots (@slug/name:tag)'),
|
|
106
|
-
message: z.string().nullable().optional().describe('Build message for the snapshot'),
|
|
107
|
-
tag: z.string().nullable().optional().describe('Tag for the snapshot'),
|
|
108
|
-
parentSnapshotId: z
|
|
109
|
-
.string()
|
|
110
|
-
.nullable()
|
|
111
|
-
.optional()
|
|
112
|
-
.describe('ID of the parent snapshot in the lineage'),
|
|
113
|
-
public: z.boolean().describe('Whether the snapshot is publicly accessible'),
|
|
114
|
-
deleted: z.boolean().optional().describe('Whether the snapshot has been deleted'),
|
|
115
|
-
org: SnapshotOrgInfoSchema.nullable()
|
|
116
|
-
.optional()
|
|
117
|
-
.describe('Organization details (for public snapshots)'),
|
|
118
|
-
user: SnapshotUserInfoSchema.nullable()
|
|
119
|
-
.optional()
|
|
120
|
-
.describe('User who pushed the snapshot (for private snapshots)'),
|
|
121
|
-
createdAt: z.string().describe('ISO timestamp when the snapshot was created'),
|
|
122
|
-
})
|
|
123
|
-
.describe('A single entry in the snapshot lineage chain');
|
|
124
|
-
|
|
125
|
-
export const SnapshotLineageDataSchema = z
|
|
126
|
-
.object({
|
|
127
|
-
lineage: z.array(SnapshotLineageEntrySchema).describe('Ordered list of snapshots in lineage'),
|
|
128
|
-
total: z.number().describe('Total number of snapshots in the lineage'),
|
|
129
|
-
})
|
|
130
|
-
.describe('Snapshot lineage response');
|
|
131
|
-
|
|
132
|
-
export const SnapshotLineageResponseSchema = APIResponseSchema(SnapshotLineageDataSchema);
|
|
133
|
-
|
|
134
|
-
export type SnapshotFileInfo = z.infer<typeof SnapshotFileInfoSchema>;
|
|
135
|
-
export type SnapshotInfo = z.infer<typeof SnapshotInfoSchema>;
|
|
136
|
-
export type SnapshotListResponse = z.infer<typeof SnapshotListDataSchema>;
|
|
137
|
-
export type SnapshotLineageEntry = z.infer<typeof SnapshotLineageEntrySchema>;
|
|
138
|
-
export type SnapshotLineageResponse = z.infer<typeof SnapshotLineageDataSchema>;
|
|
139
|
-
|
|
140
|
-
const _SnapshotCreateParamsSchema = z
|
|
141
|
-
.object({
|
|
142
|
-
sandboxId: z.string().describe('ID of the sandbox to snapshot'),
|
|
143
|
-
name: z.string().optional().describe('Display name for the snapshot'),
|
|
144
|
-
description: z.string().optional().describe('Description of the snapshot'),
|
|
145
|
-
tag: z.string().optional().describe('Tag for the snapshot'),
|
|
146
|
-
public: z
|
|
147
|
-
.boolean()
|
|
148
|
-
.optional()
|
|
149
|
-
.describe('Whether to make the snapshot publicly accessible (default: false)'),
|
|
150
|
-
orgId: z.string().optional().describe('Organization ID'),
|
|
151
|
-
})
|
|
152
|
-
.describe('Parameters for creating a snapshot');
|
|
153
|
-
|
|
154
|
-
const _SnapshotGetParamsSchema = z
|
|
155
|
-
.object({
|
|
156
|
-
snapshotId: z.string().describe('ID of the snapshot to retrieve'),
|
|
157
|
-
orgId: z.string().optional().describe('Organization ID'),
|
|
158
|
-
})
|
|
159
|
-
.describe('Parameters for getting a snapshot');
|
|
160
|
-
|
|
161
|
-
const _SnapshotListParamsSchema = z
|
|
162
|
-
.object({
|
|
163
|
-
sandboxId: z.string().optional().describe('Filter by sandbox ID'),
|
|
164
|
-
limit: z.number().optional().describe('Maximum number of snapshots to return'),
|
|
165
|
-
offset: z.number().optional().describe('Number of snapshots to skip'),
|
|
166
|
-
sort: z.string().optional().describe('Field to sort by'),
|
|
167
|
-
direction: z.enum(['asc', 'desc']).optional().describe('Sort direction (asc or desc)'),
|
|
168
|
-
orgId: z.string().optional().describe('Organization ID'),
|
|
169
|
-
})
|
|
170
|
-
.describe('Parameters for listing snapshots');
|
|
171
|
-
|
|
172
|
-
const _SnapshotDeleteParamsSchema = z
|
|
173
|
-
.object({
|
|
174
|
-
snapshotId: z.string().describe('ID of the snapshot to delete'),
|
|
175
|
-
orgId: z.string().optional().describe('Organization ID'),
|
|
176
|
-
})
|
|
177
|
-
.describe('Parameters for deleting a snapshot');
|
|
178
|
-
|
|
179
|
-
const _SnapshotTagParamsSchema = z
|
|
180
|
-
.object({
|
|
181
|
-
snapshotId: z.string().describe('ID of the snapshot to tag'),
|
|
182
|
-
tag: z.string().nullable().describe('New tag (or null to remove)'),
|
|
183
|
-
orgId: z.string().optional().describe('Organization ID'),
|
|
184
|
-
})
|
|
185
|
-
.describe('Parameters for tagging a snapshot');
|
|
186
|
-
|
|
187
|
-
const _SnapshotLineageParamsSchema = z
|
|
188
|
-
.object({
|
|
189
|
-
snapshot: z
|
|
190
|
-
.string()
|
|
191
|
-
.optional()
|
|
192
|
-
.describe(
|
|
193
|
-
'Snapshot ID or name:tag to start lineage from (e.g., "sss_xxx" or "myimage:v1")'
|
|
194
|
-
),
|
|
195
|
-
name: z
|
|
196
|
-
.string()
|
|
197
|
-
.optional()
|
|
198
|
-
.describe('Snapshot name to start lineage from (uses latest if tag not specified)'),
|
|
199
|
-
tag: z.string().optional().describe('Tag to use with name parameter'),
|
|
200
|
-
limit: z
|
|
201
|
-
.number()
|
|
202
|
-
.optional()
|
|
203
|
-
.describe('Maximum number of snapshots to return in lineage (default: 100, max: 1000)'),
|
|
204
|
-
orgId: z.string().optional().describe('Organization ID'),
|
|
205
|
-
})
|
|
206
|
-
.describe('Parameters for getting snapshot lineage');
|
|
207
|
-
|
|
208
|
-
export type SnapshotCreateParams = z.infer<typeof _SnapshotCreateParamsSchema>;
|
|
209
|
-
export type SnapshotGetParams = z.infer<typeof _SnapshotGetParamsSchema>;
|
|
210
|
-
export type SnapshotListParams = z.infer<typeof _SnapshotListParamsSchema>;
|
|
211
|
-
export type SnapshotDeleteParams = z.infer<typeof _SnapshotDeleteParamsSchema>;
|
|
212
|
-
export type SnapshotTagParams = z.infer<typeof _SnapshotTagParamsSchema>;
|
|
213
|
-
export type SnapshotLineageParams = z.infer<typeof _SnapshotLineageParamsSchema>;
|
|
214
|
-
|
|
215
|
-
function buildQueryString(params: Record<string, string | number | undefined>): string {
|
|
216
|
-
const query = new URLSearchParams();
|
|
217
|
-
for (const [key, value] of Object.entries(params)) {
|
|
218
|
-
if (value !== undefined) {
|
|
219
|
-
query.set(key, String(value));
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
const str = query.toString();
|
|
223
|
-
return str ? `?${str}` : '';
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Creates a snapshot of a sandbox's current state.
|
|
228
|
-
*
|
|
229
|
-
* @param client - The API client to use for the request
|
|
230
|
-
* @param params - Parameters including sandbox ID and optional tag
|
|
231
|
-
* @returns The created snapshot information
|
|
232
|
-
* @throws {SandboxResponseError} If the snapshot creation fails
|
|
233
|
-
*/
|
|
234
|
-
export async function snapshotCreate(
|
|
235
|
-
client: APIClient,
|
|
236
|
-
params: SnapshotCreateParams
|
|
237
|
-
): Promise<SnapshotInfo> {
|
|
238
|
-
const { sandboxId, name, description, tag, public: isPublic, orgId } = params;
|
|
239
|
-
const queryString = buildQueryString({ orgId });
|
|
240
|
-
const url = `/sandbox/${API_VERSION}/${sandboxId}/snapshot${queryString}`;
|
|
241
|
-
|
|
242
|
-
const body: Record<string, string | boolean> = {};
|
|
243
|
-
if (name) {
|
|
244
|
-
body.name = name;
|
|
245
|
-
}
|
|
246
|
-
if (description) {
|
|
247
|
-
body.description = description;
|
|
248
|
-
}
|
|
249
|
-
if (tag) {
|
|
250
|
-
body.tag = tag;
|
|
251
|
-
}
|
|
252
|
-
if (isPublic !== undefined) {
|
|
253
|
-
body.public = isPublic;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
const resp = await client.post<z.infer<typeof SnapshotCreateResponseSchema>>(
|
|
257
|
-
url,
|
|
258
|
-
body,
|
|
259
|
-
SnapshotCreateResponseSchema
|
|
260
|
-
);
|
|
261
|
-
|
|
262
|
-
if (resp.success) {
|
|
263
|
-
return resp.data;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
throwSandboxError(resp, {});
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Retrieves detailed information about a specific snapshot.
|
|
271
|
-
*
|
|
272
|
-
* @param client - The API client to use for the request
|
|
273
|
-
* @param params - Parameters including the snapshot ID
|
|
274
|
-
* @returns Snapshot information including files and download URL
|
|
275
|
-
* @throws {SandboxResponseError} If the snapshot is not found or request fails
|
|
276
|
-
*/
|
|
277
|
-
export async function snapshotGet(
|
|
278
|
-
client: APIClient,
|
|
279
|
-
params: SnapshotGetParams
|
|
280
|
-
): Promise<SnapshotInfo> {
|
|
281
|
-
const { snapshotId, orgId } = params;
|
|
282
|
-
const queryString = buildQueryString({ orgId });
|
|
283
|
-
const url = `/sandbox/${API_VERSION}/snapshots/${snapshotId}${queryString}`;
|
|
284
|
-
|
|
285
|
-
const resp = await client.get<z.infer<typeof SnapshotGetResponseSchema>>(
|
|
286
|
-
url,
|
|
287
|
-
SnapshotGetResponseSchema
|
|
288
|
-
);
|
|
289
|
-
|
|
290
|
-
if (resp.success) {
|
|
291
|
-
return resp.data;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
throwSandboxError(resp, {});
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Lists snapshots with optional filtering and pagination.
|
|
299
|
-
*
|
|
300
|
-
* @param client - The API client to use for the request
|
|
301
|
-
* @param params - Optional parameters for filtering by sandbox and pagination
|
|
302
|
-
* @returns Paginated list of snapshots with total count
|
|
303
|
-
* @throws {SandboxResponseError} If the request fails
|
|
304
|
-
*/
|
|
305
|
-
export async function snapshotList(
|
|
306
|
-
client: APIClient,
|
|
307
|
-
params: SnapshotListParams = {}
|
|
308
|
-
): Promise<SnapshotListResponse> {
|
|
309
|
-
const { sandboxId, limit, offset, sort, direction, orgId } = params;
|
|
310
|
-
const queryString = buildQueryString({ sandboxId, limit, offset, sort, direction, orgId });
|
|
311
|
-
const url = `/sandbox/${API_VERSION}/snapshots${queryString}`;
|
|
312
|
-
|
|
313
|
-
const resp = await client.get<z.infer<typeof SnapshotListResponseSchema>>(
|
|
314
|
-
url,
|
|
315
|
-
SnapshotListResponseSchema
|
|
316
|
-
);
|
|
317
|
-
|
|
318
|
-
if (resp.success) {
|
|
319
|
-
return resp.data;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
throwSandboxError(resp, {});
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Deletes a snapshot and releases its storage.
|
|
327
|
-
*
|
|
328
|
-
* @param client - The API client to use for the request
|
|
329
|
-
* @param params - Parameters including the snapshot ID to delete
|
|
330
|
-
* @throws {SandboxResponseError} If the snapshot is not found or deletion fails
|
|
331
|
-
*/
|
|
332
|
-
export async function snapshotDelete(
|
|
333
|
-
client: APIClient,
|
|
334
|
-
params: SnapshotDeleteParams
|
|
335
|
-
): Promise<void> {
|
|
336
|
-
const { snapshotId, orgId } = params;
|
|
337
|
-
const queryString = buildQueryString({ orgId });
|
|
338
|
-
const url = `/sandbox/${API_VERSION}/snapshots/${snapshotId}${queryString}`;
|
|
339
|
-
|
|
340
|
-
const resp = await client.delete<z.infer<typeof SnapshotDeleteResponseSchema>>(
|
|
341
|
-
url,
|
|
342
|
-
SnapshotDeleteResponseSchema
|
|
343
|
-
);
|
|
344
|
-
|
|
345
|
-
if (!resp.success) {
|
|
346
|
-
throwSandboxError(resp, {});
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Updates or removes the tag on a snapshot.
|
|
352
|
-
*
|
|
353
|
-
* @param client - The API client to use for the request
|
|
354
|
-
* @param params - Parameters including snapshot ID and new tag (or null to remove)
|
|
355
|
-
* @returns Updated snapshot information
|
|
356
|
-
* @throws {SandboxResponseError} If the snapshot is not found or update fails
|
|
357
|
-
*/
|
|
358
|
-
export async function snapshotTag(
|
|
359
|
-
client: APIClient,
|
|
360
|
-
params: SnapshotTagParams
|
|
361
|
-
): Promise<SnapshotInfo> {
|
|
362
|
-
const { snapshotId, tag, orgId } = params;
|
|
363
|
-
const queryString = buildQueryString({ orgId });
|
|
364
|
-
const url = `/sandbox/${API_VERSION}/snapshots/${snapshotId}${queryString}`;
|
|
365
|
-
|
|
366
|
-
const resp = await client.patch<z.infer<typeof SnapshotGetResponseSchema>>(
|
|
367
|
-
url,
|
|
368
|
-
{ tag },
|
|
369
|
-
SnapshotGetResponseSchema
|
|
370
|
-
);
|
|
371
|
-
|
|
372
|
-
if (resp.success) {
|
|
373
|
-
return resp.data;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
throwSandboxError(resp, {});
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* Gets the lineage (ancestry chain) of a snapshot.
|
|
381
|
-
*
|
|
382
|
-
* Returns an ordered list of snapshots from the specified snapshot (or latest by name)
|
|
383
|
-
* walking back through parentSnapshotId references to the root.
|
|
384
|
-
*
|
|
385
|
-
* @param client - The API client to use for the request
|
|
386
|
-
* @param params - Parameters specifying which snapshot to get lineage for
|
|
387
|
-
* @returns Ordered list of snapshots in the lineage (newest to oldest)
|
|
388
|
-
* @throws {SandboxResponseError} If the snapshot is not found or request fails
|
|
389
|
-
*
|
|
390
|
-
* @example
|
|
391
|
-
* // Get lineage starting from a specific snapshot ID
|
|
392
|
-
* const lineage = await snapshotLineage(client, { snapshot: 'snp_abc123' });
|
|
393
|
-
*
|
|
394
|
-
* @example
|
|
395
|
-
* // Get lineage starting from the latest snapshot with a given name
|
|
396
|
-
* const lineage = await snapshotLineage(client, { name: 'myapp' });
|
|
397
|
-
*
|
|
398
|
-
* @example
|
|
399
|
-
* // Get lineage starting from a specific name:tag
|
|
400
|
-
* const lineage = await snapshotLineage(client, { name: 'myapp', tag: 'v1.0.0' });
|
|
401
|
-
*/
|
|
402
|
-
export async function snapshotLineage(
|
|
403
|
-
client: APIClient,
|
|
404
|
-
params: SnapshotLineageParams
|
|
405
|
-
): Promise<SnapshotLineageResponse> {
|
|
406
|
-
const { snapshot, name, tag, limit, orgId } = params;
|
|
407
|
-
const queryString = buildQueryString({ snapshot, name, tag, limit, orgId });
|
|
408
|
-
const url = `/sandbox/${API_VERSION}/snapshots/lineage${queryString}`;
|
|
409
|
-
|
|
410
|
-
const resp = await client.get<z.infer<typeof SnapshotLineageResponseSchema>>(
|
|
411
|
-
url,
|
|
412
|
-
SnapshotLineageResponseSchema
|
|
413
|
-
);
|
|
414
|
-
|
|
415
|
-
if (resp.success) {
|
|
416
|
-
return resp.data;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
throwSandboxError(resp, {});
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
// ===== Public Snapshot API =====
|
|
423
|
-
|
|
424
|
-
const _SnapshotPublicListParamsSchema = z
|
|
425
|
-
.object({
|
|
426
|
-
limit: z
|
|
427
|
-
.number()
|
|
428
|
-
.optional()
|
|
429
|
-
.describe('Maximum number of snapshots to return (default: 50, max: 100)'),
|
|
430
|
-
offset: z.number().optional().describe('Number of snapshots to skip for pagination'),
|
|
431
|
-
})
|
|
432
|
-
.describe('Parameters for listing public snapshots');
|
|
433
|
-
|
|
434
|
-
export type SnapshotPublicListParams = z.infer<typeof _SnapshotPublicListParamsSchema>;
|
|
435
|
-
|
|
436
|
-
const _SnapshotPublicGetParamsSchema = z
|
|
437
|
-
.object({
|
|
438
|
-
snapshotRef: z
|
|
439
|
-
.string()
|
|
440
|
-
.describe('Snapshot reference: ID (snp_xxx), full name (@slug/name:tag), or name:tag'),
|
|
441
|
-
})
|
|
442
|
-
.describe('Parameters for getting a public snapshot');
|
|
443
|
-
|
|
444
|
-
export type SnapshotPublicGetParams = z.infer<typeof _SnapshotPublicGetParamsSchema>;
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Gets a public snapshot without requiring authentication.
|
|
448
|
-
*
|
|
449
|
-
* Supports multiple reference formats:
|
|
450
|
-
* - Snapshot ID: `snp_abc123`
|
|
451
|
-
* - Full name with org slug: `@myorg/myimage:latest`
|
|
452
|
-
* - Simple name:tag: `myimage:v1.0`
|
|
453
|
-
*
|
|
454
|
-
* @param client - The API client to use for the request
|
|
455
|
-
* @param params - Parameters including the snapshot reference
|
|
456
|
-
* @returns Snapshot information including files and download URL
|
|
457
|
-
* @throws {SandboxResponseError} If the snapshot is not found or is not public
|
|
458
|
-
*
|
|
459
|
-
* @example
|
|
460
|
-
* // Get by snapshot ID
|
|
461
|
-
* const snapshot = await snapshotPublicGet(client, { snapshotRef: 'snp_abc123' });
|
|
462
|
-
*
|
|
463
|
-
* @example
|
|
464
|
-
* // Get by full name with org slug
|
|
465
|
-
* const snapshot = await snapshotPublicGet(client, { snapshotRef: '@agentuity/bun:latest' });
|
|
466
|
-
*
|
|
467
|
-
* @example
|
|
468
|
-
* // Get by name:tag
|
|
469
|
-
* const snapshot = await snapshotPublicGet(client, { snapshotRef: 'bun:1.2' });
|
|
470
|
-
*/
|
|
471
|
-
export async function snapshotPublicGet(
|
|
472
|
-
client: APIClient,
|
|
473
|
-
params: SnapshotPublicGetParams
|
|
474
|
-
): Promise<SnapshotInfo> {
|
|
475
|
-
const { snapshotRef } = params;
|
|
476
|
-
const url = `/sandbox/${API_VERSION}/snapshots/public/${encodeURIComponent(snapshotRef)}`;
|
|
477
|
-
|
|
478
|
-
const resp = await client.get<z.infer<typeof SnapshotGetResponseSchema>>(
|
|
479
|
-
url,
|
|
480
|
-
SnapshotGetResponseSchema
|
|
481
|
-
);
|
|
482
|
-
|
|
483
|
-
if (resp.success) {
|
|
484
|
-
return resp.data;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
throwSandboxError(resp, {});
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Lists all public snapshots across the platform.
|
|
492
|
-
*
|
|
493
|
-
* Returns paginated list of snapshots that have been marked as public,
|
|
494
|
-
* regardless of which organization owns them.
|
|
495
|
-
*
|
|
496
|
-
* @param client - The API client to use for the request
|
|
497
|
-
* @param params - Optional parameters for pagination
|
|
498
|
-
* @returns Paginated list of public snapshots with total count
|
|
499
|
-
* @throws {SandboxResponseError} If the request fails
|
|
500
|
-
*
|
|
501
|
-
* @example
|
|
502
|
-
* // List first page of public snapshots
|
|
503
|
-
* const result = await snapshotPublicList(client);
|
|
504
|
-
* console.log(result.snapshots);
|
|
505
|
-
*
|
|
506
|
-
* @example
|
|
507
|
-
* // List with pagination
|
|
508
|
-
* const result = await snapshotPublicList(client, { limit: 20, offset: 40 });
|
|
509
|
-
*/
|
|
510
|
-
export async function snapshotPublicList(
|
|
511
|
-
client: APIClient,
|
|
512
|
-
params: SnapshotPublicListParams = {}
|
|
513
|
-
): Promise<SnapshotListResponse> {
|
|
514
|
-
const { limit, offset } = params;
|
|
515
|
-
const queryString = buildQueryString({ limit, offset });
|
|
516
|
-
const url = `/sandbox/${API_VERSION}/snapshots/public${queryString}`;
|
|
517
|
-
|
|
518
|
-
const resp = await client.get<z.infer<typeof SnapshotListResponseSchema>>(
|
|
519
|
-
url,
|
|
520
|
-
SnapshotListResponseSchema
|
|
521
|
-
);
|
|
522
|
-
|
|
523
|
-
if (resp.success) {
|
|
524
|
-
return resp.data;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
throwSandboxError(resp, {});
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
// ===== Snapshot Build API =====
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* Git information for snapshot builds
|
|
534
|
-
*/
|
|
535
|
-
export const SnapshotBuildGitInfoSchema = z
|
|
536
|
-
.object({
|
|
537
|
-
branch: z.string().optional().describe('Git branch name'),
|
|
538
|
-
commit: z.string().optional().describe('Git commit SHA'),
|
|
539
|
-
repo: z.string().optional().describe('Git repository URL'),
|
|
540
|
-
provider: z.string().optional().describe('Git provider (github, gitlab, bitbucket)'),
|
|
541
|
-
commitUrl: z.string().optional().describe('URL to the commit'),
|
|
542
|
-
})
|
|
543
|
-
.describe('Git information for the snapshot build');
|
|
544
|
-
|
|
545
|
-
const _SnapshotBuildInitParamsSchema = z
|
|
546
|
-
.object({
|
|
547
|
-
runtime: z.string().describe('Runtime identifier (name:tag or runtime ID)'),
|
|
548
|
-
name: z.string().optional().describe('Display name for the snapshot'),
|
|
549
|
-
tag: z.string().optional().describe('Tag for the snapshot'),
|
|
550
|
-
description: z.string().optional().describe('Description of the snapshot'),
|
|
551
|
-
message: z.string().optional().describe('Build message for the snapshot'),
|
|
552
|
-
git: SnapshotBuildGitInfoSchema.optional().describe('Git information for the build'),
|
|
553
|
-
contentHash: z
|
|
554
|
-
.string()
|
|
555
|
-
.optional()
|
|
556
|
-
.describe('SHA-256 hash of snapshot content for change detection'),
|
|
557
|
-
force: z.boolean().optional().describe('Force rebuild even if content is unchanged'),
|
|
558
|
-
encrypt: z.boolean().optional().describe('Request encryption for the snapshot archive'),
|
|
559
|
-
public: z
|
|
560
|
-
.boolean()
|
|
561
|
-
.optional()
|
|
562
|
-
.describe('Make snapshot public (enables virus scanning, disables encryption)'),
|
|
563
|
-
orgId: z.string().optional().describe('Organization ID'),
|
|
564
|
-
})
|
|
565
|
-
.describe('Parameters for initializing a snapshot build');
|
|
566
|
-
|
|
567
|
-
export type SnapshotBuildGitInfo = z.infer<typeof SnapshotBuildGitInfoSchema>;
|
|
568
|
-
|
|
569
|
-
export const SnapshotBuildInitResponseSchema = z
|
|
570
|
-
.object({
|
|
571
|
-
snapshotId: z.string().optional().describe('Unique identifier for the snapshot being built'),
|
|
572
|
-
uploadUrl: z
|
|
573
|
-
.string()
|
|
574
|
-
.optional()
|
|
575
|
-
.describe('Pre-signed URL for uploading the snapshot archive (private snapshots only)'),
|
|
576
|
-
publicKey: z
|
|
577
|
-
.string()
|
|
578
|
-
.optional()
|
|
579
|
-
.describe('PEM-encoded public key for encrypting the snapshot archive'),
|
|
580
|
-
unchanged: z.boolean().optional().describe('True if snapshot content is unchanged'),
|
|
581
|
-
existingId: z.string().optional().describe('ID of existing unchanged snapshot'),
|
|
582
|
-
existingName: z.string().optional().describe('Name of existing unchanged snapshot'),
|
|
583
|
-
existingTag: z.string().optional().describe('Tag of existing unchanged snapshot'),
|
|
584
|
-
})
|
|
585
|
-
.describe('Response from snapshot build init API');
|
|
586
|
-
|
|
587
|
-
export const SnapshotBuildInitAPIResponseSchema = APIResponseSchema(
|
|
588
|
-
SnapshotBuildInitResponseSchema
|
|
589
|
-
);
|
|
590
|
-
|
|
591
|
-
const _SnapshotBuildFinalizeParamsSchema = z
|
|
592
|
-
.object({
|
|
593
|
-
snapshotId: z.string().describe('Snapshot ID from init response'),
|
|
594
|
-
sizeBytes: z.number().describe('Total size of the snapshot in bytes'),
|
|
595
|
-
fileCount: z.number().describe('Number of files in the snapshot'),
|
|
596
|
-
files: z.array(SnapshotFileInfoSchema).describe('List of files with path and size'),
|
|
597
|
-
dependencies: z.array(z.string()).optional().describe('List of apt packages to install'),
|
|
598
|
-
packages: z
|
|
599
|
-
.array(
|
|
600
|
-
z
|
|
601
|
-
.string()
|
|
602
|
-
.regex(
|
|
603
|
-
NPM_PACKAGE_NAME_PATTERN,
|
|
604
|
-
'Invalid npm/bun package specifier: must not contain whitespace, semicolons, backticks, pipes, or dollar signs'
|
|
605
|
-
)
|
|
606
|
-
)
|
|
607
|
-
.optional()
|
|
608
|
-
.describe('List of npm/bun packages to install globally'),
|
|
609
|
-
env: z.record(z.string(), z.string()).optional().describe('Environment variables to set'),
|
|
610
|
-
metadata: z
|
|
611
|
-
.record(z.string(), z.string())
|
|
612
|
-
.optional()
|
|
613
|
-
.describe('User-defined metadata key-value pairs'),
|
|
614
|
-
orgId: z.string().optional().describe('Organization ID'),
|
|
615
|
-
})
|
|
616
|
-
.describe('Parameters for finalizing a snapshot build');
|
|
617
|
-
|
|
618
|
-
export type SnapshotBuildInitParams = z.infer<typeof _SnapshotBuildInitParamsSchema>;
|
|
619
|
-
export type SnapshotBuildInitResponse = z.infer<typeof SnapshotBuildInitResponseSchema>;
|
|
620
|
-
export type SnapshotBuildFinalizeParams = z.infer<typeof _SnapshotBuildFinalizeParamsSchema>;
|
|
621
|
-
|
|
622
|
-
/**
|
|
623
|
-
* Initialize a snapshot build by getting a presigned upload URL.
|
|
624
|
-
*
|
|
625
|
-
* @param client - The API client to use for the request
|
|
626
|
-
* @param params - Parameters including runtime and optional name/tag/description
|
|
627
|
-
* @returns Snapshot ID and presigned upload URL
|
|
628
|
-
* @throws {SandboxResponseError} If the initialization fails
|
|
629
|
-
*/
|
|
630
|
-
export async function snapshotBuildInit(
|
|
631
|
-
client: APIClient,
|
|
632
|
-
params: SnapshotBuildInitParams
|
|
633
|
-
): Promise<SnapshotBuildInitResponse> {
|
|
634
|
-
const {
|
|
635
|
-
runtime,
|
|
636
|
-
name,
|
|
637
|
-
description,
|
|
638
|
-
message,
|
|
639
|
-
git,
|
|
640
|
-
tag,
|
|
641
|
-
contentHash,
|
|
642
|
-
force,
|
|
643
|
-
encrypt,
|
|
644
|
-
public: isPublic,
|
|
645
|
-
orgId,
|
|
646
|
-
} = params;
|
|
647
|
-
const queryString = buildQueryString({ orgId });
|
|
648
|
-
const url = `/sandbox/${API_VERSION}/snapshots/build${queryString}`;
|
|
649
|
-
|
|
650
|
-
const body: Record<string, string | boolean | SnapshotBuildGitInfo> = { runtime };
|
|
651
|
-
if (name) body.name = name;
|
|
652
|
-
if (description) body.description = description;
|
|
653
|
-
if (message) body.message = message;
|
|
654
|
-
if (git) body.git = git;
|
|
655
|
-
if (tag) body.tag = tag;
|
|
656
|
-
if (contentHash) body.contentHash = contentHash;
|
|
657
|
-
if (force) body.force = force;
|
|
658
|
-
if (encrypt) body.encrypt = encrypt;
|
|
659
|
-
if (isPublic !== undefined) body.public = isPublic;
|
|
660
|
-
|
|
661
|
-
const resp = await client.post<z.infer<typeof SnapshotBuildInitAPIResponseSchema>>(
|
|
662
|
-
url,
|
|
663
|
-
body,
|
|
664
|
-
SnapshotBuildInitAPIResponseSchema
|
|
665
|
-
);
|
|
666
|
-
|
|
667
|
-
if (resp.success) {
|
|
668
|
-
return resp.data;
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
throwSandboxError(resp, {});
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* Finalize a snapshot build after uploading the archive.
|
|
676
|
-
*
|
|
677
|
-
* @param client - The API client to use for the request
|
|
678
|
-
* @param params - Parameters including snapshot details and file metadata
|
|
679
|
-
* @returns The created snapshot information
|
|
680
|
-
* @throws {SandboxResponseError} If the finalization fails
|
|
681
|
-
*/
|
|
682
|
-
export async function snapshotBuildFinalize(
|
|
683
|
-
client: APIClient,
|
|
684
|
-
params: SnapshotBuildFinalizeParams
|
|
685
|
-
): Promise<SnapshotInfo> {
|
|
686
|
-
const { snapshotId, sizeBytes, fileCount, files, dependencies, packages, env, metadata, orgId } =
|
|
687
|
-
params;
|
|
688
|
-
const queryString = buildQueryString({ orgId });
|
|
689
|
-
const url = `/sandbox/${API_VERSION}/snapshots/${snapshotId}/finalize${queryString}`;
|
|
690
|
-
|
|
691
|
-
const body: Record<string, unknown> = {
|
|
692
|
-
sizeBytes,
|
|
693
|
-
fileCount,
|
|
694
|
-
files,
|
|
695
|
-
};
|
|
696
|
-
if (dependencies) body.dependencies = dependencies;
|
|
697
|
-
if (packages) body.packages = packages;
|
|
698
|
-
if (env) body.env = env;
|
|
699
|
-
if (metadata) body.metadata = metadata;
|
|
700
|
-
|
|
701
|
-
const resp = await client.post<z.infer<typeof SnapshotGetResponseSchema>>(
|
|
702
|
-
url,
|
|
703
|
-
body,
|
|
704
|
-
SnapshotGetResponseSchema
|
|
705
|
-
);
|
|
706
|
-
|
|
707
|
-
if (resp.success) {
|
|
708
|
-
return resp.data;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
throwSandboxError(resp, {});
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
// ===== Snapshot Upload API (for public snapshots) =====
|
|
715
|
-
|
|
716
|
-
export const SnapshotUploadResponseSchema = z
|
|
717
|
-
.object({
|
|
718
|
-
success: z.boolean().describe('Whether the upload was successful'),
|
|
719
|
-
scanned: z.boolean().describe('Whether the upload was virus scanned'),
|
|
720
|
-
message: z.string().optional().describe('Optional message'),
|
|
721
|
-
})
|
|
722
|
-
.describe('Response from snapshot upload API');
|
|
723
|
-
|
|
724
|
-
const _SnapshotUploadAPIResponseSchema = APIResponseSchema(SnapshotUploadResponseSchema);
|
|
725
|
-
|
|
726
|
-
export type SnapshotUploadResponse = z.infer<typeof SnapshotUploadResponseSchema>;
|
|
727
|
-
|
|
728
|
-
export interface SnapshotUploadParams {
|
|
729
|
-
snapshotId: string;
|
|
730
|
-
body: Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | string | Blob;
|
|
731
|
-
contentLength: number;
|
|
732
|
-
orgId?: string;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
/**
|
|
736
|
-
* Upload a public snapshot archive via Catalyst (with virus scanning).
|
|
737
|
-
* This should only be used when snapshotBuildInit returns no uploadUrl.
|
|
738
|
-
*
|
|
739
|
-
* @param client - The API client to use for the request
|
|
740
|
-
* @param params - Parameters including snapshotId and the archive body
|
|
741
|
-
* @returns Upload result with scan status
|
|
742
|
-
* @throws {SandboxResponseError} If the upload fails or malware is detected
|
|
743
|
-
*/
|
|
744
|
-
export async function snapshotUpload(
|
|
745
|
-
client: APIClient,
|
|
746
|
-
params: SnapshotUploadParams
|
|
747
|
-
): Promise<SnapshotUploadResponse> {
|
|
748
|
-
const { snapshotId, body, contentLength, orgId } = params;
|
|
749
|
-
const queryString = buildQueryString({ orgId });
|
|
750
|
-
const url = `/sandbox/${API_VERSION}/snapshots/${snapshotId}/upload${queryString}`;
|
|
751
|
-
|
|
752
|
-
const response = await client.rawPut(url, body, 'application/gzip', undefined, {
|
|
753
|
-
'Content-Length': String(contentLength),
|
|
754
|
-
Accept: 'application/json',
|
|
755
|
-
});
|
|
756
|
-
|
|
757
|
-
if (!response.ok) {
|
|
758
|
-
const text = await response.text();
|
|
759
|
-
let message = `Upload failed: ${response.status} ${response.statusText}`;
|
|
760
|
-
try {
|
|
761
|
-
const json = JSON.parse(text);
|
|
762
|
-
if (json.message) {
|
|
763
|
-
message = json.message;
|
|
764
|
-
} else if (json.error) {
|
|
765
|
-
message = typeof json.error === 'string' ? json.error : JSON.stringify(json.error);
|
|
766
|
-
}
|
|
767
|
-
} catch {
|
|
768
|
-
if (text) {
|
|
769
|
-
message = text;
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
throw new SandboxResponseError({ message });
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
const data = (await response.json()) as z.infer<typeof _SnapshotUploadAPIResponseSchema>;
|
|
776
|
-
if (data.success) {
|
|
777
|
-
return data.data;
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
throwSandboxError(data, {});
|
|
781
|
-
}
|