@noodleseed/one 0.63.0 → 0.64.0

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 (440) hide show
  1. package/dist/auth-discovery.d.ts +17 -0
  2. package/dist/auth-discovery.d.ts.map +1 -0
  3. package/dist/auth-discovery.js +54 -0
  4. package/dist/auth-discovery.js.map +1 -0
  5. package/dist/cli.d.ts.map +1 -1
  6. package/dist/cli.js +3 -0
  7. package/dist/cli.js.map +1 -1
  8. package/dist/commands/catalog-data-platform-auth.d.ts +7 -0
  9. package/dist/commands/catalog-data-platform-auth.d.ts.map +1 -0
  10. package/dist/commands/catalog-data-platform-auth.js +47 -0
  11. package/dist/commands/catalog-data-platform-auth.js.map +1 -0
  12. package/dist/commands/catalog.d.ts.map +1 -1
  13. package/dist/commands/catalog.js +6 -3
  14. package/dist/commands/catalog.js.map +1 -1
  15. package/dist/commands/docs-mcp.d.ts +3 -3
  16. package/dist/commands/docs-mcp.js +3 -3
  17. package/dist/commands/platform-auth-finalization-args.d.ts +13 -0
  18. package/dist/commands/platform-auth-finalization-args.d.ts.map +1 -0
  19. package/dist/commands/platform-auth-finalization-args.js +29 -0
  20. package/dist/commands/platform-auth-finalization-args.js.map +1 -0
  21. package/dist/commands/platform-auth-migration-args.d.ts +71 -0
  22. package/dist/commands/platform-auth-migration-args.d.ts.map +1 -0
  23. package/dist/commands/platform-auth-migration-args.js +320 -0
  24. package/dist/commands/platform-auth-migration-args.js.map +1 -0
  25. package/dist/commands/platform-auth-migration-ops.d.ts +3 -0
  26. package/dist/commands/platform-auth-migration-ops.d.ts.map +1 -0
  27. package/dist/commands/platform-auth-migration-ops.js +369 -0
  28. package/dist/commands/platform-auth-migration-ops.js.map +1 -0
  29. package/dist/commands/project-setup.js +1 -1
  30. package/dist/commands/project-setup.js.map +1 -1
  31. package/dist/config.d.ts +4 -4
  32. package/dist/config.d.ts.map +1 -1
  33. package/dist/control-plane.d.ts +0 -11
  34. package/dist/control-plane.d.ts.map +1 -1
  35. package/dist/control-plane.js +1 -8
  36. package/dist/control-plane.js.map +1 -1
  37. package/dist/doctor.d.ts.map +1 -1
  38. package/dist/doctor.js +3 -5
  39. package/dist/doctor.js.map +1 -1
  40. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.d.ts.map +1 -1
  41. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js +4 -0
  42. package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js.map +1 -1
  43. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.d.ts.map +1 -1
  44. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js +1 -0
  45. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js.map +1 -1
  46. package/node_modules/@noodle-borg/auth/dist/jwt-issuer.d.ts +2 -2
  47. package/node_modules/@noodle-borg/auth/dist/jwt-issuer.d.ts.map +1 -1
  48. package/node_modules/@noodle-borg/auth/dist/jwt-issuer.js +1 -1
  49. package/node_modules/@noodle-borg/auth/dist/verify.d.ts +1 -1
  50. package/node_modules/@noodle-borg/auth/dist/verify.d.ts.map +1 -1
  51. package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.d.ts +26 -0
  52. package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.d.ts.map +1 -1
  53. package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.js +105 -1
  54. package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.js.map +1 -1
  55. package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.d.ts +25 -0
  56. package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.d.ts.map +1 -0
  57. package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.js +99 -0
  58. package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.js.map +1 -0
  59. package/node_modules/@noodle-borg/service/dist/index.d.ts +15 -0
  60. package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
  61. package/node_modules/@noodle-borg/service/dist/index.js +15 -0
  62. package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
  63. package/node_modules/@noodle-borg/service/dist/main.js +112 -19
  64. package/node_modules/@noodle-borg/service/dist/main.js.map +1 -1
  65. package/node_modules/@noodle-borg/service/dist/oauth/app.d.ts +1 -1
  66. package/node_modules/@noodle-borg/service/dist/oauth/app.d.ts.map +1 -1
  67. package/node_modules/@noodle-borg/service/dist/oauth/app.js +9 -1
  68. package/node_modules/@noodle-borg/service/dist/oauth/app.js.map +1 -1
  69. package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.d.ts +24 -0
  70. package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.d.ts.map +1 -0
  71. package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.js +88 -0
  72. package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.js.map +1 -0
  73. package/node_modules/@noodle-borg/service/dist/oauth/branding.d.ts +2 -0
  74. package/node_modules/@noodle-borg/service/dist/oauth/branding.d.ts.map +1 -1
  75. package/node_modules/@noodle-borg/service/dist/oauth/branding.js +3 -2
  76. package/node_modules/@noodle-borg/service/dist/oauth/branding.js.map +1 -1
  77. package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.d.ts +1 -1
  78. package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.d.ts.map +1 -1
  79. package/node_modules/@noodle-borg/service/dist/oauth/consent-token.d.ts +5 -0
  80. package/node_modules/@noodle-borg/service/dist/oauth/consent-token.d.ts.map +1 -0
  81. package/node_modules/@noodle-borg/service/dist/oauth/consent-token.js +19 -0
  82. package/node_modules/@noodle-borg/service/dist/oauth/consent-token.js.map +1 -0
  83. package/node_modules/@noodle-borg/service/dist/oauth/consent.js +1 -1
  84. package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-page.d.ts.map +1 -1
  85. package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-page.js +216 -28
  86. package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-page.js.map +1 -1
  87. package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.d.ts +13 -0
  88. package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.d.ts.map +1 -0
  89. package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.js +62 -0
  90. package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.js.map +1 -0
  91. package/node_modules/@noodle-borg/service/dist/oauth/metadata.d.ts +4 -0
  92. package/node_modules/@noodle-borg/service/dist/oauth/metadata.d.ts.map +1 -0
  93. package/node_modules/@noodle-borg/service/dist/oauth/metadata.js +20 -0
  94. package/node_modules/@noodle-borg/service/dist/oauth/metadata.js.map +1 -0
  95. package/node_modules/@noodle-borg/service/dist/oauth/paths.d.ts.map +1 -1
  96. package/node_modules/@noodle-borg/service/dist/oauth/paths.js +2 -0
  97. package/node_modules/@noodle-borg/service/dist/oauth/paths.js.map +1 -1
  98. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.d.ts +15 -0
  99. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.d.ts.map +1 -0
  100. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.js +58 -0
  101. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.js.map +1 -0
  102. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.d.ts +8 -0
  103. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.d.ts.map +1 -0
  104. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.js +49 -0
  105. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.js.map +1 -0
  106. package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.d.ts +3 -0
  107. package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.d.ts.map +1 -0
  108. package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.js +7 -0
  109. package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.js.map +1 -0
  110. package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts +20 -25
  111. package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts.map +1 -1
  112. package/node_modules/@noodle-borg/service/dist/oauth/provider.js +105 -196
  113. package/node_modules/@noodle-borg/service/dist/oauth/provider.js.map +1 -1
  114. package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.d.ts +36 -0
  115. package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.d.ts.map +1 -0
  116. package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.js +157 -0
  117. package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.js.map +1 -0
  118. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.d.ts +4 -0
  119. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.d.ts.map +1 -0
  120. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.js +110 -0
  121. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.js.map +1 -0
  122. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts +7 -4
  123. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts.map +1 -1
  124. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js +63 -120
  125. package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js.map +1 -1
  126. package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts +19 -6
  127. package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts.map +1 -1
  128. package/node_modules/@noodle-borg/service/dist/oauth/store.js +24 -2
  129. package/node_modules/@noodle-borg/service/dist/oauth/store.js.map +1 -1
  130. package/node_modules/@noodle-borg/service/dist/oauth/tokens.d.ts +1 -1
  131. package/node_modules/@noodle-borg/service/dist/oauth/tokens.d.ts.map +1 -1
  132. package/node_modules/@noodle-borg/service/dist/oauth/tokens.js +1 -1
  133. package/node_modules/@noodle-borg/service/dist/oauth/tokens.js.map +1 -1
  134. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.d.ts +4 -0
  135. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.d.ts.map +1 -0
  136. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.js +8 -0
  137. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.js.map +1 -0
  138. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.d.ts +34 -0
  139. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.d.ts.map +1 -0
  140. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.js +109 -0
  141. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.js.map +1 -0
  142. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.d.ts +22 -0
  143. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.d.ts.map +1 -0
  144. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.js +30 -0
  145. package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.js.map +1 -0
  146. package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.d.ts +21 -0
  147. package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.d.ts.map +1 -0
  148. package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js +56 -0
  149. package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js.map +1 -0
  150. package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.d.ts +30 -0
  151. package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.d.ts.map +1 -0
  152. package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.js +94 -0
  153. package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.js.map +1 -0
  154. package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.d.ts +33 -0
  155. package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.d.ts.map +1 -0
  156. package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.js +27 -0
  157. package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.js.map +1 -0
  158. package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.d.ts +13 -0
  159. package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.d.ts.map +1 -0
  160. package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.js +63 -0
  161. package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.js.map +1 -0
  162. package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.d.ts +20 -0
  163. package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.d.ts.map +1 -0
  164. package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.js +40 -0
  165. package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.js.map +1 -0
  166. package/node_modules/@noodle-borg/service/dist/oauth/workos-events.d.ts +115 -0
  167. package/node_modules/@noodle-borg/service/dist/oauth/workos-events.d.ts.map +1 -0
  168. package/node_modules/@noodle-borg/service/dist/oauth/workos-events.js +310 -0
  169. package/node_modules/@noodle-borg/service/dist/oauth/workos-events.js.map +1 -0
  170. package/node_modules/@noodle-borg/service/dist/oauth/workos.d.ts +65 -0
  171. package/node_modules/@noodle-borg/service/dist/oauth/workos.d.ts.map +1 -0
  172. package/node_modules/@noodle-borg/service/dist/oauth/workos.js +85 -0
  173. package/node_modules/@noodle-borg/service/dist/oauth/workos.js.map +1 -0
  174. package/node_modules/@noodle-borg/service/dist/options.d.ts +11 -2
  175. package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
  176. package/node_modules/@noodle-borg/service/dist/personal-workspace.d.ts +2 -0
  177. package/node_modules/@noodle-borg/service/dist/personal-workspace.d.ts.map +1 -1
  178. package/node_modules/@noodle-borg/service/dist/personal-workspace.js +8 -2
  179. package/node_modules/@noodle-borg/service/dist/personal-workspace.js.map +1 -1
  180. package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.d.ts +67 -0
  181. package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.d.ts.map +1 -0
  182. package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.js +54 -0
  183. package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.js.map +1 -0
  184. package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.d.ts +25 -0
  185. package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.d.ts.map +1 -0
  186. package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.js +61 -0
  187. package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.js.map +1 -0
  188. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.d.ts +32 -0
  189. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.d.ts.map +1 -0
  190. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.js +231 -0
  191. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.js.map +1 -0
  192. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.d.ts +29 -0
  193. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.d.ts.map +1 -0
  194. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.js +350 -0
  195. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.js.map +1 -0
  196. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.d.ts +50 -0
  197. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.d.ts.map +1 -0
  198. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.js +239 -0
  199. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.js.map +1 -0
  200. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.d.ts +66 -0
  201. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.d.ts.map +1 -0
  202. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.js +77 -0
  203. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.js.map +1 -0
  204. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.d.ts +40 -0
  205. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.d.ts.map +1 -0
  206. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.js +355 -0
  207. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.js.map +1 -0
  208. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.d.ts +41 -0
  209. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.d.ts.map +1 -0
  210. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.js +230 -0
  211. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.js.map +1 -0
  212. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.d.ts +20 -0
  213. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.d.ts.map +1 -0
  214. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.js +126 -0
  215. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.js.map +1 -0
  216. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.d.ts +8 -0
  217. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.d.ts.map +1 -0
  218. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.js +86 -0
  219. package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.js.map +1 -0
  220. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.d.ts +42 -0
  221. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.d.ts.map +1 -0
  222. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.js +368 -0
  223. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.js.map +1 -0
  224. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.d.ts +86 -0
  225. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.d.ts.map +1 -0
  226. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.js +474 -0
  227. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.js.map +1 -0
  228. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.d.ts +17 -0
  229. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.d.ts.map +1 -0
  230. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.js +435 -0
  231. package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.js.map +1 -0
  232. package/node_modules/@noodle-borg/service/dist/platform-auth-migration.d.ts +202 -0
  233. package/node_modules/@noodle-borg/service/dist/platform-auth-migration.d.ts.map +1 -0
  234. package/node_modules/@noodle-borg/service/dist/platform-auth-migration.js +313 -0
  235. package/node_modules/@noodle-borg/service/dist/platform-auth-migration.js.map +1 -0
  236. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.d.ts +48 -0
  237. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.d.ts.map +1 -0
  238. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.js +158 -0
  239. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.js.map +1 -0
  240. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.d.ts +43 -0
  241. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.d.ts.map +1 -0
  242. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.js +92 -0
  243. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.js.map +1 -0
  244. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.d.ts +31 -0
  245. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.d.ts.map +1 -0
  246. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.js +94 -0
  247. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.js.map +1 -0
  248. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.d.ts +102 -0
  249. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.d.ts.map +1 -0
  250. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.js +2 -0
  251. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.js.map +1 -0
  252. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.d.ts +17 -0
  253. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.d.ts.map +1 -0
  254. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.js +367 -0
  255. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.js.map +1 -0
  256. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.d.ts +10 -0
  257. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.d.ts.map +1 -0
  258. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.js +37 -0
  259. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.js.map +1 -0
  260. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.d.ts +36 -0
  261. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.d.ts.map +1 -0
  262. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.js +156 -0
  263. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.js.map +1 -0
  264. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.d.ts +4 -0
  265. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.d.ts.map +1 -0
  266. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.js +162 -0
  267. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.js.map +1 -0
  268. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.d.ts +92 -0
  269. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.d.ts.map +1 -0
  270. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.js +271 -0
  271. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.js.map +1 -0
  272. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.d.ts +13 -0
  273. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.d.ts.map +1 -0
  274. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.js +67 -0
  275. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.js.map +1 -0
  276. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.d.ts +15 -0
  277. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.d.ts.map +1 -0
  278. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.js +47 -0
  279. package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.js.map +1 -0
  280. package/node_modules/@noodle-borg/service/dist/platform-auth-operator.d.ts +1569 -0
  281. package/node_modules/@noodle-borg/service/dist/platform-auth-operator.d.ts.map +1 -0
  282. package/node_modules/@noodle-borg/service/dist/platform-auth-operator.js +274 -0
  283. package/node_modules/@noodle-borg/service/dist/platform-auth-operator.js.map +1 -0
  284. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.d.ts +41 -0
  285. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.d.ts.map +1 -0
  286. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.js +163 -0
  287. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.js.map +1 -0
  288. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.d.ts +34 -0
  289. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.d.ts.map +1 -0
  290. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.js +274 -0
  291. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.js.map +1 -0
  292. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.d.ts +3 -0
  293. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.d.ts.map +1 -0
  294. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.js +120 -0
  295. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.js.map +1 -0
  296. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.d.ts +79 -0
  297. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.d.ts.map +1 -0
  298. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.js +88 -0
  299. package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.js.map +1 -0
  300. package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.d.ts +6 -0
  301. package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.d.ts.map +1 -0
  302. package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.js +38 -0
  303. package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.js.map +1 -0
  304. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.d.ts +61 -0
  305. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.d.ts.map +1 -0
  306. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.js +292 -0
  307. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.js.map +1 -0
  308. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.d.ts +19 -0
  309. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.d.ts.map +1 -0
  310. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.js +121 -0
  311. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.js.map +1 -0
  312. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.d.ts +119 -0
  313. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.d.ts.map +1 -0
  314. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.js +194 -0
  315. package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.js.map +1 -0
  316. package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.d.ts +36 -0
  317. package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.d.ts.map +1 -0
  318. package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.js +93 -0
  319. package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.js.map +1 -0
  320. package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.d.ts +32 -0
  321. package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.d.ts.map +1 -0
  322. package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.js +68 -0
  323. package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.js.map +1 -0
  324. package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.d.ts +36 -0
  325. package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.d.ts.map +1 -0
  326. package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.js +92 -0
  327. package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.js.map +1 -0
  328. package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.d.ts +23 -0
  329. package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.d.ts.map +1 -0
  330. package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.js +231 -0
  331. package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.js.map +1 -0
  332. package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.d.ts +13 -0
  333. package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.d.ts.map +1 -0
  334. package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.js +399 -0
  335. package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.js.map +1 -0
  336. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.d.ts +18 -0
  337. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.d.ts.map +1 -0
  338. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.js +25 -0
  339. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.js.map +1 -0
  340. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.d.ts +15 -0
  341. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.d.ts.map +1 -0
  342. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.js +74 -0
  343. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.js.map +1 -0
  344. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.d.ts +19 -0
  345. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.d.ts.map +1 -0
  346. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.js +249 -0
  347. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.js.map +1 -0
  348. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.d.ts +34 -0
  349. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.d.ts.map +1 -0
  350. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.js +275 -0
  351. package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.js.map +1 -0
  352. package/node_modules/@noodle-borg/service/dist/platform-identity-sync.d.ts +98 -0
  353. package/node_modules/@noodle-borg/service/dist/platform-identity-sync.d.ts.map +1 -0
  354. package/node_modules/@noodle-borg/service/dist/platform-identity-sync.js +179 -0
  355. package/node_modules/@noodle-borg/service/dist/platform-identity-sync.js.map +1 -0
  356. package/node_modules/@noodle-borg/service/dist/platform-identity.d.ts +110 -0
  357. package/node_modules/@noodle-borg/service/dist/platform-identity.d.ts.map +1 -0
  358. package/node_modules/@noodle-borg/service/dist/platform-identity.js +312 -0
  359. package/node_modules/@noodle-borg/service/dist/platform-identity.js.map +1 -0
  360. package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.d.ts +6 -0
  361. package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.d.ts.map +1 -0
  362. package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.js +36 -0
  363. package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.js.map +1 -0
  364. package/node_modules/@noodle-borg/service/dist/routes/billing-read.d.ts.map +1 -1
  365. package/node_modules/@noodle-borg/service/dist/routes/billing-read.js +3 -9
  366. package/node_modules/@noodle-borg/service/dist/routes/billing-read.js.map +1 -1
  367. package/node_modules/@noodle-borg/service/dist/routes/billing-stripe.d.ts.map +1 -1
  368. package/node_modules/@noodle-borg/service/dist/routes/billing-stripe.js +3 -3
  369. package/node_modules/@noodle-borg/service/dist/routes/billing-stripe.js.map +1 -1
  370. package/node_modules/@noodle-borg/service/dist/routes/github-run-claim.d.ts.map +1 -1
  371. package/node_modules/@noodle-borg/service/dist/routes/github-run-claim.js +3 -1
  372. package/node_modules/@noodle-borg/service/dist/routes/github-run-claim.js.map +1 -1
  373. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.d.ts +8 -0
  374. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.d.ts.map +1 -0
  375. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.js +40 -0
  376. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.js.map +1 -0
  377. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.d.ts +13 -0
  378. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.d.ts.map +1 -0
  379. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.js +158 -0
  380. package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.js.map +1 -0
  381. package/node_modules/@noodle-borg/service/dist/serve-options.d.ts +21 -3
  382. package/node_modules/@noodle-borg/service/dist/serve-options.d.ts.map +1 -1
  383. package/node_modules/@noodle-borg/service/dist/serve.d.ts.map +1 -1
  384. package/node_modules/@noodle-borg/service/dist/serve.js +61 -146
  385. package/node_modules/@noodle-borg/service/dist/serve.js.map +1 -1
  386. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts +1 -0
  387. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts.map +1 -1
  388. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js +3 -0
  389. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js.map +1 -1
  390. package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
  391. package/node_modules/@noodle-borg/service/dist/service.js +17 -29
  392. package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
  393. package/node_modules/@noodle-borg/service/dist/store/control-plane.d.ts.map +1 -1
  394. package/node_modules/@noodle-borg/service/dist/store/control-plane.js +60 -19
  395. package/node_modules/@noodle-borg/service/dist/store/control-plane.js.map +1 -1
  396. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.d.ts +1 -2
  397. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.d.ts.map +1 -1
  398. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.js +0 -40
  399. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.js.map +1 -1
  400. package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.d.ts +5 -0
  401. package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.d.ts.map +1 -0
  402. package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.js +176 -0
  403. package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.js.map +1 -0
  404. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.d.ts +2 -0
  405. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.d.ts.map +1 -1
  406. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js +43 -1
  407. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js.map +1 -1
  408. package/node_modules/@noodle-borg/service/dist/store/postgres-signup.js +2 -1
  409. package/node_modules/@noodle-borg/service/dist/store/postgres-signup.js.map +1 -1
  410. package/node_modules/@noodle-borg/service/dist/workos-directory.d.ts +71 -0
  411. package/node_modules/@noodle-borg/service/dist/workos-directory.d.ts.map +1 -0
  412. package/node_modules/@noodle-borg/service/dist/workos-directory.js +175 -0
  413. package/node_modules/@noodle-borg/service/dist/workos-directory.js.map +1 -0
  414. package/node_modules/@noodle-borg/service/package.json +1 -0
  415. package/node_modules/@workos-inc/node/LICENSE +21 -0
  416. package/node_modules/@workos-inc/node/README.md +140 -0
  417. package/node_modules/@workos-inc/node/lib/factory-B8vTFojy.d.cts +9727 -0
  418. package/node_modules/@workos-inc/node/lib/factory-B8vTFojy.d.mts +9727 -0
  419. package/node_modules/@workos-inc/node/lib/factory-CoKXdPX2.cjs +8426 -0
  420. package/node_modules/@workos-inc/node/lib/factory-CoKXdPX2.cjs.map +1 -0
  421. package/node_modules/@workos-inc/node/lib/factory-MKPb5Egh.mjs +8241 -0
  422. package/node_modules/@workos-inc/node/lib/factory-MKPb5Egh.mjs.map +1 -0
  423. package/node_modules/@workos-inc/node/lib/index.cjs +449 -0
  424. package/node_modules/@workos-inc/node/lib/index.cjs.map +1 -0
  425. package/node_modules/@workos-inc/node/lib/index.d.cts +478 -0
  426. package/node_modules/@workos-inc/node/lib/index.d.mts +478 -0
  427. package/node_modules/@workos-inc/node/lib/index.mjs +394 -0
  428. package/node_modules/@workos-inc/node/lib/index.mjs.map +1 -0
  429. package/node_modules/@workos-inc/node/lib/index.worker.cjs +60 -0
  430. package/node_modules/@workos-inc/node/lib/index.worker.cjs.map +1 -0
  431. package/node_modules/@workos-inc/node/lib/index.worker.d.cts +16 -0
  432. package/node_modules/@workos-inc/node/lib/index.worker.d.mts +16 -0
  433. package/node_modules/@workos-inc/node/lib/index.worker.mjs +35 -0
  434. package/node_modules/@workos-inc/node/lib/index.worker.mjs.map +1 -0
  435. package/node_modules/@workos-inc/node/lib/webapi-BgpV54gi.mjs +3224 -0
  436. package/node_modules/@workos-inc/node/lib/webapi-BgpV54gi.mjs.map +1 -0
  437. package/node_modules/@workos-inc/node/lib/webapi-BzGFatFp.cjs +3271 -0
  438. package/node_modules/@workos-inc/node/lib/webapi-BzGFatFp.cjs.map +1 -0
  439. package/node_modules/@workos-inc/node/package.json +96 -0
  440. package/package.json +2 -1
