@alienplatform/manager-api 1.14.0 → 1.15.0-dev.e74fae6cd01b61e77a285276f264b5480977f41a

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/FUNCTIONS.md +2 -2
  2. package/README.md +16 -10
  3. package/esm/funcs/commandsCreateCommand.d.ts.map +1 -1
  4. package/esm/funcs/commandsCreateCommand.js +2 -1
  5. package/esm/funcs/commandsCreateCommand.js.map +1 -1
  6. package/esm/funcs/commandsGetCommandPayload.d.ts.map +1 -1
  7. package/esm/funcs/commandsGetCommandPayload.js +2 -1
  8. package/esm/funcs/commandsGetCommandPayload.js.map +1 -1
  9. package/esm/funcs/commandsGetCommandStatus.d.ts.map +1 -1
  10. package/esm/funcs/commandsGetCommandStatus.js +2 -1
  11. package/esm/funcs/commandsGetCommandStatus.js.map +1 -1
  12. package/esm/funcs/commandsStoreCommandPayload.d.ts.map +1 -1
  13. package/esm/funcs/commandsStoreCommandPayload.js +2 -1
  14. package/esm/funcs/commandsStoreCommandPayload.js.map +1 -1
  15. package/esm/funcs/commandsSubmitResponse.d.ts.map +1 -1
  16. package/esm/funcs/commandsSubmitResponse.js +2 -1
  17. package/esm/funcs/commandsSubmitResponse.js.map +1 -1
  18. package/esm/funcs/commandsUploadComplete.d.ts.map +1 -1
  19. package/esm/funcs/commandsUploadComplete.js +2 -1
  20. package/esm/funcs/commandsUploadComplete.js.map +1 -1
  21. package/esm/funcs/credentialsMintCredentials.d.ts +11 -0
  22. package/esm/funcs/credentialsMintCredentials.d.ts.map +1 -0
  23. package/esm/funcs/credentialsMintCredentials.js +73 -0
  24. package/esm/funcs/credentialsMintCredentials.js.map +1 -0
  25. package/esm/funcs/credentialsResolveCredentials.d.ts.map +1 -1
  26. package/esm/funcs/credentialsResolveCredentials.js +2 -1
  27. package/esm/funcs/credentialsResolveCredentials.js.map +1 -1
  28. package/esm/funcs/deploymentGroupsCreateDeploymentGroup.d.ts.map +1 -1
  29. package/esm/funcs/deploymentGroupsCreateDeploymentGroup.js +2 -1
  30. package/esm/funcs/deploymentGroupsCreateDeploymentGroup.js.map +1 -1
  31. package/esm/funcs/deploymentGroupsCreateDeploymentGroupToken.d.ts.map +1 -1
  32. package/esm/funcs/deploymentGroupsCreateDeploymentGroupToken.js +2 -1
  33. package/esm/funcs/deploymentGroupsCreateDeploymentGroupToken.js.map +1 -1
  34. package/esm/funcs/deploymentGroupsGetDeploymentGroup.d.ts.map +1 -1
  35. package/esm/funcs/deploymentGroupsGetDeploymentGroup.js +2 -1
  36. package/esm/funcs/deploymentGroupsGetDeploymentGroup.js.map +1 -1
  37. package/esm/funcs/deploymentGroupsListDeploymentGroups.d.ts.map +1 -1
  38. package/esm/funcs/deploymentGroupsListDeploymentGroups.js +2 -1
  39. package/esm/funcs/deploymentGroupsListDeploymentGroups.js.map +1 -1
  40. package/esm/funcs/deploymentsCreateDeployment.d.ts.map +1 -1
  41. package/esm/funcs/deploymentsCreateDeployment.js +2 -1
  42. package/esm/funcs/deploymentsCreateDeployment.js.map +1 -1
  43. package/esm/funcs/deploymentsDeleteDeployment.d.ts.map +1 -1
  44. package/esm/funcs/deploymentsDeleteDeployment.js +2 -1
  45. package/esm/funcs/deploymentsDeleteDeployment.js.map +1 -1
  46. package/esm/funcs/deploymentsGetDeployment.d.ts.map +1 -1
  47. package/esm/funcs/deploymentsGetDeployment.js +2 -1
  48. package/esm/funcs/deploymentsGetDeployment.js.map +1 -1
  49. package/esm/funcs/deploymentsGetDeploymentInfo.d.ts.map +1 -1
  50. package/esm/funcs/deploymentsGetDeploymentInfo.js +2 -1
  51. package/esm/funcs/deploymentsGetDeploymentInfo.js.map +1 -1
  52. package/esm/funcs/deploymentsListDeployments.d.ts.map +1 -1
  53. package/esm/funcs/deploymentsListDeployments.js +2 -1
  54. package/esm/funcs/deploymentsListDeployments.js.map +1 -1
  55. package/esm/funcs/deploymentsRedeploy.d.ts.map +1 -1
  56. package/esm/funcs/deploymentsRedeploy.js +2 -1
  57. package/esm/funcs/deploymentsRedeploy.js.map +1 -1
  58. package/esm/funcs/deploymentsRetryDeployment.d.ts.map +1 -1
  59. package/esm/funcs/deploymentsRetryDeployment.js +2 -1
  60. package/esm/funcs/deploymentsRetryDeployment.js.map +1 -1
  61. package/esm/funcs/healthHealth.d.ts.map +1 -1
  62. package/esm/funcs/healthHealth.js +2 -1
  63. package/esm/funcs/healthHealth.js.map +1 -1
  64. package/esm/funcs/leasesAcquireLeases.d.ts.map +1 -1
  65. package/esm/funcs/leasesAcquireLeases.js +2 -1
  66. package/esm/funcs/leasesAcquireLeases.js.map +1 -1
  67. package/esm/funcs/leasesReleaseLease.d.ts.map +1 -1
  68. package/esm/funcs/leasesReleaseLease.js +2 -1
  69. package/esm/funcs/leasesReleaseLease.js.map +1 -1
  70. package/esm/funcs/releasesCreateRelease.d.ts.map +1 -1
  71. package/esm/funcs/releasesCreateRelease.js +2 -1
  72. package/esm/funcs/releasesCreateRelease.js.map +1 -1
  73. package/esm/funcs/releasesGetLatestRelease.d.ts.map +1 -1
  74. package/esm/funcs/releasesGetLatestRelease.js +2 -1
  75. package/esm/funcs/releasesGetLatestRelease.js.map +1 -1
  76. package/esm/funcs/releasesGetRelease.d.ts.map +1 -1
  77. package/esm/funcs/releasesGetRelease.js +2 -1
  78. package/esm/funcs/releasesGetRelease.js.map +1 -1
  79. package/esm/funcs/releasesListReleases.d.ts.map +1 -1
  80. package/esm/funcs/releasesListReleases.js +2 -1
  81. package/esm/funcs/releasesListReleases.js.map +1 -1
  82. package/esm/funcs/stackImportStackImport.d.ts.map +1 -1
  83. package/esm/funcs/stackImportStackImport.js +2 -1
  84. package/esm/funcs/stackImportStackImport.js.map +1 -1
  85. package/esm/funcs/syncAcquire.d.ts.map +1 -1
  86. package/esm/funcs/syncAcquire.js +2 -1
  87. package/esm/funcs/syncAcquire.js.map +1 -1
  88. package/esm/funcs/syncAgentSync.d.ts.map +1 -1
  89. package/esm/funcs/syncAgentSync.js +2 -1
  90. package/esm/funcs/syncAgentSync.js.map +1 -1
  91. package/esm/funcs/syncInitialize.d.ts.map +1 -1
  92. package/esm/funcs/syncInitialize.js +2 -1
  93. package/esm/funcs/syncInitialize.js.map +1 -1
  94. package/esm/funcs/syncReconcile.d.ts.map +1 -1
  95. package/esm/funcs/syncReconcile.js +2 -1
  96. package/esm/funcs/syncReconcile.js.map +1 -1
  97. package/esm/funcs/syncRelease.d.ts.map +1 -1
  98. package/esm/funcs/syncRelease.js +2 -1
  99. package/esm/funcs/syncRelease.js.map +1 -1
  100. package/esm/funcs/whoamiWhoami.d.ts.map +1 -1
  101. package/esm/funcs/whoamiWhoami.js +2 -1
  102. package/esm/funcs/whoamiWhoami.js.map +1 -1
  103. package/esm/hooks/types.d.ts +1 -0
  104. package/esm/hooks/types.d.ts.map +1 -1
  105. package/esm/lib/config.d.ts +3 -11
  106. package/esm/lib/config.d.ts.map +1 -1
  107. package/esm/lib/config.js +6 -16
  108. package/esm/lib/config.js.map +1 -1
  109. package/esm/lib/encodings.d.ts +1 -0
  110. package/esm/lib/encodings.d.ts.map +1 -1
  111. package/esm/lib/encodings.js +27 -6
  112. package/esm/lib/encodings.js.map +1 -1
  113. package/esm/lib/env.d.ts.map +1 -1
  114. package/esm/lib/env.js +3 -3
  115. package/esm/lib/env.js.map +1 -1
  116. package/esm/lib/files.d.ts +13 -0
  117. package/esm/lib/files.d.ts.map +1 -1
  118. package/esm/lib/files.js +18 -0
  119. package/esm/lib/files.js.map +1 -1
  120. package/esm/lib/http.d.ts +1 -1
  121. package/esm/lib/http.d.ts.map +1 -1
  122. package/esm/lib/http.js +1 -1
  123. package/esm/lib/http.js.map +1 -1
  124. package/esm/lib/matchers.d.ts.map +1 -1
  125. package/esm/lib/matchers.js +1 -2
  126. package/esm/lib/matchers.js.map +1 -1
  127. package/esm/lib/primitives.d.ts +1 -0
  128. package/esm/lib/primitives.d.ts.map +1 -1
  129. package/esm/lib/primitives.js +17 -0
  130. package/esm/lib/primitives.js.map +1 -1
  131. package/esm/lib/retries.js +7 -0
  132. package/esm/lib/retries.js.map +1 -1
  133. package/esm/lib/sdks.d.ts +1 -1
  134. package/esm/lib/sdks.d.ts.map +1 -1
  135. package/esm/lib/sdks.js +62 -26
  136. package/esm/lib/sdks.js.map +1 -1
  137. package/esm/lib/security.d.ts +6 -5
  138. package/esm/lib/security.d.ts.map +1 -1
  139. package/esm/lib/security.js +24 -15
  140. package/esm/lib/security.js.map +1 -1
  141. package/esm/lib/url.d.ts.map +1 -1
  142. package/esm/lib/url.js +4 -2
  143. package/esm/lib/url.js.map +1 -1
  144. package/esm/models/agentsyncresponse.d.ts +2 -2
  145. package/esm/models/awscredentials.d.ts +97 -0
  146. package/esm/models/awscredentials.d.ts.map +1 -0
  147. package/esm/models/awscredentials.js +77 -0
  148. package/esm/models/awscredentials.js.map +1 -0
  149. package/esm/models/awsserviceoverrides.d.ts +21 -0
  150. package/esm/models/awsserviceoverrides.d.ts.map +1 -0
  151. package/esm/models/awsserviceoverrides.js +13 -0
  152. package/esm/models/awsserviceoverrides.js.map +1 -0
  153. package/esm/models/awswebidentityconfig.d.ts +28 -0
  154. package/esm/models/awswebidentityconfig.d.ts.map +1 -0
  155. package/esm/models/awswebidentityconfig.js +16 -0
  156. package/esm/models/awswebidentityconfig.js.map +1 -0
  157. package/esm/models/azurecredentials.d.ts +132 -0
  158. package/esm/models/azurecredentials.d.ts.map +1 -0
  159. package/esm/models/azurecredentials.js +97 -0
  160. package/esm/models/azurecredentials.js.map +1 -0
  161. package/esm/models/azureserviceoverrides.d.ts +21 -0
  162. package/esm/models/azureserviceoverrides.d.ts.map +1 -0
  163. package/esm/models/azureserviceoverrides.js +13 -0
  164. package/esm/models/azureserviceoverrides.js.map +1 -0
  165. package/esm/models/clientconfigunion.d.ts +284 -0
  166. package/esm/models/clientconfigunion.d.ts.map +1 -0
  167. package/esm/models/clientconfigunion.js +201 -0
  168. package/esm/models/clientconfigunion.js.map +1 -0
  169. package/esm/models/commandstatusresponse.d.ts +5 -0
  170. package/esm/models/commandstatusresponse.d.ts.map +1 -1
  171. package/esm/models/commandstatusresponse.js +2 -0
  172. package/esm/models/commandstatusresponse.js.map +1 -1
  173. package/esm/models/commandtarget.d.ts +29 -0
  174. package/esm/models/commandtarget.d.ts.map +1 -0
  175. package/esm/models/commandtarget.js +24 -0
  176. package/esm/models/commandtarget.js.map +1 -0
  177. package/esm/models/commandtargettype.d.ts +19 -0
  178. package/esm/models/commandtargettype.d.ts.map +1 -0
  179. package/esm/models/commandtargettype.js +17 -0
  180. package/esm/models/commandtargettype.js.map +1 -0
  181. package/esm/models/containerheartbeatdata.d.ts +4 -0
  182. package/esm/models/containerheartbeatdata.d.ts.map +1 -1
  183. package/esm/models/containerheartbeatdata.js +2 -0
  184. package/esm/models/containerheartbeatdata.js.map +1 -1
  185. package/esm/models/createcommandrequest.d.ts +9 -0
  186. package/esm/models/createcommandrequest.d.ts.map +1 -1
  187. package/esm/models/createcommandrequest.js +1 -0
  188. package/esm/models/createcommandrequest.js.map +1 -1
  189. package/esm/models/daemonheartbeatdata.d.ts +8 -0
  190. package/esm/models/daemonheartbeatdata.d.ts.map +1 -1
  191. package/esm/models/daemonheartbeatdata.js +4 -0
  192. package/esm/models/daemonheartbeatdata.js.map +1 -1
  193. package/esm/models/envelope.d.ts +7 -0
  194. package/esm/models/envelope.d.ts.map +1 -1
  195. package/esm/models/envelope.js +4 -0
  196. package/esm/models/envelope.js.map +1 -1
  197. package/esm/models/gcpcredentials.d.ts +138 -0
  198. package/esm/models/gcpcredentials.d.ts.map +1 -0
  199. package/esm/models/gcpcredentials.js +107 -0
  200. package/esm/models/gcpcredentials.js.map +1 -0
  201. package/esm/models/gcpimpersonationconfig.d.ts +42 -0
  202. package/esm/models/gcpimpersonationconfig.d.ts.map +1 -0
  203. package/esm/models/gcpimpersonationconfig.js +18 -0
  204. package/esm/models/gcpimpersonationconfig.js.map +1 -0
  205. package/esm/models/gcpserviceoverrides.d.ts +21 -0
  206. package/esm/models/gcpserviceoverrides.d.ts.map +1 -0
  207. package/esm/models/gcpserviceoverrides.js +13 -0
  208. package/esm/models/gcpserviceoverrides.js.map +1 -0
  209. package/esm/models/index.d.ts +15 -0
  210. package/esm/models/index.d.ts.map +1 -1
  211. package/esm/models/index.js +15 -0
  212. package/esm/models/index.js.map +1 -1
  213. package/esm/models/kubernetesclientconfig.d.ts +116 -0
  214. package/esm/models/kubernetesclientconfig.d.ts.map +1 -0
  215. package/esm/models/kubernetesclientconfig.js +73 -0
  216. package/esm/models/kubernetesclientconfig.js.map +1 -0
  217. package/esm/models/leaserequest.d.ts +6 -0
  218. package/esm/models/leaserequest.d.ts.map +1 -1
  219. package/esm/models/leaserequest.js +2 -0
  220. package/esm/models/leaserequest.js.map +1 -1
  221. package/esm/models/mintcredentialsrequest.d.ts +49 -0
  222. package/esm/models/mintcredentialsrequest.d.ts.map +1 -0
  223. package/esm/models/mintcredentialsrequest.js +15 -0
  224. package/esm/models/mintcredentialsrequest.js.map +1 -0
  225. package/esm/models/mintcredentialsresponse.d.ts +37 -0
  226. package/esm/models/mintcredentialsresponse.d.ts.map +1 -0
  227. package/esm/models/mintcredentialsresponse.js +16 -0
  228. package/esm/models/mintcredentialsresponse.js.map +1 -0
  229. package/esm/models/resolvecredentialsresponse.d.ts +5 -1
  230. package/esm/models/resolvecredentialsresponse.d.ts.map +1 -1
  231. package/esm/models/resolvecredentialsresponse.js +2 -1
  232. package/esm/models/resolvecredentialsresponse.js.map +1 -1
  233. package/esm/models/resourceref.d.ts +1 -4
  234. package/esm/models/resourceref.d.ts.map +1 -1
  235. package/esm/models/resourceref.js.map +1 -1
  236. package/esm/models/tracecontext.d.ts +25 -0
  237. package/esm/models/tracecontext.d.ts.map +1 -0
  238. package/esm/models/tracecontext.js +15 -0
  239. package/esm/models/tracecontext.js.map +1 -0
  240. package/esm/sdk/credentials.d.ts +1 -0
  241. package/esm/sdk/credentials.d.ts.map +1 -1
  242. package/esm/sdk/credentials.js +4 -0
  243. package/esm/sdk/credentials.js.map +1 -1
  244. package/esm/sdk/sdk.d.ts +2 -2
  245. package/esm/sdk/sdk.d.ts.map +1 -1
  246. package/esm/sdk/sdk.js +3 -3
  247. package/esm/sdk/sdk.js.map +1 -1
  248. package/esm/types/async.d.ts.map +1 -1
  249. package/esm/types/async.js +8 -7
  250. package/esm/types/async.js.map +1 -1
  251. package/jsr.json +1 -1
  252. package/package.json +6 -8
  253. package/src/funcs/commandsCreateCommand.ts +3 -1
  254. package/src/funcs/commandsGetCommandPayload.ts +3 -2
  255. package/src/funcs/commandsGetCommandStatus.ts +3 -2
  256. package/src/funcs/commandsStoreCommandPayload.ts +3 -2
  257. package/src/funcs/commandsSubmitResponse.ts +3 -2
  258. package/src/funcs/commandsUploadComplete.ts +3 -2
  259. package/src/funcs/credentialsMintCredentials.ts +156 -0
  260. package/src/funcs/credentialsResolveCredentials.ts +3 -1
  261. package/src/funcs/deploymentGroupsCreateDeploymentGroup.ts +3 -1
  262. package/src/funcs/deploymentGroupsCreateDeploymentGroupToken.ts +3 -2
  263. package/src/funcs/deploymentGroupsGetDeploymentGroup.ts +3 -2
  264. package/src/funcs/deploymentGroupsListDeploymentGroups.ts +3 -1
  265. package/src/funcs/deploymentsCreateDeployment.ts +3 -1
  266. package/src/funcs/deploymentsDeleteDeployment.ts +3 -2
  267. package/src/funcs/deploymentsGetDeployment.ts +3 -2
  268. package/src/funcs/deploymentsGetDeploymentInfo.ts +3 -2
  269. package/src/funcs/deploymentsListDeployments.ts +3 -1
  270. package/src/funcs/deploymentsRedeploy.ts +3 -2
  271. package/src/funcs/deploymentsRetryDeployment.ts +3 -2
  272. package/src/funcs/healthHealth.ts +3 -1
  273. package/src/funcs/leasesAcquireLeases.ts +3 -1
  274. package/src/funcs/leasesReleaseLease.ts +3 -2
  275. package/src/funcs/releasesCreateRelease.ts +3 -1
  276. package/src/funcs/releasesGetLatestRelease.ts +3 -1
  277. package/src/funcs/releasesGetRelease.ts +3 -2
  278. package/src/funcs/releasesListReleases.ts +3 -1
  279. package/src/funcs/stackImportStackImport.ts +3 -1
  280. package/src/funcs/syncAcquire.ts +3 -1
  281. package/src/funcs/syncAgentSync.ts +3 -1
  282. package/src/funcs/syncInitialize.ts +3 -1
  283. package/src/funcs/syncReconcile.ts +3 -1
  284. package/src/funcs/syncRelease.ts +3 -1
  285. package/src/funcs/whoamiWhoami.ts +3 -1
  286. package/src/hooks/types.ts +1 -0
  287. package/src/lib/config.ts +8 -23
  288. package/src/lib/encodings.ts +33 -5
  289. package/src/lib/env.ts +7 -3
  290. package/src/lib/files.ts +22 -0
  291. package/src/lib/http.ts +3 -1
  292. package/src/lib/matchers.ts +4 -3
  293. package/src/lib/primitives.ts +16 -0
  294. package/src/lib/retries.ts +8 -0
  295. package/src/lib/sdks.ts +66 -30
  296. package/src/lib/security.ts +25 -9
  297. package/src/lib/url.ts +16 -14
  298. package/src/models/agentsyncresponse.ts +2 -2
  299. package/src/models/awscredentials.ts +231 -0
  300. package/src/models/awsserviceoverrides.ts +39 -0
  301. package/src/models/awswebidentityconfig.ts +51 -0
  302. package/src/models/azurecredentials.ts +295 -0
  303. package/src/models/azureserviceoverrides.ts +39 -0
  304. package/src/models/clientconfigunion.ts +602 -0
  305. package/src/models/commandstatusresponse.ts +6 -0
  306. package/src/models/commandtarget.ts +61 -0
  307. package/src/models/commandtargettype.ts +28 -0
  308. package/src/models/containerheartbeatdata.ts +6 -0
  309. package/src/models/createcommandrequest.ts +10 -0
  310. package/src/models/daemonheartbeatdata.ts +12 -0
  311. package/src/models/envelope.ts +9 -0
  312. package/src/models/gcpcredentials.ts +335 -0
  313. package/src/models/gcpimpersonationconfig.ts +67 -0
  314. package/src/models/gcpserviceoverrides.ts +39 -0
  315. package/src/models/index.ts +15 -0
  316. package/src/models/kubernetesclientconfig.ts +220 -0
  317. package/src/models/leaserequest.ts +11 -0
  318. package/src/models/mintcredentialsrequest.ts +70 -0
  319. package/src/models/mintcredentialsresponse.ts +62 -0
  320. package/src/models/resolvecredentialsresponse.ts +9 -2
  321. package/src/models/resourceref.ts +1 -4
  322. package/src/models/tracecontext.ts +44 -0
  323. package/src/sdk/credentials.ts +12 -0
  324. package/src/sdk/sdk.ts +5 -5
  325. package/src/types/async.ts +8 -7
  326. package/.devcontainer/devcontainer.json +0 -45
  327. package/esm/lib/dlv.d.ts +0 -14
  328. package/esm/lib/dlv.d.ts.map +0 -1
  329. package/esm/lib/dlv.js +0 -46
  330. package/esm/lib/dlv.js.map +0 -1
  331. package/esm/lib/is-plain-object.d.ts +0 -2
  332. package/esm/lib/is-plain-object.d.ts.map +0 -1
  333. package/esm/lib/is-plain-object.js +0 -38
  334. package/esm/lib/is-plain-object.js.map +0 -1
  335. package/examples/package.json +0 -18
  336. package/src/lib/dlv.ts +0 -53
  337. package/src/lib/is-plain-object.ts +0 -43
  338. package/tsconfig.json +0 -40
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
6
  import { encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
7
8
  import * as M from "../lib/matchers.js";
8
9
  import { compactMap } from "../lib/primitives.js";
9
10
  import { safeParse } from "../lib/schemas.js";
@@ -86,7 +87,6 @@ async function $do(
86
87
  charEncoding: "percent",
87
88
  }),
