@agentuity/server 1.0.32 → 1.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (562) hide show
  1. package/dist/api/api.d.ts +1 -227
  2. package/dist/api/api.d.ts.map +1 -1
  3. package/dist/api/api.js +1 -637
  4. package/dist/api/api.js.map +1 -1
  5. package/dist/api/index.d.ts +1 -17
  6. package/dist/api/index.d.ts.map +1 -1
  7. package/dist/api/index.js +1 -17
  8. package/dist/api/index.js.map +1 -1
  9. package/dist/api/org/env-delete.d.ts +1 -22
  10. package/dist/api/org/env-delete.d.ts.map +1 -1
  11. package/dist/api/org/env-delete.js +1 -24
  12. package/dist/api/org/env-delete.js.map +1 -1
  13. package/dist/api/org/env-get.d.ts +1 -32
  14. package/dist/api/org/env-get.d.ts.map +1 -1
  15. package/dist/api/org/env-get.js +1 -25
  16. package/dist/api/org/env-get.js.map +1 -1
  17. package/dist/api/org/env-update.d.ts +1 -23
  18. package/dist/api/org/env-update.d.ts.map +1 -1
  19. package/dist/api/org/env-update.js +1 -25
  20. package/dist/api/org/env-update.js.map +1 -1
  21. package/dist/api/project/get.d.ts +1 -42
  22. package/dist/api/project/get.d.ts.map +1 -1
  23. package/dist/api/project/get.js +1 -35
  24. package/dist/api/project/get.js.map +1 -1
  25. package/dist/api/project/list.d.ts +1 -47
  26. package/dist/api/project/list.d.ts.map +1 -1
  27. package/dist/api/project/list.js +1 -37
  28. package/dist/api/project/list.js.map +1 -1
  29. package/dist/api/project/malware.d.ts +1 -70
  30. package/dist/api/project/malware.d.ts.map +1 -1
  31. package/dist/api/project/malware.js +1 -41
  32. package/dist/api/project/malware.js.map +1 -1
  33. package/dist/api/region/create.d.ts +1 -80
  34. package/dist/api/region/create.d.ts.map +1 -1
  35. package/dist/api/region/create.js +1 -176
  36. package/dist/api/region/create.js.map +1 -1
  37. package/dist/api/sandbox/client.d.ts +1 -190
  38. package/dist/api/sandbox/client.d.ts.map +1 -1
  39. package/dist/api/sandbox/client.js +1 -260
  40. package/dist/api/sandbox/client.js.map +1 -1
  41. package/dist/api/sandbox/pause.d.ts +1 -21
  42. package/dist/api/sandbox/pause.d.ts.map +1 -1
  43. package/dist/api/sandbox/pause.js +1 -24
  44. package/dist/api/sandbox/pause.js.map +1 -1
  45. package/dist/api/sandbox/resume.d.ts +1 -21
  46. package/dist/api/sandbox/resume.d.ts.map +1 -1
  47. package/dist/api/sandbox/resume.js +1 -24
  48. package/dist/api/sandbox/resume.js.map +1 -1
  49. package/dist/api/sandbox/util.d.ts +1 -284
  50. package/dist/api/sandbox/util.d.ts.map +1 -1
  51. package/dist/api/sandbox/util.js +1 -210
  52. package/dist/api/sandbox/util.js.map +1 -1
  53. package/dist/api/user/whoami.d.ts +1 -38
  54. package/dist/api/user/whoami.d.ts.map +1 -1
  55. package/dist/api/user/whoami.js +1 -26
  56. package/dist/api/user/whoami.js.map +1 -1
  57. package/dist/index.d.ts +1 -4
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +3 -12
  60. package/dist/index.js.map +1 -1
  61. package/package.json +4 -4
  62. package/src/api/api.ts +1 -936
  63. package/src/api/index.ts +1 -17
  64. package/src/api/org/env-delete.ts +1 -37
  65. package/src/api/org/env-get.ts +1 -43
  66. package/src/api/org/env-update.ts +1 -38
  67. package/src/api/project/get.ts +1 -49
  68. package/src/api/project/list.ts +1 -54
  69. package/src/api/project/malware.ts +1 -68
  70. package/src/api/region/create.ts +1 -207
  71. package/src/api/sandbox/client.ts +1 -460
  72. package/src/api/sandbox/pause.ts +1 -39
  73. package/src/api/sandbox/resume.ts +1 -39
  74. package/src/api/sandbox/util.ts +1 -276
  75. package/src/api/user/whoami.ts +1 -32
  76. package/src/index.ts +3 -30
  77. package/dist/api/apikey/create.d.ts +0 -33
  78. package/dist/api/apikey/create.d.ts.map +0 -1
  79. package/dist/api/apikey/create.js +0 -23
  80. package/dist/api/apikey/create.js.map +0 -1
  81. package/dist/api/apikey/delete.d.ts +0 -19
  82. package/dist/api/apikey/delete.d.ts.map +0 -1
  83. package/dist/api/apikey/delete.js +0 -19
  84. package/dist/api/apikey/delete.js.map +0 -1
  85. package/dist/api/apikey/get.d.ts +0 -45
  86. package/dist/api/apikey/get.d.ts.map +0 -1
  87. package/dist/api/apikey/get.js +0 -36
  88. package/dist/api/apikey/get.js.map +0 -1
  89. package/dist/api/apikey/index.d.ts +0 -6
  90. package/dist/api/apikey/index.d.ts.map +0 -1
  91. package/dist/api/apikey/index.js +0 -6
  92. package/dist/api/apikey/index.js.map +0 -1
  93. package/dist/api/apikey/list.d.ts +0 -64
  94. package/dist/api/apikey/list.d.ts.map +0 -1
  95. package/dist/api/apikey/list.js +0 -46
  96. package/dist/api/apikey/list.js.map +0 -1
  97. package/dist/api/apikey/util.d.ts +0 -23
  98. package/dist/api/apikey/util.d.ts.map +0 -1
  99. package/dist/api/apikey/util.js +0 -3
  100. package/dist/api/apikey/util.js.map +0 -1
  101. package/dist/api/db/index.d.ts +0 -5
  102. package/dist/api/db/index.d.ts.map +0 -1
  103. package/dist/api/db/index.js +0 -5
  104. package/dist/api/db/index.js.map +0 -1
  105. package/dist/api/db/logs.d.ts +0 -70
  106. package/dist/api/db/logs.d.ts.map +0 -1
  107. package/dist/api/db/logs.js +0 -59
  108. package/dist/api/db/logs.js.map +0 -1
  109. package/dist/api/db/query.d.ts +0 -39
  110. package/dist/api/db/query.d.ts.map +0 -1
  111. package/dist/api/db/query.js +0 -49
  112. package/dist/api/db/query.js.map +0 -1
  113. package/dist/api/db/tables.d.ts +0 -49
  114. package/dist/api/db/tables.d.ts.map +0 -1
  115. package/dist/api/db/tables.js +0 -59
  116. package/dist/api/db/tables.js.map +0 -1
  117. package/dist/api/db/util.d.ts +0 -31
  118. package/dist/api/db/util.d.ts.map +0 -1
  119. package/dist/api/db/util.js +0 -4
  120. package/dist/api/db/util.js.map +0 -1
  121. package/dist/api/eval/get.d.ts +0 -36
  122. package/dist/api/eval/get.d.ts.map +0 -1
  123. package/dist/api/eval/get.js +0 -23
  124. package/dist/api/eval/get.js.map +0 -1
  125. package/dist/api/eval/index.d.ts +0 -5
  126. package/dist/api/eval/index.d.ts.map +0 -1
  127. package/dist/api/eval/index.js +0 -5
  128. package/dist/api/eval/index.js.map +0 -1
  129. package/dist/api/eval/list.d.ts +0 -50
  130. package/dist/api/eval/list.d.ts.map +0 -1
  131. package/dist/api/eval/list.js +0 -32
  132. package/dist/api/eval/list.js.map +0 -1
  133. package/dist/api/eval/run-get.d.ts +0 -48
  134. package/dist/api/eval/run-get.d.ts.map +0 -1
  135. package/dist/api/eval/run-get.js +0 -29
  136. package/dist/api/eval/run-get.js.map +0 -1
  137. package/dist/api/eval/run-list.d.ts +0 -70
  138. package/dist/api/eval/run-list.d.ts.map +0 -1
  139. package/dist/api/eval/run-list.js +0 -42
  140. package/dist/api/eval/run-list.js.map +0 -1
  141. package/dist/api/machine/index.d.ts +0 -3
  142. package/dist/api/machine/index.d.ts.map +0 -1
  143. package/dist/api/machine/index.js +0 -3
  144. package/dist/api/machine/index.js.map +0 -1
  145. package/dist/api/machine/machine.d.ts +0 -192
  146. package/dist/api/machine/machine.d.ts.map +0 -1
  147. package/dist/api/machine/machine.js +0 -109
  148. package/dist/api/machine/machine.js.map +0 -1
  149. package/dist/api/machine/util.d.ts +0 -14
  150. package/dist/api/machine/util.d.ts.map +0 -1
  151. package/dist/api/machine/util.js +0 -3
  152. package/dist/api/machine/util.js.map +0 -1
  153. package/dist/api/org/index.d.ts +0 -7
  154. package/dist/api/org/index.d.ts.map +0 -1
  155. package/dist/api/org/index.js +0 -7
  156. package/dist/api/org/index.js.map +0 -1
  157. package/dist/api/org/list.d.ts +0 -27
  158. package/dist/api/org/list.d.ts.map +0 -1
  159. package/dist/api/org/list.js +0 -22
  160. package/dist/api/org/list.js.map +0 -1
  161. package/dist/api/org/resources.d.ts +0 -141
  162. package/dist/api/org/resources.d.ts.map +0 -1
  163. package/dist/api/org/resources.js +0 -97
  164. package/dist/api/org/resources.js.map +0 -1
  165. package/dist/api/org/util.d.ts +0 -45
  166. package/dist/api/org/util.d.ts.map +0 -1
  167. package/dist/api/org/util.js +0 -4
  168. package/dist/api/org/util.js.map +0 -1
  169. package/dist/api/project/agent.d.ts +0 -89
  170. package/dist/api/project/agent.d.ts.map +0 -1
  171. package/dist/api/project/agent.js +0 -60
  172. package/dist/api/project/agent.js.map +0 -1
  173. package/dist/api/project/create.d.ts +0 -37
  174. package/dist/api/project/create.d.ts.map +0 -1
  175. package/dist/api/project/create.js +0 -31
  176. package/dist/api/project/create.js.map +0 -1
  177. package/dist/api/project/delete.d.ts +0 -15
  178. package/dist/api/project/delete.d.ts.map +0 -1
  179. package/dist/api/project/delete.js +0 -13
  180. package/dist/api/project/delete.js.map +0 -1
  181. package/dist/api/project/deploy.d.ts +0 -490
  182. package/dist/api/project/deploy.d.ts.map +0 -1
  183. package/dist/api/project/deploy.js +0 -313
  184. package/dist/api/project/deploy.js.map +0 -1
  185. package/dist/api/project/deployment.d.ts +0 -237
  186. package/dist/api/project/deployment.d.ts.map +0 -1
  187. package/dist/api/project/deployment.js +0 -127
  188. package/dist/api/project/deployment.js.map +0 -1
  189. package/dist/api/project/env-delete.d.ts +0 -22
  190. package/dist/api/project/env-delete.d.ts.map +0 -1
  191. package/dist/api/project/env-delete.js +0 -29
  192. package/dist/api/project/env-delete.js.map +0 -1
  193. package/dist/api/project/env-update.d.ts +0 -31
  194. package/dist/api/project/env-update.d.ts.map +0 -1
  195. package/dist/api/project/env-update.js +0 -36
  196. package/dist/api/project/env-update.js.map +0 -1
  197. package/dist/api/project/exists.d.ts +0 -25
  198. package/dist/api/project/exists.d.ts.map +0 -1
  199. package/dist/api/project/exists.js +0 -45
  200. package/dist/api/project/exists.js.map +0 -1
  201. package/dist/api/project/hostname.d.ts +0 -25
  202. package/dist/api/project/hostname.d.ts.map +0 -1
  203. package/dist/api/project/hostname.js +0 -37
  204. package/dist/api/project/hostname.js.map +0 -1
  205. package/dist/api/project/index.d.ts +0 -14
  206. package/dist/api/project/index.d.ts.map +0 -1
  207. package/dist/api/project/index.js +0 -14
  208. package/dist/api/project/index.js.map +0 -1
  209. package/dist/api/project/update-region.d.ts +0 -27
  210. package/dist/api/project/update-region.d.ts.map +0 -1
  211. package/dist/api/project/update-region.js +0 -25
  212. package/dist/api/project/update-region.js.map +0 -1
  213. package/dist/api/project/util.d.ts +0 -62
  214. package/dist/api/project/util.d.ts.map +0 -1
  215. package/dist/api/project/util.js +0 -6
  216. package/dist/api/project/util.js.map +0 -1
  217. package/dist/api/queue/analytics.d.ts +0 -250
  218. package/dist/api/queue/analytics.d.ts.map +0 -1
  219. package/dist/api/queue/analytics.js +0 -233
  220. package/dist/api/queue/analytics.js.map +0 -1
  221. package/dist/api/queue/destinations.d.ts +0 -202
  222. package/dist/api/queue/destinations.d.ts.map +0 -1
  223. package/dist/api/queue/destinations.js +0 -168
  224. package/dist/api/queue/destinations.js.map +0 -1
  225. package/dist/api/queue/dlq.d.ts +0 -168
  226. package/dist/api/queue/dlq.d.ts.map +0 -1
  227. package/dist/api/queue/dlq.js +0 -166
  228. package/dist/api/queue/dlq.js.map +0 -1
  229. package/dist/api/queue/index.d.ts +0 -56
  230. package/dist/api/queue/index.d.ts.map +0 -1
  231. package/dist/api/queue/index.js +0 -90
  232. package/dist/api/queue/index.js.map +0 -1
  233. package/dist/api/queue/messages.d.ts +0 -503
  234. package/dist/api/queue/messages.d.ts.map +0 -1
  235. package/dist/api/queue/messages.js +0 -549
  236. package/dist/api/queue/messages.js.map +0 -1
  237. package/dist/api/queue/queues.d.ts +0 -226
  238. package/dist/api/queue/queues.d.ts.map +0 -1
  239. package/dist/api/queue/queues.js +0 -321
  240. package/dist/api/queue/queues.js.map +0 -1
  241. package/dist/api/queue/sources.d.ts +0 -202
  242. package/dist/api/queue/sources.d.ts.map +0 -1
  243. package/dist/api/queue/sources.js +0 -202
  244. package/dist/api/queue/sources.js.map +0 -1
  245. package/dist/api/queue/types.d.ts +0 -1218
  246. package/dist/api/queue/types.d.ts.map +0 -1
  247. package/dist/api/queue/types.js +0 -1002
  248. package/dist/api/queue/types.js.map +0 -1
  249. package/dist/api/queue/util.d.ts +0 -278
  250. package/dist/api/queue/util.d.ts.map +0 -1
  251. package/dist/api/queue/util.js +0 -235
  252. package/dist/api/queue/util.js.map +0 -1
  253. package/dist/api/queue/validation.d.ts +0 -247
  254. package/dist/api/queue/validation.d.ts.map +0 -1
  255. package/dist/api/queue/validation.js +0 -513
  256. package/dist/api/queue/validation.js.map +0 -1
  257. package/dist/api/queue/websocket.d.ts +0 -168
  258. package/dist/api/queue/websocket.d.ts.map +0 -1
  259. package/dist/api/queue/websocket.js +0 -394
  260. package/dist/api/queue/websocket.js.map +0 -1
  261. package/dist/api/region/delete.d.ts +0 -62
  262. package/dist/api/region/delete.d.ts.map +0 -1
  263. package/dist/api/region/delete.js +0 -37
  264. package/dist/api/region/delete.js.map +0 -1
  265. package/dist/api/region/index.d.ts +0 -5
  266. package/dist/api/region/index.d.ts.map +0 -1
  267. package/dist/api/region/index.js +0 -5
  268. package/dist/api/region/index.js.map +0 -1
  269. package/dist/api/region/list.d.ts +0 -27
  270. package/dist/api/region/list.d.ts.map +0 -1
  271. package/dist/api/region/list.js +0 -22
  272. package/dist/api/region/list.js.map +0 -1
  273. package/dist/api/region/resources.d.ts +0 -71
  274. package/dist/api/region/resources.d.ts.map +0 -1
  275. package/dist/api/region/resources.js +0 -53
  276. package/dist/api/region/resources.js.map +0 -1
  277. package/dist/api/region/util.d.ts +0 -23
  278. package/dist/api/region/util.d.ts.map +0 -1
  279. package/dist/api/region/util.js +0 -3
  280. package/dist/api/region/util.js.map +0 -1
  281. package/dist/api/sandbox/cli-list.d.ts +0 -114
  282. package/dist/api/sandbox/cli-list.d.ts.map +0 -1
  283. package/dist/api/sandbox/cli-list.js +0 -71
  284. package/dist/api/sandbox/cli-list.js.map +0 -1
  285. package/dist/api/sandbox/create.d.ts +0 -118
  286. package/dist/api/sandbox/create.d.ts.map +0 -1
  287. package/dist/api/sandbox/create.js +0 -211
  288. package/dist/api/sandbox/create.js.map +0 -1
  289. package/dist/api/sandbox/destroy.d.ts +0 -22
  290. package/dist/api/sandbox/destroy.d.ts.map +0 -1
  291. package/dist/api/sandbox/destroy.js +0 -25
  292. package/dist/api/sandbox/destroy.js.map +0 -1
  293. package/dist/api/sandbox/disk-checkpoint.d.ts +0 -104
  294. package/dist/api/sandbox/disk-checkpoint.d.ts.map +0 -1
  295. package/dist/api/sandbox/disk-checkpoint.js +0 -104
  296. package/dist/api/sandbox/disk-checkpoint.js.map +0 -1
  297. package/dist/api/sandbox/execute.d.ts +0 -69
  298. package/dist/api/sandbox/execute.d.ts.map +0 -1
  299. package/dist/api/sandbox/execute.js +0 -103
  300. package/dist/api/sandbox/execute.js.map +0 -1
  301. package/dist/api/sandbox/execution.d.ts +0 -169
  302. package/dist/api/sandbox/execution.d.ts.map +0 -1
  303. package/dist/api/sandbox/execution.js +0 -118
  304. package/dist/api/sandbox/execution.js.map +0 -1
  305. package/dist/api/sandbox/files.d.ts +0 -261
  306. package/dist/api/sandbox/files.d.ts.map +0 -1
  307. package/dist/api/sandbox/files.js +0 -386
  308. package/dist/api/sandbox/files.js.map +0 -1
  309. package/dist/api/sandbox/get.d.ts +0 -283
  310. package/dist/api/sandbox/get.d.ts.map +0 -1
  311. package/dist/api/sandbox/get.js +0 -215
  312. package/dist/api/sandbox/get.js.map +0 -1
  313. package/dist/api/sandbox/getStatus.d.ts +0 -16
  314. package/dist/api/sandbox/getStatus.d.ts.map +0 -1
  315. package/dist/api/sandbox/getStatus.js +0 -32
  316. package/dist/api/sandbox/getStatus.js.map +0 -1
  317. package/dist/api/sandbox/index.d.ts +0 -39
  318. package/dist/api/sandbox/index.d.ts.map +0 -1
  319. package/dist/api/sandbox/index.js +0 -20
  320. package/dist/api/sandbox/index.js.map +0 -1
  321. package/dist/api/sandbox/list.d.ts +0 -293
  322. package/dist/api/sandbox/list.d.ts.map +0 -1
  323. package/dist/api/sandbox/list.js +0 -191
  324. package/dist/api/sandbox/list.js.map +0 -1
  325. package/dist/api/sandbox/resolve.d.ts +0 -82
  326. package/dist/api/sandbox/resolve.d.ts.map +0 -1
  327. package/dist/api/sandbox/resolve.js +0 -71
  328. package/dist/api/sandbox/resolve.js.map +0 -1
  329. package/dist/api/sandbox/run.d.ts +0 -28
  330. package/dist/api/sandbox/run.d.ts.map +0 -1
  331. package/dist/api/sandbox/run.js +0 -342
  332. package/dist/api/sandbox/run.js.map +0 -1
  333. package/dist/api/sandbox/runtime.d.ts +0 -83
  334. package/dist/api/sandbox/runtime.d.ts.map +0 -1
  335. package/dist/api/sandbox/runtime.js +0 -78
  336. package/dist/api/sandbox/runtime.js.map +0 -1
  337. package/dist/api/sandbox/snapshot-build.d.ts +0 -48
  338. package/dist/api/sandbox/snapshot-build.d.ts.map +0 -1
  339. package/dist/api/sandbox/snapshot-build.js +0 -74
  340. package/dist/api/sandbox/snapshot-build.js.map +0 -1
  341. package/dist/api/sandbox/snapshot.d.ts +0 -595
  342. package/dist/api/sandbox/snapshot.d.ts.map +0 -1
  343. package/dist/api/sandbox/snapshot.js +0 -598
  344. package/dist/api/sandbox/snapshot.js.map +0 -1
  345. package/dist/api/services/index.d.ts +0 -2
  346. package/dist/api/services/index.d.ts.map +0 -1
  347. package/dist/api/services/index.js +0 -2
  348. package/dist/api/services/index.js.map +0 -1
  349. package/dist/api/services/stats.d.ts +0 -263
  350. package/dist/api/services/stats.d.ts.map +0 -1
  351. package/dist/api/services/stats.js +0 -144
  352. package/dist/api/services/stats.js.map +0 -1
  353. package/dist/api/session/get.d.ts +0 -169
  354. package/dist/api/session/get.d.ts.map +0 -1
  355. package/dist/api/session/get.js +0 -56
  356. package/dist/api/session/get.js.map +0 -1
  357. package/dist/api/session/index.d.ts +0 -4
  358. package/dist/api/session/index.d.ts.map +0 -1
  359. package/dist/api/session/index.js +0 -4
  360. package/dist/api/session/index.js.map +0 -1
  361. package/dist/api/session/list.d.ts +0 -143
  362. package/dist/api/session/list.d.ts.map +0 -1
  363. package/dist/api/session/list.js +0 -91
  364. package/dist/api/session/list.js.map +0 -1
  365. package/dist/api/session/logs.d.ts +0 -40
  366. package/dist/api/session/logs.d.ts.map +0 -1
  367. package/dist/api/session/logs.js +0 -28
  368. package/dist/api/session/logs.js.map +0 -1
  369. package/dist/api/session/util.d.ts +0 -23
  370. package/dist/api/session/util.d.ts.map +0 -1
  371. package/dist/api/session/util.js +0 -3
  372. package/dist/api/session/util.js.map +0 -1
  373. package/dist/api/storage/config.d.ts +0 -99
  374. package/dist/api/storage/config.d.ts.map +0 -1
  375. package/dist/api/storage/config.js +0 -61
  376. package/dist/api/storage/config.js.map +0 -1
  377. package/dist/api/storage/index.d.ts +0 -5
  378. package/dist/api/storage/index.d.ts.map +0 -1
  379. package/dist/api/storage/index.js +0 -5
  380. package/dist/api/storage/index.js.map +0 -1
  381. package/dist/api/storage/objects.d.ts +0 -155
  382. package/dist/api/storage/objects.d.ts.map +0 -1
  383. package/dist/api/storage/objects.js +0 -148
  384. package/dist/api/storage/objects.js.map +0 -1
  385. package/dist/api/storage/types.d.ts +0 -161
  386. package/dist/api/storage/types.d.ts.map +0 -1
  387. package/dist/api/storage/types.js +0 -141
  388. package/dist/api/storage/types.js.map +0 -1
  389. package/dist/api/storage/util.d.ts +0 -48
  390. package/dist/api/storage/util.d.ts.map +0 -1
  391. package/dist/api/storage/util.js +0 -8
  392. package/dist/api/storage/util.js.map +0 -1
  393. package/dist/api/stream/get.d.ts +0 -58
  394. package/dist/api/stream/get.d.ts.map +0 -1
  395. package/dist/api/stream/get.js +0 -40
  396. package/dist/api/stream/get.js.map +0 -1
  397. package/dist/api/stream/index.d.ts +0 -4
  398. package/dist/api/stream/index.d.ts.map +0 -1
  399. package/dist/api/stream/index.js +0 -4
  400. package/dist/api/stream/index.js.map +0 -1
  401. package/dist/api/stream/list.d.ts +0 -120
  402. package/dist/api/stream/list.d.ts.map +0 -1
  403. package/dist/api/stream/list.js +0 -77
  404. package/dist/api/stream/list.js.map +0 -1
  405. package/dist/api/stream/util.d.ts +0 -23
  406. package/dist/api/stream/util.d.ts.map +0 -1
  407. package/dist/api/stream/util.js +0 -3
  408. package/dist/api/stream/util.js.map +0 -1
  409. package/dist/api/thread/delete.d.ts +0 -23
  410. package/dist/api/thread/delete.d.ts.map +0 -1
  411. package/dist/api/thread/delete.js +0 -21
  412. package/dist/api/thread/delete.js.map +0 -1
  413. package/dist/api/thread/get.d.ts +0 -36
  414. package/dist/api/thread/get.d.ts.map +0 -1
  415. package/dist/api/thread/get.js +0 -23
  416. package/dist/api/thread/get.js.map +0 -1
  417. package/dist/api/thread/index.d.ts +0 -5
  418. package/dist/api/thread/index.d.ts.map +0 -1
  419. package/dist/api/thread/index.js +0 -5
  420. package/dist/api/thread/index.js.map +0 -1
  421. package/dist/api/thread/list.d.ts +0 -69
  422. package/dist/api/thread/list.d.ts.map +0 -1
  423. package/dist/api/thread/list.js +0 -51
  424. package/dist/api/thread/list.js.map +0 -1
  425. package/dist/api/thread/util.d.ts +0 -23
  426. package/dist/api/thread/util.d.ts.map +0 -1
  427. package/dist/api/thread/util.js +0 -3
  428. package/dist/api/thread/util.js.map +0 -1
  429. package/dist/api/user/index.d.ts +0 -2
  430. package/dist/api/user/index.d.ts.map +0 -1
  431. package/dist/api/user/index.js +0 -2
  432. package/dist/api/user/index.js.map +0 -1
  433. package/dist/api/user/util.d.ts +0 -23
  434. package/dist/api/user/util.d.ts.map +0 -1
  435. package/dist/api/user/util.js +0 -3
  436. package/dist/api/user/util.js.map +0 -1
  437. package/dist/api/webhook/deliveries.d.ts +0 -94
  438. package/dist/api/webhook/deliveries.d.ts.map +0 -1
  439. package/dist/api/webhook/deliveries.js +0 -79
  440. package/dist/api/webhook/deliveries.js.map +0 -1
  441. package/dist/api/webhook/destinations.d.ts +0 -136
  442. package/dist/api/webhook/destinations.d.ts.map +0 -1
  443. package/dist/api/webhook/destinations.js +0 -137
  444. package/dist/api/webhook/destinations.js.map +0 -1
  445. package/dist/api/webhook/index.d.ts +0 -41
  446. package/dist/api/webhook/index.d.ts.map +0 -1
  447. package/dist/api/webhook/index.js +0 -59
  448. package/dist/api/webhook/index.js.map +0 -1
  449. package/dist/api/webhook/receipts.d.ts +0 -77
  450. package/dist/api/webhook/receipts.d.ts.map +0 -1
  451. package/dist/api/webhook/receipts.js +0 -78
  452. package/dist/api/webhook/receipts.js.map +0 -1
  453. package/dist/api/webhook/types.d.ts +0 -249
  454. package/dist/api/webhook/types.d.ts.map +0 -1
  455. package/dist/api/webhook/types.js +0 -221
  456. package/dist/api/webhook/types.js.map +0 -1
  457. package/dist/api/webhook/util.d.ts +0 -202
  458. package/dist/api/webhook/util.d.ts.map +0 -1
  459. package/dist/api/webhook/util.js +0 -201
  460. package/dist/api/webhook/util.js.map +0 -1
  461. package/dist/api/webhook/webhooks.d.ts +0 -146
  462. package/dist/api/webhook/webhooks.d.ts.map +0 -1
  463. package/dist/api/webhook/webhooks.js +0 -165
  464. package/dist/api/webhook/webhooks.js.map +0 -1
  465. package/src/api/api-example.md +0 -164
  466. package/src/api/apikey/create.ts +0 -41
  467. package/src/api/apikey/delete.ts +0 -30
  468. package/src/api/apikey/get.ts +0 -48
  469. package/src/api/apikey/index.ts +0 -5
  470. package/src/api/apikey/list.ts +0 -64
  471. package/src/api/apikey/util.ts +0 -3
  472. package/src/api/db/index.ts +0 -27
  473. package/src/api/db/logs.ts +0 -75
  474. package/src/api/db/query.ts +0 -67
  475. package/src/api/db/tables.ts +0 -92
  476. package/src/api/db/util.ts +0 -9
  477. package/src/api/eval/get.ts +0 -33
  478. package/src/api/eval/index.ts +0 -28
  479. package/src/api/eval/list.ts +0 -49
  480. package/src/api/eval/run-get.ts +0 -39
  481. package/src/api/eval/run-list.ts +0 -59
  482. package/src/api/machine/index.ts +0 -2
  483. package/src/api/machine/machine.ts +0 -160
  484. package/src/api/machine/util.ts +0 -5
  485. package/src/api/org/index.ts +0 -6
  486. package/src/api/org/list.ts +0 -28
  487. package/src/api/org/resources.ts +0 -140
  488. package/src/api/org/util.ts +0 -4
  489. package/src/api/project/agent.ts +0 -86
  490. package/src/api/project/create.ts +0 -47
  491. package/src/api/project/delete.ts +0 -25
  492. package/src/api/project/deploy.ts +0 -458
  493. package/src/api/project/deployment.ts +0 -195
  494. package/src/api/project/env-delete.ts +0 -45
  495. package/src/api/project/env-update.ts +0 -55
  496. package/src/api/project/exists.ts +0 -58
  497. package/src/api/project/hostname.ts +0 -73
  498. package/src/api/project/index.ts +0 -13
  499. package/src/api/project/update-region.ts +0 -44
  500. package/src/api/project/util.ts +0 -8
  501. package/src/api/queue/analytics.ts +0 -311
  502. package/src/api/queue/destinations.ts +0 -259
  503. package/src/api/queue/dlq.ts +0 -243
  504. package/src/api/queue/index.ts +0 -308
  505. package/src/api/queue/messages.ts +0 -784
  506. package/src/api/queue/queues.ts +0 -460
  507. package/src/api/queue/sources.ts +0 -294
  508. package/src/api/queue/types.ts +0 -1325
  509. package/src/api/queue/util.ts +0 -278
  510. package/src/api/queue/validation.ts +0 -560
  511. package/src/api/queue/websocket.ts +0 -514
  512. package/src/api/region/delete.ts +0 -57
  513. package/src/api/region/index.ts +0 -4
  514. package/src/api/region/list.ts +0 -32
  515. package/src/api/region/resources.ts +0 -69
  516. package/src/api/region/util.ts +0 -3
  517. package/src/api/sandbox/cli-list.ts +0 -127
  518. package/src/api/sandbox/create.ts +0 -256
  519. package/src/api/sandbox/destroy.ts +0 -41
  520. package/src/api/sandbox/disk-checkpoint.ts +0 -179
  521. package/src/api/sandbox/execute.ts +0 -132
  522. package/src/api/sandbox/execution.ts +0 -183
  523. package/src/api/sandbox/files.ts +0 -596
  524. package/src/api/sandbox/get.ts +0 -249
  525. package/src/api/sandbox/getStatus.ts +0 -54
  526. package/src/api/sandbox/index.ts +0 -211
  527. package/src/api/sandbox/list.ts +0 -224
  528. package/src/api/sandbox/resolve.ts +0 -98
  529. package/src/api/sandbox/run.ts +0 -439
  530. package/src/api/sandbox/runtime.ts +0 -100
  531. package/src/api/sandbox/snapshot-build.ts +0 -98
  532. package/src/api/sandbox/snapshot.ts +0 -781
  533. package/src/api/services/index.ts +0 -1
  534. package/src/api/services/stats.ts +0 -213
  535. package/src/api/session/get.ts +0 -106
  536. package/src/api/session/index.ts +0 -3
  537. package/src/api/session/list.ts +0 -136
  538. package/src/api/session/logs.ts +0 -47
  539. package/src/api/session/util.ts +0 -3
  540. package/src/api/storage/config.ts +0 -111
  541. package/src/api/storage/index.ts +0 -4
  542. package/src/api/storage/objects.ts +0 -250
  543. package/src/api/storage/types.ts +0 -174
  544. package/src/api/storage/util.ts +0 -10
  545. package/src/api/stream/get.ts +0 -51
  546. package/src/api/stream/index.ts +0 -3
  547. package/src/api/stream/list.ts +0 -127
  548. package/src/api/stream/util.ts +0 -3
  549. package/src/api/thread/delete.ts +0 -31
  550. package/src/api/thread/get.ts +0 -34
  551. package/src/api/thread/index.ts +0 -4
  552. package/src/api/thread/list.ts +0 -76
  553. package/src/api/thread/util.ts +0 -3
  554. package/src/api/user/index.ts +0 -1
  555. package/src/api/user/util.ts +0 -3
  556. package/src/api/webhook/deliveries.ts +0 -129
  557. package/src/api/webhook/destinations.ts +0 -224
  558. package/src/api/webhook/index.ts +0 -133
  559. package/src/api/webhook/receipts.ts +0 -124
  560. package/src/api/webhook/types.ts +0 -309
  561. package/src/api/webhook/util.ts +0 -237
  562. package/src/api/webhook/webhooks.ts +0 -260