@@ -1,5 +1,5 @@
1
1
  import { createHash, randomBytes } from 'node:crypto';
2
- /** A high-entropy (256-bit) opaque token used for authorization codes, refresh tokens, and the Google `state` nonce. */
2
+ /** A high-entropy (256-bit) opaque token used for codes, refresh tokens, and upstream-login state. */
3
3
  export function randomToken() {
4
4
  return randomBytes(32).toString('base64url');
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/oauth/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEtD,0HAA0H;AAC1H,MAAM,UAAU,WAAW;IACzB,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC"}
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/oauth/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEtD,sGAAsG;AACtG,MAAM,UAAU,WAAW;IACzB,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Response } from 'express';
2
+ /** Keeps a skewed instance from burning a shared pending callback it cannot complete. */
3
+ export declare function rejectUnavailableUpstreamCallback(res: Response, available: boolean): boolean;
4
+ //# sourceMappingURL=upstream-callback-availability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-callback-availability.d.ts","sourceRoot":"","sources":["../../src/oauth/upstream-callback-availability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,yFAAyF;AACzF,wBAAgB,iCAAiC,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAI5F"}
@@ -0,0 +1,8 @@
1
+ /** Keeps a skewed instance from burning a shared pending callback it cannot complete. */
2
+ export function rejectUnavailableUpstreamCallback(res, available) {
3
+ if (available)
4
+ return false;
5
+ res.status(503).set('Retry-After', '5').type('text/plain').send('upstream authentication failed');
6
+ return true;
7
+ }
8
+ //# sourceMappingURL=upstream-callback-availability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-callback-availability.js","sourceRoot":"","sources":["../../src/oauth/upstream-callback-availability.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,MAAM,UAAU,iCAAiC,CAAC,GAAa,EAAE,SAAkB;IACjF,IAAI,SAAS;QAAE,OAAO,KAAK,CAAC;IAC5B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IAClG,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { Logger } from '@noodle-borg/transport-http';
2
+ import type { Request, Response } from 'express';
3
+ import type { ControlPlaneSignupMode, SignupAuthorizer } from '../auth/deploy-gate.js';
4
+ import { type PlatformPrincipalResolver, type ResolvedPlatformIdentity } from '../platform-identity.js';
5
+ import type { ConsentClaims } from './consent-claims.js';
6
+ import type { DeveloperGrantOAuthFlow } from './developer-grant-flow.js';
7
+ import type { GoogleAuthenticator } from './google.js';
8
+ import type { OAuthStore } from './store.js';
9
+ import type { OAuthTokenIssuer } from './token-issuer.js';
10
+ import type { UpstreamHumanOAuthAuthenticator, UpstreamHumanProvider } from './upstream-human.js';
11
+ export declare function handleUpstreamHumanCallback(input: {
12
+ readonly provider: UpstreamHumanProvider;
13
+ readonly req: Request;
14
+ readonly res: Response;
15
+ readonly store: OAuthStore;
16
+ readonly issuer: string;
17
+ readonly google?: GoogleAuthenticator;
18
+ readonly workos?: UpstreamHumanOAuthAuthenticator;
19
+ readonly resolver?: PlatformPrincipalResolver;
20
+ readonly signupAuthorizer?: SignupAuthorizer;
21
+ readonly signupMode: ControlPlaneSignupMode;
22
+ readonly allowedEmailDomain?: string;
23
+ readonly deniedSignupDomains: readonly string[];
24
+ readonly deniedSignupSubjects: readonly string[];
25
+ readonly provisionPlatformPrincipal?: (identity: ResolvedPlatformIdentity & {
26
+ readonly email: string;
27
+ }) => Promise<void>;
28
+ readonly developerGrantFlow?: DeveloperGrantOAuthFlow;
29
+ readonly tokenIssuer: OAuthTokenIssuer;
30
+ readonly signConsent: (claims: ConsentClaims) => Promise<string>;
31
+ readonly logger: Logger;
32
+ readonly now: () => number;
33
+ }): Promise<void>;
34
+ //# sourceMappingURL=upstream-callback-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-callback-handler.d.ts","sourceRoot":"","sources":["../../src/oauth/upstream-callback-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO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AE,CACpC,QAAQ,EAAE,wBAAwB,GAAG;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAC5D,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,QAAQ,CAAC,kBAAkB,CAAC,EAAE,uBAAuB,CAAC;IACtD,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACjE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC;CAC5B,GAAG,OAAO,CAAC,IAAI,CAAC,CAsGhB"}
@@ -0,0 +1,109 @@
1
+ import { PlatformIdentityError, } from '../platform-identity.js';
2
+ import { hashToken } from './tokens.js';
3
+ import { rejectUnavailableUpstreamCallback } from './upstream-callback-availability.js';
4
+ import { logUpstreamCallback, redirectPendingAuthorizationError, } from './upstream-callback-support.js';
5
+ import { renderUpstreamConsent } from './upstream-consent.js';
6
+ import { exchangeUpstreamHumanIdentity, resolveUpstreamHumanPrincipal, } from './upstream-federation.js';
7
+ export async function handleUpstreamHumanCallback(input) {
8
+ const startedAt = input.now();
9
+ const record = (outcome, resolutionResult) => logUpstreamCallback({
10
+ logger: input.logger,
11
+ provider: input.provider,
12
+ startedAt,
13
+ finishedAt: input.now(),
14
+ outcome,
15
+ resolutionResult,
16
+ });
17
+ const available = input.provider === 'google' ? input.google !== undefined : input.workos !== undefined;
18
+ if (rejectUnavailableUpstreamCallback(input.res, available)) {
19
+ record('rejected', 'provider_unavailable');
20
+ return;
21
+ }
22
+ if (typeof input.req.query.error === 'string') {
23
+ const state = typeof input.req.query.state === 'string' ? input.req.query.state : undefined;
24
+ const redirected = await redirectPendingAuthorizationError({
25
+ store: input.store,
26
+ res: input.res,
27
+ state,
28
+ error: 'access_denied',
29
+ callbackKind: input.provider,
30
+ });
31
+ record('rejected', redirected ? 'upstream_denied' : 'pending_not_found');
32
+ return;
33
+ }
34
+ const code = typeof input.req.query.code === 'string' ? input.req.query.code : undefined;
35
+ const state = typeof input.req.query.state === 'string' ? input.req.query.state : undefined;
36
+ if (!code || !state) {
37
+ input.res.status(400).type('text/plain').send('missing authorization code or state');
38
+ record('rejected', 'invalid_request');
39
+ return;
40
+ }
41
+ const pending = await input.store.consumePendingAuthorization(hashToken(state), input.provider);
42
+ if (!pending) {
43
+ input.res.status(400).type('text/plain').send('unknown or expired authorization request');
44
+ record('rejected', 'pending_not_found');
45
+ return;
46
+ }
47
+ let identity;
48
+ try {
49
+ identity = await exchangeUpstreamHumanIdentity({
50
+ provider: input.provider,
51
+ code,
52
+ ...(input.google === undefined ? {} : { google: input.google }),
53
+ ...(input.workos === undefined ? {} : { workos: input.workos }),
54
+ });
55
+ }
56
+ catch {
57
+ input.res.status(400).type('text/plain').send('upstream authentication failed');
58
+ record('failed', 'exchange_failed');
59
+ return;
60
+ }
61
+ let ownerSubject;
62
+ try {
63
+ ownerSubject = await resolveUpstreamHumanPrincipal({
64
+ provider: input.provider,
65
+ identity,
66
+ ...(input.resolver === undefined ? {} : { resolver: input.resolver }),
67
+ ...(input.signupAuthorizer === undefined ? {} : { signupAuthorizer: input.signupAuthorizer }),
68
+ ...(input.allowedEmailDomain === undefined
69
+ ? {}
70
+ : { allowedEmailDomain: input.allowedEmailDomain }),
71
+ signupMode: input.signupMode,
72
+ deniedSignupDomains: input.deniedSignupDomains,
73
+ deniedSignupSubjects: input.deniedSignupSubjects,
74
+ });
75
+ }
76
+ catch (error) {
77
+ const code = error instanceof PlatformIdentityError ? error.code : 'identity_not_permitted';
78
+ input.res.status(403).type('text/plain').send(code);
79
+ record('rejected', 'identity_denied');
80
+ return;
81
+ }
82
+ try {
83
+ if (input.provisionPlatformPrincipal !== undefined) {
84
+ const resolved = await input.resolver?.resolveExisting(ownerSubject);
85
+ if (resolved === undefined)
86
+ throw new PlatformIdentityError('identity_link_required');
87
+ await input.provisionPlatformPrincipal({ ...resolved, email: identity.email });
88
+ }
89
+ await renderUpstreamConsent({
90
+ pending,
91
+ identity,
92
+ ownerSubject,
93
+ issuer: input.issuer,
94
+ store: input.store,
95
+ tokenIssuer: input.tokenIssuer,
96
+ ...(input.developerGrantFlow === undefined
97
+ ? {}
98
+ : { developerGrantFlow: input.developerGrantFlow }),
99
+ signConsent: input.signConsent,
100
+ res: input.res,
101
+ });
102
+ record('succeeded', 'principal_resolved');
103
+ }
104
+ catch (error) {
105
+ record('failed', 'completion_failed');
106
+ throw error;
107
+ }
108
+ }
109
+ //# sourceMappingURL=upstream-callback-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-callback-handler.js","sourceRoot":"","sources":["../../src/oauth/upstream-callback-handler.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,qBAAqB,GAGtB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,EACL,mBAAmB,EACnB,iCAAiC,GAElC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,0BAA0B,CAAC;AAGlC,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,KAsBjD;IACC,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;IAC9B,MAAM,MAAM,GAAG,CACb,OAA4C,EAC5C,gBAAkD,EAC5C,EAAE,CACR,mBAAmB,CAAC;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,SAAS;QACT,UAAU,EAAE,KAAK,CAAC,GAAG,EAAE;QACvB,OAAO;QACP,gBAAgB;KACjB,CAAC,CAAC;IACL,MAAM,SAAS,GACb,K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,CAAC;YACrE,IAAI,QAAQ,KAAK,SAAS;gBAAE,MAAM,IAAI,qBAAqB,CAAC,wBAAwB,CAAC,CAAC;YACtF,MAAM,KAAK,CAAC,0BAA0B,CAAC,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QACjF,CAAC;QACD,MAAM,qBAAqB,CAAC;YAC1B,OAAO;YACP,QAAQ;YACR,YAAY;YACZ,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,GAAG,CAAC,KAAK,CAAC,kBAAkB,KAAK,SAAS;gBACxC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC;YACrD,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,GAAG,EAAE,KAAK,CAAC,GAAG;SACf,CAAC,CAAC;QACH,MAAM,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;QACtC,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { Logger } from '@noodle-borg/transport-http';
2
+ import type { Response } from 'express';
3
+ import type { OAuthStore, PendingAuthorizationCallbackKind } from './store.js';
4
+ import type { UpstreamHumanProvider } from './upstream-human.js';
5
+ export type UpstreamCallbackResolutionResult = 'principal_resolved' | 'provider_unavailable' | 'upstream_denied' | 'invalid_request' | 'pending_not_found' | 'exchange_failed' | 'identity_denied' | 'completion_failed';
6
+ /** Emits only the bounded aggregate fields approved for platform-auth rollout telemetry. */
7
+ export declare function logUpstreamCallback(input: {
8
+ readonly logger: Logger;
9
+ readonly provider: UpstreamHumanProvider;
10
+ readonly startedAt: number;
11
+ readonly finishedAt: number;
12
+ readonly outcome: 'succeeded' | 'rejected' | 'failed';
13
+ readonly resolutionResult: UpstreamCallbackResolutionResult;
14
+ }): void;
15
+ export declare function redirectPendingAuthorizationError(input: {
16
+ readonly store: OAuthStore;
17
+ readonly res: Response;
18
+ readonly state: string | undefined;
19
+ readonly error: string;
20
+ readonly callbackKind: PendingAuthorizationCallbackKind;
21
+ }): Promise<boolean>;
22
+ //# sourceMappingURL=upstream-callback-support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-callback-support.d.ts","sourceRoot":"","sources":["../../src/oauth/upstream-callback-support.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAE/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,MAAM,MAAM,gCAAgC,GACxC,oBAAoB,GACpB,sBAAsB,GACtB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,CAAC;AAExB,4FAA4F;AAC5F,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAC;IACtD,QAAQ,CAAC,gBAAgB,EAAE,gCAAgC,CAAC;CAC7D,GAAG,IAAI,CASP;AAED,wBAAsB,iCAAiC,CAAC,KAAK,EAAE;IAC7D,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,gCAAgC,CAAC;CACzD,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBnB"}
@@ -0,0 +1,30 @@
1
+ import { hashToken } from './tokens.js';
2
+ /** Emits only the bounded aggregate fields approved for platform-auth rollout telemetry. */
3
+ export function logUpstreamCallback(input) {
4
+ input.logger.info('oauth.upstream_callback', {
5
+ provider: input.provider,
6
+ cohort: 'interactive_human',
7
+ surface: 'oauth_callback',
8
+ outcome: input.outcome,
9
+ resolutionResult: input.resolutionResult,
10
+ latencyMs: Math.max(0, input.finishedAt - input.startedAt),
11
+ });
12
+ }
13
+ export async function redirectPendingAuthorizationError(input) {
14
+ if (input.state === undefined) {
15
+ input.res.status(400).type('text/plain').send(`customer authorization failed: ${input.error}`);
16
+ return false;
17
+ }
18
+ const pending = await input.store.consumePendingAuthorization(hashToken(input.state), input.callbackKind);
19
+ if (!pending) {
20
+ input.res.status(400).type('text/plain').send('unknown or expired authorization request');
21
+ return false;
22
+ }
23
+ const redirect = new URL(pending.redirectUri);
24
+ redirect.searchParams.set('error', input.error);
25
+ if (pending.clientState !== undefined)
26
+ redirect.searchParams.set('state', pending.clientState);
27
+ input.res.redirect(302, redirect.href);
28
+ return true;
29
+ }
30
+ //# sourceMappingURL=upstream-callback-support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-callback-support.js","sourceRoot":"","sources":["../../src/oauth/upstream-callback-support.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAaxC,4FAA4F;AAC5F,MAAM,UAAU,mBAAmB,CAAC,KAOnC;IACC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,EAAE;QA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,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { Response } from 'express';
2
+ import type { ConsentClaims } from './consent-claims.js';
3
+ import { type DeveloperGrantOAuthFlow } from './developer-grant-flow.js';
4
+ import type { OAuthStore, PendingAuthorizationRecord } from './store.js';
5
+ import type { OAuthTokenIssuer } from './token-issuer.js';
6
+ export declare function renderUpstreamConsent(input: {
7
+ readonly pending: PendingAuthorizationRecord;
8
+ readonly identity: {
9
+ readonly email: string;
10
+ readonly locale?: string;
11
+ readonly timeZone?: string;
12
+ };
13
+ readonly ownerSubject: string;
14
+ readonly issuer: string;
15
+ readonly store: OAuthStore;
16
+ readonly tokenIssuer: OAuthTokenIssuer;
17
+ readonly developerGrantFlow?: DeveloperGrantOAuthFlow;
18
+ readonly signConsent: (claims: ConsentClaims) => Promise<string>;
19
+ readonly res: Response;
20
+ }): Promise<void>;
21
+ //# sourceMappingURL=upstream-consent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-consent.d.ts","sourceRoot":"","sources":["../../src/oauth/upstream-consent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACL,KAAK,uBAAuB,EAE7B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,KAAK,EAAE,UAAU,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,wBAAsB,qBAAqB,CAAC,KAAK,EAAE;IACjD,QAAQ,CAAC,OAAO,EAAE,0BAA0B,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACvC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,uBAAuB,CAAC;IACtD,QAAQ,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACjE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;CACxB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8DhB"}
@@ -0,0 +1,56 @@
1
+ import { renderConsentPage } from './consent.js';
2
+ import { isDeveloperResourceForIssuer, } from './developer-grant-flow.js';
3
+ import { storedOAuthOwnerPreferences } from './identity-preferences.js';
4
+ import { hostOf } from './provider-util.js';
5
+ export async function renderUpstreamConsent(input) {
6
+ const preferences = storedOAuthOwnerPreferences(input.identity);
7
+ if (isDeveloperResourceForIssuer(input.pending.resource, input.issuer)) {
8
+ if (input.developerGrantFlow === undefined) {
9
+ input.res.status(400).type('text/plain').send('developer access is not configured');
10
+ return;
11
+ }
12
+ await input.developerGrantFlow.renderSelection(input.pending, { subject: input.ownerSubject, email: input.identity.email, ...preferences }, input.res);
13
+ return;
14
+ }
15
+ if (await input.store.hasConsentGrant(input.pending.clientId, input.ownerSubject, input.pending.resource)) {
16
+ await input.tokenIssuer.issueAuthorizationCode(input.res, {
17
+ clientId: input.pending.clientId,
18
+ codeChallenge: input.pending.codeChallenge,
19
+ redirectUri: input.pending.redirectUri,
20
+ resource: input.pending.resource,
21
+ ownerSubject: input.ownerSubject,
22
+ ownerEmail: input.identity.email,
23
+ ...preferences,
24
+ ...(input.pending.clientState !== undefined
25
+ ? { clientState: input.pending.clientState }
26
+ : {}),
27
+ ...(input.pending.scope !== undefined ? { scope: input.pending.scope } : {}),
28
+ });
29
+ return;
30
+ }
31
+ const consentToken = await input.signConsent({
32
+ kind: 'consent',
33
+ clientId: input.pending.clientId,
34
+ redirectUri: input.pending.redirectUri,
35
+ codeChallenge: input.pending.codeChallenge,
36
+ resource: input.pending.resource,
37
+ ownerSubject: input.ownerSubject,
38
+ ownerEmail: input.identity.email,
39
+ ...preferences,
40
+ ...(input.pending.clientState !== undefined ? { clientState: input.pending.clientState } : {}),
41
+ ...(input.pending.scope !== undefined ? { scope: input.pending.scope } : {}),
42
+ });
43
+ const client = await input.store.getClient(input.pending.clientId);
44
+ input.res
45
+ .status(200)
46
+ .type('html')
47
+ .send(renderConsentPage({
48
+ clientName: client?.client_name ?? input.pending.clientId,
49
+ resourceHost: hostOf(input.pending.resource),
50
+ redirectHost: hostOf(input.pending.redirectUri),
51
+ userEmail: input.identity.email,
52
+ consentToken,
53
+ consentAction: '/oauth/consent',
54
+ }));
55
+ }
56
+ //# sourceMappingURL=upstream-consent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-consent.js","sourceRoot":"","sources":["../../src/oauth/upstream-consent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAEL,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAI5C,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,KAc3C;IACC,MAAM,WAAW,GAAG,2BAA2B,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChE,IAAI,4BAA4B,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACvE,IAAI,KAAK,CAAC,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,WAAW,CAAC;QAC/C,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK;QAC/B,YAAY;QACZ,aAAa,EAAE,gBAAgB;KAChC,CAAC,CACH,CAAC;AACN,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { ControlPlaneSignupMode, SignupAuthorizer } from '../auth/deploy-gate.js';
2
+ import { type PlatformPrincipalResolver, type UpstreamHumanIdentity } from '../platform-identity.js';
3
+ import type { GoogleAuthenticator } from './google.js';
4
+ import type { UpstreamHumanOAuthAuthenticator, UpstreamHumanProvider } from './upstream-human.js';
5
+ export declare function upstreamAuthorizationUrl(input: {
6
+ readonly provider: UpstreamHumanProvider;
7
+ readonly google?: GoogleAuthenticator;
8
+ readonly workos?: UpstreamHumanOAuthAuthenticator;
9
+ readonly state: string;
10
+ }): string;
11
+ export declare function exchangeUpstreamHumanIdentity(input: {
12
+ readonly provider: UpstreamHumanProvider;
13
+ readonly code: string;
14
+ readonly google?: GoogleAuthenticator;
15
+ readonly workos?: UpstreamHumanOAuthAuthenticator;
16
+ }): Promise<UpstreamHumanIdentity & {
17
+ readonly locale?: string;
18
+ readonly timeZone?: string;
19
+ }>;
20
+ export declare function resolveUpstreamHumanPrincipal(input: {
21
+ readonly provider: UpstreamHumanProvider;
22
+ readonly identity: UpstreamHumanIdentity;
23
+ readonly resolver?: PlatformPrincipalResolver;
24
+ readonly signupAuthorizer?: SignupAuthorizer;
25
+ readonly allowedEmailDomain?: string;
26
+ readonly signupMode?: ControlPlaneSignupMode;
27
+ readonly deniedSignupDomains?: readonly string[];
28
+ readonly deniedSignupSubjects?: readonly string[];
29
+ }): Promise<string>;
30
+ //# sourceMappingURL=upstream-federation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-federation.d.ts","sourceRoot":"","sources":["../../src/oauth/upstream-federation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OA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AAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACnD,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ClB"}
@@ -0,0 +1,94 @@
1
+ import { PlatformIdentityError, } from '../platform-identity.js';
2
+ export function upstreamAuthorizationUrl(input) {
3
+ if (input.provider === 'google') {
4
+ if (input.google === undefined)
5
+ throw new Error('Google authenticator is unavailable');
6
+ return input.google.authorizationUrl(input.state);
7
+ }
8
+ return input.workos?.authorizationUrl(input.state) ?? '';
9
+ }
10
+ export async function exchangeUpstreamHumanIdentity(input) {
11
+ if (input.provider === 'workos') {
12
+ if (input.workos === undefined)
13
+ throw new Error('WorkOS authenticator is unavailable');
14
+ const identity = await input.workos.exchange(input.code);
15
+ if (identity.provider !== input.workos.provider || identity.realm !== input.workos.realm) {
16
+ throw new Error('WorkOS identity provider or realm mismatch');
17
+ }
18
+ return identity;
19
+ }
20
+ if (input.google === undefined)
21
+ throw new Error('Google authenticator is unavailable');
22
+ const identity = await input.google.exchange(input.code);
23
+ return {
24
+ provider: 'google',
25
+ realm: 'accounts.google.com',
26
+ subject: identity.subject,
27
+ email: identity.email,
28
+ emailVerified: true,
29
+ ...(identity.locale !== undefined ? { locale: identity.locale } : {}),
30
+ ...(identity.timeZone !== undefined ? { timeZone: identity.timeZone } : {}),
31
+ };
32
+ }
33
+ export async function resolveUpstreamHumanPrincipal(input) {
34
+ if (input.provider === 'google') {
35
+ // Admission is evaluated against the verified Google identity before creating canonical state or
36
+ // enqueueing WorkOS synchronization. Rejected callbacks must be side-effect free.
37
+ assertIdentityIsNotDenied(input, input.identity.subject);
38
+ if ((input.signupMode ?? 'restricted') === 'restricted' &&
39
+ input.allowedEmailDomain !== undefined &&
40
+ !emailMatchesDomain(input.identity.email, input.allowedEmailDomain) &&
41
+ !(await input.signupAuthorizer?.isSignupAllowed({
42
+ subject: input.identity.subject,
43
+ email: input.identity.email.toLowerCase(),
44
+ }))) {
45
+ throw new PlatformIdentityError('identity_link_required');
46
+ }
47
+ return input.resolver === undefined
48
+ ? input.identity.subject
49
+ : (await input.resolver.resolve(input.identity)).subject;
50
+ }
51
+ if (input.resolver === undefined)
52
+ throw new PlatformIdentityError('identity_link_required');
53
+ const existing = await input.resolver.resolveLinked(input.identity);
54
+ // Linked identities are still observed through the resolver so a newer verified WorkOS email becomes the
55
+ // sole current provider/realm evidence. This is not email linking: the immutable WorkOS ID was resolved first.
56
+ if (existing !== undefined) {
57
+ assertIdentityIsNotDenied(input, existing.subject);
58
+ return (await input.resolver.resolve(input.identity)).subject;
59
+ }
60
+ if (await input.resolver.hasVerifiedEmailEvidence(input.identity.email)) {
61
+ throw new PlatformIdentityError('identity_link_required');
62
+ }
63
+ assertIdentityIsNotDenied(input);
64
+ if ((input.signupMode ?? 'restricted') === 'public') {
65
+ return (await input.resolver.resolve(input.identity)).subject;
66
+ }
67
+ const signupAllowed = await input.signupAuthorizer?.isSignupAllowed({
68
+ subject: input.identity.subject,
69
+ email: input.identity.email.toLowerCase(),
70
+ });
71
+ const domainAllowed = input.allowedEmailDomain !== undefined &&
72
+ emailMatchesDomain(input.identity.email, input.allowedEmailDomain);
73
+ if (!domainAllowed && signupAllowed !== true)
74
+ throw new PlatformIdentityError('identity_link_required');
75
+ return (await input.resolver.resolve(input.identity)).subject;
76
+ }
77
+ function assertIdentityIsNotDenied(input, canonicalSubject) {
78
+ const subjects = new Set((input.deniedSignupSubjects ?? []).map((subject) => subject.trim().toLowerCase()));
79
+ const externalSubject = input.identity.subject.toLowerCase();
80
+ const canonical = canonicalSubject?.toLowerCase();
81
+ const deniedDomain = (input.deniedSignupDomains ?? []).some((domain) => emailMatchesDomain(input.identity.email, domain));
82
+ if (subjects.has(externalSubject) ||
83
+ (canonical !== undefined && subjects.has(canonical)) ||
84
+ deniedDomain) {
85
+ throw new PlatformIdentityError('identity_signup_denied');
86
+ }
87
+ }
88
+ function emailMatchesDomain(email, configuredDomain) {
89
+ const domain = configuredDomain.trim().toLowerCase();
90
+ if (domain.length === 0)
91
+ return false;
92
+ return email.toLowerCase().endsWith(domain.startsWith('@') ? domain : `@${domain}`);
93
+ }
94
+ //# sourceMappingURL=upstream-federation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-federation.js","sourceRoot":"","sources":["../../src/oauth/upstream-federation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,GAGtB,MAAM,yBAAyB,CAAC;AAIjC,MAAM,UAAU,wBAAwB,CAAC,KAKxC;IACC,IAAI,KAAK,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAChC,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACvF,OAAO,KAAK,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;AAC3D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAAC,KAKnD;IACC,IAAI,KAAK,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAChC,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACvF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzD,IAAI,QAAQ,CAAC,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,QAAQ,IAAI,QAAQ,CAAC,KAAK,KAAK,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACzF,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,I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C,CAAC;QACpD,YAAY,EACZ,CAAC;QACD,MAAM,IAAI,qBAAqB,CAAC,wBAAwB,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa,EAAE,gBAAwB;IACjE,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACtC,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;AACtF,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { UpstreamHumanIdentity } from '../platform-identity.js';
2
+ export type UpstreamHumanProvider = 'google' | 'workos';
3
+ /**
4
+ * The OAuth-facing federation boundary. Implementations receive an authorization code and return identity
5
+ * claims only: upstream access and refresh credentials are deliberately discarded at this boundary.
6
+ */
7
+ export interface UpstreamHumanOAuthAuthenticator {
8
+ readonly provider: UpstreamHumanProvider;
9
+ readonly realm: string;
10
+ authorizationUrl(state: string): string;
11
+ exchange(code: string): Promise<UpstreamHumanIdentity & {
12
+ readonly locale?: string;
13
+ readonly timeZone?: string;
14
+ }>;
15
+ }
16
+ export interface UpstreamHumanRollout {
17
+ readonly workosPercentage: number;
18
+ readonly workosCanaryClientIds: readonly string[];
19
+ /** Recovery clients remain WorkOS-routed while the normal percentage is rolled back to zero. */
20
+ readonly workosRecoveryClientIds?: readonly string[];
21
+ /**
22
+ * Server-owned rollback state may offer an explicit browser choice to use WorkOS even when this
23
+ * transaction's normal rollout selection is Google. OAuth clients cannot set this value.
24
+ */
25
+ readonly allowUserSelectedWorkosRecovery?: boolean;
26
+ }
27
+ export declare const GOOGLE_ONLY_UPSTREAM_ROLLOUT: UpstreamHumanRollout;
28
+ /** Select once at authorization creation; callbacks must use the stored result, never recalculate rollout. */
29
+ export declare function selectUpstreamHumanProvider(input: {
30
+ readonly clientId: string;
31
+ readonly transactionNonce: string;
32
+ }, rollout?: UpstreamHumanRollout): UpstreamHumanProvider;
33
+ //# sourceMappingURL=upstream-human.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-human.d.ts","sourceRoot":"","sources":["../../src/oauth/upstream-human.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACxC,QAAQ,CACN,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,qBAAqB,GAAG;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC9F;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;IAClD,gGAAgG;IAChG,QAAQ,CAAC,uBAAuB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrD;;;OAGG;IACH,QAAQ,CAAC,+BAA+B,CAAC,EAAE,OAAO,CAAC;CACpD;AAED,eAAO,MAAM,4BAA4B,EAAE,oBAK1C,CAAC;AAEF,8GAA8G;AAC9G,wBAAgB,2BAA2B,CACzC,KAAK,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,EACvE,OAAO,GAAE,oBAAmD,GAC3D,qBAAqB,CAavB"}
@@ -0,0 +1,27 @@
1
+ import { createHash } from 'node:crypto';
2
+ export const GOOGLE_ONLY_UPSTREAM_ROLLOUT = {
3
+ workosPercentage: 0,
4
+ workosCanaryClientIds: [],
5
+ workosRecoveryClientIds: [],
6
+ allowUserSelectedWorkosRecovery: false,
7
+ };
8
+ /** Select once at authorization creation; callbacks must use the stored result, never recalculate rollout. */
9
+ export function selectUpstreamHumanProvider(input, rollout = GOOGLE_ONLY_UPSTREAM_ROLLOUT) {
10
+ if (rollout.workosRecoveryClientIds?.includes(input.clientId) === true)
11
+ return 'workos';
12
+ if (rollout.workosPercentage <= 0)
13
+ return 'google';
14
+ if (rollout.workosCanaryClientIds.includes(input.clientId))
15
+ return 'workos';
16
+ if (rollout.workosPercentage >= 100)
17
+ return 'workos';
18
+ const digest = createHash('sha256')
19
+ .update(`${input.clientId}:${input.transactionNonce}`)
20
+ .digest();
21
+ // Map a full uint32 into the exact [0, 2^32) range rather than reducing one byte modulo 100, whose
22
+ // uneven buckets bias an intermediate rollout. The threshold form needs no rejection sampling.
23
+ const bucket = digest.readUInt32BE(0);
24
+ const threshold = (rollout.workosPercentage / 100) * 0x1_0000_0000;
25
+ return bucket < threshold ? 'workos' : 'google';
26
+ }
27
+ //# sourceMappingURL=upstream-human.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-human.js","sourceRoot":"","sources":["../../src/oauth/upstream-human.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA8BzC,MAAM,CAAC,MAAM,4BAA4B,GAAyB;IAChE,gBAAgB,EAAE,CAAC;IACnB,qBAAqB,EAAE,EAAE;IACzB,uBAAuB,EAAE,EAAE;IAC3B,+BAA+B,EAAE,KAAK;CACvC,CAAC;AAEF,8GAA8G;AAC9G,MAAM,UAAU,2BAA2B,CACzC,KAAuE,EACvE,UAAgC,4BAA4B;IAE5D,IAAI,OAAO,CAAC,uBAAuB,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI;QAAE,OAAO,QAAQ,CAAC;IACxF,IAAI,OAAO,CAAC,gBAAgB,IAAI,CAAC;QAAE,OAAO,QAAQ,CAAC;IACnD,IAAI,OAAO,CAAC,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC5E,IAAI,OAAO,CAAC,gBAAgB,IAAI,GAAG;QAAE,OAAO,QAAQ,CAAC;IACrD,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC;SAChC,MAAM,CAAC,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;SACrD,MAAM,EAAE,CAAC;IACZ,mGAAmG;IACnG,+FAA+F;IAC/F,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,gBAAgB,GAAG,GAAG,CAAC,GAAG,aAAa,CAAC;IACnE,OAAO,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;AAClD,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Request, Response } from 'express';
2
+ import type { GoogleAuthenticator } from './google.js';
3
+ import type { OAuthStore } from './store.js';
4
+ import type { UpstreamHumanOAuthAuthenticator } from './upstream-human.js';
5
+ export declare function renderUpstreamProviderChoice(state: string): string;
6
+ export declare function continueUpstreamProviderChoice(input: {
7
+ readonly req: Request;
8
+ readonly res: Response;
9
+ readonly store: OAuthStore;
10
+ readonly google?: GoogleAuthenticator;
11
+ readonly workos?: UpstreamHumanOAuthAuthenticator;
12
+ }): Promise<void>;
13
+ //# sourceMappingURL=upstream-provider-choice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upstream-provider-choice.d.ts","sourceRoot":"","sources":["../../src/oauth/upstream-provider-choice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAA8B,MAAM,YAAY,CAAC;AAGzE,OAAO,KAAK,EAAE,+BAA+B,EAAyB,MAAM,qBAAqB,CAAC;AAElG,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAalE;AAED,wBAAsB,8BAA8B,CAAC,KAAK,EAAE;IAC1D,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,MAAM,CAAC,EAAE,+BAA+B,CAAC;CACnD,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BhB"}