@boxrouter/sdk 0.0.1-alpha.0 → 0.12.190

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 (338) hide show
  1. package/NOTICE +29 -5
  2. package/README.md +497 -24
  3. package/dist/addresses.d.ts +5 -0
  4. package/dist/addresses.js +10 -0
  5. package/dist/api-error.d.ts +62 -0
  6. package/dist/api-error.js +264 -0
  7. package/dist/boxrouter.d.ts +68 -0
  8. package/dist/boxrouter.js +291 -0
  9. package/dist/browser-session/index.d.ts +17 -0
  10. package/dist/browser-session/index.js +48 -0
  11. package/dist/browser-session/operations.gen.d.ts +272 -0
  12. package/dist/browser-session/operations.gen.js +58 -0
  13. package/dist/browser-session/responseContracts/api_keys.d.ts +2 -0
  14. package/dist/browser-session/responseContracts/api_keys.js +10 -0
  15. package/dist/browser-session/responseContracts/credits.d.ts +2 -0
  16. package/dist/browser-session/responseContracts/credits.js +8 -0
  17. package/dist/browser-session/responseContracts/github.d.ts +2 -0
  18. package/dist/browser-session/responseContracts/github.js +11 -0
  19. package/dist/browser-session/responseContracts/identity.d.ts +2 -0
  20. package/dist/browser-session/responseContracts/identity.js +30 -0
  21. package/dist/browser-session/responseContracts/organizations.d.ts +2 -0
  22. package/dist/browser-session/responseContracts/organizations.js +17 -0
  23. package/dist/browser-session/responseContracts/privacy.d.ts +2 -0
  24. package/dist/browser-session/responseContracts/privacy.js +7 -0
  25. package/dist/browser-session/responseContracts.gen.d.ts +3 -0
  26. package/dist/browser-session/responseContracts.gen.js +10 -0
  27. package/dist/browser-session/responseValidators/api_keys-diagnostics.cjs +1 -0
  28. package/dist/browser-session/responseValidators/api_keys-diagnostics.d.cts +4 -0
  29. package/dist/browser-session/responseValidators/api_keys.cjs +2 -0
  30. package/dist/browser-session/responseValidators/api_keys.d.cts +4 -0
  31. package/dist/browser-session/responseValidators/credits-diagnostics.cjs +1 -0
  32. package/dist/browser-session/responseValidators/credits-diagnostics.d.cts +3 -0
  33. package/dist/browser-session/responseValidators/credits.cjs +2 -0
  34. package/dist/browser-session/responseValidators/credits.d.cts +3 -0
  35. package/dist/browser-session/responseValidators/github-diagnostics.cjs +1 -0
  36. package/dist/browser-session/responseValidators/github-diagnostics.d.cts +3 -0
  37. package/dist/browser-session/responseValidators/github.cjs +2 -0
  38. package/dist/browser-session/responseValidators/github.d.cts +3 -0
  39. package/dist/browser-session/responseValidators/identity-diagnostics.cjs +1 -0
  40. package/dist/browser-session/responseValidators/identity-diagnostics.d.cts +23 -0
  41. package/dist/browser-session/responseValidators/identity.cjs +2 -0
  42. package/dist/browser-session/responseValidators/identity.d.cts +23 -0
  43. package/dist/browser-session/responseValidators/organizations-diagnostics.cjs +1 -0
  44. package/dist/browser-session/responseValidators/organizations-diagnostics.d.cts +15 -0
  45. package/dist/browser-session/responseValidators/organizations.cjs +2 -0
  46. package/dist/browser-session/responseValidators/organizations.d.cts +15 -0
  47. package/dist/browser-session/responseValidators/privacy-diagnostics.cjs +1 -0
  48. package/dist/browser-session/responseValidators/privacy-diagnostics.d.cts +2 -0
  49. package/dist/browser-session/responseValidators/privacy.cjs +2 -0
  50. package/dist/browser-session/responseValidators/privacy.d.cts +2 -0
  51. package/dist/client/client.gen.d.ts +1 -1
  52. package/dist/client/client.gen.js +46 -94
  53. package/dist/client/index.d.ts +10 -10
  54. package/dist/client/index.js +16 -5
  55. package/dist/client/types.gen.d.ts +6 -6
  56. package/dist/client/types.gen.js +2 -1
  57. package/dist/client/utils.gen.d.ts +2 -2
  58. package/dist/client/utils.gen.js +31 -20
  59. package/dist/client.gen.d.ts +2 -2
  60. package/dist/client.gen.js +5 -2
  61. package/dist/command-check.gen.d.ts +14 -0
  62. package/dist/command-check.gen.js +23 -0
  63. package/dist/command-input.gen.d.ts +6 -0
  64. package/dist/command-input.gen.js +45 -0
  65. package/dist/core/auth.gen.js +5 -1
  66. package/dist/core/binaryStream.d.ts +8 -0
  67. package/dist/core/binaryStream.js +76 -0
  68. package/dist/core/bodySerializer.gen.d.ts +1 -1
  69. package/dist/core/bodySerializer.gen.js +8 -5
  70. package/dist/core/commandValidators.cjs +1 -0
  71. package/dist/core/commandValidators.d.cts +14 -0
  72. package/dist/core/eventValidation.d.ts +17 -0
  73. package/dist/core/eventValidation.js +56 -0
  74. package/dist/core/eventValidators.cjs +1 -0
  75. package/dist/core/eventValidators.d.cts +2 -0
  76. package/dist/core/json.d.ts +3 -0
  77. package/dist/core/json.js +33 -0
  78. package/dist/core/params.gen.js +4 -1
  79. package/dist/core/pathSerializer.gen.js +20 -11
  80. package/dist/core/queryKeySerializer.gen.js +12 -6
  81. package/dist/core/responseContracts/actions.d.ts +2 -0
  82. package/dist/core/responseContracts/actions.js +30 -0
  83. package/dist/core/responseContracts/agents.d.ts +2 -0
  84. package/dist/core/responseContracts/agents.js +7 -0
  85. package/dist/core/responseContracts/artifacts.d.ts +2 -0
  86. package/dist/core/responseContracts/artifacts.js +8 -0
  87. package/dist/core/responseContracts/commands.d.ts +2 -0
  88. package/dist/core/responseContracts/commands.js +6 -0
  89. package/dist/core/responseContracts/credits.d.ts +2 -0
  90. package/dist/core/responseContracts/credits.js +27 -0
  91. package/dist/core/responseContracts/files.d.ts +2 -0
  92. package/dist/core/responseContracts/files.js +15 -0
  93. package/dist/core/responseContracts/github.d.ts +2 -0
  94. package/dist/core/responseContracts/github.js +8 -0
  95. package/dist/core/responseContracts/images.d.ts +2 -0
  96. package/dist/core/responseContracts/images.js +8 -0
  97. package/dist/core/responseContracts/launchRuns.d.ts +2 -0
  98. package/dist/core/responseContracts/launchRuns.js +10 -0
  99. package/dist/core/responseContracts/launches.d.ts +2 -0
  100. package/dist/core/responseContracts/launches.js +10 -0
  101. package/dist/core/responseContracts/operations.d.ts +2 -0
  102. package/dist/core/responseContracts/operations.js +7 -0
  103. package/dist/core/responseContracts/previews.d.ts +2 -0
  104. package/dist/core/responseContracts/previews.js +8 -0
  105. package/dist/core/responseContracts/pricing.d.ts +2 -0
  106. package/dist/core/responseContracts/pricing.js +6 -0
  107. package/dist/core/responseContracts/processes.d.ts +2 -0
  108. package/dist/core/responseContracts/processes.js +11 -0
  109. package/dist/core/responseContracts/provider_accounts.d.ts +2 -0
  110. package/dist/core/responseContracts/provider_accounts.js +13 -0
  111. package/dist/core/responseContracts/providers.d.ts +2 -0
  112. package/dist/core/responseContracts/providers.js +6 -0
  113. package/dist/core/responseContracts/routing.d.ts +2 -0
  114. package/dist/core/responseContracts/routing.js +8 -0
  115. package/dist/core/responseContracts/sandboxes.d.ts +2 -0
  116. package/dist/core/responseContracts/sandboxes.js +15 -0
  117. package/dist/core/responseContracts/secrets.d.ts +2 -0
  118. package/dist/core/responseContracts/secrets.js +8 -0
  119. package/dist/core/responseContracts/spend_limits.d.ts +2 -0
  120. package/dist/core/responseContracts/spend_limits.js +8 -0
  121. package/dist/core/responseContracts/terminals.d.ts +2 -0
  122. package/dist/core/responseContracts/terminals.js +11 -0
  123. package/dist/core/responseContracts/usage.d.ts +2 -0
  124. package/dist/core/responseContracts/usage.js +7 -0
  125. package/dist/core/responseContracts/volumes.d.ts +2 -0
  126. package/dist/core/responseContracts/volumes.js +19 -0
  127. package/dist/core/responseContracts.gen.d.ts +3 -0
  128. package/dist/core/responseContracts.gen.js +27 -0
  129. package/dist/core/responseModes.d.ts +19 -0
  130. package/dist/core/responseModes.js +13 -0
  131. package/dist/core/responseValidation.d.ts +44 -0
  132. package/dist/core/responseValidation.js +174 -0
  133. package/dist/core/responseValidators/actions-diagnostics.cjs +4 -0
  134. package/dist/core/responseValidators/actions-diagnostics.d.cts +24 -0
  135. package/dist/core/responseValidators/actions.cjs +2 -0
  136. package/dist/core/responseValidators/actions.d.cts +24 -0
  137. package/dist/core/responseValidators/agents-diagnostics.cjs +1 -0
  138. package/dist/core/responseValidators/agents-diagnostics.d.cts +2 -0
  139. package/dist/core/responseValidators/agents.cjs +2 -0
  140. package/dist/core/responseValidators/agents.d.cts +2 -0
  141. package/dist/core/responseValidators/artifacts-diagnostics.cjs +1 -0
  142. package/dist/core/responseValidators/artifacts-diagnostics.d.cts +2 -0
  143. package/dist/core/responseValidators/artifacts.cjs +2 -0
  144. package/dist/core/responseValidators/artifacts.d.cts +2 -0
  145. package/dist/core/responseValidators/commands-diagnostics.cjs +1 -0
  146. package/dist/core/responseValidators/commands-diagnostics.d.cts +1 -0
  147. package/dist/core/responseValidators/commands.cjs +2 -0
  148. package/dist/core/responseValidators/commands.d.cts +1 -0
  149. package/dist/core/responseValidators/compact.cjs +122 -0
  150. package/dist/core/responseValidators/credits-diagnostics.cjs +1 -0
  151. package/dist/core/responseValidators/credits-diagnostics.d.cts +21 -0
  152. package/dist/core/responseValidators/credits.cjs +2 -0
  153. package/dist/core/responseValidators/credits.d.cts +21 -0
  154. package/dist/core/responseValidators/files-diagnostics.cjs +1 -0
  155. package/dist/core/responseValidators/files-diagnostics.d.cts +5 -0
  156. package/dist/core/responseValidators/files.cjs +2 -0
  157. package/dist/core/responseValidators/files.d.cts +5 -0
  158. package/dist/core/responseValidators/github-diagnostics.cjs +1 -0
  159. package/dist/core/responseValidators/github-diagnostics.d.cts +2 -0
  160. package/dist/core/responseValidators/github.cjs +2 -0
  161. package/dist/core/responseValidators/github.d.cts +2 -0
  162. package/dist/core/responseValidators/images-diagnostics.cjs +1 -0
  163. package/dist/core/responseValidators/images-diagnostics.d.cts +3 -0
  164. package/dist/core/responseValidators/images.cjs +2 -0
  165. package/dist/core/responseValidators/images.d.cts +3 -0
  166. package/dist/core/responseValidators/launchRuns-diagnostics.cjs +1 -0
  167. package/dist/core/responseValidators/launchRuns-diagnostics.d.cts +5 -0
  168. package/dist/core/responseValidators/launchRuns.cjs +2 -0
  169. package/dist/core/responseValidators/launchRuns.d.cts +5 -0
  170. package/dist/core/responseValidators/launches-diagnostics.cjs +10 -0
  171. package/dist/core/responseValidators/launches-diagnostics.d.cts +5 -0
  172. package/dist/core/responseValidators/launches.cjs +2 -0
  173. package/dist/core/responseValidators/launches.d.cts +5 -0
  174. package/dist/core/responseValidators/operations-diagnostics.cjs +1 -0
  175. package/dist/core/responseValidators/operations-diagnostics.d.cts +2 -0
  176. package/dist/core/responseValidators/operations.cjs +2 -0
  177. package/dist/core/responseValidators/operations.d.cts +2 -0
  178. package/dist/core/responseValidators/previews-diagnostics.cjs +1 -0
  179. package/dist/core/responseValidators/previews-diagnostics.d.cts +3 -0
  180. package/dist/core/responseValidators/previews.cjs +2 -0
  181. package/dist/core/responseValidators/previews.d.cts +3 -0
  182. package/dist/core/responseValidators/pricing-diagnostics.cjs +7 -0
  183. package/dist/core/responseValidators/pricing-diagnostics.d.cts +1 -0
  184. package/dist/core/responseValidators/pricing.cjs +2 -0
  185. package/dist/core/responseValidators/pricing.d.cts +1 -0
  186. package/dist/core/responseValidators/processes-diagnostics.cjs +1 -0
  187. package/dist/core/responseValidators/processes-diagnostics.d.cts +2 -0
  188. package/dist/core/responseValidators/processes.cjs +2 -0
  189. package/dist/core/responseValidators/processes.d.cts +2 -0
  190. package/dist/core/responseValidators/provider_accounts-diagnostics.cjs +1 -0
  191. package/dist/core/responseValidators/provider_accounts-diagnostics.d.cts +8 -0
  192. package/dist/core/responseValidators/provider_accounts.cjs +2 -0
  193. package/dist/core/responseValidators/provider_accounts.d.cts +8 -0
  194. package/dist/core/responseValidators/providers-diagnostics.cjs +1 -0
  195. package/dist/core/responseValidators/providers-diagnostics.d.cts +1 -0
  196. package/dist/core/responseValidators/providers.cjs +2 -0
  197. package/dist/core/responseValidators/providers.d.cts +1 -0
  198. package/dist/core/responseValidators/routing-diagnostics.cjs +1 -0
  199. package/dist/core/responseValidators/routing-diagnostics.d.cts +3 -0
  200. package/dist/core/responseValidators/routing.cjs +2 -0
  201. package/dist/core/responseValidators/routing.d.cts +3 -0
  202. package/dist/core/responseValidators/sandboxes-diagnostics.cjs +1 -0
  203. package/dist/core/responseValidators/sandboxes-diagnostics.d.cts +10 -0
  204. package/dist/core/responseValidators/sandboxes.cjs +2 -0
  205. package/dist/core/responseValidators/sandboxes.d.cts +10 -0
  206. package/dist/core/responseValidators/secrets-diagnostics.cjs +1 -0
  207. package/dist/core/responseValidators/secrets-diagnostics.d.cts +1 -0
  208. package/dist/core/responseValidators/secrets.cjs +2 -0
  209. package/dist/core/responseValidators/secrets.d.cts +1 -0
  210. package/dist/core/responseValidators/spend_limits-diagnostics.cjs +1 -0
  211. package/dist/core/responseValidators/spend_limits-diagnostics.d.cts +3 -0
  212. package/dist/core/responseValidators/spend_limits.cjs +2 -0
  213. package/dist/core/responseValidators/spend_limits.d.cts +3 -0
  214. package/dist/core/responseValidators/terminals-diagnostics.cjs +1 -0
  215. package/dist/core/responseValidators/terminals-diagnostics.d.cts +2 -0
  216. package/dist/core/responseValidators/terminals.cjs +2 -0
  217. package/dist/core/responseValidators/terminals.d.cts +2 -0
  218. package/dist/core/responseValidators/usage-diagnostics.cjs +1 -0
  219. package/dist/core/responseValidators/usage-diagnostics.d.cts +1 -0
  220. package/dist/core/responseValidators/usage.cjs +2 -0
  221. package/dist/core/responseValidators/usage.d.cts +1 -0
  222. package/dist/core/responseValidators/volumes-diagnostics.cjs +1 -0
  223. package/dist/core/responseValidators/volumes-diagnostics.d.cts +10 -0
  224. package/dist/core/responseValidators/volumes.cjs +2 -0
  225. package/dist/core/responseValidators/volumes.d.cts +10 -0
  226. package/dist/core/serverSentEvents.gen.d.ts +21 -62
  227. package/dist/core/serverSentEvents.gen.js +297 -116
  228. package/dist/core/streamErrors.d.ts +32 -0
  229. package/dist/core/streamErrors.js +51 -0
  230. package/dist/core/types.gen.d.ts +2 -2
  231. package/dist/core/types.gen.js +2 -1
  232. package/dist/core/utils.gen.d.ts +1 -1
  233. package/dist/core/utils.gen.js +16 -10
  234. package/dist/creation.gen.d.ts +21 -0
  235. package/dist/creation.gen.js +35 -0
  236. package/dist/data-origin.d.ts +25 -0
  237. package/dist/data-origin.js +57 -0
  238. package/dist/error-codes.gen.d.ts +2 -0
  239. package/dist/error-codes.gen.js +2 -0
  240. package/dist/idempotency.gen.d.ts +1 -0
  241. package/dist/idempotency.gen.js +60 -0
  242. package/dist/images.d.ts +74 -0
  243. package/dist/images.js +88 -0
  244. package/dist/index.d.ts +22 -2
  245. package/dist/index.js +79 -1
  246. package/dist/launch-input.gen.d.ts +9 -0
  247. package/dist/launch-input.gen.js +83 -0
  248. package/dist/launch.d.ts +28 -0
  249. package/dist/launch.js +222 -0
  250. package/dist/namespace-actions.d.mts +307 -0
  251. package/dist/namespace-actions.mjs +595 -0
  252. package/dist/namespace-agents.d.mts +33 -0
  253. package/dist/namespace-agents.mjs +40 -0
  254. package/dist/namespace-artifacts.d.mts +46 -0
  255. package/dist/namespace-artifacts.mjs +69 -0
  256. package/dist/namespace-base.d.mts +7 -0
  257. package/dist/namespace-base.mjs +7 -0
  258. package/dist/namespace-commands.d.mts +57 -0
  259. package/dist/namespace-commands.mjs +57 -0
  260. package/dist/namespace-credits.d.mts +213 -0
  261. package/dist/namespace-credits.mjs +476 -0
  262. package/dist/namespace-files.d.mts +203 -0
  263. package/dist/namespace-files.mjs +334 -0
  264. package/dist/namespace-github.d.mts +50 -0
  265. package/dist/namespace-github.mjs +68 -0
  266. package/dist/namespace-images.d.mts +52 -0
  267. package/dist/namespace-images.mjs +78 -0
  268. package/dist/namespace-launch_runs.d.mts +89 -0
  269. package/dist/namespace-launch_runs.mjs +133 -0
  270. package/dist/namespace-launches.d.mts +89 -0
  271. package/dist/namespace-launches.mjs +133 -0
  272. package/dist/namespace-operations.d.mts +45 -0
  273. package/dist/namespace-operations.mjs +52 -0
  274. package/dist/namespace-previews.d.mts +79 -0
  275. package/dist/namespace-previews.mjs +101 -0
  276. package/dist/namespace-pricing.d.mts +31 -0
  277. package/dist/namespace-pricing.mjs +22 -0
  278. package/dist/namespace-processes.d.mts +125 -0
  279. package/dist/namespace-processes.mjs +184 -0
  280. package/dist/namespace-provider_accounts.d.mts +156 -0
  281. package/dist/namespace-provider_accounts.mjs +241 -0
  282. package/dist/namespace-providers.d.mts +28 -0
  283. package/dist/namespace-providers.mjs +24 -0
  284. package/dist/namespace-routing.d.mts +64 -0
  285. package/dist/namespace-routing.mjs +86 -0
  286. package/dist/namespace-sandboxes.d.mts +287 -0
  287. package/dist/namespace-sandboxes.mjs +402 -0
  288. package/dist/namespace-secrets.d.mts +46 -0
  289. package/dist/namespace-secrets.mjs +68 -0
  290. package/dist/namespace-spend_limits.d.mts +48 -0
  291. package/dist/namespace-spend_limits.mjs +70 -0
  292. package/dist/namespace-terminals.d.mts +112 -0
  293. package/dist/namespace-terminals.mjs +177 -0
  294. package/dist/namespace-usage.d.mts +46 -0
  295. package/dist/namespace-usage.mjs +53 -0
  296. package/dist/namespace-volumes.d.mts +110 -0
  297. package/dist/namespace-volumes.mjs +269 -0
  298. package/dist/operations.d.ts +14 -0
  299. package/dist/operations.js +31 -0
  300. package/dist/retry.d.ts +8 -0
  301. package/dist/retry.js +63 -0
  302. package/dist/routing-choices.gen.d.ts +132 -0
  303. package/dist/routing-choices.gen.js +136 -0
  304. package/dist/routing.d.ts +23 -0
  305. package/dist/routing.js +38 -0
  306. package/dist/sandbox-handle.gen.d.ts +8 -0
  307. package/dist/sandbox-handle.gen.js +14 -0
  308. package/dist/sandboxes.d.ts +213 -0
  309. package/dist/sandboxes.js +507 -0
  310. package/dist/sdk.gen.d.ts +2016 -12
  311. package/dist/sdk.gen.js +3862 -16
  312. package/dist/server-timing.d.ts +19 -0
  313. package/dist/server-timing.gen.d.ts +265 -0
  314. package/dist/server-timing.gen.js +254 -0
  315. package/dist/server-timing.js +421 -0
  316. package/dist/spend-limits.d.ts +17 -0
  317. package/dist/spend-limits.js +26 -0
  318. package/dist/telemetry.d.ts +51 -0
  319. package/dist/telemetry.gen.d.ts +1 -0
  320. package/dist/telemetry.gen.js +5 -0
  321. package/dist/telemetry.js +438 -0
  322. package/dist/terminal.d.ts +61 -0
  323. package/dist/terminal.js +266 -0
  324. package/dist/transfer.d.ts +75 -0
  325. package/dist/transfer.js +389 -0
  326. package/dist/types.gen.d.ts +14936 -110
  327. package/dist/types.gen.js +2 -1
  328. package/dist/user-agent.d.ts +2 -0
  329. package/dist/user-agent.js +18 -0
  330. package/dist/version.gen.d.ts +1 -0
  331. package/dist/version.gen.js +5 -0
  332. package/dist/volumes.d.ts +33 -0
  333. package/dist/volumes.js +221 -0
  334. package/dist/waits.d.ts +31 -0
  335. package/dist/waits.js +42 -0
  336. package/dist/workflow-policy.gen.d.ts +41 -0
  337. package/dist/workflow-policy.gen.js +45 -0
  338. package/package.json +124 -14
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.operations = void 0;
4
+ const loadValidators = () => import("../responseValidators/volumes.cjs").then(module => module.default);
5
+ const loadDiagnostics = () => import("../responseValidators/volumes-diagnostics.cjs").then(module => module.default);
6
+ exports.operations = { "GET /volumes": { responses: { "200": { "media": ["application/json"], "validator": "validate0" } }, completeErrors: { "400": false, "default": false }, loadValidators, loadDiagnostics },
7
+ "POST /volumes": { responses: { "201": { "media": ["application/json"], "validator": "validate1" } }, completeErrors: { "400": false, "409": false, "413": false, "default": false }, loadValidators, loadDiagnostics },
8
+ "GET /volumes/{volume_id}": { responses: { "200": { "media": ["application/json"], "validator": "validate2" } }, completeErrors: { "404": false, "default": false }, loadValidators, loadDiagnostics },
9
+ "DELETE /volumes/{volume_id}": { responses: { "204": { "media": [] } }, completeErrors: { "404": false, "409": false, "default": false } },
10
+ "GET /volumes/{volume_id}/checkpoints": { responses: { "200": { "media": ["application/json"], "validator": "validate3" } }, completeErrors: { "404": false, "default": false }, loadValidators, loadDiagnostics },
11
+ "POST /volumes/{volume_id}/checkpoints": { responses: { "201": { "media": ["application/json"], "validator": "validate4" } }, completeErrors: { "404": false, "409": false, "413": false, "502": false, "default": false }, loadValidators, loadDiagnostics },
12
+ "GET /volumes/{volume_id}/checkpoints/{checkpoint}": { responses: { "200": { "media": ["application/json"], "validator": "validate5" } }, completeErrors: { "404": false, "default": false }, loadValidators, loadDiagnostics },
13
+ "DELETE /volumes/{volume_id}/checkpoints/{checkpoint}": { responses: { "204": { "media": [] } }, completeErrors: { "404": false, "409": false, "default": false } },
14
+ "DELETE /volumes/{volume_id}/lease": { responses: { "204": { "media": [] } }, completeErrors: { "404": false, "409": false, "default": false } },
15
+ "POST /volumes/{volume_id}/uploads": { responses: { "201": { "media": ["application/json"], "validator": "validate6" } }, completeErrors: { "400": false, "404": false, "409": false, "413": false, "default": false }, loadValidators, loadDiagnostics },
16
+ "POST /volumes/{volume_id}/uploads/{upload_id}/complete": { responses: { "200": { "media": ["application/json"], "validator": "validate7" } }, completeErrors: { "400": false, "404": false, "409": false, "default": false }, loadValidators, loadDiagnostics },
17
+ "DELETE /volumes/{volume_id}/uploads/{upload_id}": { responses: { "204": { "media": [] } }, completeErrors: { "404": false, "default": false } },
18
+ "POST /volumes/{volume_id}/downloads": { responses: { "201": { "media": ["application/json"], "validator": "validate8" } }, completeErrors: { "400": false, "404": false, "default": false }, loadValidators, loadDiagnostics },
19
+ "GET /volumes/{volume_id}/files": { responses: { "200": { "media": ["application/json"], "validator": "validate9" } }, completeErrors: { "400": false, "404": false, "default": false }, loadValidators, loadDiagnostics } };
@@ -0,0 +1,3 @@
1
+ import type { ResponseOperation } from "./responseValidation";
2
+ export declare const responseGroups: Record<string, string>;
3
+ export declare const responseContractLoaders: Record<string, () => Promise<Record<string, ResponseOperation>>>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.responseContractLoaders = exports.responseGroups = void 0;
4
+ exports.responseGroups = { "GET /agents": "agents", "GET /agents/{name}": "agents", "POST /launches": "launches", "GET /launches/{operation_id}": "launches", "GET /launches/{operation_id}/settings": "launches", "GET /launches/{operation_id}/command": "launches", "GET /launch-runs": "launchRuns", "POST /launch-runs": "launchRuns", "GET /launch-runs/{run_id}": "launchRuns", "POST /launch-runs/{run_id}/stop": "launchRuns", "POST /launch-runs/{run_id}/copies/{copy_index}/destroy": "launchRuns", "GET /repositories/{owner}/{repo}/access": "launches", "GET /github/installations": "github", "DELETE /github/installations/{installation_id}": "github", "GET /github/repositories": "github", "GET /actions/repositories/{repository_id}": "actions", "PUT /actions/repositories/{repository_id}": "actions", "GET /routing/settings": "routing", "PUT /routing/settings": "routing", "GET /routing/preview": "routing", "GET /actions/readiness": "actions", "GET /actions/runner-catalog": "actions", "GET /actions/policies": "actions", "POST /actions/policies": "actions", "GET /actions/policies/{policy_id}": "actions", "PUT /actions/policies/{policy_id}": "actions", "DELETE /actions/policies/{policy_id}": "actions", "POST /actions/preview": "actions", "GET /actions/runs": "actions", "GET /actions/runs/facets": "actions", "GET /actions/pool-idle-time": "actions", "GET /actions/runs/{run_id}": "actions", "GET /actions/runs/{run_id}/jobs": "actions", "GET /actions/runs/{run_id}/placements": "actions", "GET /actions/jobs/{job_id}": "actions", "GET /actions/jobs/{job_id}/steps": "actions", "GET /actions/jobs/{job_id}/logs": "actions", "GET /actions/jobs/{job_id}/steps/{step_position}/logs": "actions", "GET /actions/jobs/{job_id}/events": "actions", "GET /actions/placements/{placement_id}": "actions", "POST /actions/runs/{run_id}/cancel": "actions", "POST /actions/runs/{run_id}/rerun": "actions", "POST /actions/runs/{run_id}/rerun-failed-jobs": "actions", "GET /operations": "operations", "POST /artifacts": "artifacts", "GET /artifacts/{artifact_id}": "artifacts", "DELETE /artifacts/{artifact_id}": "artifacts", "POST /images/prepare": "images", "GET /images/preparations": "images", "POST /images/unprepare": "images", "POST /sandboxes/{sandbox_id}/processes": "processes", "GET /sandboxes/{sandbox_id}/processes/{process_id}": "processes", "DELETE /sandboxes/{sandbox_id}/processes/{process_id}": "processes", "POST /sandboxes/{sandbox_id}/processes/{process_id}/stdin": "processes", "POST /sandboxes/{sandbox_id}/processes/{process_id}/stdin/close": "processes", "POST /sandboxes/{sandbox_id}/processes/{process_id}/cancel": "processes", "GET /credits": "credits", "GET /spend-limits": "spend_limits", "PUT /spend-limits/{scope}": "spend_limits", "DELETE /spend-limits/{scope}": "spend_limits", "POST /credits/purchases": "credits", "GET /credits/purchases": "credits", "POST /credits/purchases/quote": "credits", "GET /credits/usage": "credits", "GET /usage": "usage", "GET /usage.csv": "usage", "GET /credits/purchases/{purchase_id}": "credits", "POST /credits/purchases/{purchase_id}/cancel": "credits", "POST /credits/promotions": "credits", "GET /credits/promotions": "credits", "GET /credits/billing-details": "credits", "PUT /credits/billing-details": "credits", "GET /credits/alerts": "credits", "PUT /credits/alerts": "credits", "GET /credits/payment-methods": "credits", "POST /credits/payment-methods/setup": "credits", "POST /credits/payment-methods/setup-intent": "credits", "PUT /credits/payment-methods/order": "credits", "GET /credits/payment-method-setups/{setup_id}": "credits", "DELETE /credits/payment-methods/{payment_method_id}": "credits", "POST /credits/payment-methods/{payment_method_id}/default": "credits", "GET /credits/auto-top-up": "credits", "PUT /credits/auto-top-up": "credits", "POST /sandboxes/{sandbox_id}/terminals": "terminals", "GET /sandboxes/{sandbox_id}/terminals/{terminal_id}": "terminals", "GET /sandboxes/{sandbox_id}/terminals/{terminal_id}/events": "terminals", "POST /sandboxes/{sandbox_id}/terminals/{terminal_id}/input": "terminals", "POST /sandboxes/{sandbox_id}/terminals/{terminal_id}/resize": "terminals", "POST /sandboxes/{sandbox_id}/terminals/{terminal_id}/kill": "terminals", "GET /secrets": "secrets", "PUT /secrets/{name}": "secrets", "DELETE /secrets/{name}": "secrets", "GET /sandboxes/{sandbox_id}/previews": "previews", "POST /sandboxes/{sandbox_id}/previews": "previews", "DELETE /sandboxes/{sandbox_id}/previews/{preview_id}": "previews", "POST /sandboxes/{sandbox_id}/browser": "sandboxes", "POST /sandboxes/{sandbox_id}/pause": "sandboxes", "POST /sandboxes/{sandbox_id}/resume": "sandboxes", "POST /sandboxes/{sandbox_id}/lifetime": "sandboxes", "POST /sandboxes/{sandbox_id}/network-policy": "sandboxes", "POST /provider-accounts": "provider_accounts", "GET /provider-accounts": "provider_accounts", "POST /provider-accounts/test": "provider_accounts", "GET /provider-accounts/{account_id}": "provider_accounts", "DELETE /provider-accounts/{account_id}": "provider_accounts", "PUT /provider-accounts/{account_id}/credentials": "provider_accounts", "POST /provider-accounts/{account_id}/test": "provider_accounts", "POST /provider-accounts/{account_id}/standard-image/setup": "provider_accounts", "GET /operations/{operation_id}": "operations", "GET /volumes": "volumes", "POST /volumes": "volumes", "GET /volumes/{volume_id}": "volumes", "DELETE /volumes/{volume_id}": "volumes", "GET /volumes/{volume_id}/checkpoints": "volumes", "POST /volumes/{volume_id}/checkpoints": "volumes", "GET /volumes/{volume_id}/checkpoints/{checkpoint}": "volumes", "DELETE /volumes/{volume_id}/checkpoints/{checkpoint}": "volumes", "DELETE /volumes/{volume_id}/lease": "volumes", "POST /volumes/{volume_id}/uploads": "volumes", "POST /volumes/{volume_id}/uploads/{upload_id}/complete": "volumes", "DELETE /volumes/{volume_id}/uploads/{upload_id}": "volumes", "POST /volumes/{volume_id}/downloads": "volumes", "GET /volumes/{volume_id}/files": "volumes", "POST /sandboxes": "sandboxes", "GET /sandboxes": "sandboxes", "POST /sandboxes/match": "sandboxes", "GET /sandboxes/{sandbox_id}": "sandboxes", "DELETE /sandboxes/{sandbox_id}": "sandboxes", "POST /sandboxes/{sandbox_id}/commands": "commands", "GET /sandboxes/{sandbox_id}/files/content": "files", "PUT /sandboxes/{sandbox_id}/files/content": "files", "POST /sandboxes/{sandbox_id}/files/uploads": "files", "POST /sandboxes/{sandbox_id}/files/uploads/{upload_id}/complete": "files", "DELETE /sandboxes/{sandbox_id}/files/uploads/{upload_id}": "files", "POST /sandboxes/{sandbox_id}/files/downloads": "files", "GET /sandboxes/{sandbox_id}/files/directories": "files", "POST /sandboxes/{sandbox_id}/files/directories": "files", "GET /sandboxes/{sandbox_id}/files/exists": "files", "POST /sandboxes/{sandbox_id}/files/remove": "files", "GET /price-versions": "pricing", "GET /providers": "providers" };
5
+ exports.responseContractLoaders = { "agents": () => import("./responseContracts/agents.js").then(module => module.operations),
6
+ "launches": () => import("./responseContracts/launches.js").then(module => module.operations),
7
+ "launchRuns": () => import("./responseContracts/launchRuns.js").then(module => module.operations),
8
+ "github": () => import("./responseContracts/github.js").then(module => module.operations),
9
+ "actions": () => import("./responseContracts/actions.js").then(module => module.operations),
10
+ "routing": () => import("./responseContracts/routing.js").then(module => module.operations),
11
+ "operations": () => import("./responseContracts/operations.js").then(module => module.operations),
12
+ "artifacts": () => import("./responseContracts/artifacts.js").then(module => module.operations),
13
+ "images": () => import("./responseContracts/images.js").then(module => module.operations),
14
+ "processes": () => import("./responseContracts/processes.js").then(module => module.operations),
15
+ "credits": () => import("./responseContracts/credits.js").then(module => module.operations),
16
+ "spend_limits": () => import("./responseContracts/spend_limits.js").then(module => module.operations),
17
+ "usage": () => import("./responseContracts/usage.js").then(module => module.operations),
18
+ "terminals": () => import("./responseContracts/terminals.js").then(module => module.operations),
19
+ "secrets": () => import("./responseContracts/secrets.js").then(module => module.operations),
20
+ "previews": () => import("./responseContracts/previews.js").then(module => module.operations),
21
+ "sandboxes": () => import("./responseContracts/sandboxes.js").then(module => module.operations),
22
+ "provider_accounts": () => import("./responseContracts/provider_accounts.js").then(module => module.operations),
23
+ "volumes": () => import("./responseContracts/volumes.js").then(module => module.operations),
24
+ "commands": () => import("./responseContracts/commands.js").then(module => module.operations),
25
+ "files": () => import("./responseContracts/files.js").then(module => module.operations),
26
+ "pricing": () => import("./responseContracts/pricing.js").then(module => module.operations),
27
+ "providers": () => import("./responseContracts/providers.js").then(module => module.operations) };
@@ -0,0 +1,19 @@
1
+ type ResponseBodyMode<Body, Mode extends boolean> = Body extends unknown ? Omit<Body, 'stream'> & {
2
+ stream?: Mode;
3
+ } : never;
4
+ export type ResponseModeOptions<T extends {
5
+ body: {
6
+ stream?: boolean;
7
+ };
8
+ }, Mode extends boolean> = Omit<T, 'body'> & {
9
+ body: ResponseBodyMode<T['body'], Mode>;
10
+ };
11
+ /** A named response variant must select the matching server-side behavior. */
12
+ export declare function withResponseMode<T extends {
13
+ body: {
14
+ stream?: boolean;
15
+ };
16
+ headers?: Config['headers'];
17
+ }>(options: T, stream: boolean): T;
18
+ import type { Config } from './types.gen';
19
+ export {};
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withResponseMode = withResponseMode;
4
+ /** A named response variant must select the matching server-side behavior. */
5
+ function withResponseMode(options, stream) {
6
+ if (options.body.stream !== undefined && options.body.stream !== stream) {
7
+ throw new TypeError(`This method requires stream=${stream}`);
8
+ }
9
+ const headers = (0, client_1.mergeHeaders)(options.headers);
10
+ headers.set('Accept', stream ? 'text/event-stream' : 'application/json');
11
+ return { ...options, body: { ...options.body, stream }, headers: Object.fromEntries(headers) };
12
+ }
13
+ const client_1 = require("../client");
@@ -0,0 +1,44 @@
1
+ import { type ResponseSchemaDiagnostic } from '../api-error';
2
+ import type { RequestTrace } from '../telemetry';
3
+ type Contracts = Record<string, ResponseOperation>;
4
+ type ContractIndex = {
5
+ groups: Record<string, string>;
6
+ loaders: Record<string, () => Promise<Contracts>>;
7
+ };
8
+ type ValidatorIssue = Pick<ResponseSchemaDiagnostic, 'keyword' | 'instancePath' | 'schemaPath'>;
9
+ type Validator = ((value: unknown) => boolean) & {
10
+ errors?: readonly ValidatorIssue[] | null;
11
+ };
12
+ type Validators = Record<string, Validator>;
13
+ export type ResponseContract = Record<string, {
14
+ media: string[];
15
+ validator?: string;
16
+ }>;
17
+ export type ResponseOperation = {
18
+ responses: ResponseContract;
19
+ completeErrors: Record<string, boolean>;
20
+ loadValidators?: () => Promise<Validators>;
21
+ loadDiagnostics?: () => Promise<Validators>;
22
+ };
23
+ type Prepared = {
24
+ contract?: ResponseContract;
25
+ completeErrors?: Record<string, boolean>;
26
+ validators?: Validators;
27
+ loadDiagnostics?: () => Promise<Validators>;
28
+ };
29
+ type ParseAs = 'arrayBuffer' | 'auto' | 'binaryStream' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
30
+ /** Missing contract or validator chunks fail before an operation can dispatch. */
31
+ export declare function prepareResponseValidation(method: string | undefined, path: string, signal?: AbortSignal | null, index?: ContractIndex): Promise<Prepared>;
32
+ /**
33
+ * Canonical media selects validation; caller parsing options cannot disable it. Only a caller
34
+ * that parses JSON can omit the trace; every other parse mode may stream and must provide one.
35
+ */
36
+ export declare function parseValidatedResponse(response: Response, request: Request, prepared: Prepared, parseAs: 'json', telemetry?: RequestTrace): Promise<{
37
+ data: unknown;
38
+ isJson: boolean;
39
+ }>;
40
+ export declare function parseValidatedResponse(response: Response, request: Request, prepared: Prepared, parseAs: ParseAs, telemetry: RequestTrace): Promise<{
41
+ data: unknown;
42
+ isJson: boolean;
43
+ }>;
44
+ export {};
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareResponseValidation = prepareResponseValidation;
4
+ exports.parseValidatedResponse = parseValidatedResponse;
5
+ const workflow_policy_gen_1 = require("../workflow-policy.gen");
6
+ const api_1 = require("@opentelemetry/api");
7
+ const api_error_1 = require("../api-error");
8
+ const json_1 = require("./json");
9
+ const responseContracts_gen_1 = require("./responseContracts.gen");
10
+ const mainIndex = { groups: responseContracts_gen_1.responseGroups, loaders: responseContracts_gen_1.responseContractLoaders };
11
+ // Each index caches its own namespaces, so two indexes can share a group name.
12
+ const caches = new WeakMap();
13
+ /** Settle with the caller's cancellation without cancelling the shared load. */
14
+ async function untilAborted(pending, signal) {
15
+ if (!signal)
16
+ return pending;
17
+ let abort;
18
+ try {
19
+ return await Promise.race([pending, new Promise((_, reject) => {
20
+ signal.addEventListener('abort', abort = () => reject(signal.reason));
21
+ })]);
22
+ }
23
+ finally {
24
+ signal.removeEventListener('abort', abort);
25
+ }
26
+ }
27
+ /** Missing contract or validator chunks fail before an operation can dispatch. */
28
+ async function prepareResponseValidation(method, path, signal, index = mainIndex) {
29
+ signal?.throwIfAborted();
30
+ const key = `${method} ${path}`;
31
+ const group = index.groups[key];
32
+ const loadContracts = group && index.loaders[group];
33
+ const contracts = caches.get(index) ?? new Map();
34
+ caches.set(index, contracts);
35
+ let operation;
36
+ const parent = api_1.context.active();
37
+ if (loadContracts) {
38
+ // A namespace's contracts load once and callers share the load; later calls add no asynchronous hop.
39
+ let loaded = contracts.get(group);
40
+ if (!loaded) {
41
+ contracts.set(group, loaded = loadContracts().then(table => { contracts.set(group, table); return table; }, error => { contracts.delete(group); throw error; }));
42
+ }
43
+ operation = (loaded.then ? await untilAborted(loaded, signal) : loaded)[key];
44
+ }
45
+ const validators = operation?.loadValidators && await untilAborted(operation.loadValidators(), signal);
46
+ return api_1.context.with(parent, () => ({ contract: operation?.responses, completeErrors: operation?.completeErrors,
47
+ validators, loadDiagnostics: operation?.loadDiagnostics }));
48
+ }
49
+ /** Retain declared complete errors or bounded diagnostics, plus mutation identity on disconnect. */
50
+ async function responseError(response, request, invalid, complete) {
51
+ const reader = response.body?.getReader();
52
+ const chunks = [];
53
+ const limit = complete ? Infinity : workflow_policy_gen_1.MAX_ERROR_BYTES;
54
+ let length = 0;
55
+ const abort = () => { void reader?.cancel(request.signal.reason).catch(() => { }); };
56
+ request.signal.addEventListener('abort', abort, { once: true });
57
+ try {
58
+ if (request.signal.aborted)
59
+ abort();
60
+ if (reader) {
61
+ while (true) {
62
+ const { done, value } = await reader.read();
63
+ if (done)
64
+ break;
65
+ const chunk = complete ? value : value.slice(0, limit - length);
66
+ chunks.push(chunk);
67
+ length += chunk.byteLength;
68
+ if (length === limit)
69
+ break;
70
+ }
71
+ }
72
+ }
73
+ catch {
74
+ // The received HTTP status and request still provide recovery context.
75
+ }
76
+ finally {
77
+ request.signal.removeEventListener('abort', abort);
78
+ if (reader) {
79
+ await reader.cancel().catch(() => { });
80
+ reader.releaseLock();
81
+ }
82
+ }
83
+ const buffer = new Uint8Array(length);
84
+ let offset = 0;
85
+ for (const chunk of chunks) {
86
+ buffer.set(chunk, offset);
87
+ offset += chunk.byteLength;
88
+ }
89
+ let payload;
90
+ try {
91
+ payload = (0, json_1.parseJson)(new TextDecoder().decode(buffer.subarray(0, length)));
92
+ }
93
+ catch { /* No JSON envelope. */ }
94
+ if (invalid)
95
+ return (0, api_error_1.invalidResponse)(response, request, payload);
96
+ return new api_error_1.APIError(payload, response, request);
97
+ }
98
+ /** Binary streaming reports through the request's trace; a caller without one cannot stream. */
99
+ function streamTrace(telemetry) {
100
+ if (!telemetry)
101
+ throw new TypeError('Streaming a response requires a request trace');
102
+ return telemetry;
103
+ }
104
+ async function parseValidatedResponse(response, request, prepared, parseAs, telemetry) {
105
+ const declaration = prepared.contract?.[String(response.status)];
106
+ const media = response.headers.get('content-type')?.split(';', 1)[0].trim().toLowerCase() ?? '';
107
+ if (!response.ok || (prepared.contract && !declaration) ||
108
+ (declaration?.media.length && !declaration.media.includes(media))) {
109
+ const status = String(response.status);
110
+ const complete = !response.ok && media === 'application/json' &&
111
+ (prepared.completeErrors?.[status] ?? prepared.completeErrors?.default) === true;
112
+ throw await responseError(response, request, response.ok, complete);
113
+ }
114
+ if (response.status === 204 || declaration?.media.length === 0)
115
+ return { data: undefined, isJson: false };
116
+ const json = media === 'application/json' && declaration?.validator !== undefined;
117
+ const mode = parseAs === 'auto' || parseAs === 'binaryStream' || parseAs === undefined
118
+ ? (media === 'application/json' ? 'json' : parseAs === 'binaryStream' ? 'stream'
119
+ : media.startsWith('text/') ? 'text' : 'blob') : parseAs;
120
+ // A missing trace is a caller error, not an invalid response, so it must not reach the catch below.
121
+ const trace = mode === 'stream' ? streamTrace(telemetry) : undefined;
122
+ if (json || mode === 'json') {
123
+ let text;
124
+ let data;
125
+ let unknownKind = false;
126
+ let schemaDiagnostics;
127
+ try {
128
+ text = await response.text();
129
+ data = (0, json_1.parseJson)(text);
130
+ if (json) {
131
+ const validate = prepared.validators[declaration.validator];
132
+ if (!validate(data)) {
133
+ const detailed = prepared.loadDiagnostics
134
+ ? (await prepared.loadDiagnostics())[declaration.validator] : validate;
135
+ if (detailed !== validate)
136
+ detailed(data);
137
+ // An enum/constant failure identifies a closed vocabulary mismatch, not an unknown
138
+ // record kind. In particular, a legacy/current response union can fail because a
139
+ // nested closed field has a future value.
140
+ const errors = detailed.errors ?? [];
141
+ schemaDiagnostics = errors;
142
+ const failedRecordUnion = errors.some(({ keyword, instancePath }) => (keyword === 'anyOf' || keyword === 'oneOf') && isRecord(pointerValue(data, instancePath)) &&
143
+ !errors.some(error => (error.keyword === 'anyOf' || error.keyword === 'oneOf') &&
144
+ error.instancePath !== instancePath && !isRecord(pointerValue(data, error.instancePath))));
145
+ const hasClosedValueFailure = errors.some(({ keyword }) => keyword === 'enum' || keyword === 'const');
146
+ unknownKind = failedRecordUnion && !hasClosedValueFailure;
147
+ throw new TypeError('Invalid schema');
148
+ }
149
+ }
150
+ }
151
+ catch {
152
+ throw (0, api_error_1.invalidResponse)(response, request, data, unknownKind, schemaDiagnostics);
153
+ }
154
+ if (mode === 'json')
155
+ return { data, isJson: true };
156
+ const buffered = new Response(text, { headers: response.headers });
157
+ return { data: mode === 'stream' ? (await import('./binaryStream.js')).binaryStream(buffered.body, response, request, trace)
158
+ : await buffered[mode](), isJson: false };
159
+ }
160
+ try {
161
+ return { data: mode === 'stream' ? (await import('./binaryStream.js')).binaryStream(response.body, response, request, trace)
162
+ : await response[mode](), isJson: false };
163
+ }
164
+ catch {
165
+ throw (0, api_error_1.invalidResponse)(response, request);
166
+ }
167
+ }
168
+ function pointerValue(value, pointer) {
169
+ return pointer.split('/').slice(1).reduce((node, key) => node !== null && typeof node === 'object'
170
+ ? node[key.replaceAll('~1', '/').replaceAll('~0', '~')] : undefined, value);
171
+ }
172
+ function isRecord(value) {
173
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
174
+ }