88
89
  };
89
-
90
90
  const path = pathToFunc("/v1/deployments/{id}")(pathParams);
91
91
 
92
92
  const headers = new Headers(compactMap({
@@ -129,7 +129,8 @@ async function $do(
129
129
 
130
130
  const doResult = await client._do(req, {
131
131
  context,
132
- errorCodes: ["401", "403", "404", "4XX", "5XX"],
132
+ isErrorStatusCode: (statusCode: number) =>
133
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
133
134
  retryConfig: context.retryConfig,
134
135
  retryCodes: context.retryCodes,
135
136
  });
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
6
  import { encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
7
8
  import * as M from "../lib/matchers.js";
8
9
  import { compactMap } from "../lib/primitives.js";
9
10
  import { safeParse } from "../lib/schemas.js";
@@ -86,7 +87,6 @@ async function $do(
86
87
  charEncoding: "percent",
87
88
  }),
88
89
  };
89
-
90
90
  const path = pathToFunc("/v1/deployments/{id}/info")(pathParams);
91
91
 
92
92
  const headers = new Headers(compactMap({
@@ -129,7 +129,8 @@ async function $do(
129
129
 
130
130
  const doResult = await client._do(req, {
131
131
  context,
132
- errorCodes: ["401", "403", "404", "4XX", "5XX"],
132
+ isErrorStatusCode: (statusCode: number) =>
133
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
133
134
  retryConfig: context.retryConfig,
134
135
  retryCodes: context.retryCodes,
135
136
  });
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
6
  import { encodeFormQuery } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
7
8
  import * as M from "../lib/matchers.js";
8
9
  import { compactMap } from "../lib/primitives.js";
9
10
  import { safeParse } from "../lib/schemas.js";
@@ -130,7 +131,8 @@ async function $do(
130
131
 
131
132
  const doResult = await client._do(req, {
132
133
  context,
133
- errorCodes: ["401", "403", "4XX", "5XX"],
134
+ isErrorStatusCode: (statusCode: number) =>
135
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
134
136
  retryConfig: context.retryConfig,
135
137
  retryCodes: context.retryCodes,
136
138
  });
@@ -5,6 +5,7 @@
5
5
  import * as z from "zod/v4";
6
6
  import { AlienManagerCore } from "../core.js";
7
7
  import { encodeSimple } from "../lib/encodings.js";
8
+ import { matchStatusCode } from "../lib/http.js";
8
9
  import * as M from "../lib/matchers.js";
9
10
  import { compactMap } from "../lib/primitives.js";
10
11
  import { safeParse } from "../lib/schemas.js";
@@ -86,7 +87,6 @@ async function $do(
86
87
  charEncoding: "percent",
87
88
  }),
88
89
  };
89
-
90
90
  const path = pathToFunc("/v1/deployments/{id}/redeploy")(pathParams);
91
91
 
92
92
  const headers = new Headers(compactMap({
@@ -129,7 +129,8 @@ async function $do(
129
129
 
130
130
  const doResult = await client._do(req, {
131
131
  context,
132
- errorCodes: ["401", "403", "404", "4XX", "5XX"],
132
+ isErrorStatusCode: (statusCode: number) =>
133
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
133
134
  retryConfig: context.retryConfig,
134
135
  retryCodes: context.retryCodes,
135
136
  });
@@ -5,6 +5,7 @@
5
5
  import * as z from "zod/v4";
6
6
  import { AlienManagerCore } from "../core.js";
7
7
  import { encodeSimple } from "../lib/encodings.js";
8
+ import { matchStatusCode } from "../lib/http.js";
8
9
  import * as M from "../lib/matchers.js";
9
10
  import { compactMap } from "../lib/primitives.js";
10
11
  import { safeParse } from "../lib/schemas.js";
@@ -86,7 +87,6 @@ async function $do(
86
87
  charEncoding: "percent",
87
88
  }),
88
89
  };
89
-
90
90
  const path = pathToFunc("/v1/deployments/{id}/retry")(pathParams);
91
91
 
92
92
  const headers = new Headers(compactMap({
@@ -129,7 +129,8 @@ async function $do(
129
129
 
130
130
  const doResult = await client._do(req, {
131
131
  context,
132
- errorCodes: ["401", "403", "404", "4XX", "5XX"],
132
+ isErrorStatusCode: (statusCode: number) =>
133
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
133
134
  retryConfig: context.retryConfig,
134
135
  retryCodes: context.retryCodes,
135
136
  });
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
+ import { matchStatusCode } from "../lib/http.js";
6
7
  import * as M from "../lib/matchers.js";
7
8
  import { compactMap } from "../lib/primitives.js";
8
9
  import { RequestOptions } from "../lib/sdks.js";
@@ -104,7 +105,8 @@ async function $do(
104
105
 
105
106
  const doResult = await client._do(req, {
106
107
  context,
107
- errorCodes: ["4XX", "5XX"],
108
+ isErrorStatusCode: (statusCode: number) =>
109
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
108
110
  retryConfig: context.retryConfig,
109
111
  retryCodes: context.retryCodes,
110
112
  });
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
6
  import { encodeJSON } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
7
8
  import * as M from "../lib/matchers.js";
8
9
  import { compactMap } from "../lib/primitives.js";
9
10
  import { safeParse } from "../lib/schemas.js";
@@ -128,7 +129,8 @@ async function $do(
128
129
 
129
130
  const doResult = await client._do(req, {
130
131
  context,
131
- errorCodes: ["4XX", "500", "5XX"],
132
+ isErrorStatusCode: (statusCode: number) =>
133
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
132
134
  retryConfig: context.retryConfig,
133
135
  retryCodes: context.retryCodes,
134
136
  });
@@ -5,6 +5,7 @@
5
5
  import * as z from "zod/v4";
6
6
  import { AlienManagerCore } from "../core.js";
7
7
  import { encodeSimple } from "../lib/encodings.js";
8
+ import { matchStatusCode } from "../lib/http.js";
8
9
  import * as M from "../lib/matchers.js";
9
10
  import { compactMap } from "../lib/primitives.js";
10
11
  import { safeParse } from "../lib/schemas.js";
@@ -92,7 +93,6 @@ async function $do(
92
93
  charEncoding: "percent",
93
94
  }),
94
95
  };
95
-
96
96
  const path = pathToFunc("/v1/commands/leases/{lease_id}/release")(pathParams);
97
97
 
98
98
  const headers = new Headers(compactMap({
@@ -135,7 +135,8 @@ async function $do(
135
135
 
136
136
  const doResult = await client._do(req, {
137
137
  context,
138
- errorCodes: ["404", "4XX", "500", "5XX"],
138
+ isErrorStatusCode: (statusCode: number) =>
139
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
139
140
  retryConfig: context.retryConfig,
140
141
  retryCodes: context.retryCodes,
141
142
  });
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
6
  import { encodeJSON } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
7
8
  import * as M from "../lib/matchers.js";
8
9
  import { compactMap } from "../lib/primitives.js";
9
10
  import { safeParse } from "../lib/schemas.js";
@@ -122,7 +123,8 @@ async function $do(
122
123
 
123
124
  const doResult = await client._do(req, {
124
125
  context,
125
- errorCodes: ["4XX", "5XX"],
126
+ isErrorStatusCode: (statusCode: number) =>
127
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
126
128
  retryConfig: context.retryConfig,
127
129
  retryCodes: context.retryCodes,
128
130
  });
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
+ import { matchStatusCode } from "../lib/http.js";
6
7
  import * as M from "../lib/matchers.js";
7
8
  import { compactMap } from "../lib/primitives.js";
8
9
  import { RequestOptions } from "../lib/sdks.js";
@@ -104,7 +105,8 @@ async function $do(
104
105
 
105
106
  const doResult = await client._do(req, {
106
107
  context,
107
- errorCodes: ["404", "4XX", "5XX"],
108
+ isErrorStatusCode: (statusCode: number) =>
109
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
108
110
  retryConfig: context.retryConfig,
109
111
  retryCodes: context.retryCodes,
110
112
  });
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
6
  import { encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
7
8
  import * as M from "../lib/matchers.js";
8
9
  import { compactMap } from "../lib/primitives.js";
9
10
  import { safeParse } from "../lib/schemas.js";
@@ -86,7 +87,6 @@ async function $do(
86
87
  charEncoding: "percent",
87
88
  }),
88
89
  };
89
-
90
90
  const path = pathToFunc("/v1/releases/{id}")(pathParams);
91
91
 
92
92
  const headers = new Headers(compactMap({
@@ -129,7 +129,8 @@ async function $do(
129
129
 
130
130
  const doResult = await client._do(req, {
131
131
  context,
132
- errorCodes: ["404", "4XX", "5XX"],
132
+ isErrorStatusCode: (statusCode: number) =>
133
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
133
134
  retryConfig: context.retryConfig,
134
135
  retryCodes: context.retryCodes,
135
136
  });
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
+ import { matchStatusCode } from "../lib/http.js";
6
7
  import * as M from "../lib/matchers.js";
7
8
  import { compactMap } from "../lib/primitives.js";
8
9
  import { RequestOptions } from "../lib/sdks.js";
@@ -109,7 +110,8 @@ async function $do(
109
110
 
110
111
  const doResult = await client._do(req, {
111
112
  context,
112
- errorCodes: ["401", "4XX", "5XX"],
113
+ isErrorStatusCode: (statusCode: number) =>
114
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
113
115
  retryConfig: context.retryConfig,
114
116
  retryCodes: context.retryCodes,
115
117
  });
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
6
  import { encodeJSON } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
7
8
  import * as M from "../lib/matchers.js";
8
9
  import { compactMap } from "../lib/primitives.js";
9
10
  import { safeParse } from "../lib/schemas.js";
@@ -133,7 +134,8 @@ async function $do(
133
134
 
134
135
  const doResult = await client._do(req, {
135
136
  context,
136
- errorCodes: ["400", "401", "403", "404", "409", "4XX", "5XX"],
137
+ isErrorStatusCode: (statusCode: number) =>
138
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
137
139
  retryConfig: context.retryConfig,
138
140
  retryCodes: context.retryCodes,
139
141
  });
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
6
  import { encodeJSON } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
7
8
  import * as M from "../lib/matchers.js";
8
9
  import { compactMap } from "../lib/primitives.js";
9
10
  import { safeParse } from "../lib/schemas.js";
@@ -127,7 +128,8 @@ async function $do(
127
128
 
128
129
  const doResult = await client._do(req, {
129
130
  context,
130
- errorCodes: ["4XX", "5XX"],
131
+ isErrorStatusCode: (statusCode: number) =>
132
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
131
133
  retryConfig: context.retryConfig,
132
134
  retryCodes: context.retryCodes,
133
135
  });
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
6
  import { encodeJSON } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
7
8
  import * as M from "../lib/matchers.js";
8
9
  import { compactMap } from "../lib/primitives.js";
9
10
  import { safeParse } from "../lib/schemas.js";
@@ -127,7 +128,8 @@ async function $do(
127
128
 
128
129
  const doResult = await client._do(req, {
129
130
  context,
130
- errorCodes: ["4XX", "5XX"],
131
+ isErrorStatusCode: (statusCode: number) =>
132
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
131
133
  retryConfig: context.retryConfig,
132
134
  retryCodes: context.retryCodes,
133
135
  });
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
6
  import { encodeJSON } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
7
8
  import * as M from "../lib/matchers.js";
8
9
  import { compactMap } from "../lib/primitives.js";
9
10
  import { safeParse } from "../lib/schemas.js";
@@ -129,7 +130,8 @@ async function $do(
129
130
 
130
131
  const doResult = await client._do(req, {
131
132
  context,
132
- errorCodes: ["4XX", "5XX"],
133
+ isErrorStatusCode: (statusCode: number) =>
134
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
133
135
  retryConfig: context.retryConfig,
134
136
  retryCodes: context.retryCodes,
135
137
  });
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
6
  import { encodeJSON } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
7
8
  import * as M from "../lib/matchers.js";
8
9
  import { compactMap } from "../lib/primitives.js";
9
10
  import { safeParse } from "../lib/schemas.js";
@@ -126,7 +127,8 @@ async function $do(
126
127
 
127
128
  const doResult = await client._do(req, {
128
129
  context,
129
- errorCodes: ["4XX", "5XX"],
130
+ isErrorStatusCode: (statusCode: number) =>
131
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
130
132
  retryConfig: context.retryConfig,
131
133
  retryCodes: context.retryCodes,
132
134
  });
@@ -5,6 +5,7 @@
5
5
  import * as z from "zod/v4";
6
6
  import { AlienManagerCore } from "../core.js";
7
7
  import { encodeJSON } from "../lib/encodings.js";
8
+ import { matchStatusCode } from "../lib/http.js";
8
9
  import * as M from "../lib/matchers.js";
9
10
  import { compactMap } from "../lib/primitives.js";
10
11
  import { safeParse } from "../lib/schemas.js";
@@ -127,7 +128,8 @@ async function $do(
127
128
 
128
129
  const doResult = await client._do(req, {
129
130
  context,
130
- errorCodes: ["4XX", "5XX"],
131
+ isErrorStatusCode: (statusCode: number) =>
132
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
131
133
  retryConfig: context.retryConfig,
132
134
  retryCodes: context.retryCodes,
133
135
  });
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { AlienManagerCore } from "../core.js";
6
+ import { matchStatusCode } from "../lib/http.js";
6
7
  import * as M from "../lib/matchers.js";
7
8
  import { compactMap } from "../lib/primitives.js";
8
9
  import { RequestOptions } from "../lib/sdks.js";
@@ -104,7 +105,8 @@ async function $do(
104
105
 
105
106
  const doResult = await client._do(req, {
106
107
  context,
107
- errorCodes: ["4XX", "5XX"],
108
+ isErrorStatusCode: (statusCode: number) =>
109
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
108
110
  retryConfig: context.retryConfig,
109
111
  retryCodes: context.retryCodes,
110
112
  });
@@ -15,6 +15,7 @@ export type HookContext = {
15
15
  retryConfig: RetryConfig;
16
16
  resolvedSecurity: SecurityState | null;
17
17
  options: SDKOptions;
18
+ timeoutMs?: number;
18
19
  };
19
20
 
20
21
  export type Awaitable<T> = T | Promise<T>;
package/src/lib/config.ts CHANGED
@@ -5,23 +5,12 @@
5
5
  import { HTTPClient } from "./http.js";
6
6
  import { Logger } from "./logger.js";
7
7
  import { RetryConfig } from "./retries.js";
8
- import { Params, pathToFunc } from "./url.js";
9
-
10
- /**
11
- * Contains the list of servers available to the SDK
12
- */
13
- export const ServerList = [
14
- "/",
15
- ] as const;
8
+ import { pathToFunc } from "./url.js";
16
9
 
17
10
  export type SDKOptions = {
18
11
  bearer?: string | (() => Promise<string>) | undefined;
19
12
 
20
13
  httpClient?: HTTPClient;
21
- /**
22
- * Allows overriding the default server used by the SDK
23
- */
24
- serverIdx?: number | undefined;
25
14
  /**
26
15
  * Specifies the server URL to be used by the SDK
27
16
  */
@@ -39,18 +28,14 @@ export type SDKOptions = {
39
28
  };
40
29
 
41
30
  export function serverURLFromOptions(options: SDKOptions): URL | null {
42
- let serverURL = options.serverURL;
43
-
44
- const params: Params = {};
31
+ const serverURL = options.serverURL;
45
32
 
46
33
  if (!serverURL) {
47
- const serverIdx = options.serverIdx ?? 0;
48
- if (serverIdx < 0 || serverIdx >= ServerList.length) {
49
- throw new Error(`Invalid server index ${serverIdx}`);
50
- }
51
- serverURL = ServerList[serverIdx] || "";
34
+ return null;
52
35
  }
53
36
 
37
+ const params: Record<string, string | undefined> = {};
38
+
54
39
  const u = pathToFunc(serverURL)(params);
55
40
  return new URL(u);
56
41
  }
@@ -58,8 +43,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
58
43
  export const SDK_METADATA = {
59
44
  language: "typescript",
60
45
  openapiDocVersion: "1.0.0",
61
- sdkVersion: "1.2.78",
62
- genVersion: "2.788.15",
46
+ sdkVersion: "1.15.0",
47
+ genVersion: "2.918.1",
63
48
  userAgent:
64
- "speakeasy-sdk/typescript 1.2.78 2.788.15 1.0.0 @alienplatform/manager-api",
49
+ "speakeasy-sdk/typescript 1.15.0 2.918.1 1.0.0 @alienplatform/manager-api",
65
50
  } as const;
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import { bytesToBase64 } from "./base64.js";
6
- import { isPlainObject } from "./is-plain-object.js";
6
+ import { isPlainObject } from "./primitives.js";
7
7
 
8
8
  export class EncodingError extends Error {
9
9
  constructor(message: string) {
@@ -479,6 +479,23 @@ export const encodeSpaceDelimitedQuery = queryEncoder(encodeSpaceDelimited);
479
479
  export const encodePipeDelimitedQuery = queryEncoder(encodePipeDelimited);
480
480
  export const encodeDeepObjectQuery = queryEncoder(encodeDeepObject);
481
481
 
482
+ function isBlobLike(val: unknown): val is Blob {
483
+ if (val instanceof Blob) {
484
+ return true;
485
+ }
486
+
487
+ if (typeof val !== "object" || val == null || !(Symbol.toStringTag in val)) {
488
+ return false;
489
+ }
490
+
491
+ const tag = val[Symbol.toStringTag];
492
+ if (tag !== "Blob" && tag !== "File") {
493
+ return false;
494
+ }
495
+
496
+ return "stream" in val && typeof val.stream === "function";
497
+ }
498
+
482
499
  export function appendForm(
483
500
  fd: FormData,
484
501
  key: string,
@@ -487,11 +504,22 @@ export function appendForm(
487
504
  ): void {
488
505
  if (value == null) {
489
506
  return;
490
- } else if (value instanceof Blob && fileName) {
491
- fd.append(key, value, fileName);
492
- } else if (value instanceof Blob) {
493
- fd.append(key, value);
507
+ } else if (isBlobLike(value)) {
508
+ if (fileName) {
509
+ fd.append(key, value as Blob, fileName);
510
+ } else {
511
+ fd.append(key, value as Blob);
512
+ }
494
513
  } else {
495
514
  fd.append(key, String(value));
496
515
  }
497
516
  }
517
+
518
+ export async function normalizeBlob(
519
+ value: Pick<Blob, "arrayBuffer" | "type">,
520
+ ): Promise<Blob> {
521
+ if (value instanceof Blob) {
522
+ return value;
523
+ }
524
+ return new Blob([await value.arrayBuffer()], { type: value.type });
525
+ }
package/src/lib/env.ts CHANGED
@@ -3,7 +3,6 @@
3
3
  */
4
4
 
5
5
  import * as z from "zod/v4";
6
- import { dlv } from "./dlv.js";
7
6
 
8
7
  export interface Env {
9
8
  ALIEN_MANAGER_BEARER?: string | undefined;
@@ -38,11 +37,16 @@ export function env(): Env {
38
37
  return envMemo;
39
38
  }
40
39
 
40
+ const globals = globalThis as {
41
+ Deno?: { env?: { toObject?: () => Record<string, string | undefined> } };
42
+ process?: { env?: Record<string, string | undefined> };
43
+ };
44
+
41
45
  let envObject: Record<string, unknown> = {};
42
46
  if (isDeno()) {
43
- envObject = (globalThis as any).Deno?.env?.toObject?.() ?? {};
47
+ envObject = globals.Deno?.env?.toObject?.() ?? {};
44
48
  } else {
45
- envObject = dlv(globalThis, "process.env") ?? {};
49
+ envObject = globals.process?.env ?? {};
46
50
  }
47
51
 
48
52
  envMemo = envSchema.parse(envObject);
package/src/lib/files.ts CHANGED
@@ -80,3 +80,25 @@ export function getContentTypeFromFileName(fileName: string): string | null {
80
80
 
81
81
  return mimeTypes[ext] || null;
82
82
  }
83
+
84
+ /**
85
+ * Creates a Blob from file content with the given MIME type.
86
+ *
87
+ * Node.js Buffers are Uint8Array subclasses that may share a pooled
88
+ * ArrayBuffer (byteOffset > 0, byteLength < buffer.byteLength). Passing
89
+ * such a Buffer directly to `new Blob([buf])` can include the entire
90
+ * underlying pool on some runtimes, producing a Blob with extra bytes
91
+ * that corrupts multipart uploads.
92
+ *
93
+ * Copying into a standalone Uint8Array ensures the Blob receives only the
94
+ * intended bytes regardless of runtime behaviour.
95
+ */
96
+ export function bytesToBlob(
97
+ content: Uint8Array<ArrayBufferLike> | ArrayBuffer | Blob | string,
98
+ contentType: string,
99
+ ): Blob {
100
+ if (content instanceof Uint8Array) {
101
+ return new Blob([new Uint8Array(content)], { type: contentType });
102
+ }
103
+ return new Blob([content as BlobPart], { type: contentType });
104
+ }
package/src/lib/http.ts CHANGED
@@ -45,8 +45,10 @@ export class HTTPClient {
45
45
  private requestHooks: BeforeRequestHook[] = [];
46
46
  private requestErrorHooks: RequestErrorHook[] = [];
47
47
  private responseHooks: ResponseHook[] = [];
48
+ private options: HTTPClientOptions;
48
49
 
49
- constructor(private options: HTTPClientOptions = {}) {
50
+ constructor(options: HTTPClientOptions = {}) {
51
+ this.options = options;
50
52
  this.fetcher = options.fetcher || DEFAULT_FETCHER;
51
53
  }
52
54
 
@@ -6,7 +6,7 @@ import { AlienManagerDefaultError } from "../models/errors/alienmanagerdefaulter
6
6
  import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
7
7
  import { ERR, OK, Result } from "../types/fp.js";
8
8
  import { matchResponse, matchStatusCode, StatusCodePredicate } from "./http.js";
9
- import { isPlainObject } from "./is-plain-object.js";
9
+ import { isPlainObject } from "./primitives.js";
10
10
 
11
11
  export type Encoding =
12
12
  | "jsonl"
@@ -254,8 +254,9 @@ export function match<T, E>(
254
254
  raw = body;
255
255
  break;
256
256
  default:
257
- encoding satisfies never;
258
- throw new Error(`Unsupported response type: ${encoding}`);
257
+ throw new Error(
258
+ `Unsupported response type: ${encoding satisfies never}`,
259
+ );
259
260
  }
260
261
 
261
262
  if (matcher.enc === "fail") {
@@ -148,3 +148,19 @@ export function allRequired<V extends Record<string, unknown>>(
148
148
 
149
149
  return v as ReturnType<typeof allRequired<V>>;
150
150
  }
151
+
152
+ export function isPlainObject(
153
+ value: unknown,
154
+ ): value is Record<string, unknown> {
155
+ if (value === null || typeof value !== "object") return false;
156
+ if (Object.prototype.toString.call(value) !== "[object Object]") return false;
157
+ const proto = Object.getPrototypeOf(value);
158
+ if (proto === null || proto === Object.prototype) return true;
159
+ // cross-realm plain objects (vm contexts, iframes) inherit from a
160
+ // different realm's Object.prototype, which itself has a null prototype
161
+ try {
162
+ return Object.getPrototypeOf(proto) === null;
163
+ } catch {
164
+ return false;
165
+ }
166
+ }
@@ -194,6 +194,14 @@ async function retryBackoff(
194
194
  }
195
195
 
196
196
  function retryIntervalFromResponse(res: Response): number {
197
+ const retryAfterMsVal = res.headers.get("retry-after-ms");
198
+ if (retryAfterMsVal) {
199
+ const parsedMs = Number(retryAfterMsVal);
200
+ if (Number.isFinite(parsedMs) && parsedMs >= 0) {
201
+ return parsedMs;
202
+ }
203
+ }
204
+
197
205
  const retryVal = res.headers.get("retry-after") || "";
198
206
  if (!retryVal) {
199
207
  return 0;