@@ -1,1325 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- /**
4
- * Queue type schema for validation.
5
- *
6
- * - `worker`: Messages are consumed by workers with acknowledgment. Each message is processed by exactly one consumer.
7
- * - `pubsub`: Messages are broadcast to all subscribers. Multiple consumers can receive the same message.
8
- *
9
- * @example
10
- * ```typescript
11
- * const queueType = QueueTypeSchema.parse('worker'); // 'worker' | 'pubsub'
12
- * ```
13
- */
14
- export const QueueTypeSchema = z.enum(['worker', 'pubsub']);
15
-
16
- /**
17
- * Queue type - either 'worker' for task queues or 'pubsub' for broadcast messaging.
18
- */
19
- export type QueueType = z.infer<typeof QueueTypeSchema>;
20
-
21
- export type QueueSortField = 'name' | 'created' | 'updated' | 'message_count' | 'dlq_count';
22
-
23
- /**
24
- * Base queue settings schema without defaults - used for partial updates.
25
- *
26
- * This schema is used for PATCH operations where we don't want Zod to apply
27
- * default values for missing fields (which would overwrite existing values).
28
- */
29
- const QueueSettingsSchemaBase = z.object({
30
- /** Default time-to-live for messages in seconds. Null means no expiration. */
31
- default_ttl_seconds: z.number().nullable().optional(),
32
- /** Time in seconds a message is invisible after being received. */
33
- default_visibility_timeout_seconds: z.number().optional(),
34
- /** Maximum number of delivery attempts before moving to DLQ. */
35
- default_max_retries: z.number().optional(),
36
- /** Initial backoff delay in milliseconds for retries. */
37
- default_retry_backoff_ms: z.number().optional(),
38
- /** Maximum backoff delay in milliseconds for retries. */
39
- default_retry_max_backoff_ms: z.number().optional(),
40
- /** Multiplier for exponential backoff. */
41
- default_retry_multiplier: z.number().optional(),
42
- /** Maximum number of messages a single client can process concurrently. */
43
- max_in_flight_per_client: z.number().optional(),
44
- /** Retention period for acknowledged messages in seconds. */
45
- retention_seconds: z.number().optional(),
46
- });
47
-
48
- /**
49
- * Queue settings schema for configuring queue behavior.
50
- *
51
- * These settings control message lifecycle, retry behavior, and concurrency limits.
52
- * This schema includes defaults and is used for output types and documentation.
53
- *
54
- * @example
55
- * ```typescript
56
- * const settings = QueueSettingsSchema.parse({
57
- * default_ttl_seconds: 3600, // Messages expire after 1 hour
58
- * default_visibility_timeout_seconds: 60, // Processing timeout
59
- * default_max_retries: 3, // Retry failed messages 3 times
60
- * });
61
- * ```
62
- */
63
- export const QueueSettingsSchema = z.object({
64
- /** Default time-to-live for messages in seconds. Null means no expiration. */
65
- default_ttl_seconds: z.number().nullable().optional(),
66
- /** Time in seconds a message is invisible after being received (default: 30). */
67
- default_visibility_timeout_seconds: z.number().default(30),
68
- /** Maximum number of delivery attempts before moving to DLQ (default: 5). */
69
- default_max_retries: z.number().default(5),
70
- /** Initial backoff delay in milliseconds for retries (default: 1000). */
71
- default_retry_backoff_ms: z.number().default(1000),
72
- /** Maximum backoff delay in milliseconds for retries (default: 60000). */
73
- default_retry_max_backoff_ms: z.number().default(60000),
74
- /** Multiplier for exponential backoff (default: 2.0). */
75
- default_retry_multiplier: z.number().default(2.0),
76
- /** Maximum number of messages a single client can process concurrently (default: 10). */
77
- max_in_flight_per_client: z.number().default(10),
78
- /** Retention period for acknowledged messages in seconds (default: 30 days). */
79
- retention_seconds: z.number().default(2592000),
80
- });
81
-
82
- /**
83
- * Queue settings configuration type.
84
- */
85
- export type QueueSettings = z.infer<typeof QueueSettingsSchema>;
86
-
87
- /**
88
- * Queue statistics schema showing current queue state.
89
- */
90
- export const QueueStatsSchema = z.object({
91
- /** Total number of messages currently in the queue. */
92
- message_count: z.number(),
93
- /** Number of messages in the dead letter queue. */
94
- dlq_count: z.number(),
95
- /** The next offset that will be assigned to a new message. */
96
- next_offset: z.number(),
97
- });
98
-
99
- /**
100
- * Queue statistics type.
101
- */
102
- export type QueueStats = z.infer<typeof QueueStatsSchema>;
103
-
104
- /**
105
- * Queue schema representing a message queue.
106
- *
107
- * @example
108
- * ```typescript
109
- * const queue = await getQueue(client, 'my-queue');
110
- * console.log(`Queue ${queue.name} has ${queue.message_count} messages`);
111
- * ```
112
- */
113
- export const QueueSchema = z.object({
114
- /** Unique identifier for the queue. */
115
- id: z.string(),
116
- /** Human-readable queue name (used for API operations). */
117
- name: z.string(),
118
- /** Optional description of the queue's purpose. */
119
- description: z.string().nullable().optional(),
120
- /** The type of queue (worker or pubsub). */
121
- queue_type: QueueTypeSchema,
122
- /** Default time-to-live for messages in seconds. Null means no expiration. */
123
- default_ttl_seconds: z.number().nullable().optional(),
124
- /** Time in seconds a message is invisible after being received. */
125
- default_visibility_timeout_seconds: z.number().optional(),
126
- /** Maximum number of delivery attempts before moving to DLQ. */
127
- default_max_retries: z.number().optional(),
128
- /** Initial backoff delay in milliseconds for retries. */
129
- default_retry_backoff_ms: z.number().optional(),
130
- /** Maximum backoff delay in milliseconds for retries. */
131
- default_retry_max_backoff_ms: z.number().optional(),
132
- /** Multiplier for exponential backoff. */
133
- default_retry_multiplier: z.number().optional(),
134
- /** Maximum number of messages a single client can process concurrently. */
135
- max_in_flight_per_client: z.number().optional(),
136
- /** The next offset that will be assigned to a new message. */
137
- next_offset: z.number().optional(),
138
- /** Total number of messages currently in the queue. */
139
- message_count: z.number().optional(),
140
- /** Number of messages in the dead letter queue. */
141
- dlq_count: z.number().optional(),
142
- /** ISO 8601 timestamp when the queue was created. */
143
- created_at: z.string(),
144
- /** ISO 8601 timestamp when the queue was last updated. */
145
- updated_at: z.string(),
146
- /** ISO 8601 timestamp when the queue was paused (null if not paused). */
147
- paused_at: z.string().nullable().optional(),
148
- /** Retention period for acknowledged messages in seconds. */
149
- retention_seconds: z.number().optional(),
150
- });
151
-
152
- /**
153
- * Queue type representing a message queue instance.
154
- */
155
- export type Queue = z.infer<typeof QueueSchema>;
156
-
157
- /**
158
- * Message state schema for tracking message lifecycle.
159
- *
160
- * - `pending`: Message is waiting to be processed.
161
- * - `leased`: Message has been received and is currently being processed by a consumer.
162
- * - `processing`: Message has been received and is being processed (legacy, equivalent to leased).
163
- * - `delivered`: Message was successfully acknowledged.
164
- * - `failed`: Message processing failed but may be retried.
165
- * - `dead`: Message exceeded retry limit and was moved to DLQ.
166
- */
167
- export const MessageStateSchema = z.enum([
168
- 'pending',
169
- 'leased',
170
- 'processing',
171
- 'delivered',
172
- 'failed',
173
- 'dead',
174
- ]);
175
-
176
- /**
177
- * Message state type.
178
- */
179
- export type MessageState = z.infer<typeof MessageStateSchema>;
180
-
181
- /**
182
- * Message schema representing a queue message.
183
- *
184
- * @example
185
- * ```typescript
186
- * const message = await publishMessage(client, 'my-queue', { payload: 'Hello' });
187
- * console.log(`Published message ${message.id} at offset ${message.offset}`);
188
- * ```
189
- */
190
- export const MessageSchema = z.object({
191
- /** Unique identifier for the message (prefixed with msg_). */
192
- id: z.string(),
193
- /** ID of the queue this message belongs to. */
194
- queue_id: z.string(),
195
- /** Sequential offset within the queue. */
196
- offset: z.number(),
197
- /** The message payload (JSON object). */
198
- payload: z.unknown(),
199
- /** Size of the message payload in bytes. */
200
- size: z.number().optional(),
201
- /** Optional metadata attached to the message. */
202
- metadata: z.record(z.string(), z.unknown()).nullable().optional(),
203
- /** Current state of the message. */
204
- state: MessageStateSchema.optional(),
205
- /** Optional key for message deduplication. */
206
- idempotency_key: z.string().nullable().optional(),
207
- /** Optional key for message ordering. */
208
- partition_key: z.string().nullable().optional(),
209
- /** Time-to-live in seconds (null means no expiration). */
210
- ttl_seconds: z.number().nullable().optional(),
211
- /** Number of times delivery has been attempted. */
212
- delivery_attempts: z.number().optional(),
213
- /** Maximum number of delivery attempts allowed. */
214
- max_retries: z.number().optional(),
215
- /** ISO 8601 timestamp when the message was published. */
216
- published_at: z.string().optional(),
217
- /** ISO 8601 timestamp when the message will expire (if TTL set). */
218
- expires_at: z.string().nullable().optional(),
219
- /** ISO 8601 timestamp when the message was delivered. */
220
- delivered_at: z.string().nullable().optional(),
221
- /** ISO 8601 timestamp when the message was acknowledged. */
222
- acknowledged_at: z.string().nullable().optional(),
223
- /** ISO 8601 timestamp when the message was created. */
224
- created_at: z.string().optional(),
225
- /** ISO 8601 timestamp when the message was last updated. */
226
- updated_at: z.string().optional(),
227
- });
228
-
229
- /**
230
- * Message type representing a queue message.
231
- */
232
- export type Message = z.infer<typeof MessageSchema>;
233
-
234
- /**
235
- * Destination type schema. Currently only HTTP webhooks are supported.
236
- */
237
- export const DestinationTypeSchema = z.enum(['http']);
238
-
239
- /**
240
- * Destination type.
241
- */
242
- export type DestinationType = z.infer<typeof DestinationTypeSchema>;
243
-
244
- /**
245
- * HTTP destination configuration schema for webhook delivery.
246
- *
247
- * @example
248
- * ```typescript
249
- * const config: HttpDestinationConfig = {
250
- * url: 'https://api.example.com/webhook',
251
- * method: 'POST',
252
- * headers: { 'X-Custom-Header': 'value' },
253
- * timeout_ms: 10000,
254
- * retry_policy: { max_attempts: 3 },
255
- * };
256
- * ```
257
- */
258
- export const HttpDestinationConfigSchema = z.object({
259
- /** The URL to send messages to. */
260
- url: z.string(),
261
- /** Optional custom headers to include in requests. */
262
- headers: z.record(z.string(), z.string()).optional(),
263
- /** HTTP method to use (default: POST). */
264
- method: z.string().default('POST'),
265
- /** Request timeout in milliseconds (default: 30000). */
266
- timeout_ms: z.number().default(30000),
267
- /** Optional retry policy for failed deliveries. */
268
- retry_policy: z
269
- .object({
270
- /** Maximum number of delivery attempts (default: 5). */
271
- max_attempts: z.number().default(5),
272
- /** Initial backoff delay in milliseconds (default: 1000). */
273
- initial_backoff_ms: z.number().default(1000),
274
- /** Maximum backoff delay in milliseconds (default: 60000). */
275
- max_backoff_ms: z.number().default(60000),
276
- /** Backoff multiplier for exponential backoff (default: 2.0). */
277
- backoff_multiplier: z.number().default(2.0),
278
- })
279
- .optional(),
280
- /** Optional request signing configuration. */
281
- signing: z
282
- .object({
283
- /** Whether signing is enabled (default: false). */
284
- enabled: z.boolean().default(false),
285
- /** Secret key for HMAC signing. */
286
- secret_key: z.string().optional(),
287
- })
288
- .optional(),
289
- });
290
-
291
- /**
292
- * HTTP destination configuration type.
293
- */
294
- export type HttpDestinationConfig = z.infer<typeof HttpDestinationConfigSchema>;
295
-
296
- /**
297
- * Destination statistics schema showing delivery metrics.
298
- */
299
- export const DestinationStatsSchema = z.object({
300
- /** Total number of delivery attempts. */
301
- total_deliveries: z.number(),
302
- /** Number of successful deliveries. */
303
- successful_deliveries: z.number(),
304
- /** Number of failed deliveries. */
305
- failed_deliveries: z.number(),
306
- /** ISO 8601 timestamp of the last delivery attempt. */
307
- last_delivery_at: z.string().nullable().optional(),
308
- /** ISO 8601 timestamp of the last successful delivery. */
309
- last_success_at: z.string().nullable().optional(),
310
- /** ISO 8601 timestamp of the last failed delivery. */
311
- last_failure_at: z.string().nullable().optional(),
312
- });
313
-
314
- /**
315
- * Destination statistics type.
316
- */
317
- export type DestinationStats = z.infer<typeof DestinationStatsSchema>;
318
-
319
- /**
320
- * Destination schema representing a webhook endpoint for message delivery.
321
- *
322
- * Destinations are attached to queues and automatically receive messages when published.
323
- *
324
- * @example
325
- * ```typescript
326
- * const destination = await createDestination(client, 'my-queue', {
327
- * destination_type: 'http',
328
- * config: { url: 'https://api.example.com/webhook' },
329
- * enabled: true,
330
- * });
331
- * ```
332
- */
333
- export const DestinationSchema = z.object({
334
- /** Unique identifier for the destination (prefixed with dest_). */
335
- id: z.string(),
336
- /** ID of the queue this destination is attached to. */
337
- queue_id: z.string(),
338
- /** Type of destination (currently only 'http'). */
339
- destination_type: DestinationTypeSchema,
340
- /** HTTP configuration for the destination. */
341
- config: HttpDestinationConfigSchema,
342
- /** Whether the destination is enabled for delivery. */
343
- enabled: z.boolean(),
344
- /** Delivery statistics for this destination. */
345
- stats: DestinationStatsSchema.optional(),
346
- /** ISO 8601 timestamp when the destination was created. */
347
- created_at: z.string(),
348
- /** ISO 8601 timestamp when the destination was last updated. */
349
- updated_at: z.string(),
350
- });
351
-
352
- /**
353
- * Destination type representing a webhook endpoint.
354
- */
355
- export type Destination = z.infer<typeof DestinationSchema>;
356
-
357
- /**
358
- * Dead letter message schema for messages that failed processing.
359
- *
360
- * Messages are moved to the dead letter queue (DLQ) after exceeding the maximum
361
- * retry limit. They can be inspected, replayed, or deleted.
362
- *
363
- * @example
364
- * ```typescript
365
- * const { messages } = await listDeadLetterMessages(client, 'my-queue');
366
- * for (const msg of messages) {
367
- * console.log(`Failed message: ${msg.failure_reason}`);
368
- * await replayDeadLetterMessage(client, 'my-queue', msg.id);
369
- * }
370
- * ```
371
- */
372
- export const DeadLetterMessageSchema = z.object({
373
- /** Unique identifier for the DLQ entry. */
374
- id: z.string(),
375
- /** ID of the queue this message belongs to. */
376
- queue_id: z.string(),
377
- /** ID of the original message that failed (optional until backend includes it). */
378
- original_message_id: z.string().optional(),
379
- /** Offset of the original message in the queue. */
380
- offset: z.number(),
381
- /** The message payload (JSON object). */
382
- payload: z.unknown(),
383
- /** Optional metadata from the original message. */
384
- metadata: z.record(z.string(), z.unknown()).nullable().optional(),
385
- /** Reason why the message was moved to DLQ. */
386
- failure_reason: z.string().nullable().optional(),
387
- /** Number of delivery attempts before failure. */
388
- delivery_attempts: z.number(),
389
- /** ISO 8601 timestamp when the message was moved to DLQ (optional until backend includes it). */
390
- moved_at: z.string().optional(),
391
- /** ISO 8601 timestamp when the original message was published (optional, falls back to published_at). */
392
- original_published_at: z.string().optional(),
393
- /** ISO 8601 timestamp when the message was published (from base message). */
394
- published_at: z.string().optional(),
395
- /** ISO 8601 timestamp when the DLQ entry was created. */
396
- created_at: z.string(),
397
- });
398
-
399
- /**
400
- * Dead letter message type.
401
- */
402
- export type DeadLetterMessage = z.infer<typeof DeadLetterMessageSchema>;
403
-
404
- // ============================================================================
405
- // API Options
406
- // ============================================================================
407
-
408
- /**
409
- * Common options for queue API calls.
410
- *
411
- * Used to pass organization context when calling from CLI or other
412
- * contexts where the org is not implicit in the authentication token.
413
- */
414
- export interface QueueApiOptions {
415
- /**
416
- * Organization ID for the request.
417
- * Required when using user authentication (CLI) instead of SDK key.
418
- */
419
- orgId?: string;
420
-
421
- /**
422
- * Whether to publish synchronously.
423
- * When true, the API waits for the message to be fully persisted before returning.
424
- * When false (default), the API returns immediately with a pending message.
425
- */
426
- sync?: boolean;
427
- }
428
-
429
- // ============================================================================
430
- // Request Schemas
431
- // ============================================================================
432
-
433
- /**
434
- * Request schema for creating a new queue.
435
- *
436
- * @example
437
- * ```typescript
438
- * const request: CreateQueueRequest = {
439
- * name: 'my-worker-queue',
440
- * queue_type: 'worker',
441
- * description: 'Processes background jobs',
442
- * settings: { default_max_retries: 3 },
443
- * };
444
- * ```
445
- */
446
- export const CreateQueueRequestSchema = z.object({
447
- /** Optional queue name (auto-generated if not provided). */
448
- name: z.string().optional(),
449
- /** Optional description of the queue's purpose. */
450
- description: z.string().optional(),
451
- /** Type of queue to create. */
452
- queue_type: QueueTypeSchema,
453
- /** Optional settings to customize queue behavior (server applies defaults for missing fields). */
454
- settings: QueueSettingsSchemaBase.partial().optional(),
455
- });
456
-
457
- /** Request type for creating a queue. */
458
- export type CreateQueueRequest = z.infer<typeof CreateQueueRequestSchema>;
459
-
460
- /**
461
- * Request schema for updating an existing queue.
462
- */
463
- export const UpdateQueueRequestSchema = z.object({
464
- /** New description for the queue. */
465
- description: z.string().optional(),
466
- /** Settings to update (partial update supported, only provided fields are updated). */
467
- settings: QueueSettingsSchemaBase.partial().optional(),
468
- });
469
-
470
- /** Request type for updating a queue. */
471
- export type UpdateQueueRequest = z.infer<typeof UpdateQueueRequestSchema>;
472
-
473
- /**
474
- * Request schema for listing queues with pagination.
475
- */
476
- export const ListQueuesRequestSchema = z.object({
477
- /** Maximum number of queues to return. */
478
- limit: z.number().optional(),
479
- /** Number of queues to skip for pagination. */
480
- offset: z.number().optional(),
481
- /** Filter by queue name substring. */
482
- name: z.string().optional(),
483
- /** Filter by queue type. */
484
- queue_type: QueueTypeSchema.optional(),
485
- /** Filter by queue status. */
486
- status: z.enum(['active', 'paused']).optional(),
487
- /** Field to sort by. */
488
- sort: z.enum(['name', 'created', 'updated', 'message_count', 'dlq_count']).optional(),
489
- /** Sort direction (asc or desc). */
490
- direction: z.enum(['asc', 'desc']).optional(),
491
- });
492
-
493
- /** Request type for listing queues. */
494
- export type ListQueuesRequest = z.infer<typeof ListQueuesRequestSchema>;
495
-
496
- /**
497
- * Request schema for publishing a message to a queue.
498
- *
499
- * @example
500
- * ```typescript
501
- * const request: PublishMessageRequest = {
502
- * payload: { task: 'process-order', orderId: 123 },
503
- * metadata: { priority: 'high' },
504
- * idempotency_key: 'order-123-v1',
505
- * ttl_seconds: 3600,
506
- * };
507
- * ```
508
- */
509
- export const PublishMessageRequestSchema = z.object({
510
- /** The message payload (JSON object). */
511
- payload: z.unknown(),
512
- /** Optional metadata to attach to the message. */
513
- metadata: z.record(z.string(), z.unknown()).optional(),
514
- /** Optional key for deduplication (prevents duplicate messages). */
515
- idempotency_key: z.string().optional(),
516
- /** Optional key for message ordering within a partition. */
517
- partition_key: z.string().optional(),
518
- /** Optional time-to-live in seconds. */
519
- ttl_seconds: z.number().optional(),
520
- });
521
-
522
- /** Request type for publishing a message. */
523
- export type PublishMessageRequest = z.infer<typeof PublishMessageRequestSchema>;
524
-
525
- /**
526
- * Request schema for batch publishing multiple messages.
527
- *
528
- * @example
529
- * ```typescript
530
- * const request: BatchPublishMessagesRequest = {
531
- * messages: [
532
- * { payload: { task: 'a' } },
533
- * { payload: { task: 'b' } },
534
- * ],
535
- * };
536
- * ```
537
- */
538
- export const BatchPublishMessagesRequestSchema = z.object({
539
- /** Array of messages to publish (max 1000 per batch). */
540
- messages: z.array(PublishMessageRequestSchema).max(1000),
541
- });
542
-
543
- /** Request type for batch publishing messages. */
544
- export type BatchPublishMessagesRequest = z.infer<typeof BatchPublishMessagesRequestSchema>;
545
-
546
- /**
547
- * Request schema for listing messages with pagination and filtering.
548
- */
549
- export const ListMessagesRequestSchema = z.object({
550
- /** Maximum number of messages to return. */
551
- limit: z.number().optional(),
552
- /** Number of messages to skip for pagination. */
553
- offset: z.number().optional(),
554
- /** Filter messages by state. */
555
- state: MessageStateSchema.optional(),
556
- });
557
-
558
- /** Request type for listing messages. */
559
- export type ListMessagesRequest = z.infer<typeof ListMessagesRequestSchema>;
560
-
561
- /**
562
- * Request schema for consuming messages from a specific offset.
563
- */
564
- export const ConsumeMessagesRequestSchema = z.object({
565
- /** Starting offset to consume from. */
566
- offset: z.number(),
567
- /** Maximum number of messages to consume. */
568
- limit: z.number().optional(),
569
- });
570
-
571
- /** Request type for consuming messages. */
572
- export type ConsumeMessagesRequest = z.infer<typeof ConsumeMessagesRequestSchema>;
573
-
574
- /**
575
- * Request schema for creating a destination webhook.
576
- *
577
- * @example
578
- * ```typescript
579
- * const request: CreateDestinationRequest = {
580
- * destination_type: 'http',
581
- * config: {
582
- * url: 'https://api.example.com/webhook',
583
- * method: 'POST',
584
- * },
585
- * enabled: true,
586
- * };
587
- * ```
588
- */
589
- export const CreateDestinationRequestSchema = z.object({
590
- /** Type of destination to create. */
591
- destination_type: DestinationTypeSchema,
592
- /** HTTP configuration for the destination. */
593
- config: HttpDestinationConfigSchema,
594
- /** Whether the destination should be enabled (default: true). */
595
- enabled: z.boolean().default(true),
596
- });
597
-
598
- /** Request type for creating a destination. */
599
- export type CreateDestinationRequest = z.infer<typeof CreateDestinationRequestSchema>;
600
-
601
- /**
602
- * Request schema for updating a destination.
603
- */
604
- export const UpdateDestinationRequestSchema = z.object({
605
- /** HTTP configuration updates (partial update supported). */
606
- config: HttpDestinationConfigSchema.partial().optional(),
607
- /** Enable or disable the destination. */
608
- enabled: z.boolean().optional(),
609
- });
610
-
611
- /** Request type for updating a destination. */
612
- export type UpdateDestinationRequest = z.infer<typeof UpdateDestinationRequestSchema>;
613
-
614
- /**
615
- * Request schema for listing dead letter queue messages with pagination.
616
- */
617
- export const ListDlqRequestSchema = z.object({
618
- /** Maximum number of messages to return. */
619
- limit: z.number().optional(),
620
- /** Number of messages to skip for pagination. */
621
- offset: z.number().optional(),
622
- });
623
-
624
- /** Request type for listing DLQ messages. */
625
- export type ListDlqRequest = z.infer<typeof ListDlqRequestSchema>;
626
-
627
- // ============================================================================
628
- // Analytics Types
629
- // ============================================================================
630
-
631
- /**
632
- * Time bucket granularity for analytics queries.
633
- *
634
- * - `minute`: 1-minute buckets, max range 24 hours. Best for real-time monitoring.
635
- * - `hour`: 1-hour buckets, max range 7 days. Best for short-term trend analysis.
636
- * - `day`: 1-day buckets, max range 90 days. Best for long-term analysis.
637
- *
638
- * @example
639
- * ```typescript
640
- * const analytics = await getQueueAnalytics(client, 'my-queue', {
641
- * granularity: 'hour',
642
- * start: '2026-01-14T00:00:00Z',
643
- * });
644
- * ```
645
- */
646
- export const AnalyticsGranularitySchema = z.enum(['minute', 'hour', 'day']);
647
-
648
- /**
649
- * Time bucket granularity type.
650
- */
651
- export type AnalyticsGranularity = z.infer<typeof AnalyticsGranularitySchema>;
652
-
653
- /**
654
- * Options for analytics queries.
655
- *
656
- * Use these options to filter and configure analytics requests by time range,
657
- * granularity, and optional filters like project or agent ID.
658
- *
659
- * @example
660
- * ```typescript
661
- * const options: AnalyticsOptions = {
662
- * start: '2026-01-14T00:00:00Z',
663
- * end: '2026-01-15T00:00:00Z',
664
- * granularity: 'hour',
665
- * projectId: 'proj_abc123',
666
- * };
667
- * const analytics = await getQueueAnalytics(client, 'my-queue', options);
668
- * ```
669
- */
670
- export interface AnalyticsOptions extends QueueApiOptions {
671
- /**
672
- * Start of time range in ISO8601 format.
673
- * @default 24 hours ago
674
- * @example '2026-01-14T00:00:00Z'
675
- */
676
- start?: string;
677
-
678
- /**
679
- * End of time range in ISO8601 format.
680
- * @default Current time
681
- * @example '2026-01-15T00:00:00Z'
682
- */
683
- end?: string;
684
-
685
- /**
686
- * Time bucket granularity for aggregation.
687
- * @default 'hour'
688
- */
689
- granularity?: AnalyticsGranularity;
690
-
691
- /**
692
- * Filter analytics to messages from a specific project.
693
- * Only messages with matching `project_id` will be included.
694
- */
695
- projectId?: string;
696
-
697
- /**
698
- * Filter analytics to messages from a specific agent.
699
- * Only messages with matching `agent_id` will be included.
700
- */
701
- agentId?: string;
702
- }
703
-
704
- /**
705
- * Options for real-time SSE streaming analytics.
706
- *
707
- * SSE (Server-Sent Events) streams provide live updates of queue statistics
708
- * at a configurable interval. The stream stays open until closed by the client.
709
- *
710
- * @example
711
- * ```typescript
712
- * const stream = streamQueueAnalytics(client, 'my-queue', { interval: 5 });
713
- * for await (const event of stream) {
714
- * console.log(`Backlog: ${event.backlog}`);
715
- * }
716
- * ```
717
- */
718
- export interface StreamAnalyticsOptions extends QueueApiOptions {
719
- /**
720
- * Interval between stats updates in seconds.
721
- * @default 5
722
- * @minimum 1
723
- * @maximum 60
724
- */
725
- interval?: number;
726
- }
727
-
728
- /**
729
- * Time period for analytics responses.
730
- *
731
- * Represents the time range and granularity of the analytics data.
732
- */
733
- export const TimePeriodSchema = z.object({
734
- /** Start of the time period in ISO8601 format. */
735
- start: z.string(),
736
- /** End of the time period in ISO8601 format. */
737
- end: z.string(),
738
- /** Time bucket granularity used for aggregation. */
739
- granularity: AnalyticsGranularitySchema.optional(),
740
- });
741
-
742
- /**
743
- * Time period type representing a date range for analytics.
744
- */
745
- export type TimePeriod = z.infer<typeof TimePeriodSchema>;
746
-
747
- /**
748
- * Latency statistics with percentile distributions.
749
- *
750
- * Provides average, percentile (p50, p95, p99), and maximum latency values
751
- * for message delivery operations.
752
- *
753
- * @example
754
- * ```typescript
755
- * const { latency } = await getQueueAnalytics(client, 'my-queue');
756
- * console.log(`Average: ${latency.avg_ms}ms, P95: ${latency.p95_ms}ms`);
757
- * ```
758
- */
759
- export const LatencyStatsSchema = z.object({
760
- /** Average latency in milliseconds. */
761
- avg_ms: z.number(),
762
- /** 50th percentile (median) latency in milliseconds. */
763
- p50_ms: z.number().optional(),
764
- /** 95th percentile latency in milliseconds. */
765
- p95_ms: z.number().optional(),
766
- /** 99th percentile latency in milliseconds. */
767
- p99_ms: z.number().optional(),
768
- /** Maximum observed latency in milliseconds. */
769
- max_ms: z.number().optional(),
770
- });
771
-
772
- /**
773
- * Latency statistics type.
774
- */
775
- export type LatencyStats = z.infer<typeof LatencyStatsSchema>;
776
-
777
- /**
778
- * Current real-time queue state.
779
- *
780
- * Represents the instantaneous state of a queue, useful for monitoring
781
- * dashboards and alerting on queue health.
782
- *
783
- * @example
784
- * ```typescript
785
- * const { current } = await getQueueAnalytics(client, 'my-queue');
786
- * if (current.backlog > 1000) {
787
- * console.warn('Queue backlog is high!');
788
- * }
789
- * ```
790
- */
791
- export const QueueCurrentStatsSchema = z.object({
792
- /** Number of messages waiting to be processed. */
793
- backlog: z.number(),
794
- /** Number of messages in the dead letter queue. */
795
- dlq_count: z.number(),
796
- /** Number of messages currently leased by consumers. */
797
- messages_in_flight: z.number(),
798
- /** Number of active WebSocket/long-poll consumers. */
799
- active_consumers: z.number(),
800
- /** Age in seconds of the oldest pending message (null if queue is empty). */
801
- oldest_message_age_seconds: z.number().nullable().optional(),
802
- });
803
-
804
- /**
805
- * Current queue state type.
806
- */
807
- export type QueueCurrentStats = z.infer<typeof QueueCurrentStatsSchema>;
808
-
809
- /**
810
- * Aggregated statistics for a time period.
811
- *
812
- * Contains counts and metrics aggregated over the requested time range.
813
- *
814
- * @example
815
- * ```typescript
816
- * const { period_stats } = await getQueueAnalytics(client, 'my-queue');
817
- * const successRate = period_stats.messages_acknowledged / period_stats.messages_published;
818
- * console.log(`Success rate: ${(successRate * 100).toFixed(1)}%`);
819
- * ```
820
- */
821
- export const QueuePeriodStatsSchema = z.object({
822
- /** Total messages published during the period. */
823
- messages_published: z.number(),
824
- /** Total messages delivered to consumers during the period. */
825
- messages_delivered: z.number(),
826
- /** Total messages successfully acknowledged during the period. */
827
- messages_acknowledged: z.number(),
828
- /** Total messages that failed and moved to DLQ during the period. */
829
- messages_failed: z.number(),
830
- /** Total messages replayed from DLQ during the period. */
831
- messages_replayed: z.number(),
832
- /** Total bytes of message payloads published during the period. */
833
- bytes_published: z.number(),
834
- /** Total delivery attempts (includes retries) during the period. */
835
- delivery_attempts: z.number(),
836
- /** Number of retry attempts (delivery_attempts - messages_delivered). */
837
- retry_count: z.number(),
838
- });
839
-
840
- /**
841
- * Period statistics type.
842
- */
843
- export type QueuePeriodStats = z.infer<typeof QueuePeriodStatsSchema>;
844
-
845
- /**
846
- * Analytics for a webhook destination.
847
- *
848
- * Provides delivery statistics for a configured webhook endpoint.
849
- *
850
- * @example
851
- * ```typescript
852
- * const { destinations } = await getQueueAnalytics(client, 'my-queue');
853
- * for (const dest of destinations ?? []) {
854
- * const successRate = dest.success_count / (dest.success_count + dest.failure_count);
855
- * console.log(`${dest.url}: ${(successRate * 100).toFixed(1)}% success`);
856
- * }
857
- * ```
858
- */
859
- export const DestinationAnalyticsSchema = z.object({
860
- /** Unique destination identifier (prefixed with dest_). */
861
- id: z.string(),
862
- /** Destination type (currently only 'http'). */
863
- type: z.string(),
864
- /** Webhook URL. */
865
- url: z.string(),
866
- /** Total successful deliveries. */
867
- success_count: z.number(),
868
- /** Total failed deliveries. */
869
- failure_count: z.number(),
870
- /** Average response time in milliseconds. */
871
- avg_response_time_ms: z.number().optional(),
872
- /** ISO8601 timestamp of last successful delivery. */
873
- last_success_at: z.string().nullable().optional(),
874
- /** ISO8601 timestamp of last failed delivery. */
875
- last_failure_at: z.string().nullable().optional(),
876
- });
877
-
878
- /**
879
- * Destination analytics type.
880
- */
881
- export type DestinationAnalytics = z.infer<typeof DestinationAnalyticsSchema>;
882
-
883
- /**
884
- * Complete analytics for a single queue.
885
- *
886
- * Provides comprehensive analytics including current state, period statistics,
887
- * latency metrics, and destination performance.
888
- *
889
- * @example
890
- * ```typescript
891
- * const analytics = await getQueueAnalytics(client, 'order-processing');
892
- * console.log(`Queue: ${analytics.queue_name} (${analytics.queue_type})`);
893
- * console.log(`Backlog: ${analytics.current.backlog}`);
894
- * console.log(`Published (24h): ${analytics.period_stats.messages_published}`);
895
- * console.log(`P95 Latency: ${analytics.latency.p95_ms}ms`);
896
- * ```
897
- */
898
- export const QueueAnalyticsSchema = z.object({
899
- /** Unique queue identifier (prefixed with queue_). */
900
- queue_id: z.string(),
901
- /** Human-readable queue name. */
902
- queue_name: z.string(),
903
- /** Queue type: 'worker' or 'pubsub'. */
904
- queue_type: z.string(),
905
- /** Time period for the analytics data. */
906
- period: TimePeriodSchema,
907
- /** Current real-time queue state. */
908
- current: QueueCurrentStatsSchema,
909
- /** Aggregated statistics for the time period. */
910
- period_stats: QueuePeriodStatsSchema,
911
- /** Message delivery latency statistics. */
912
- latency: LatencyStatsSchema,
913
- /** Consumer processing latency (delivery-to-ack time). */
914
- consumer_latency: LatencyStatsSchema,
915
- /** Analytics for each configured webhook destination. */
916
- destinations: z.array(DestinationAnalyticsSchema).optional(),
917
- });
918
-
919
- /**
920
- * Queue analytics type.
921
- */
922
- export type QueueAnalytics = z.infer<typeof QueueAnalyticsSchema>;
923
-
924
- /**
925
- * Summary statistics for a queue in org-level analytics.
926
- *
927
- * Provides a condensed view of queue metrics for listing in dashboards.
928
- */
929
- export const QueueSummarySchema = z.object({
930
- /** Unique queue identifier. */
931
- id: z.string(),
932
- /** Human-readable queue name. */
933
- name: z.string(),
934
- /** Queue type: 'worker' or 'pubsub'. */
935
- queue_type: z.string(),
936
- /** Messages published during the period. */
937
- messages_published: z.number(),
938
- /** Messages delivered during the period. */
939
- messages_delivered: z.number(),
940
- /** Messages acknowledged during the period. */
941
- messages_acknowledged: z.number(),
942
- /** Current pending message count. */
943
- backlog: z.number(),
944
- /** Current dead letter queue count. */
945
- dlq_count: z.number(),
946
- /** Average delivery latency in milliseconds. */
947
- avg_latency_ms: z.number(),
948
- /** Percentage of messages that failed (0-100). */
949
- error_rate_percent: z.number(),
950
- });
951
-
952
- /**
953
- * Queue summary type for org-level listings.
954
- */
955
- export type QueueSummary = z.infer<typeof QueueSummarySchema>;
956
-
957
- /**
958
- * Aggregated summary across all queues in an organization.
959
- *
960
- * @example
961
- * ```typescript
962
- * const { summary } = await getOrgAnalytics(client);
963
- * console.log(`Total queues: ${summary.total_queues}`);
964
- * console.log(`Total messages: ${summary.total_messages_published}`);
965
- * console.log(`Error rate: ${summary.error_rate_percent.toFixed(2)}%`);
966
- * ```
967
- */
968
- export const OrgAnalyticsSummarySchema = z.object({
969
- /** Total number of queues in the organization. */
970
- total_queues: z.number(),
971
- /** Total messages published across all queues. */
972
- total_messages_published: z.number(),
973
- /** Total messages delivered across all queues. */
974
- total_messages_delivered: z.number(),
975
- /** Total messages acknowledged across all queues. */
976
- total_messages_acknowledged: z.number(),
977
- /** Total messages in all dead letter queues. */
978
- total_dlq_messages: z.number(),
979
- /** Total bytes published across all queues. */
980
- total_bytes_published: z.number(),
981
- /** Average delivery latency across all queues in milliseconds. */
982
- avg_latency_ms: z.number(),
983
- /** 95th percentile latency across all queues in milliseconds. */
984
- p95_latency_ms: z.number(),
985
- /** Overall error rate as percentage (0-100). */
986
- error_rate_percent: z.number(),
987
- });
988
-
989
- /**
990
- * Org-level analytics summary type.
991
- */
992
- export type OrgAnalyticsSummary = z.infer<typeof OrgAnalyticsSummarySchema>;
993
-
994
- /**
995
- * Complete organization-level analytics.
996
- *
997
- * Provides an overview of all queues with aggregated metrics and per-queue summaries.
998
- *
999
- * @example
1000
- * ```typescript
1001
- * const analytics = await getOrgAnalytics(client);
1002
- * console.log(`Org: ${analytics.org_id}`);
1003
- * console.log(`Queues: ${analytics.summary.total_queues}`);
1004
- * for (const queue of analytics.queues) {
1005
- * console.log(` ${queue.name}: ${queue.backlog} pending`);
1006
- * }
1007
- * ```
1008
- */
1009
- export const OrgAnalyticsSchema = z.object({
1010
- /** Organization identifier. */
1011
- org_id: z.string(),
1012
- /** Time period for the analytics data. */
1013
- period: TimePeriodSchema,
1014
- /** Aggregated summary across all queues. */
1015
- summary: OrgAnalyticsSummarySchema,
1016
- /** Per-queue summary statistics. */
1017
- queues: z.array(QueueSummarySchema),
1018
- });
1019
-
1020
- /**
1021
- * Org-level analytics type.
1022
- */
1023
- export type OrgAnalytics = z.infer<typeof OrgAnalyticsSchema>;
1024
-
1025
- /**
1026
- * Single data point in a time series.
1027
- *
1028
- * Represents metrics for one time bucket (minute, hour, or day).
1029
- * Used for building charts and visualizing trends over time.
1030
- *
1031
- * @example
1032
- * ```typescript
1033
- * const { series } = await getQueueTimeSeries(client, 'my-queue', { granularity: 'hour' });
1034
- * for (const point of series) {
1035
- * console.log(`${point.timestamp}: ${point.throughput} msg/h, ${point.avg_latency_ms}ms avg`);
1036
- * }
1037
- * ```
1038
- */
1039
- export const TimeSeriesPointSchema = z.object({
1040
- /** ISO8601 timestamp for the start of this time bucket. */
1041
- timestamp: z.string(),
1042
- /** Messages published during this bucket. */
1043
- throughput: z.number(),
1044
- /** Messages delivered during this bucket. */
1045
- delivery_rate: z.number(),
1046
- /** Messages acknowledged during this bucket. */
1047
- ack_rate: z.number(),
1048
- /** Messages that failed during this bucket. */
1049
- error_rate: z.number(),
1050
- /** Average delivery latency in milliseconds for this bucket. */
1051
- avg_latency_ms: z.number(),
1052
- /** 95th percentile latency in milliseconds for this bucket. */
1053
- p95_latency_ms: z.number().optional(),
1054
- /** Queue backlog at the end of this bucket (snapshot). */
1055
- backlog: z.number().optional(),
1056
- /** Messages in flight at the end of this bucket (snapshot). */
1057
- messages_in_flight: z.number().optional(),
1058
- });
1059
-
1060
- /**
1061
- * Time series data point type.
1062
- */
1063
- export type TimeSeriesPoint = z.infer<typeof TimeSeriesPointSchema>;
1064
-
1065
- /**
1066
- * Time series analytics data for charting and visualization.
1067
- *
1068
- * Contains an array of data points at the requested granularity for building
1069
- * time-based charts and dashboards.
1070
- *
1071
- * @example
1072
- * ```typescript
1073
- * const timeseries = await getQueueTimeSeries(client, 'order-processing', {
1074
- * granularity: 'hour',
1075
- * start: '2026-01-14T00:00:00Z',
1076
- * end: '2026-01-15T00:00:00Z',
1077
- * });
1078
- *
1079
- * // Plot throughput over time
1080
- * const chartData = timeseries.series.map(p => ({
1081
- * x: new Date(p.timestamp),
1082
- * y: p.throughput,
1083
- * }));
1084
- * ```
1085
- */
1086
- export const TimeSeriesDataSchema = z.object({
1087
- /** Unique queue identifier. */
1088
- queue_id: z.string(),
1089
- /** Human-readable queue name. */
1090
- queue_name: z.string(),
1091
- /** Time period and granularity for the data. */
1092
- period: TimePeriodSchema,
1093
- /** Array of time-bucketed data points. */
1094
- series: z.array(TimeSeriesPointSchema),
1095
- });
1096
-
1097
- /**
1098
- * Time series data type.
1099
- */
1100
- export type TimeSeriesData = z.infer<typeof TimeSeriesDataSchema>;
1101
-
1102
- /**
1103
- * Real-time stats event from SSE stream.
1104
- *
1105
- * Represents a single snapshot of queue statistics delivered via Server-Sent Events.
1106
- * Events are pushed at the interval specified when opening the stream.
1107
- *
1108
- * @example
1109
- * ```typescript
1110
- * const stream = streamQueueAnalytics(client, 'my-queue', { interval: 5 });
1111
- * for await (const event of stream) {
1112
- * updateDashboard({
1113
- * backlog: event.backlog,
1114
- * throughput: event.throughput_1m,
1115
- * latency: event.avg_latency_ms,
1116
- * consumers: event.active_consumers,
1117
- * });
1118
- * }
1119
- * ```
1120
- */
1121
- export const SSEStatsEventSchema = z.object({
1122
- /** ISO8601 timestamp when this snapshot was taken. */
1123
- timestamp: z.string(),
1124
- /** Current number of pending messages. */
1125
- backlog: z.number(),
1126
- /** Current number of messages being processed. */
1127
- messages_in_flight: z.number(),
1128
- /** Messages published in the last minute. */
1129
- throughput_1m: z.number(),
1130
- /** Messages delivered in the last minute. */
1131
- delivery_rate_1m: z.number(),
1132
- /** Messages that failed in the last minute. */
1133
- error_rate_1m: z.number(),
1134
- /** Current average delivery latency in milliseconds. */
1135
- avg_latency_ms: z.number(),
1136
- /** Current number of connected consumers. */
1137
- active_consumers: z.number(),
1138
- });
1139
-
1140
- /**
1141
- * SSE stats event type for real-time streaming.
1142
- */
1143
- export type SSEStatsEvent = z.infer<typeof SSEStatsEventSchema>;
1144
-
1145
- // ============================================================================
1146
- // Source Types
1147
- // ============================================================================
1148
-
1149
- /**
1150
- * Source authentication type schema.
1151
- */
1152
- export const SourceAuthTypeSchema = z.enum(['none', 'basic', 'header']);
1153
-
1154
- /**
1155
- * Source authentication type.
1156
- */
1157
- export type SourceAuthType = z.infer<typeof SourceAuthTypeSchema>;
1158
-
1159
- /**
1160
- * Queue source schema representing an HTTP ingestion endpoint.
1161
- *
1162
- * Sources provide public URLs for ingesting data into queues from external sources.
1163
- * They support various authentication methods to secure access.
1164
- *
1165
- * @example
1166
- * ```typescript
1167
- * const source = await getSource(client, 'my-queue', 'qsrc_abc123');
1168
- * console.log(`Source URL: ${source.url}`);
1169
- * console.log(`Success rate: ${source.success_count}/${source.request_count}`);
1170
- * ```
1171
- */
1172
- export const SourceSchema = z.object({
1173
- /** Unique identifier for the source (prefixed with qsrc_). */
1174
- id: z.string(),
1175
- /** ID of the queue this source publishes to. */
1176
- queue_id: z.string(),
1177
- /** Human-readable source name. */
1178
- name: z.string(),
1179
- /** Optional description of the source's purpose. */
1180
- description: z.string().nullable().optional(),
1181
- /** Authentication type for the public endpoint. */
1182
- auth_type: SourceAuthTypeSchema,
1183
- /** Whether the source is enabled. */
1184
- enabled: z.boolean(),
1185
- /** Public URL to send data to this source. */
1186
- url: z.string(),
1187
- /** Total number of requests received. */
1188
- request_count: z.number(),
1189
- /** Number of successful ingestions. */
1190
- success_count: z.number(),
1191
- /** Number of failed ingestions. */
1192
- failure_count: z.number(),
1193
- /** ISO 8601 timestamp of last request. */
1194
- last_request_at: z.string().nullable().optional(),
1195
- /** ISO 8601 timestamp of last success. */
1196
- last_success_at: z.string().nullable().optional(),
1197
- /** ISO 8601 timestamp of last failure. */
1198
- last_failure_at: z.string().nullable().optional(),
1199
- /** Error message from last failure. */
1200
- last_failure_error: z.string().nullable().optional(),
1201
- /** ISO 8601 timestamp when the source was created. */
1202
- created_at: z.string(),
1203
- /** ISO 8601 timestamp when the source was last updated. */
1204
- updated_at: z.string(),
1205
- });
1206
-
1207
- /**
1208
- * Queue source type.
1209
- */
1210
- export type Source = z.infer<typeof SourceSchema>;
1211
-
1212
- /**
1213
- * Create source request schema.
1214
- *
1215
- * @example
1216
- * ```typescript
1217
- * const request: CreateSourceRequest = {
1218
- * name: 'webhook-ingestion',
1219
- * description: 'Receives webhooks from external service',
1220
- * auth_type: 'header',
1221
- * auth_value: 'Bearer my-secret-token',
1222
- * };
1223
- * ```
1224
- */
1225
- export const CreateSourceRequestSchema = z.object({
1226
- /** Human-readable name for the source. */
1227
- name: z.string().min(1).max(256),
1228
- /** Optional description. */
1229
- description: z.string().max(1024).optional(),
1230
- /** Authentication type (default: none). */
1231
- auth_type: SourceAuthTypeSchema.optional().default('none'),
1232
- /** Authentication value (format depends on auth_type). */
1233
- auth_value: z.string().optional(),
1234
- });
1235
-
1236
- /**
1237
- * Create source request type.
1238
- */
1239
- export type CreateSourceRequest = z.infer<typeof CreateSourceRequestSchema>;
1240
-
1241
- /**
1242
- * Update source request schema.
1243
- *
1244
- * All fields are optional - only provided fields will be updated.
1245
- *
1246
- * @example
1247
- * ```typescript
1248
- * // Disable a source
1249
- * const request: UpdateSourceRequest = { enabled: false };
1250
- *
1251
- * // Update authentication
1252
- * const request: UpdateSourceRequest = {
1253
- * auth_type: 'basic',
1254
- * auth_value: 'user:password',
1255
- * };
1256
- * ```
1257
- */
1258
- export const UpdateSourceRequestSchema = z.object({
1259
- /** New name for the source. */
1260
- name: z.string().min(1).max(256).optional(),
1261
- /** New description. */
1262
- description: z.string().max(1024).nullable().optional(),
1263
- /** New authentication type. */
1264
- auth_type: SourceAuthTypeSchema.optional(),
1265
- /** New authentication value. */
1266
- auth_value: z.string().optional(),
1267
- /** Whether the source is enabled. */
1268
- enabled: z.boolean().optional(),
1269
- });
1270
-
1271
- /**
1272
- * Update source request type.
1273
- */
1274
- export type UpdateSourceRequest = z.infer<typeof UpdateSourceRequestSchema>;
1275
-
1276
- // ============================================================================
1277
- // WebSocket Types
1278
- // ============================================================================
1279
-
1280
- /**
1281
- * WebSocket authentication request.
1282
- * This must be the first message sent after the WebSocket connection is established.
1283
- */
1284
- export const WebSocketAuthRequestSchema = z.object({
1285
- /** The API key for authentication (raw key, not "Bearer ..."). */
1286
- authorization: z.string(),
1287
- /** Optional client ID from a previous connection for reconnection. */
1288
- client_id: z.string().optional(),
1289
- /** Offset of the last message successfully processed. Server replays from here. */
1290
- last_offset: z.number().optional(),
1291
- });
1292
-
1293
- export type WebSocketAuthRequest = z.infer<typeof WebSocketAuthRequestSchema>;
1294
-
1295
- /**
1296
- * WebSocket authentication response from the server.
1297
- */
1298
- export const WebSocketAuthResponseSchema = z.object({
1299
- /** Whether authentication was successful. */
1300
- success: z.boolean(),
1301
- /** Error message if authentication failed. */
1302
- error: z.string().optional(),
1303
- /** The client/subscription ID assigned to this connection. Store and reuse on reconnect. */
1304
- client_id: z.string().optional(),
1305
- });
1306
-
1307
- export type WebSocketAuthResponse = z.infer<typeof WebSocketAuthResponseSchema>;
1308
-
1309
- /**
1310
- * WebSocket message pushed by the server.
1311
- *
1312
- * Messages are always delivered as an array. A single live push contains one
1313
- * element (`type: "message"`), while a replay batch may contain many
1314
- * (`type: "replay"`).
1315
- */
1316
- export const WebSocketMessageSchema = z.object({
1317
- /** Message type — "message" for live pushes, "replay" for reconnect replay batches. */
1318
- type: z.enum(['message', 'replay']),
1319
- /** Queue ID the messages belong to. */
1320
- queue_id: z.string(),
1321
- /** The queue messages. Always an array — single live pushes contain one element. */
1322
- messages: z.array(MessageSchema),
1323
- });
1324
-
1325
- export type WebSocketMessage = z.infer<typeof WebSocketMessageSchema>;