@alienplatform/manager-api 1.14.1 → 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
package/src/lib/sdks.ts CHANGED
@@ -22,9 +22,9 @@ import {
22
22
  isConnectionError,
23
23
  isTimeoutError,
24
24
  matchContentType,
25
- matchStatusCode,
26
25
  } from "./http.js";
27
26
  import { Logger } from "./logger.js";
27
+ import { combineSignals } from "./primitives.js";
28
28
  import { retry, RetryConfig } from "./retries.js";
29
29
  import { SecurityState } from "./security.js";
30
30
 
@@ -127,30 +127,60 @@ export class ClientSDK {
127
127
  if (!base) {
128
128
  return ERR(new InvalidRequestError("No base URL provided for operation"));
129
129
  }
130
- const reqURL = new URL(base);
131
- const inputURL = new URL(path, reqURL);
132
-
130
+ const baseURL = new URL(base);
131
+ let reqURL: URL;
133
132
  if (path) {
134
- reqURL.pathname += reqURL.pathname.endsWith("/") ? "" : "/";
135
- reqURL.pathname += inputURL.pathname.replace(/^\/+/, "");
133
+ baseURL.pathname = baseURL.pathname.replace(/\/+$/, "") + "/";
134
+ reqURL = new URL(path, baseURL);
135
+ if (!reqURL.search && baseURL.search) {
136
+ reqURL.search = baseURL.search;
137
+ }
138
+ } else {
139
+ reqURL = baseURL;
136
140
  }
141
+ reqURL.hash = "";
137
142
 
138
- let finalQuery = query || "";
139
-
140
- const secQuery: string[] = [];
141
- for (const [k, v] of Object.entries(security?.queryParams || {})) {
142
- const q = encodeForm(k, v, { charEncoding: "percent" });
143
- if (typeof q !== "undefined") {
144
- secQuery.push(q);
143
+ // Appends already-encoded query pairs to a query string, replacing any
144
+ // existing pairs with the same key so later sources take precedence.
145
+ const mergeQuery = (current: string, additions: string): string => {
146
+ if (!additions) {
147
+ return current;
145
148
  }
146
- }
147
- if (secQuery.length) {
148
- finalQuery += `&${secQuery.join("&")}`;
149
- }
149
+ const additionKeys = new Set(
150
+ additions
151
+ .split("&")
152
+ .filter((pair) => pair !== "")
153
+ .map((pair) => pair.split("=")[0] ?? ""),
154
+ );
155
+ const kept = current.split("&").filter((pair) => {
156
+ return pair !== "" && !additionKeys.has(pair.split("=")[0] ?? "");
157
+ });
158
+ return [...kept, additions].join("&");
159
+ };
160
+
161
+ const encodeQueryRecord = (record: Record<string, unknown>): string => {
162
+ return Object.entries(record)
163
+ .map(([k, v]) => {
164
+ if (v == null) {
165
+ return undefined;
166
+ }
167
+ const value = v;
168
+ return encodeForm(k, value, {
169
+ explode: Array.isArray(value),
170
+ charEncoding: "percent",
171
+ });
172
+ })
173
+ .filter((pair): pair is string => typeof pair !== "undefined")
174
+ .join("&");
175
+ };
176
+
177
+ const finalQuery = [
178
+ query || "",
179
+ encodeQueryRecord(security?.queryParams || {}),
180
+ ].reduce(mergeQuery, reqURL.search.slice(1));
150
181
 
151
182
  if (finalQuery) {
152
- const q = finalQuery.startsWith("&") ? finalQuery.slice(1) : finalQuery;
153
- reqURL.search = `?${q}`;
183
+ reqURL.search = `?${finalQuery}`;
154
184
  }
155
185
 
156
186
  const headers = new Headers(opHeaders);
@@ -196,9 +226,8 @@ export class ClientSDK {
196
226
  ...options?.fetchOptions,
197
227
  ...options,
198
228
  };
199
- if (!fetchOptions?.signal && conf.timeoutMs && conf.timeoutMs > 0) {
200
- const timeoutSignal = AbortSignal.timeout(conf.timeoutMs);
201
- fetchOptions.signal = timeoutSignal;
229
+ if (!fetchOptions?.signal && conf.timeoutMs != null && conf.timeoutMs > 0) {
230
+ context.timeoutMs = conf.timeoutMs;
202
231
  }
203
232
 
204
233
  if (conf.body instanceof ReadableStream) {
@@ -231,7 +260,7 @@ export class ClientSDK {
231
260
  request: Request,
232
261
  options: {
233
262
  context: HookContext;
234
- errorCodes: number | string | (number | string)[];
263
+ isErrorStatusCode: (statusCode: number) => boolean;
235
264
  retryConfig: RetryConfig;
236
265
  retryCodes: string[];
237
266
  },
@@ -244,11 +273,20 @@ export class ClientSDK {
244
273
  | UnexpectedClientError
245
274
  >
246
275
  > {
247
- const { context, errorCodes } = options;
276
+ const { context, isErrorStatusCode } = options;
277
+ const timeoutMs = context.timeoutMs;
248
278
 
249
279
  return retry(
250
280
  async () => {
251
- const req = await this.#hooks.beforeRequest(context, request.clone());
281
+ const cloned = request.clone();
282
+ let attempt = cloned;
283
+ if (timeoutMs != null && timeoutMs > 0) {
284
+ const timeoutSignal = AbortSignal.timeout(timeoutMs);
285
+ const combined = combineSignals(cloned.signal, timeoutSignal)
286
+ ?? timeoutSignal;
287
+ attempt = new Request(cloned, { signal: combined });
288
+ }
289
+ const req = await this.#hooks.beforeRequest(context, attempt);
252
290
  await logRequest(this.#logger, req).catch((e) =>
253
291
  this.#logger?.log("Failed to log request:", e)
254
292
  );
@@ -256,7 +294,7 @@ export class ClientSDK {
256
294
  let response = await this.#httpClient.request(req);
257
295
 
258
296
  try {
259
- if (matchStatusCode(response, errorCodes)) {
297
+ if (isErrorStatusCode(response.status)) {
260
298
  const result = await this.#hooks.afterError(
261
299
  context,
262
300
  response,
@@ -307,9 +345,9 @@ export class ClientSDK {
307
345
  }
308
346
  }
309
347
 
310
- const jsonLikeContentTypeRE = /(application|text)\/.*?\+*json.*/;
348
+ const jsonLikeContentTypeRE = /^(application|text)\/([^+]+\+)*json.*/;
311
349
  const jsonlLikeContentTypeRE =
312
- /(application|text)\/(.*?\+*\bjsonl\b.*|.*?\+*\bx-ndjson\b.*)/;
350
+ /^(application|text)\/([^+]+\+)*(jsonl|x-ndjson)\b.*/;
313
351
  async function logRequest(logger: Logger | undefined, req: Request) {
314
352
  if (!logger) {
315
353
  return;
@@ -380,8 +418,6 @@ async function logResponse(
380
418
  break;
381
419
  case matchContentType(res, "application/jsonl")
382
420
  || jsonlLikeContentTypeRE.test(ct):
383
- logger.log(await res.clone().text());
384
- break;
385
421
  case matchContentType(res, "text/event-stream"):
386
422
  logger.log(`<${contentType}>`);
387
423
  break;
@@ -13,17 +13,22 @@ type OAuth2PasswordFlow = {
13
13
  tokenURL: string;
14
14
  };
15
15
 
16
- export enum SecurityErrorCode {
17
- Incomplete = "incomplete",
18
- UnrecognisedSecurityType = "unrecognized_security_type",
19
- }
16
+ export const SecurityErrorCode = {
17
+ Incomplete: "incomplete",
18
+ UnrecognisedSecurityType: "unrecognized_security_type",
19
+ } as const;
20
+ export type SecurityErrorCode =
21
+ (typeof SecurityErrorCode)[keyof typeof SecurityErrorCode];
20
22
 
21
23
  export class SecurityError extends Error {
24
+ public code: SecurityErrorCode;
25
+
22
26
  constructor(
23
- public code: SecurityErrorCode,
27
+ code: SecurityErrorCode,
24
28
  message: string,
25
29
  ) {
26
30
  super(message);
31
+ this.code = code;
27
32
  this.name = "SecurityError";
28
33
  }
29
34
 
@@ -198,8 +203,7 @@ export function resolveSecurity(
198
203
  applyBearer(state, spec);
199
204
  break;
200
205
  default:
201
- spec satisfies never;
202
- throw SecurityError.unrecognizedType(type);
206
+ throw SecurityError.unrecognizedType((spec satisfies never, type));
203
207
  }
204
208
  });
205
209
 
@@ -241,8 +245,9 @@ function applyBearer(
241
245
 
242
246
  export function resolveGlobalSecurity(
243
247
  security: Partial<models.Security> | null | undefined,
248
+ allowedFields?: number[],
244
249
  ): SecurityState | null {
245
- return resolveSecurity(
250
+ let inputs: SecurityInput[][] = [
246
251
  [
247
252
  {
248
253
  fieldName: "Authorization",
@@ -250,7 +255,18 @@ export function resolveGlobalSecurity(
250
255
  value: security?.bearer ?? env().ALIEN_MANAGER_BEARER,
251
256
  },
252
257
  ],
253
- );
258
+ ];
259
+
260
+ if (allowedFields) {
261
+ inputs = allowedFields.map((i) => {
262
+ if (i < 0 || i >= inputs.length) {
263
+ throw new RangeError(`invalid allowedFields index ${i}`);
264
+ }
265
+ return inputs[i]!;
266
+ });
267
+ }
268
+
269
+ return resolveSecurity(...inputs);
254
270
  }
255
271
 
256
272
  export async function extractSecurity<
package/src/lib/url.ts CHANGED
@@ -13,21 +13,23 @@ export function pathToFunc(
13
13
  const paramRE = /\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;
14
14
 
15
15
  return function buildURLPath(params: Record<string, unknown> = {}): string {
16
- return pathPattern.replace(paramRE, function (_, placeholder) {
17
- if (!hasOwn.call(params, placeholder)) {
18
- throw new Error(`Parameter '${placeholder}' is required`);
19
- }
16
+ return pathPattern
17
+ .replace(paramRE, function (_, placeholder) {
18
+ if (!hasOwn.call(params, placeholder)) {
19
+ throw new Error(`Parameter '${placeholder}' is required`);
20
+ }
20
21
 
21
- const value = params[placeholder];
22
- if (typeof value !== "string" && typeof value !== "number") {
23
- throw new Error(
24
- `Parameter '${placeholder}' must be a string or number`,
25
- );
26
- }
22
+ const value = params[placeholder];
23
+ if (typeof value !== "string" && typeof value !== "number") {
24
+ throw new Error(
25
+ `Parameter '${placeholder}' must be a string or number`,
26
+ );
27
+ }
27
28
 
28
- return options?.charEncoding === "percent"
29
- ? encodeURIComponent(`${value}`)
30
- : `${value}`;
31
- });
29
+ return options?.charEncoding === "percent"
30
+ ? encodeURIComponent(`${value}`)
31
+ : `${value}`;
32
+ })
33
+ .replace(/^\/+/, "");
32
34
  };
33
35
  }
@@ -9,10 +9,10 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
9
9
 
10
10
  export type AgentSyncResponse = {
11
11
  /**
12
- * Public URL for the commands API. Cloud-deployed workers use this
12
+ * Public URL for the commands API. Operators and app-owned receivers use
13
13
  *
14
14
  * @remarks
15
- * to poll for pending commands instead of the agent's local sync URL.
15
+ * it to lease pending commands instead of the agent's local sync URL.
16
16
  */
17
17
  commandsUrl?: string | null | undefined;
18
18
  /**
@@ -0,0 +1,231 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { safeParse } from "../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../types/fp.js";
9
+ import {
10
+ AwsWebIdentityConfig,
11
+ AwsWebIdentityConfig$inboundSchema,
12
+ } from "./awswebidentityconfig.js";
13
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
14
+
15
+ /**
16
+ * Web Identity Token for OIDC authentication
17
+ */
18
+ export type AwsCredentialsWebIdentity = {
19
+ /**
20
+ * Configuration for AWS Web Identity Token authentication
21
+ */
22
+ config: AwsWebIdentityConfig;
23
+ type: "webIdentity";
24
+ };
25
+
26
+ /**
27
+ * AWS profile credentials loaded via the AWS CLI.
28
+ */
29
+ export type AwsCredentialsProfile = {
30
+ /**
31
+ * AWS profile name
32
+ */
33
+ name: string;
34
+ type: "profile";
35
+ };
36
+
37
+ /**
38
+ * AWS Instance Metadata Service credentials.
39
+ */
40
+ export type AwsCredentialsImds = {
41
+ /**
42
+ * Optional IMDS endpoint override
43
+ */
44
+ endpoint?: string | null | undefined;
45
+ type: "imds";
46
+ };
47
+
48
+ /**
49
+ * Temporary AWS session credentials with an expiration time.
50
+ */
51
+ export type AwsCredentialsSessionCredentials = {
52
+ /**
53
+ * AWS Access Key ID
54
+ */
55
+ accessKeyId: string;
56
+ /**
57
+ * Credential expiration as an RFC3339 timestamp
58
+ */
59
+ expiresAt: string;
60
+ /**
61
+ * AWS Secret Access Key
62
+ */
63
+ secretAccessKey: string;
64
+ /**
65
+ * AWS Session Token
66
+ */
67
+ sessionToken: string;
68
+ type: "sessionCredentials";
69
+ };
70
+
71
+ /**
72
+ * Static direct access keys.
73
+ */
74
+ export type AwsCredentialsAccessKeys = {
75
+ /**
76
+ * AWS Access Key ID
77
+ */
78
+ accessKeyId: string;
79
+ /**
80
+ * AWS Secret Access Key
81
+ */
82
+ secretAccessKey: string;
83
+ /**
84
+ * Optional AWS Session Token
85
+ */
86
+ sessionToken?: string | null | undefined;
87
+ type: "accessKeys";
88
+ };
89
+
90
+ /**
91
+ * Supported AWS authentication methods
92
+ */
93
+ export type AwsCredentials =
94
+ | AwsCredentialsAccessKeys
95
+ | AwsCredentialsSessionCredentials
96
+ | AwsCredentialsImds
97
+ | AwsCredentialsProfile
98
+ | AwsCredentialsWebIdentity;
99
+
100
+ /** @internal */
101
+ export const AwsCredentialsWebIdentity$inboundSchema: z.ZodType<
102
+ AwsCredentialsWebIdentity,
103
+ unknown
104
+ > = z.object({
105
+ config: AwsWebIdentityConfig$inboundSchema,
106
+ type: z.literal("webIdentity"),
107
+ });
108
+
109
+ export function awsCredentialsWebIdentityFromJSON(
110
+ jsonString: string,
111
+ ): SafeParseResult<AwsCredentialsWebIdentity, SDKValidationError> {
112
+ return safeParse(
113
+ jsonString,
114
+ (x) => AwsCredentialsWebIdentity$inboundSchema.parse(JSON.parse(x)),
115
+ `Failed to parse 'AwsCredentialsWebIdentity' from JSON`,
116
+ );
117
+ }
118
+
119
+ /** @internal */
120
+ export const AwsCredentialsProfile$inboundSchema: z.ZodType<
121
+ AwsCredentialsProfile,
122
+ unknown
123
+ > = z.object({
124
+ name: z.string(),
125
+ type: z.literal("profile"),
126
+ });
127
+
128
+ export function awsCredentialsProfileFromJSON(
129
+ jsonString: string,
130
+ ): SafeParseResult<AwsCredentialsProfile, SDKValidationError> {
131
+ return safeParse(
132
+ jsonString,
133
+ (x) => AwsCredentialsProfile$inboundSchema.parse(JSON.parse(x)),
134
+ `Failed to parse 'AwsCredentialsProfile' from JSON`,
135
+ );
136
+ }
137
+
138
+ /** @internal */
139
+ export const AwsCredentialsImds$inboundSchema: z.ZodType<
140
+ AwsCredentialsImds,
141
+ unknown
142
+ > = z.object({
143
+ endpoint: z.nullable(z.string()).optional(),
144
+ type: z.literal("imds"),
145
+ });
146
+
147
+ export function awsCredentialsImdsFromJSON(
148
+ jsonString: string,
149
+ ): SafeParseResult<AwsCredentialsImds, SDKValidationError> {
150
+ return safeParse(
151
+ jsonString,
152
+ (x) => AwsCredentialsImds$inboundSchema.parse(JSON.parse(x)),
153
+ `Failed to parse 'AwsCredentialsImds' from JSON`,
154
+ );
155
+ }
156
+
157
+ /** @internal */
158
+ export const AwsCredentialsSessionCredentials$inboundSchema: z.ZodType<
159
+ AwsCredentialsSessionCredentials,
160
+ unknown
161
+ > = z.object({
162
+ access_key_id: z.string(),
163
+ expires_at: z.string(),
164
+ secret_access_key: z.string(),
165
+ session_token: z.string(),
166
+ type: z.literal("sessionCredentials"),
167
+ }).transform((v) => {
168
+ return remap$(v, {
169
+ "access_key_id": "accessKeyId",
170
+ "expires_at": "expiresAt",
171
+ "secret_access_key": "secretAccessKey",
172
+ "session_token": "sessionToken",
173
+ });
174
+ });
175
+
176
+ export function awsCredentialsSessionCredentialsFromJSON(
177
+ jsonString: string,
178
+ ): SafeParseResult<AwsCredentialsSessionCredentials, SDKValidationError> {
179
+ return safeParse(
180
+ jsonString,
181
+ (x) => AwsCredentialsSessionCredentials$inboundSchema.parse(JSON.parse(x)),
182
+ `Failed to parse 'AwsCredentialsSessionCredentials' from JSON`,
183
+ );
184
+ }
185
+
186
+ /** @internal */
187
+ export const AwsCredentialsAccessKeys$inboundSchema: z.ZodType<
188
+ AwsCredentialsAccessKeys,
189
+ unknown
190
+ > = z.object({
191
+ access_key_id: z.string(),
192
+ secret_access_key: z.string(),
193
+ session_token: z.nullable(z.string()).optional(),
194
+ type: z.literal("accessKeys"),
195
+ }).transform((v) => {
196
+ return remap$(v, {
197
+ "access_key_id": "accessKeyId",
198
+ "secret_access_key": "secretAccessKey",
199
+ "session_token": "sessionToken",
200
+ });
201
+ });
202
+
203
+ export function awsCredentialsAccessKeysFromJSON(
204
+ jsonString: string,
205
+ ): SafeParseResult<AwsCredentialsAccessKeys, SDKValidationError> {
206
+ return safeParse(
207
+ jsonString,
208
+ (x) => AwsCredentialsAccessKeys$inboundSchema.parse(JSON.parse(x)),
209
+ `Failed to parse 'AwsCredentialsAccessKeys' from JSON`,
210
+ );
211
+ }
212
+
213
+ /** @internal */
214
+ export const AwsCredentials$inboundSchema: z.ZodType<AwsCredentials, unknown> =
215
+ z.union([
216
+ z.lazy(() => AwsCredentialsAccessKeys$inboundSchema),
217
+ z.lazy(() => AwsCredentialsSessionCredentials$inboundSchema),
218
+ z.lazy(() => AwsCredentialsImds$inboundSchema),
219
+ z.lazy(() => AwsCredentialsProfile$inboundSchema),
220
+ z.lazy(() => AwsCredentialsWebIdentity$inboundSchema),
221
+ ]);
222
+
223
+ export function awsCredentialsFromJSON(
224
+ jsonString: string,
225
+ ): SafeParseResult<AwsCredentials, SDKValidationError> {
226
+ return safeParse(
227
+ jsonString,
228
+ (x) => AwsCredentials$inboundSchema.parse(JSON.parse(x)),
229
+ `Failed to parse 'AwsCredentials' from JSON`,
230
+ );
231
+ }
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../types/fp.js";
8
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
9
+
10
+ /**
11
+ * Service endpoint overrides for testing AWS services
12
+ */
13
+ export type AwsServiceOverrides = {
14
+ /**
15
+ * Override endpoints for specific AWS services
16
+ *
17
+ * @remarks
18
+ * Key is the service name (e.g., "lambda", "s3"), value is the base URL
19
+ */
20
+ endpoints: { [k: string]: string };
21
+ };
22
+
23
+ /** @internal */
24
+ export const AwsServiceOverrides$inboundSchema: z.ZodType<
25
+ AwsServiceOverrides,
26
+ unknown
27
+ > = z.object({
28
+ endpoints: z.record(z.string(), z.string()),
29
+ });
30
+
31
+ export function awsServiceOverridesFromJSON(
32
+ jsonString: string,
33
+ ): SafeParseResult<AwsServiceOverrides, SDKValidationError> {
34
+ return safeParse(
35
+ jsonString,
36
+ (x) => AwsServiceOverrides$inboundSchema.parse(JSON.parse(x)),
37
+ `Failed to parse 'AwsServiceOverrides' from JSON`,
38
+ );
39
+ }
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../types/fp.js";
8
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
9
+
10
+ /**
11
+ * Configuration for AWS Web Identity Token authentication
12
+ */
13
+ export type AwsWebIdentityConfig = {
14
+ /**
15
+ * Optional duration for the assumed role credentials (in seconds)
16
+ */
17
+ durationSeconds?: number | null | undefined;
18
+ /**
19
+ * The ARN of the role to assume
20
+ */
21
+ roleArn: string;
22
+ /**
23
+ * Optional session name for the assumed role session
24
+ */
25
+ sessionName?: string | null | undefined;
26
+ /**
27
+ * The path to the web identity token file
28
+ */
29
+ webIdentityTokenFile: string;
30
+ };
31
+
32
+ /** @internal */
33
+ export const AwsWebIdentityConfig$inboundSchema: z.ZodType<
34
+ AwsWebIdentityConfig,
35
+ unknown
36
+ > = z.object({
37
+ durationSeconds: z.nullable(z.int()).optional(),
38
+ roleArn: z.string(),
39
+ sessionName: z.nullable(z.string()).optional(),
40
+ webIdentityTokenFile: z.string(),
41
+ });
42
+
43
+ export function awsWebIdentityConfigFromJSON(
44
+ jsonString: string,
45
+ ): SafeParseResult<AwsWebIdentityConfig, SDKValidationError> {
46
+ return safeParse(
47
+ jsonString,
48
+ (x) => AwsWebIdentityConfig$inboundSchema.parse(JSON.parse(x)),
49
+ `Failed to parse 'AwsWebIdentityConfig' from JSON`,
50
+ );
51
+ }