run402 4.11.2 → 4.12.1

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 (41) hide show
  1. package/cli.mjs +6 -0
  2. package/lib/auth.mjs +55 -22
  3. package/lib/command-manifest.mjs +6 -0
  4. package/lib/delegates.mjs +189 -0
  5. package/lib/deploy-v2.mjs +10 -0
  6. package/package.json +1 -1
  7. package/sdk/dist/delegate-credentials.d.ts +37 -0
  8. package/sdk/dist/delegate-credentials.d.ts.map +1 -0
  9. package/sdk/dist/delegate-credentials.js +41 -0
  10. package/sdk/dist/delegate-credentials.js.map +1 -0
  11. package/sdk/dist/index.d.ts +12 -0
  12. package/sdk/dist/index.d.ts.map +1 -1
  13. package/sdk/dist/index.js +11 -0
  14. package/sdk/dist/index.js.map +1 -1
  15. package/sdk/dist/namespaces/auth.d.ts +43 -6
  16. package/sdk/dist/namespaces/auth.d.ts.map +1 -1
  17. package/sdk/dist/namespaces/auth.js +46 -5
  18. package/sdk/dist/namespaces/auth.js.map +1 -1
  19. package/sdk/dist/namespaces/delegates.d.ts +50 -0
  20. package/sdk/dist/namespaces/delegates.d.ts.map +1 -0
  21. package/sdk/dist/namespaces/delegates.js +99 -0
  22. package/sdk/dist/namespaces/delegates.js.map +1 -0
  23. package/sdk/dist/namespaces/delegates.types.d.ts +88 -0
  24. package/sdk/dist/namespaces/delegates.types.d.ts.map +1 -0
  25. package/sdk/dist/namespaces/delegates.types.js +10 -0
  26. package/sdk/dist/namespaces/delegates.types.js.map +1 -0
  27. package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
  28. package/sdk/dist/namespaces/deploy.js +9 -1
  29. package/sdk/dist/namespaces/deploy.js.map +1 -1
  30. package/sdk/dist/node/credentials.d.ts +17 -1
  31. package/sdk/dist/node/credentials.d.ts.map +1 -1
  32. package/sdk/dist/node/credentials.js +28 -0
  33. package/sdk/dist/node/credentials.js.map +1 -1
  34. package/sdk/dist/node/index.d.ts +8 -1
  35. package/sdk/dist/node/index.d.ts.map +1 -1
  36. package/sdk/dist/node/index.js +2 -1
  37. package/sdk/dist/node/index.js.map +1 -1
  38. package/sdk/dist/scoped.d.ts +15 -2
  39. package/sdk/dist/scoped.d.ts.map +1 -1
  40. package/sdk/dist/scoped.js +26 -0
  41. package/sdk/dist/scoped.js.map +1 -1
@@ -19,6 +19,7 @@
19
19
  * behavior; this file is the implementation.
20
20
  */
21
21
  import { isCiSessionCredentials } from "../ci-credentials.js";
22
+ import { isDelegateCredentials } from "../delegate-credentials.js";
22
23
  import { assertCiDeployableSpec } from "./ci.js";
23
24
  import { ROUTE_PRICING_NETWORKS, ROUTE_HTTP_METHODS, normalizeDeployResolveRequest, } from "./deploy.types.js";
24
25
  import { ApiError, LocalError, NetworkError, PaymentRequired, Run402DeployError, Unauthorized, isTransferFreezeError, } from "../errors.js";
@@ -3824,7 +3825,11 @@ async function uploadInlineCas(client, projectId, bytes, contentType) {
3824
3825
  * projects in any of today's other apikey-auth tools).
3825
3826
  */
3826
3827
  async function apikeyHeaders(client, projectId) {
3827
- if (isCiClient(client))
3828
+ // A CI session and a delegate both already authorize these routes via
3829
+ // `Authorization: Bearer`, supplied by the kernel's getAuth. Attaching an
3830
+ // apikey beside a bearer mixes credential families on one request, which the
3831
+ // kernel explicitly forbids — so stand down and let the bearer carry it.
3832
+ if (isCiClient(client) || isDelegateClient(client))
3828
3833
  return {};
3829
3834
  const project = await client.getProject(projectId);
3830
3835
  if (!project)
@@ -3834,6 +3839,9 @@ async function apikeyHeaders(client, projectId) {
3834
3839
  function isCiClient(client) {
3835
3840
  return isCiSessionCredentials(client.credentials);
3836
3841
  }
3842
+ function isDelegateClient(client) {
3843
+ return isDelegateCredentials(client.credentials);
3844
+ }
3837
3845
  function makeEmitter(cb) {
3838
3846
  if (!cb)
3839
3847
  return () => { };