@aws/nx-plugin 1.0.0-rc.79 → 1.0.0-rc.80

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 (469) hide show
  1. package/generators.json +10 -0
  2. package/migrations.json +1 -1
  3. package/package.json +1 -1
  4. package/src/agentcore-gateway/agent-connection/generator.d.ts +1 -1
  5. package/src/agentcore-gateway/agent-connection/generator.js.map +1 -1
  6. package/src/agentcore-gateway/agent-connection/schema.d.js.map +1 -1
  7. package/src/agentcore-gateway/agent-connection/schema.d.ts +1 -1
  8. package/src/agentcore-gateway/attach-upstream.js.map +1 -1
  9. package/src/agentcore-gateway/gateway-connection/generator.d.ts +1 -1
  10. package/src/agentcore-gateway/gateway-connection/generator.js.map +1 -1
  11. package/src/agentcore-gateway/gateway-connection/schema.d.js.map +1 -1
  12. package/src/agentcore-gateway/gateway-connection/schema.d.ts +1 -1
  13. package/src/agentcore-gateway/generator.d.ts +3 -3
  14. package/src/agentcore-gateway/generator.js.map +1 -1
  15. package/src/agentcore-gateway/mcp-connection/generator.d.ts +1 -1
  16. package/src/agentcore-gateway/mcp-connection/generator.js.map +1 -1
  17. package/src/agentcore-gateway/mcp-connection/schema.d.js.map +1 -1
  18. package/src/agentcore-gateway/mcp-connection/schema.d.ts +1 -1
  19. package/src/agentcore-gateway/react-connection/generator.d.ts +1 -1
  20. package/src/agentcore-gateway/react-connection/generator.js.map +1 -1
  21. package/src/agentcore-gateway/react-connection/schema.d.js.map +1 -1
  22. package/src/agentcore-gateway/react-connection/schema.d.ts +1 -1
  23. package/src/agentcore-gateway/schema.d.js.map +1 -1
  24. package/src/agentcore-gateway/schema.d.ts +1 -1
  25. package/src/agentcore-harness/generator.d.ts +4 -4
  26. package/src/agentcore-harness/generator.js.map +1 -1
  27. package/src/agentcore-harness/schema.d.js.map +1 -1
  28. package/src/agentcore-harness/schema.d.ts +1 -1
  29. package/src/connection/agent-local-dev.d.ts +1 -1
  30. package/src/connection/agent-local-dev.js.map +1 -1
  31. package/src/connection/agent-runtime-config.js.map +1 -1
  32. package/src/connection/gateway-runtime-config.js.map +1 -1
  33. package/src/connection/generator.d.ts +2 -2
  34. package/src/connection/generator.js.map +1 -1
  35. package/src/connection/local-dev.js.map +1 -1
  36. package/src/connection/scaffold-catalog.d.ts +1 -1
  37. package/src/connection/scaffold-catalog.js +6 -6
  38. package/src/connection/scaffold-catalog.js.map +1 -1
  39. package/src/connection/schema-resolver.d.ts +1 -1
  40. package/src/connection/schema-resolver.js.map +1 -1
  41. package/src/index.d.ts +1 -1
  42. package/src/index.js.map +1 -1
  43. package/src/infra/app/generator.d.ts +7 -7
  44. package/src/infra/app/generator.js.map +1 -1
  45. package/src/init/generator.d.ts +3 -3
  46. package/src/init/generator.js.map +1 -1
  47. package/src/init/schema.d.js.map +1 -1
  48. package/src/init/schema.d.ts +2 -2
  49. package/src/internal/test-matrix/generator.js.map +1 -1
  50. package/src/license/config-types.d.ts +2 -2
  51. package/src/license/config-types.js.map +1 -1
  52. package/src/license/config.d.ts +2 -2
  53. package/src/license/config.js.map +1 -1
  54. package/src/license/dependency-check/check.d.ts +2 -2
  55. package/src/license/dependency-check/check.js.map +1 -1
  56. package/src/license/dependency-check/collectors/collector.js.map +1 -1
  57. package/src/license/dependency-check/collectors/python-collector.js.map +1 -1
  58. package/src/license/dependency-check/evaluator.d.ts +1 -1
  59. package/src/license/dependency-check/evaluator.js.map +1 -1
  60. package/src/license/dependency-check/executor.js.map +1 -1
  61. package/src/license/dependency-check/pre-approved.d.ts +1 -1
  62. package/src/license/dependency-check/pre-approved.js.map +1 -1
  63. package/src/license/dependency-check/types.d.ts +1 -1
  64. package/src/license/dependency-check/types.js.map +1 -1
  65. package/src/license/generator.d.ts +1 -1
  66. package/src/license/generator.js.map +1 -1
  67. package/src/license/index.d.ts +4 -4
  68. package/src/license/index.js.map +1 -1
  69. package/src/license/known-exceptions.d.ts +1 -1
  70. package/src/license/known-exceptions.js.map +1 -1
  71. package/src/license/sync/generator.js.map +1 -1
  72. package/src/license/sync/project-file-sync.d.ts +1 -1
  73. package/src/license/sync/project-file-sync.js.map +1 -1
  74. package/src/mcp-server/dev-server.js.map +1 -1
  75. package/src/mcp-server/generator-info.d.ts +3 -3
  76. package/src/mcp-server/generator-info.js.map +1 -1
  77. package/src/mcp-server/guide-pipeline.d.ts +1 -1
  78. package/src/mcp-server/guide-pipeline.js.map +1 -1
  79. package/src/mcp-server/guide-render.js.map +1 -1
  80. package/src/mcp-server/index.js.map +1 -1
  81. package/src/mcp-server/mdx-ast.js.map +1 -1
  82. package/src/mcp-server/server.js.map +1 -1
  83. package/src/mcp-server/tools/add-to-existing-project.d.ts +1 -1
  84. package/src/mcp-server/tools/add-to-existing-project.js.map +1 -1
  85. package/src/mcp-server/tools/create-workspace-command.js.map +1 -1
  86. package/src/mcp-server/tools/general-guidance.d.ts +1 -1
  87. package/src/mcp-server/tools/general-guidance.js +1 -1
  88. package/src/mcp-server/tools/general-guidance.js.map +1 -1
  89. package/src/mcp-server/tools/generator-guide.d.ts +1 -1
  90. package/src/mcp-server/tools/generator-guide.js.map +1 -1
  91. package/src/mcp-server/tools/list-generators.d.ts +1 -1
  92. package/src/mcp-server/tools/list-generators.js.map +1 -1
  93. package/src/mcp-server/tools/upgrade-workspace.d.ts +1 -1
  94. package/src/mcp-server/tools/upgrade-workspace.js.map +1 -1
  95. package/src/migrations/latest/apt-security-updates-in-container-images/migration.js.map +1 -1
  96. package/src/migrations/latest/dynamodb-configurable-encryption/migration.js.map +1 -1
  97. package/src/migrations/latest/py-agent-ag-ui-hooks/migration.js.map +1 -1
  98. package/src/migrations/latest/py-agent-session-id-middleware-extraction/migration.js.map +1 -1
  99. package/src/migrations/latest/remove-mcp-inspector-license-exceptions/migration.js.map +1 -1
  100. package/src/migrations/latest/static-website-configurable-waf-encryption/migration.js.map +1 -1
  101. package/src/migrations/latest/ts-agent-session-id-middleware-extraction/migration.js.map +1 -1
  102. package/src/migrations/latest/user-identity-configurable-mfa/migration.js.map +1 -1
  103. package/src/migrations/v1.0.0-rc.50/0001-modernize-function-props-cast/migration.js.map +1 -1
  104. package/src/migrations/v1.0.0-rc.50/0002-restrict-cors-to-custom-domains/migration.js.map +1 -1
  105. package/src/migrations/v1.0.0-rc.50/0003-terraform-bootstrap-adopt-existing-bucket/migration.js.map +1 -1
  106. package/src/migrations/v1.0.0-rc.52/0001-user-identity-waf-allow-localhost-callback/migration.js.map +1 -1
  107. package/src/migrations/v1.0.0-rc.54/0001-order-access-log-delivery-after-bucket-policy/migration.js.map +1 -1
  108. package/src/migrations/v1.0.0-rc.55/0001-backfill-generator-metadata/migration.d.ts +1 -1
  109. package/src/migrations/v1.0.0-rc.55/0001-backfill-generator-metadata/migration.js.map +1 -1
  110. package/src/migrations/v1.0.0-rc.56/0001-dynamodb-local-remove-optimize-flag/migration.js.map +1 -1
  111. package/src/migrations/v1.0.0-rc.57/0001-ts-agent-session-management-support/migration.js.map +1 -1
  112. package/src/migrations/v1.0.0-rc.58/0001-smithy-ssdk-bundle-pins/migration.js.map +1 -1
  113. package/src/migrations/v1.0.0-rc.59/0001-gateway-agent-targets/migration.js.map +1 -1
  114. package/src/migrations/v1.0.0-rc.60/0001-gateway-cognito-passthrough/migration.js.map +1 -1
  115. package/src/migrations/v1.0.0-rc.60/0002-waf-log-group-removal/migration.js.map +1 -1
  116. package/src/migrations/v1.0.0-rc.60/0003-strip-pip-from-python-images/migration.js.map +1 -1
  117. package/src/migrations/v1.0.0-rc.61/0001-py-agent-lifespan-construction/migration.js.map +1 -1
  118. package/src/migrations/v1.0.0-rc.62/0001-rename-load-runtime-config-target/migration.js.map +1 -1
  119. package/src/migrations/v1.0.0-rc.63/0001-add-deploy-sandbox-target/migration.js.map +1 -1
  120. package/src/migrations/v1.0.0-rc.64/0001-smithy-build-without-docker/migration.js.map +1 -1
  121. package/src/migrations/v1.0.0-rc.65/0001-vite-config-import-meta-dirname/migration.js.map +1 -1
  122. package/src/migrations/v1.0.0-rc.65/0002-rolldown-code-splitting/migration.js.map +1 -1
  123. package/src/migrations/v1.0.0-rc.67/0001-smithy-server-package-rename/migration.js.map +1 -1
  124. package/src/migrations/v1.0.0-rc.68/0001-translate-script-whole-file-writes/migration.js.map +1 -1
  125. package/src/migrations/v1.0.0-rc.70/0001-py-agent-a2a-lifespan-construction/migration.js.map +1 -1
  126. package/src/migrations/v1.0.0-rc.71/0001-py-agent-a2a-httpx-client-per-call/migration.js.map +1 -1
  127. package/src/migrations/v1.0.0-rc.72/0001-py-agent-session-management-support/migration.js.map +1 -1
  128. package/src/open-api/ts-client/generator.d.ts +1 -1
  129. package/src/open-api/ts-client/generator.js.map +1 -1
  130. package/src/open-api/ts-hooks/generator.d.ts +1 -1
  131. package/src/open-api/ts-hooks/generator.js.map +1 -1
  132. package/src/open-api/ts-hooks/generator.spec.tsx +6 -6
  133. package/src/open-api/ts-metadata/generator.d.ts +1 -1
  134. package/src/open-api/ts-metadata/generator.js.map +1 -1
  135. package/src/open-api/utils/codegen-data/languages.d.ts +1 -1
  136. package/src/open-api/utils/codegen-data/languages.js.map +1 -1
  137. package/src/open-api/utils/codegen-data.d.ts +2 -2
  138. package/src/open-api/utils/codegen-data.js.map +1 -1
  139. package/src/open-api/utils/normalise.d.ts +1 -1
  140. package/src/open-api/utils/normalise.js.map +1 -1
  141. package/src/open-api/utils/parse.d.ts +1 -1
  142. package/src/open-api/utils/parse.js.map +1 -1
  143. package/src/open-api/utils/parser.d.ts +2 -2
  144. package/src/open-api/utils/parser.js.map +1 -1
  145. package/src/open-api/utils/refs.d.ts +1 -1
  146. package/src/open-api/utils/refs.js.map +1 -1
  147. package/src/preset/generator.d.ts +3 -3
  148. package/src/preset/generator.js.map +1 -1
  149. package/src/preset/schema.d.js.map +1 -1
  150. package/src/preset/schema.d.ts +3 -3
  151. package/src/py/agent/a2a-connection/generator.d.ts +3 -3
  152. package/src/py/agent/a2a-connection/generator.js.map +1 -1
  153. package/src/py/agent/a2a-connection/schema.d.js.map +1 -1
  154. package/src/py/agent/a2a-connection/schema.d.ts +1 -1
  155. package/src/py/agent/gateway-connection/generator.d.ts +3 -3
  156. package/src/py/agent/gateway-connection/generator.js.map +1 -1
  157. package/src/py/agent/gateway-connection/schema.d.js.map +1 -1
  158. package/src/py/agent/gateway-connection/schema.d.ts +1 -1
  159. package/src/py/agent/generator.d.ts +3 -3
  160. package/src/py/agent/generator.js.map +1 -1
  161. package/src/py/agent/mcp-connection/generator.d.ts +3 -3
  162. package/src/py/agent/mcp-connection/generator.js.map +1 -1
  163. package/src/py/agent/mcp-connection/schema.d.js.map +1 -1
  164. package/src/py/agent/mcp-connection/schema.d.ts +1 -1
  165. package/src/py/agent/react-connection/generator.d.ts +12 -12
  166. package/src/py/agent/react-connection/generator.js.map +1 -1
  167. package/src/py/agent/react-connection/local-dev.d.ts +1 -1
  168. package/src/py/agent/react-connection/local-dev.js.map +1 -1
  169. package/src/py/agent/react-connection/schema.d.js.map +1 -1
  170. package/src/py/agent/react-connection/schema.d.ts +1 -1
  171. package/src/py/agent/schema.d.js.map +1 -1
  172. package/src/py/agent/schema.d.ts +1 -1
  173. package/src/py/api/generator.d.ts +1 -1
  174. package/src/py/api/generator.js.map +1 -1
  175. package/src/py/api/schema.d.js.map +1 -1
  176. package/src/py/api/schema.d.ts +1 -1
  177. package/src/py/dynamodb/agent-connection/generator.d.ts +1 -1
  178. package/src/py/dynamodb/agent-connection/generator.js.map +1 -1
  179. package/src/py/dynamodb/agent-connection/schema.d.js.map +1 -1
  180. package/src/py/dynamodb/agent-connection/schema.d.ts +1 -1
  181. package/src/py/dynamodb/fast-api-connection/generator.d.ts +1 -1
  182. package/src/py/dynamodb/fast-api-connection/generator.js.map +1 -1
  183. package/src/py/dynamodb/generator.d.ts +4 -4
  184. package/src/py/dynamodb/generator.js.map +1 -1
  185. package/src/py/dynamodb/mcp-server-connection/generator.d.ts +1 -1
  186. package/src/py/dynamodb/mcp-server-connection/generator.js.map +1 -1
  187. package/src/py/dynamodb/mcp-server-connection/schema.d.js.map +1 -1
  188. package/src/py/dynamodb/mcp-server-connection/schema.d.ts +1 -1
  189. package/src/py/dynamodb/schema.d.js.map +1 -1
  190. package/src/py/dynamodb/schema.d.ts +1 -1
  191. package/src/py/fast-api/generator.d.ts +3 -3
  192. package/src/py/fast-api/generator.js.map +1 -1
  193. package/src/py/fast-api/react/generator.d.ts +3 -3
  194. package/src/py/fast-api/react/generator.js.map +1 -1
  195. package/src/py/fast-api/react/open-api.js.map +1 -1
  196. package/src/py/fast-api/schema.d.js.map +1 -1
  197. package/src/py/fast-api/schema.d.ts +1 -1
  198. package/src/py/lambda-function/files/handler/__lambdaFunctionSnakeCase__.py.template +1 -1
  199. package/src/py/lambda-function/generator.d.ts +10 -4
  200. package/src/py/lambda-function/generator.js +8 -1
  201. package/src/py/lambda-function/generator.js.map +1 -1
  202. package/src/py/lambda-function/schema.d.js.map +1 -1
  203. package/src/py/lambda-function/schema.d.ts +2 -2
  204. package/src/py/lambda-function/schema.json +1 -1
  205. package/src/py/mcp-server/generator.d.ts +3 -3
  206. package/src/py/mcp-server/generator.js.map +1 -1
  207. package/src/py/mcp-server/schema.d.js.map +1 -1
  208. package/src/py/mcp-server/schema.d.ts +1 -1
  209. package/src/py/project/generator.d.ts +2 -2
  210. package/src/py/project/generator.js.map +1 -1
  211. package/src/py/project/schema.json +1 -0
  212. package/src/py/rdb/agent-connection/generator.d.ts +1 -1
  213. package/src/py/rdb/agent-connection/generator.js.map +1 -1
  214. package/src/py/rdb/agent-connection/schema.d.js.map +1 -1
  215. package/src/py/rdb/agent-connection/schema.d.ts +1 -1
  216. package/src/py/rdb/fast-api-connection/generator.d.ts +1 -1
  217. package/src/py/rdb/fast-api-connection/generator.js.map +1 -1
  218. package/src/py/rdb/generator.d.ts +3 -3
  219. package/src/py/rdb/generator.js.map +1 -1
  220. package/src/py/rdb/mcp-server-connection/generator.d.ts +1 -1
  221. package/src/py/rdb/mcp-server-connection/generator.js.map +1 -1
  222. package/src/py/rdb/mcp-server-connection/schema.d.js.map +1 -1
  223. package/src/py/rdb/mcp-server-connection/schema.d.ts +1 -1
  224. package/src/sdk/agentcore-gateway.d.ts +1 -1
  225. package/src/sdk/agentcore-gateway.js.map +1 -1
  226. package/src/sdk/agentcore-harness.d.ts +1 -1
  227. package/src/sdk/agentcore-harness.js.map +1 -1
  228. package/src/sdk/connection.d.ts +1 -1
  229. package/src/sdk/connection.js.map +1 -1
  230. package/src/sdk/license.d.ts +3 -3
  231. package/src/sdk/license.js.map +1 -1
  232. package/src/sdk/open-api.d.ts +3 -3
  233. package/src/sdk/open-api.js.map +1 -1
  234. package/src/sdk/py.d.ts +7 -7
  235. package/src/sdk/py.js.map +1 -1
  236. package/src/sdk/smithy.d.ts +1 -1
  237. package/src/sdk/smithy.js.map +1 -1
  238. package/src/sdk/terraform.d.ts +1 -1
  239. package/src/sdk/terraform.js.map +1 -1
  240. package/src/sdk/ts.d.ts +18 -18
  241. package/src/sdk/ts.js.map +1 -1
  242. package/src/sdk/utils/ast.d.ts +1 -1
  243. package/src/sdk/utils/ast.js.map +1 -1
  244. package/src/sdk/utils/format.d.ts +1 -1
  245. package/src/sdk/utils/format.js.map +1 -1
  246. package/src/sdk/utils/test.d.ts +1 -1
  247. package/src/sdk/utils/test.js.map +1 -1
  248. package/src/smithy/project/generator.d.ts +4 -4
  249. package/src/smithy/project/generator.js.map +1 -1
  250. package/src/smithy/react-connection/generator.d.ts +3 -3
  251. package/src/smithy/react-connection/generator.js.map +1 -1
  252. package/src/smithy/ts/api/generator.d.ts +3 -3
  253. package/src/smithy/ts/api/generator.js.map +1 -1
  254. package/src/smithy/ts/api/schema.d.js.map +1 -1
  255. package/src/smithy/ts/api/schema.d.ts +1 -1
  256. package/src/terraform/project/generator.d.ts +5 -5
  257. package/src/terraform/project/generator.js.map +1 -1
  258. package/src/trpc/backend/generator.d.ts +3 -3
  259. package/src/trpc/backend/generator.js.map +1 -1
  260. package/src/trpc/backend/schema.d.js.map +1 -1
  261. package/src/trpc/backend/schema.d.ts +1 -1
  262. package/src/trpc/react/generator.d.ts +3 -3
  263. package/src/trpc/react/generator.js.map +1 -1
  264. package/src/ts/agent/a2a-connection/generator.d.ts +3 -3
  265. package/src/ts/agent/a2a-connection/generator.js.map +1 -1
  266. package/src/ts/agent/a2a-connection/schema.d.js.map +1 -1
  267. package/src/ts/agent/a2a-connection/schema.d.ts +1 -1
  268. package/src/ts/agent/gateway-connection/generator.d.ts +3 -3
  269. package/src/ts/agent/gateway-connection/generator.js.map +1 -1
  270. package/src/ts/agent/gateway-connection/schema.d.js.map +1 -1
  271. package/src/ts/agent/gateway-connection/schema.d.ts +1 -1
  272. package/src/ts/agent/generator.d.ts +3 -3
  273. package/src/ts/agent/generator.js.map +1 -1
  274. package/src/ts/agent/mcp-connection/generator.d.ts +3 -3
  275. package/src/ts/agent/mcp-connection/generator.js.map +1 -1
  276. package/src/ts/agent/mcp-connection/schema.d.js.map +1 -1
  277. package/src/ts/agent/mcp-connection/schema.d.ts +1 -1
  278. package/src/ts/agent/react-connection/generator.d.ts +11 -11
  279. package/src/ts/agent/react-connection/generator.js.map +1 -1
  280. package/src/ts/agent/react-connection/local-dev.d.ts +1 -1
  281. package/src/ts/agent/react-connection/local-dev.js.map +1 -1
  282. package/src/ts/agent/react-connection/schema.d.js.map +1 -1
  283. package/src/ts/agent/react-connection/schema.d.ts +1 -1
  284. package/src/ts/agent/schema.d.js.map +1 -1
  285. package/src/ts/agent/schema.d.ts +1 -1
  286. package/src/ts/api/generator.d.ts +1 -1
  287. package/src/ts/api/generator.js.map +1 -1
  288. package/src/ts/api/schema.d.js.map +1 -1
  289. package/src/ts/api/schema.d.ts +1 -1
  290. package/src/ts/astro-docs/generator.d.ts +3 -3
  291. package/src/ts/astro-docs/generator.js.map +1 -1
  292. package/src/ts/dcr-proxy/generator.d.ts +5 -5
  293. package/src/ts/dcr-proxy/generator.js.map +1 -1
  294. package/src/ts/dcr-proxy/schema.d.js.map +1 -1
  295. package/src/ts/dcr-proxy/schema.d.ts +1 -1
  296. package/src/ts/docs/generator.d.ts +1 -1
  297. package/src/ts/docs/generator.js.map +1 -1
  298. package/src/ts/dynamodb/agent-connection/generator.d.ts +1 -1
  299. package/src/ts/dynamodb/agent-connection/generator.js.map +1 -1
  300. package/src/ts/dynamodb/agent-connection/schema.d.js.map +1 -1
  301. package/src/ts/dynamodb/agent-connection/schema.d.ts +1 -1
  302. package/src/ts/dynamodb/generator.d.ts +5 -5
  303. package/src/ts/dynamodb/generator.js +1 -0
  304. package/src/ts/dynamodb/generator.js.map +1 -1
  305. package/src/ts/dynamodb/mcp-server-connection/generator.d.ts +1 -1
  306. package/src/ts/dynamodb/mcp-server-connection/generator.js.map +1 -1
  307. package/src/ts/dynamodb/mcp-server-connection/schema.d.js.map +1 -1
  308. package/src/ts/dynamodb/mcp-server-connection/schema.d.ts +1 -1
  309. package/src/ts/dynamodb/schema.d.js.map +1 -1
  310. package/src/ts/dynamodb/schema.d.ts +1 -1
  311. package/src/ts/dynamodb/smithy-connection/generator.d.ts +1 -1
  312. package/src/ts/dynamodb/smithy-connection/generator.js.map +1 -1
  313. package/src/ts/dynamodb/trpc-connection/generator.d.ts +1 -1
  314. package/src/ts/dynamodb/trpc-connection/generator.js.map +1 -1
  315. package/src/ts/lambda-function/generator.d.ts +5 -5
  316. package/src/ts/lambda-function/generator.js.map +1 -1
  317. package/src/ts/lambda-function/schema.d.js.map +1 -1
  318. package/src/ts/lambda-function/schema.d.ts +1 -1
  319. package/src/ts/lib/biome.d.ts +1 -1
  320. package/src/ts/lib/biome.js.map +1 -1
  321. package/src/ts/lib/generator.d.ts +3 -3
  322. package/src/ts/lib/generator.js.map +1 -1
  323. package/src/ts/lib/ts-project-utils.d.ts +3 -3
  324. package/src/ts/lib/ts-project-utils.js.map +1 -1
  325. package/src/ts/lib/vitest.d.ts +2 -2
  326. package/src/ts/lib/vitest.js.map +1 -1
  327. package/src/ts/mcp-server/generator.d.ts +3 -3
  328. package/src/ts/mcp-server/generator.js.map +1 -1
  329. package/src/ts/mcp-server/schema.d.js.map +1 -1
  330. package/src/ts/mcp-server/schema.d.ts +1 -1
  331. package/src/ts/nx-generator/generator.d.ts +2 -2
  332. package/src/ts/nx-generator/generator.js.map +1 -1
  333. package/src/ts/nx-migration/generator.d.ts +3 -3
  334. package/src/ts/nx-migration/generator.js.map +1 -1
  335. package/src/ts/nx-plugin/generator.d.ts +3 -3
  336. package/src/ts/nx-plugin/generator.js.map +1 -1
  337. package/src/ts/nx-plugin/utils.d.ts +1 -1
  338. package/src/ts/nx-plugin/utils.js.map +1 -1
  339. package/src/ts/rdb/agent-connection/generator.d.ts +1 -1
  340. package/src/ts/rdb/agent-connection/generator.js.map +1 -1
  341. package/src/ts/rdb/agent-connection/schema.d.js.map +1 -1
  342. package/src/ts/rdb/agent-connection/schema.d.ts +1 -1
  343. package/src/ts/rdb/generator.d.ts +4 -4
  344. package/src/ts/rdb/generator.js +1 -0
  345. package/src/ts/rdb/generator.js.map +1 -1
  346. package/src/ts/rdb/mcp-server-connection/generator.d.ts +1 -1
  347. package/src/ts/rdb/mcp-server-connection/generator.js.map +1 -1
  348. package/src/ts/rdb/mcp-server-connection/schema.d.js.map +1 -1
  349. package/src/ts/rdb/mcp-server-connection/schema.d.ts +1 -1
  350. package/src/ts/rdb/schema.d.js.map +1 -1
  351. package/src/ts/rdb/schema.d.ts +1 -1
  352. package/src/ts/rdb/smithy-connection/generator.d.ts +1 -1
  353. package/src/ts/rdb/smithy-connection/generator.js.map +1 -1
  354. package/src/ts/rdb/trpc-connection/generator.d.ts +1 -1
  355. package/src/ts/rdb/trpc-connection/generator.js.map +1 -1
  356. package/src/ts/react-website/agui/generator.d.ts +2 -2
  357. package/src/ts/react-website/agui/generator.js.map +1 -1
  358. package/src/ts/react-website/app/generator.d.ts +3 -3
  359. package/src/ts/react-website/app/generator.js.map +1 -1
  360. package/src/ts/react-website/app/schema.d.js.map +1 -1
  361. package/src/ts/react-website/app/schema.d.ts +2 -2
  362. package/src/ts/react-website/cognito-auth/generator.d.ts +5 -5
  363. package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
  364. package/src/ts/react-website/cognito-auth/schema.d.js.map +1 -1
  365. package/src/ts/react-website/cognito-auth/schema.d.ts +1 -1
  366. package/src/ts/react-website/cognito-auth/utils.js.map +1 -1
  367. package/src/ts/react-website/runtime-config/generator.d.ts +1 -1
  368. package/src/ts/react-website/runtime-config/generator.js.map +1 -1
  369. package/src/ts/sync/generator.d.ts +1 -1
  370. package/src/ts/sync/generator.js.map +1 -1
  371. package/src/ts/website/app/generator.d.ts +1 -1
  372. package/src/ts/website/app/generator.js.map +1 -1
  373. package/src/ts/website/app/schema.d.js.map +1 -1
  374. package/src/ts/website/app/schema.d.ts +2 -2
  375. package/src/ts/website/auth/generator.d.ts +1 -1
  376. package/src/ts/website/auth/generator.js.map +1 -1
  377. package/src/ts/website/auth/schema.d.js.map +1 -1
  378. package/src/ts/website/auth/schema.d.ts +1 -1
  379. package/src/utils/add-dependencies.d.ts +1 -1
  380. package/src/utils/add-dependencies.js.map +1 -1
  381. package/src/utils/agent-chat/agent-chat.js.map +1 -1
  382. package/src/utils/agent-connection/agent-connection.d.ts +2 -2
  383. package/src/utils/agent-connection/agent-connection.js.map +1 -1
  384. package/src/utils/agent-core-constructs/agent-core-constructs.d.ts +4 -4
  385. package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
  386. package/src/utils/api-constructs/api-constructs.d.ts +3 -3
  387. package/src/utils/api-constructs/api-constructs.js.map +1 -1
  388. package/src/utils/api-constructs/open-api-metadata.d.ts +1 -1
  389. package/src/utils/api-constructs/open-api-metadata.js.map +1 -1
  390. package/src/utils/ast/website.js.map +1 -1
  391. package/src/utils/ast.js +6 -0
  392. package/src/utils/ast.js.map +1 -1
  393. package/src/utils/bundle/bundle.d.ts +1 -1
  394. package/src/utils/bundle/bundle.js.map +1 -1
  395. package/src/utils/commands.d.ts +1 -1
  396. package/src/utils/commands.js.map +1 -1
  397. package/src/utils/config/index.d.ts +6 -6
  398. package/src/utils/config/index.js.map +1 -1
  399. package/src/utils/config/utils.d.ts +1 -1
  400. package/src/utils/config/utils.js.map +1 -1
  401. package/src/utils/connection/open-api/react.d.ts +1 -1
  402. package/src/utils/connection/open-api/react.js.map +1 -1
  403. package/src/utils/containers.js.map +1 -1
  404. package/src/utils/dcr-proxy-constructs/dcr-proxy-constructs.d.ts +1 -1
  405. package/src/utils/dcr-proxy-constructs/dcr-proxy-constructs.js.map +1 -1
  406. package/src/utils/declared-dependencies.d.ts +1 -1
  407. package/src/utils/declared-dependencies.js.map +1 -1
  408. package/src/utils/dependencies.js.map +1 -1
  409. package/src/utils/docker.d.ts +1 -1
  410. package/src/utils/docker.js.map +1 -1
  411. package/src/utils/dynamodb-constructs/dynamodb-constructs.d.ts +1 -1
  412. package/src/utils/dynamodb-constructs/dynamodb-constructs.js.map +1 -1
  413. package/src/utils/format.js.map +1 -1
  414. package/src/utils/fs.d.ts +1 -1
  415. package/src/utils/fs.js.map +1 -1
  416. package/src/utils/function-constructs/function-constructs.d.ts +1 -1
  417. package/src/utils/function-constructs/function-constructs.js.map +1 -1
  418. package/src/utils/iac.d.ts +2 -2
  419. package/src/utils/iac.js.map +1 -1
  420. package/src/utils/identity-constructs/identity-constructs.d.ts +2 -2
  421. package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
  422. package/src/utils/init.d.ts +3 -3
  423. package/src/utils/init.js.map +1 -1
  424. package/src/utils/install.d.ts +1 -1
  425. package/src/utils/install.js.map +1 -1
  426. package/src/utils/mcp.js.map +1 -1
  427. package/src/utils/metrics.d.ts +1 -1
  428. package/src/utils/metrics.js.map +1 -1
  429. package/src/utils/migration-manifest.d.ts +1 -1
  430. package/src/utils/migration-manifest.js.map +1 -1
  431. package/src/utils/nx.d.ts +3 -3
  432. package/src/utils/nx.js.map +1 -1
  433. package/src/utils/paths.js.map +1 -1
  434. package/src/utils/pkg-manager.d.ts +1 -1
  435. package/src/utils/pkg-manager.js.map +1 -1
  436. package/src/utils/pnpm-workspace.js.map +1 -1
  437. package/src/utils/project-package-json.js.map +1 -1
  438. package/src/utils/py.d.ts +2 -2
  439. package/src/utils/py.js.map +1 -1
  440. package/src/utils/rdb-constructs/rdb-constructs.d.ts +2 -2
  441. package/src/utils/rdb-constructs/rdb-constructs.js.map +1 -1
  442. package/src/utils/shared-constructs-constants.js.map +1 -1
  443. package/src/utils/shared-constructs.d.ts +3 -3
  444. package/src/utils/shared-constructs.js.map +1 -1
  445. package/src/utils/shared-dynamodb-scripts.d.ts +1 -1
  446. package/src/utils/shared-dynamodb-scripts.js.map +1 -1
  447. package/src/utils/shared-infra-config.js.map +1 -1
  448. package/src/utils/shared-infra-scripts.d.ts +2 -2
  449. package/src/utils/shared-infra-scripts.js.map +1 -1
  450. package/src/utils/shared-rdb-scripts.d.ts +1 -1
  451. package/src/utils/shared-rdb-scripts.js.map +1 -1
  452. package/src/utils/shared-scripts.js.map +1 -1
  453. package/src/utils/shared-shadcn.d.ts +1 -1
  454. package/src/utils/shared-shadcn.js.map +1 -1
  455. package/src/utils/smithy.js.map +1 -1
  456. package/src/utils/test.js.map +1 -1
  457. package/src/utils/version-upgrade-migration/migration.js.map +1 -1
  458. package/src/utils/version-upgrade-migration/nx-package-updates.js.map +1 -1
  459. package/src/utils/version-upgrade-migration/owned-dependencies.d.ts +1 -1
  460. package/src/utils/version-upgrade-migration/owned-dependencies.js.map +1 -1
  461. package/src/utils/version-upgrade-migration/register.js.map +1 -1
  462. package/src/utils/version-upgrade-migration/sync-embedded-versions.d.ts +1 -1
  463. package/src/utils/version-upgrade-migration/sync-embedded-versions.js.map +1 -1
  464. package/src/utils/version-upgrade-migration/sync-metrics-version.js.map +1 -1
  465. package/src/utils/version-upgrade-migration/sync-vended-versions.js.map +1 -1
  466. package/src/utils/versions.d.ts +1 -1
  467. package/src/utils/versions.js.map +1 -1
  468. package/src/utils/website-constructs/website-constructs.d.ts +2 -2
  469. package/src/utils/website-constructs/website-constructs.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/agentcore-harness/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { IacOption } from '../utils/iac';\n\n/**\n * Options for the agentcore-harness generator, mirroring schema.json.\n */\nexport interface AgentcoreHarnessGeneratorSchema {\n name: string;\n directory?: string;\n subDirectory?: string;\n infra?: 'agentcore' | 'none';\n iac?: IacOption;\n preferInstallDependencies?: boolean;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAGD;;CAEC,GACD,WAOC"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/agentcore-harness/schema.d.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { IacOption } from '../utils/iac.js';\n\n/**\n * Options for the agentcore-harness generator, mirroring schema.json.\n */\nexport interface AgentcoreHarnessGeneratorSchema {\n name: string;\n directory?: string;\n subDirectory?: string;\n infra?: 'agentcore' | 'none';\n iac?: IacOption;\n preferInstallDependencies?: boolean;\n}\n"],"names":[],"mappings":"AAAA;;;CAGC,GAGD;;CAEC,GACD,WAOC"}
@@ -2,7 +2,7 @@
2
2
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- import type { IacOption } from '../utils/iac';
5
+ import type { IacOption } from '../utils/iac.js';
6
6
 
7
7
  /**
8
8
  * Options for the agentcore-harness generator, mirroring schema.json.
@@ -3,7 +3,7 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { type Tree } from '@nx/devkit';
6
- import { type ComponentMetadata } from '../utils/nx';
6
+ import { type ComponentMetadata } from '../utils/nx.js';
7
7
  export interface AgentLocalDevOptions {
8
8
  agentNameClassName: string;
9
9
  port: number;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/agent-local-dev.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n joinPathFragments,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { applyGritQL } from '../utils/ast';\nimport {\n addDependencyToTargetIfNotPresent,\n type ComponentMetadata,\n readProjectConfigurationUnqualified,\n} from '../utils/nx';\n\nexport interface AgentLocalDevOptions {\n agentNameClassName: string;\n port: number;\n targetComponent?: ComponentMetadata;\n /**\n * The runtime config namespace to set the local URL on.\n * E.g. 'apis' results in `runtimeConfig.apis.X = url`\n */\n runtimeConfigNamespace: string;\n /**\n * The local URL to set in the runtime config override.\n */\n localUrl: string;\n /**\n * Additional targets to add as dev dependencies.\n */\n additionalDependencyTargets?: string[];\n}\n\n/**\n * Adds a Strands Agent's component dev target as a dependency of the\n * source project's dev target, and updates the RuntimeConfig provider\n * to point to the agent's local URL.\n *\n * This is the shared implementation used by both Python and TypeScript Strands\n * Agent react-connection generators.\n */\nexport const addAgentTargetToLocalDev = async (\n tree: Tree,\n sourceProjectName: string,\n targetProjectName: string,\n options: AgentLocalDevOptions,\n) => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n sourceProjectName,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n targetProjectName,\n );\n\n // Determine the dev target name for the agent component\n const agentDevTargetName = options.targetComponent?.name\n ? `${options.targetComponent.name}-dev`\n : 'agent-dev';\n\n // Target project must have the agent dev target which is continuous\n if (\n !(\n targetProject.targets?.[agentDevTargetName]?.continuous &&\n sourceProject.targets?.['dev']\n )\n ) {\n return;\n }\n\n // Add a dependency on the agent dev target (so that the agent's\n // own dev dependencies, such as MCP servers, are also started)\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', {\n projects: [targetProject.name],\n target: agentDevTargetName,\n });\n for (const additional of options.additionalDependencyTargets ?? []) {\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', additional);\n }\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n\n await addLocalDevRuntimeConfigOverride(tree, sourceProject, {\n statement: `runtimeConfig.${options.runtimeConfigNamespace}.${options.agentNameClassName} = '${options.localUrl}';`,\n marker: `runtimeConfig.${options.runtimeConfigNamespace}.${options.agentNameClassName}`,\n });\n};\n\nexport interface GatewayLocalDevOptions {\n gatewayClassName: string;\n /** Local port the gateway project's dev target listens on. */\n port: number;\n /**\n * Additional targets to add as dev dependencies.\n */\n additionalDependencyTargets?: string[];\n}\n\n/**\n * Adds an AgentCore Gateway project's dev target as a dependency of the\n * source project's dev target (transitively starting the gateway's attached\n * agents), and updates the RuntimeConfig provider to point the gateway's\n * runtime config entry at the local gateway.\n */\nexport const addGatewayTargetToLocalDev = async (\n tree: Tree,\n sourceProjectName: string,\n gatewayProjectName: string,\n options: GatewayLocalDevOptions,\n) => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n sourceProjectName,\n );\n const gatewayProject = readProjectConfigurationUnqualified(\n tree,\n gatewayProjectName,\n );\n\n // A gateway is its own standalone project, so it exposes plain dev\n if (\n !(\n gatewayProject.targets?.['dev']?.continuous &&\n sourceProject.targets?.['dev']\n )\n ) {\n return;\n }\n\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', {\n projects: [gatewayProject.name],\n target: 'dev',\n });\n for (const additional of options.additionalDependencyTargets ?? []) {\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', additional);\n }\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n\n // Spread rather than member assignment: the provider's fetch-failure\n // fallback config carries no `gateways` key, so assigning into it would\n // throw and leave the site stuck on the loading spinner. The marker is\n // this gateway's own local URL (its port is unique per gateway and stable\n // across re-runs), not the shared `gateways` key, so a website connected to\n // several gateways gets one override statement per gateway.\n await addLocalDevRuntimeConfigOverride(tree, sourceProject, {\n statement: `runtimeConfig.gateways = { ...runtimeConfig.gateways, ${options.gatewayClassName}: 'http://localhost:${options.port}' };`,\n marker: `'http://localhost:${options.port}'`,\n });\n};\n\n/**\n * Add an override statement to the source project's RuntimeConfig provider so\n * the dev target uses local urls. `marker` guards idempotency: the statement\n * is only inserted when the overrides don't already contain it. Idempotent.\n */\nconst addLocalDevRuntimeConfigOverride = async (\n tree: Tree,\n sourceProject: { root: string },\n options: { statement: string; marker: string },\n) => {\n const runtimeConfigProvider = joinPathFragments(\n sourceProject.root,\n 'src',\n 'components',\n 'RuntimeConfig',\n 'index.tsx',\n );\n if (tree.exists(runtimeConfigProvider)) {\n await applyGritQL(\n tree,\n runtimeConfigProvider,\n `\\`if ($cond) { $stmts }\\` => raw\\`if ($cond) {\\n $stmts\\n ${options.statement}\\n }\\` where { $cond <: contains \\`'local-dev'\\`, $stmts <: within \\`const applyOverrides = $_\\`, $stmts <: not contains \\`${options.marker}\\` }`,\n );\n }\n};\n"],"names":["joinPathFragments","updateProjectConfiguration","applyGritQL","addDependencyToTargetIfNotPresent","readProjectConfigurationUnqualified","addAgentTargetToLocalDev","tree","sourceProjectName","targetProjectName","options","sourceProject","targetProject","agentDevTargetName","targetComponent","name","targets","continuous","projects","target","additional","additionalDependencyTargets","addLocalDevRuntimeConfigOverride","statement","runtimeConfigNamespace","agentNameClassName","localUrl","marker","addGatewayTargetToLocalDev","gatewayProjectName","gatewayProject","gatewayClassName","port","runtimeConfigProvider","root","exists"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,WAAW,QAAQ,kBAAe;AAC3C,SACEC,iCAAiC,EAEjCC,mCAAmC,QAC9B,iBAAc;AAqBrB;;;;;;;CAOC,GACD,OAAO,MAAMC,2BAA2B,OACtCC,MACAC,mBACAC,mBACAC;IAEA,MAAMC,gBAAgBN,oCACpBE,MACAC;IAEF,MAAMI,gBAAgBP,oCACpBE,MACAE;IAGF,wDAAwD;IACxD,MAAMI,qBAAqBH,QAAQI,eAAe,EAAEC,OAChD,GAAGL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AMI,cAAcI,IAAI,EAAEJ;IAErD,qEAAqE;IACrE,wEAAwE;IACxE,uEAAuE;IACvE,0EAA0E;IAC1E,4EAA4E;IAC5E,4DAA4D;IAC5D,MAAMW,iCAAiCf,MAAMI,eAAe;QAC1DY,WAAW,CAAC,sDAAsD,EAAEb,QAAQqB,gBAAgB,CAAC,oBAAoB,EAAErB,QAAQsB,IAAI,CAAC,IAAI,CAAC;QACrIL,QAAQ,CAAC,kBAAkB,EAAEjB,QAAQsB,IAAI,CAAC,CAAC,CAAC;IAC9C;AACF,EAAE;AAEF;;;;CAIC,GACD,MAAMV,mCAAmC,OACvCf,MACAI,eACAD;IAEA,MAAMuB,wBAAwBhC,kBAC5BU,cAAcuB,IAAI,EAClB,OACA,cACA,iBACA;IAEF,IAAI3B,KAAK4B,MAAM,CAACF,wBAAwB;QACtC,MAAM9B,YACJI,MACA0B,uBACA,CAAC,gEAAgE,EAAEvB,QAAQa,SAAS,CAAC,4HAA4H,EAAEb,QAAQiB,MAAM,CAAC,IAAI,CAAC;IAE3O;AACF"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/agent-local-dev.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n joinPathFragments,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { applyGritQL } from '../utils/ast.js';\nimport {\n addDependencyToTargetIfNotPresent,\n type ComponentMetadata,\n readProjectConfigurationUnqualified,\n} from '../utils/nx.js';\n\nexport interface AgentLocalDevOptions {\n agentNameClassName: string;\n port: number;\n targetComponent?: ComponentMetadata;\n /**\n * The runtime config namespace to set the local URL on.\n * E.g. 'apis' results in `runtimeConfig.apis.X = url`\n */\n runtimeConfigNamespace: string;\n /**\n * The local URL to set in the runtime config override.\n */\n localUrl: string;\n /**\n * Additional targets to add as dev dependencies.\n */\n additionalDependencyTargets?: string[];\n}\n\n/**\n * Adds a Strands Agent's component dev target as a dependency of the\n * source project's dev target, and updates the RuntimeConfig provider\n * to point to the agent's local URL.\n *\n * This is the shared implementation used by both Python and TypeScript Strands\n * Agent react-connection generators.\n */\nexport const addAgentTargetToLocalDev = async (\n tree: Tree,\n sourceProjectName: string,\n targetProjectName: string,\n options: AgentLocalDevOptions,\n) => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n sourceProjectName,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n targetProjectName,\n );\n\n // Determine the dev target name for the agent component\n const agentDevTargetName = options.targetComponent?.name\n ? `${options.targetComponent.name}-dev`\n : 'agent-dev';\n\n // Target project must have the agent dev target which is continuous\n if (\n !(\n targetProject.targets?.[agentDevTargetName]?.continuous &&\n sourceProject.targets?.['dev']\n )\n ) {\n return;\n }\n\n // Add a dependency on the agent dev target (so that the agent's\n // own dev dependencies, such as MCP servers, are also started)\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', {\n projects: [targetProject.name],\n target: agentDevTargetName,\n });\n for (const additional of options.additionalDependencyTargets ?? []) {\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', additional);\n }\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n\n await addLocalDevRuntimeConfigOverride(tree, sourceProject, {\n statement: `runtimeConfig.${options.runtimeConfigNamespace}.${options.agentNameClassName} = '${options.localUrl}';`,\n marker: `runtimeConfig.${options.runtimeConfigNamespace}.${options.agentNameClassName}`,\n });\n};\n\nexport interface GatewayLocalDevOptions {\n gatewayClassName: string;\n /** Local port the gateway project's dev target listens on. */\n port: number;\n /**\n * Additional targets to add as dev dependencies.\n */\n additionalDependencyTargets?: string[];\n}\n\n/**\n * Adds an AgentCore Gateway project's dev target as a dependency of the\n * source project's dev target (transitively starting the gateway's attached\n * agents), and updates the RuntimeConfig provider to point the gateway's\n * runtime config entry at the local gateway.\n */\nexport const addGatewayTargetToLocalDev = async (\n tree: Tree,\n sourceProjectName: string,\n gatewayProjectName: string,\n options: GatewayLocalDevOptions,\n) => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n sourceProjectName,\n );\n const gatewayProject = readProjectConfigurationUnqualified(\n tree,\n gatewayProjectName,\n );\n\n // A gateway is its own standalone project, so it exposes plain dev\n if (\n !(\n gatewayProject.targets?.['dev']?.continuous &&\n sourceProject.targets?.['dev']\n )\n ) {\n return;\n }\n\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', {\n projects: [gatewayProject.name],\n target: 'dev',\n });\n for (const additional of options.additionalDependencyTargets ?? []) {\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', additional);\n }\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n\n // Spread rather than member assignment: the provider's fetch-failure\n // fallback config carries no `gateways` key, so assigning into it would\n // throw and leave the site stuck on the loading spinner. The marker is\n // this gateway's own local URL (its port is unique per gateway and stable\n // across re-runs), not the shared `gateways` key, so a website connected to\n // several gateways gets one override statement per gateway.\n await addLocalDevRuntimeConfigOverride(tree, sourceProject, {\n statement: `runtimeConfig.gateways = { ...runtimeConfig.gateways, ${options.gatewayClassName}: 'http://localhost:${options.port}' };`,\n marker: `'http://localhost:${options.port}'`,\n });\n};\n\n/**\n * Add an override statement to the source project's RuntimeConfig provider so\n * the dev target uses local urls. `marker` guards idempotency: the statement\n * is only inserted when the overrides don't already contain it. Idempotent.\n */\nconst addLocalDevRuntimeConfigOverride = async (\n tree: Tree,\n sourceProject: { root: string },\n options: { statement: string; marker: string },\n) => {\n const runtimeConfigProvider = joinPathFragments(\n sourceProject.root,\n 'src',\n 'components',\n 'RuntimeConfig',\n 'index.tsx',\n );\n if (tree.exists(runtimeConfigProvider)) {\n await applyGritQL(\n tree,\n runtimeConfigProvider,\n `\\`if ($cond) { $stmts }\\` => raw\\`if ($cond) {\\n $stmts\\n ${options.statement}\\n }\\` where { $cond <: contains \\`'local-dev'\\`, $stmts <: within \\`const applyOverrides = $_\\`, $stmts <: not contains \\`${options.marker}\\` }`,\n );\n }\n};\n"],"names":["joinPathFragments","updateProjectConfiguration","applyGritQL","addDependencyToTargetIfNotPresent","readProjectConfigurationUnqualified","addAgentTargetToLocalDev","tree","sourceProjectName","targetProjectName","options","sourceProject","targetProject","agentDevTargetName","targetComponent","name","targets","continuous","projects","target","additional","additionalDependencyTargets","addLocalDevRuntimeConfigOverride","statement","runtimeConfigNamespace","agentNameClassName","localUrl","marker","addGatewayTargetToLocalDev","gatewayProjectName","gatewayProject","gatewayClassName","port","runtimeConfigProvider","root","exists"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SACEC,iCAAiC,EAEjCC,mCAAmC,QAC9B,iBAAiB;AAqBxB;;;;;;;CAOC,GACD,OAAO,MAAMC,2BAA2B,OACtCC,MACAC,mBACAC,mBACAC;IAEA,MAAMC,gBAAgBN,oCACpBE,MACAC;IAEF,MAAMI,gBAAgBP,oCACpBE,MACAE;IAGF,wDAAwD;IACxD,MAAMI,qBAAqBH,QAAQI,eAAe,EAAEC,OAChD,GAAGL,QAAQI,eAAe,CAACC,IAAI,CAAC,IAAI,CAAC,GACrC;IAEJ,oEAAoE;IACpE,IACE,CACEH,CAAAA,cAAcI,OAAO,EAAE,CAACH,mBAAmB,EAAEI,cAC7CN,cAAcK,OAAO,EAAE,CAAC,MAAM,AAAD,GAE/B;QACA;IACF;IAEA,gEAAgE;IAChE,+DAA+D;IAC/DZ,kCAAkCO,eAAe,OAAO;QACtDO,UAAU;YAACN,cAAcG,IAAI;SAAC;QAC9BI,QAAQN;IACV;IACA,KAAK,MAAMO,cAAcV,QAAQW,2BAA2B,IAAI,EAAE,CAAE;QAClEjB,kCAAkCO,eAAe,OAAOS;IAC1D;IACAlB,2BAA2BK,MAAMI,cAAcI,IAAI,EAAEJ;IAErD,MAAMW,iCAAiCf,MAAMI,eAAe;QAC1DY,WAAW,CAAC,cAAc,EAAEb,QAAQc,sBAAsB,CAAC,CAAC,EAA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gEAAgE,EAAEvB,QAAQa,SAAS,CAAC,4HAA4H,EAAEb,QAAQiB,MAAM,CAAC,IAAI,CAAC;IAE3O;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/agent-runtime-config.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { joinPathFragments, type Tree } from '@nx/devkit';\nimport { applyGritQL, matchGritQL } from '../utils/ast';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_TERRAFORM_DIR,\n} from '../utils/shared-constructs-constants';\n\nconst CONNECTION_TF_MODULE_NAME =\n 'add_agent_runtime_to_connection_runtime_config';\n\n/**\n * Register the agent's runtime ARN in the 'connection' namespace so it is\n * published to the website's runtime-config.json. Patches the generated CDK\n * and Terraform constructs in-place; idempotent.\n *\n * Note: the 'connection' namespace is stage-scoped — every StaticWebsite in\n * the stage will see this ARN, not just the one the user connected.\n */\nexport const addAgentRuntimeToConnectionNamespace = async (\n tree: Tree,\n options: {\n /** The kebab-case directory name that holds the construct, e.g. 'story-agent'. */\n agentNameKebabCase: string;\n /** The class name of the agent, e.g. 'StoryAgent'. */\n agentNameClassName: string;\n },\n) => {\n const cdkConstructPath = joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'agents',\n options.agentNameKebabCase,\n `${options.agentNameKebabCase}.ts`,\n );\n if (tree.exists(cdkConstructPath)) {\n await applyGritQL(\n tree,\n cdkConstructPath,\n `\\`rc.set('agentcore', 'agentRuntimes', $args);\\` => raw\\`rc.set('agentcore', 'agentRuntimes', $args);\n\n rc.set('connection', 'agentRuntimes', {\n ...rc.get('connection').agentRuntimes,\n ${options.agentNameClassName}: this.agentCoreRuntime.agentRuntimeArn,\n });\\` where { $program <: not contains \\`rc.set('connection', 'agentRuntimes', $_)\\` }`,\n );\n }\n\n const terraformConstructPath = joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'app',\n 'agents',\n options.agentNameKebabCase,\n `${options.agentNameKebabCase}.tf`,\n );\n if (tree.exists(terraformConstructPath)) {\n const alreadyPatched = await matchGritQL(\n tree,\n terraformConstructPath,\n `language hcl\\n\\`module \"${CONNECTION_TF_MODULE_NAME}\" { $_ }\\``,\n );\n if (!alreadyPatched) {\n const source = tree.read(terraformConstructPath, 'utf-8')!;\n tree.write(\n terraformConstructPath,\n `${source.trimEnd()}\n\n# Also expose the agent runtime ARN to the frontend via the 'connection' namespace\nmodule \"${CONNECTION_TF_MODULE_NAME}\" {\n source = \"../../../core/runtime-config/entry\"\n\n namespace = \"connection\"\n key = \"agentRuntimes\"\n value = { \"${options.agentNameClassName}\" = module.agent_core_runtime.agent_core_runtime_arn }\n\n depends_on = [module.agent_core_runtime]\n}\n`,\n );\n }\n }\n};\n"],"names":["joinPathFragments","applyGritQL","matchGritQL","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","SHARED_TERRAFORM_DIR","CONNECTION_TF_MODULE_NAME","addAgentRuntimeToConnectionNamespace","tree","options","cdkConstructPath","agentNameKebabCase","exists","agentNameClassName","terraformConstructPath","alreadyPatched","source","read","write","trimEnd"],"mappings":"AAAA;;;CAGC,GACD,SAASA,iBAAiB,QAAmB,aAAa;AAC1D,SAASC,WAAW,EAAEC,WAAW,QAAQ,kBAAe;AACxD,SACEC,YAAY,EACZC,qBAAqB,EACrBC,oBAAoB,QACf,0CAAuC;AAE9C,MAAMC,4BACJ;AAEF;;;;;;;CAOC,GACD,OAAO,MAAMC,uCAAuC,OAClDC,MACAC;IAOA,MAAMC,mBAAmBV,kBACvBG,cACAC,uBACA,OACA,OACA,UACAK,QAAQE,kBAAkB,EAC1B,GAAGF,QAAQE,kBAAkB,CAAC,GAAG,CAAC;IAEpC,IAAIH,KAAKI,MAAM,CAACF,mBAAmB;QACjC,MAAMT,YACJO,MACAE,kBACA,CAAC;;;;MAID,EAAED,QAAQI,kBAAkB,CAAC;0FACuD,CAAC;IAEzF;IAEA,MAAMC,yBAAyBd,kBAC7BG,cACAE,sBACA,OACA,OACA,UACAI,QAAQE,kBAAkB,EAC1B,GAAGF,QAAQE,kBAAkB,CAAC,GAAG,CAAC;IAEpC,IAAIH,KAAKI,MAAM,CAACE,yBAAyB;QACvC,MAAMC,iBAAiB,MAAMb,YAC3BM,MACAM,wBACA,CAAC,wBAAwB,EAAER,0BAA0B,UAAU,CAAC;QAElE,IAAI,CAACS,gBAAgB;YACnB,MAAMC,SAASR,KAAKS,IAAI,CAACH,wBAAwB;YACjDN,KAAKU,KAAK,CACRJ,wBACA,GAAGE,OAAOG,OAAO,GAAG;;;QAGpB,EAAEb,0BAA0B;;;;;iBAKnB,EAAEG,QAAQI,kBAAkB,CAAC;;;;AAI9C,CAAC;QAEG;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/agent-runtime-config.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { joinPathFragments, type Tree } from '@nx/devkit';\nimport { applyGritQL, matchGritQL } from '../utils/ast.js';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_TERRAFORM_DIR,\n} from '../utils/shared-constructs-constants.js';\n\nconst CONNECTION_TF_MODULE_NAME =\n 'add_agent_runtime_to_connection_runtime_config';\n\n/**\n * Register the agent's runtime ARN in the 'connection' namespace so it is\n * published to the website's runtime-config.json. Patches the generated CDK\n * and Terraform constructs in-place; idempotent.\n *\n * Note: the 'connection' namespace is stage-scoped — every StaticWebsite in\n * the stage will see this ARN, not just the one the user connected.\n */\nexport const addAgentRuntimeToConnectionNamespace = async (\n tree: Tree,\n options: {\n /** The kebab-case directory name that holds the construct, e.g. 'story-agent'. */\n agentNameKebabCase: string;\n /** The class name of the agent, e.g. 'StoryAgent'. */\n agentNameClassName: string;\n },\n) => {\n const cdkConstructPath = joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'agents',\n options.agentNameKebabCase,\n `${options.agentNameKebabCase}.ts`,\n );\n if (tree.exists(cdkConstructPath)) {\n await applyGritQL(\n tree,\n cdkConstructPath,\n `\\`rc.set('agentcore', 'agentRuntimes', $args);\\` => raw\\`rc.set('agentcore', 'agentRuntimes', $args);\n\n rc.set('connection', 'agentRuntimes', {\n ...rc.get('connection').agentRuntimes,\n ${options.agentNameClassName}: this.agentCoreRuntime.agentRuntimeArn,\n });\\` where { $program <: not contains \\`rc.set('connection', 'agentRuntimes', $_)\\` }`,\n );\n }\n\n const terraformConstructPath = joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'app',\n 'agents',\n options.agentNameKebabCase,\n `${options.agentNameKebabCase}.tf`,\n );\n if (tree.exists(terraformConstructPath)) {\n const alreadyPatched = await matchGritQL(\n tree,\n terraformConstructPath,\n `language hcl\\n\\`module \"${CONNECTION_TF_MODULE_NAME}\" { $_ }\\``,\n );\n if (!alreadyPatched) {\n const source = tree.read(terraformConstructPath, 'utf-8')!;\n tree.write(\n terraformConstructPath,\n `${source.trimEnd()}\n\n# Also expose the agent runtime ARN to the frontend via the 'connection' namespace\nmodule \"${CONNECTION_TF_MODULE_NAME}\" {\n source = \"../../../core/runtime-config/entry\"\n\n namespace = \"connection\"\n key = \"agentRuntimes\"\n value = { \"${options.agentNameClassName}\" = module.agent_core_runtime.agent_core_runtime_arn }\n\n depends_on = [module.agent_core_runtime]\n}\n`,\n );\n }\n }\n};\n"],"names":["joinPathFragments","applyGritQL","matchGritQL","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","SHARED_TERRAFORM_DIR","CONNECTION_TF_MODULE_NAME","addAgentRuntimeToConnectionNamespace","tree","options","cdkConstructPath","agentNameKebabCase","exists","agentNameClassName","terraformConstructPath","alreadyPatched","source","read","write","trimEnd"],"mappings":"AAAA;;;CAGC,GACD,SAASA,iBAAiB,QAAmB,aAAa;AAC1D,SAASC,WAAW,EAAEC,WAAW,QAAQ,kBAAkB;AAC3D,SACEC,YAAY,EACZC,qBAAqB,EACrBC,oBAAoB,QACf,0CAA0C;AAEjD,MAAMC,4BACJ;AAEF;;;;;;;CAOC,GACD,OAAO,MAAMC,uCAAuC,OAClDC,MACAC;IAOA,MAAMC,mBAAmBV,kBACvBG,cACAC,uBACA,OACA,OACA,UACAK,QAAQE,kBAAkB,EAC1B,GAAGF,QAAQE,kBAAkB,CAAC,GAAG,CAAC;IAEpC,IAAIH,KAAKI,MAAM,CAACF,mBAAmB;QACjC,MAAMT,YACJO,MACAE,kBACA,CAAC;;;;MAID,EAAED,QAAQI,kBAAkB,CAAC;0FACuD,CAAC;IAEzF;IAEA,MAAMC,yBAAyBd,kBAC7BG,cACAE,sBACA,OACA,OACA,UACAI,QAAQE,kBAAkB,EAC1B,GAAGF,QAAQE,kBAAkB,CAAC,GAAG,CAAC;IAEpC,IAAIH,KAAKI,MAAM,CAACE,yBAAyB;QACvC,MAAMC,iBAAiB,MAAMb,YAC3BM,MACAM,wBACA,CAAC,wBAAwB,EAAER,0BAA0B,UAAU,CAAC;QAElE,IAAI,CAACS,gBAAgB;YACnB,MAAMC,SAASR,KAAKS,IAAI,CAACH,wBAAwB;YACjDN,KAAKU,KAAK,CACRJ,wBACA,GAAGE,OAAOG,OAAO,GAAG;;;QAGpB,EAAEb,0BAA0B;;;;;iBAKnB,EAAEG,QAAQI,kBAAkB,CAAC;;;;AAI9C,CAAC;QAEG;IACF;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/gateway-runtime-config.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { joinPathFragments, type Tree } from '@nx/devkit';\nimport { applyGritQL, matchGritQL } from '../utils/ast';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_TERRAFORM_DIR,\n} from '../utils/shared-constructs-constants';\n\nconst CONNECTION_TF_MODULE_NAME =\n 'add_gateway_url_to_connection_runtime_config';\n\n/**\n * Register the gateway's URL in the 'connection' namespace so it is published\n * to the website's runtime-config.json. Patches the generated CDK and\n * Terraform constructs in-place; idempotent.\n *\n * Note: the 'connection' namespace is stage-scoped — every StaticWebsite in\n * the stage will see this URL, not just the one the user connected.\n */\nexport const addGatewayUrlToConnectionNamespace = async (\n tree: Tree,\n options: {\n /** The kebab-case directory name that holds the construct, e.g. 'my-gateway'. */\n gatewayNameKebabCase: string;\n /** The class name of the gateway, e.g. 'MyGateway'. */\n gatewayNameClassName: string;\n },\n) => {\n const cdkConstructPath = joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'gateways',\n options.gatewayNameKebabCase,\n `${options.gatewayNameKebabCase}.ts`,\n );\n if (tree.exists(cdkConstructPath)) {\n await applyGritQL(\n tree,\n cdkConstructPath,\n `\\`rc.set('agentcore', 'gateways', $args);\\` => raw\\`rc.set('agentcore', 'gateways', $args);\n\n rc.set('connection', 'gateways', {\n ...rc.get('connection').gateways,\n ${options.gatewayNameClassName}: this.gateway.gatewayUrl,\n });\\` where { $program <: not contains \\`rc.set('connection', 'gateways', $_)\\` }`,\n );\n }\n\n const terraformConstructPath = joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'app',\n 'gateways',\n options.gatewayNameKebabCase,\n `${options.gatewayNameKebabCase}.tf`,\n );\n if (tree.exists(terraformConstructPath)) {\n const alreadyPatched = await matchGritQL(\n tree,\n terraformConstructPath,\n `language hcl\\n\\`module \"${CONNECTION_TF_MODULE_NAME}\" { $_ }\\``,\n );\n if (!alreadyPatched) {\n const source = tree.read(terraformConstructPath, 'utf-8')!;\n tree.write(\n terraformConstructPath,\n `${source.trimEnd()}\n\n# Also expose the gateway URL to the frontend via the 'connection' namespace\nmodule \"${CONNECTION_TF_MODULE_NAME}\" {\n source = \"../../../core/runtime-config/entry\"\n\n namespace = \"connection\"\n key = \"gateways\"\n value = { \"${options.gatewayNameClassName}\" = aws_bedrockagentcore_gateway.this.gateway_url }\n\n depends_on = [aws_bedrockagentcore_gateway.this]\n}\n`,\n );\n }\n }\n};\n"],"names":["joinPathFragments","applyGritQL","matchGritQL","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","SHARED_TERRAFORM_DIR","CONNECTION_TF_MODULE_NAME","addGatewayUrlToConnectionNamespace","tree","options","cdkConstructPath","gatewayNameKebabCase","exists","gatewayNameClassName","terraformConstructPath","alreadyPatched","source","read","write","trimEnd"],"mappings":"AAAA;;;CAGC,GACD,SAASA,iBAAiB,QAAmB,aAAa;AAC1D,SAASC,WAAW,EAAEC,WAAW,QAAQ,kBAAe;AACxD,SACEC,YAAY,EACZC,qBAAqB,EACrBC,oBAAoB,QACf,0CAAuC;AAE9C,MAAMC,4BACJ;AAEF;;;;;;;CAOC,GACD,OAAO,MAAMC,qCAAqC,OAChDC,MACAC;IAOA,MAAMC,mBAAmBV,kBACvBG,cACAC,uBACA,OACA,OACA,YACAK,QAAQE,oBAAoB,EAC5B,GAAGF,QAAQE,oBAAoB,CAAC,GAAG,CAAC;IAEtC,IAAIH,KAAKI,MAAM,CAACF,mBAAmB;QACjC,MAAMT,YACJO,MACAE,kBACA,CAAC;;;;MAID,EAAED,QAAQI,oBAAoB,CAAC;qFACgD,CAAC;IAEpF;IAEA,MAAMC,yBAAyBd,kBAC7BG,cACAE,sBACA,OACA,OACA,YACAI,QAAQE,oBAAoB,EAC5B,GAAGF,QAAQE,oBAAoB,CAAC,GAAG,CAAC;IAEtC,IAAIH,KAAKI,MAAM,CAACE,yBAAyB;QACvC,MAAMC,iBAAiB,MAAMb,YAC3BM,MACAM,wBACA,CAAC,wBAAwB,EAAER,0BAA0B,UAAU,CAAC;QAElE,IAAI,CAACS,gBAAgB;YACnB,MAAMC,SAASR,KAAKS,IAAI,CAACH,wBAAwB;YACjDN,KAAKU,KAAK,CACRJ,wBACA,GAAGE,OAAOG,OAAO,GAAG;;;QAGpB,EAAEb,0BAA0B;;;;;iBAKnB,EAAEG,QAAQI,oBAAoB,CAAC;;;;AAIhD,CAAC;QAEG;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/gateway-runtime-config.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { joinPathFragments, type Tree } from '@nx/devkit';\nimport { applyGritQL, matchGritQL } from '../utils/ast.js';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_TERRAFORM_DIR,\n} from '../utils/shared-constructs-constants.js';\n\nconst CONNECTION_TF_MODULE_NAME =\n 'add_gateway_url_to_connection_runtime_config';\n\n/**\n * Register the gateway's URL in the 'connection' namespace so it is published\n * to the website's runtime-config.json. Patches the generated CDK and\n * Terraform constructs in-place; idempotent.\n *\n * Note: the 'connection' namespace is stage-scoped — every StaticWebsite in\n * the stage will see this URL, not just the one the user connected.\n */\nexport const addGatewayUrlToConnectionNamespace = async (\n tree: Tree,\n options: {\n /** The kebab-case directory name that holds the construct, e.g. 'my-gateway'. */\n gatewayNameKebabCase: string;\n /** The class name of the gateway, e.g. 'MyGateway'. */\n gatewayNameClassName: string;\n },\n) => {\n const cdkConstructPath = joinPathFragments(\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n 'src',\n 'app',\n 'gateways',\n options.gatewayNameKebabCase,\n `${options.gatewayNameKebabCase}.ts`,\n );\n if (tree.exists(cdkConstructPath)) {\n await applyGritQL(\n tree,\n cdkConstructPath,\n `\\`rc.set('agentcore', 'gateways', $args);\\` => raw\\`rc.set('agentcore', 'gateways', $args);\n\n rc.set('connection', 'gateways', {\n ...rc.get('connection').gateways,\n ${options.gatewayNameClassName}: this.gateway.gatewayUrl,\n });\\` where { $program <: not contains \\`rc.set('connection', 'gateways', $_)\\` }`,\n );\n }\n\n const terraformConstructPath = joinPathFragments(\n PACKAGES_DIR,\n SHARED_TERRAFORM_DIR,\n 'src',\n 'app',\n 'gateways',\n options.gatewayNameKebabCase,\n `${options.gatewayNameKebabCase}.tf`,\n );\n if (tree.exists(terraformConstructPath)) {\n const alreadyPatched = await matchGritQL(\n tree,\n terraformConstructPath,\n `language hcl\\n\\`module \"${CONNECTION_TF_MODULE_NAME}\" { $_ }\\``,\n );\n if (!alreadyPatched) {\n const source = tree.read(terraformConstructPath, 'utf-8')!;\n tree.write(\n terraformConstructPath,\n `${source.trimEnd()}\n\n# Also expose the gateway URL to the frontend via the 'connection' namespace\nmodule \"${CONNECTION_TF_MODULE_NAME}\" {\n source = \"../../../core/runtime-config/entry\"\n\n namespace = \"connection\"\n key = \"gateways\"\n value = { \"${options.gatewayNameClassName}\" = aws_bedrockagentcore_gateway.this.gateway_url }\n\n depends_on = [aws_bedrockagentcore_gateway.this]\n}\n`,\n );\n }\n }\n};\n"],"names":["joinPathFragments","applyGritQL","matchGritQL","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","SHARED_TERRAFORM_DIR","CONNECTION_TF_MODULE_NAME","addGatewayUrlToConnectionNamespace","tree","options","cdkConstructPath","gatewayNameKebabCase","exists","gatewayNameClassName","terraformConstructPath","alreadyPatched","source","read","write","trimEnd"],"mappings":"AAAA;;;CAGC,GACD,SAASA,iBAAiB,QAAmB,aAAa;AAC1D,SAASC,WAAW,EAAEC,WAAW,QAAQ,kBAAkB;AAC3D,SACEC,YAAY,EACZC,qBAAqB,EACrBC,oBAAoB,QACf,0CAA0C;AAEjD,MAAMC,4BACJ;AAEF;;;;;;;CAOC,GACD,OAAO,MAAMC,qCAAqC,OAChDC,MACAC;IAOA,MAAMC,mBAAmBV,kBACvBG,cACAC,uBACA,OACA,OACA,YACAK,QAAQE,oBAAoB,EAC5B,GAAGF,QAAQE,oBAAoB,CAAC,GAAG,CAAC;IAEtC,IAAIH,KAAKI,MAAM,CAACF,mBAAmB;QACjC,MAAMT,YACJO,MACAE,kBACA,CAAC;;;;MAID,EAAED,QAAQI,oBAAoB,CAAC;qFACgD,CAAC;IAEpF;IAEA,MAAMC,yBAAyBd,kBAC7BG,cACAE,sBACA,OACA,OACA,YACAI,QAAQE,oBAAoB,EAC5B,GAAGF,QAAQE,oBAAoB,CAAC,GAAG,CAAC;IAEtC,IAAIH,KAAKI,MAAM,CAACE,yBAAyB;QACvC,MAAMC,iBAAiB,MAAMb,YAC3BM,MACAM,wBACA,CAAC,wBAAwB,EAAER,0BAA0B,UAAU,CAAC;QAElE,IAAI,CAACS,gBAAgB;YACnB,MAAMC,SAASR,KAAKS,IAAI,CAACH,wBAAwB;YACjDN,KAAKU,KAAK,CACRJ,wBACA,GAAGE,OAAOG,OAAO,GAAG;;;QAGpB,EAAEb,0BAA0B;;;;;iBAKnB,EAAEG,QAAQI,oBAAoB,CAAC;;;;AAIhD,CAAC;QAEG;IACF;AACF,EAAE"}
@@ -3,9 +3,9 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { type ProjectConfiguration, type Tree } from '@nx/devkit';
6
- import { type ComponentMetadata } from '../utils/nx';
6
+ import { type ComponentMetadata } from '../utils/nx.js';
7
7
  import type { ConnectionGeneratorSchema } from './schema';
8
- import { type Connection, type SUPPORTED_PROJECT_TYPES } from './supported-connections';
8
+ import { type Connection, type SUPPORTED_PROJECT_TYPES } from './supported-connections.js';
9
9
  export type { Connection };
10
10
  type ProjectType = (typeof SUPPORTED_PROJECT_TYPES)[number];
11
11
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n joinPathFragments,\n type ProjectConfiguration,\n type Tree,\n} from '@nx/devkit';\nimport agentcoreGatewayAgentConnectionGenerator from '../agentcore-gateway/agent-connection/generator';\nimport agentcoreGatewayGatewayConnectionGenerator from '../agentcore-gateway/gateway-connection/generator';\nimport { AGENTCORE_GATEWAY_GENERATOR_INFO } from '../agentcore-gateway/generator';\nimport agentcoreGatewayMcpConnectionGenerator from '../agentcore-gateway/mcp-connection/generator';\nimport agentcoreGatewayReactConnectionGenerator from '../agentcore-gateway/react-connection/generator';\nimport pyAgentA2aConnectionGenerator from '../py/agent/a2a-connection/generator';\nimport pyAgentGatewayConnectionGenerator from '../py/agent/gateway-connection/generator';\nimport pyAgentMcpConnectionGenerator from '../py/agent/mcp-connection/generator';\nimport pyAgentReactConnectionGenerator from '../py/agent/react-connection/generator';\nimport pyDynamoDBAgentConnectionGenerator from '../py/dynamodb/agent-connection/generator';\nimport pyDynamoDBFastApiConnectionGenerator from '../py/dynamodb/fast-api-connection/generator';\nimport { PY_DYNAMODB_GENERATOR_INFO } from '../py/dynamodb/generator';\nimport pyDynamoDBMcpServerConnectionGenerator from '../py/dynamodb/mcp-server-connection/generator';\nimport fastApiReactGenerator from '../py/fast-api/react/generator';\nimport pyRdbAgentConnectionGenerator from '../py/rdb/agent-connection/generator';\nimport pyRdbFastApiConnectionGenerator from '../py/rdb/fast-api-connection/generator';\nimport { PY_RDB_GENERATOR_INFO } from '../py/rdb/generator';\nimport pyRdbMcpServerConnectionGenerator from '../py/rdb/mcp-server-connection/generator';\nimport { SMITHY_PROJECT_GENERATOR_INFO } from '../smithy/project/generator';\nimport smithyReactConnectionGenerator from '../smithy/react-connection/generator';\nimport { TS_SMITHY_API_GENERATOR_INFO } from '../smithy/ts/api/generator';\nimport trpcReactGenerator from '../trpc/react/generator';\nimport tsAgentA2aConnectionGenerator from '../ts/agent/a2a-connection/generator';\nimport tsAgentGatewayConnectionGenerator from '../ts/agent/gateway-connection/generator';\nimport tsAgentMcpConnectionGenerator from '../ts/agent/mcp-connection/generator';\nimport tsAgentReactConnectionGenerator from '../ts/agent/react-connection/generator';\nimport tsDynamoDBAgentConnectionGenerator from '../ts/dynamodb/agent-connection/generator';\nimport { TS_DYNAMODB_GENERATOR_INFO } from '../ts/dynamodb/generator';\nimport tsDynamoDBMcpServerConnectionGenerator from '../ts/dynamodb/mcp-server-connection/generator';\nimport tsDynamoDBSmithyConnectionGenerator from '../ts/dynamodb/smithy-connection/generator';\nimport tsDynamoDBTrpcConnectionGenerator from '../ts/dynamodb/trpc-connection/generator';\nimport tsRdbAgentConnectionGenerator from '../ts/rdb/agent-connection/generator';\nimport { TS_RDB_GENERATOR_INFO } from '../ts/rdb/generator';\nimport tsRdbMcpServerConnectionGenerator from '../ts/rdb/mcp-server-connection/generator';\nimport tsRdbSmithyConnectionGenerator from '../ts/rdb/smithy-connection/generator';\nimport tsRdbTrpcConnectionGenerator from '../ts/rdb/trpc-connection/generator';\nimport { hasExportDeclaration } from '../utils/ast';\nimport {\n type ComponentMetadata,\n readProjectConfigurationUnqualified,\n} from '../utils/nx';\nimport { readToml } from '../utils/toml';\nimport type { ConnectionGeneratorSchema } from './schema';\nimport {\n type Connection,\n type ConnectionKey,\n SUPPORTED_CONNECTIONS,\n type SUPPORTED_PROJECT_TYPES,\n} from './supported-connections';\n\nexport type { Connection };\n\ntype ProjectType = (typeof SUPPORTED_PROJECT_TYPES)[number];\n\n/**\n * Sentinel value for sourceComponent/targetComponent that means\n * \"use the project-level connection, not a component\".\n */\nexport const PROJECT_COMPONENT_SENTINEL = '.';\n\n/**\n * The result of resolving a connection, including the matched connection\n * and any resolved source/target component metadata.\n */\nexport interface ResolvedConnection {\n readonly connection: Connection;\n readonly sourceComponent?: ComponentMetadata;\n readonly targetComponent?: ComponentMetadata;\n}\n\n/**\n * Generators for each connection type\n */\n/**\n * Options passed to connection generators, including resolved component metadata.\n */\nexport interface ResolvedConnectionOptions {\n sourceProject: string;\n targetProject: string;\n sourceComponent?: ComponentMetadata;\n targetComponent?: ComponentMetadata;\n preferInstallDependencies?: boolean;\n}\n\nconst CONNECTION_GENERATORS = {\n 'ts#trpc-api -> ts#rdb': (tree, options) =>\n tsRdbTrpcConnectionGenerator(tree, options),\n 'ts#agent -> ts#rdb': (tree, options) =>\n tsRdbAgentConnectionGenerator(tree, options),\n 'ts#smithy-api -> ts#rdb': (tree, options) =>\n tsRdbSmithyConnectionGenerator(tree, options),\n 'ts#mcp-server -> ts#rdb': (tree, options) =>\n tsRdbMcpServerConnectionGenerator(tree, options),\n 'ts#trpc-api -> ts#dynamodb': (tree, options) =>\n tsDynamoDBTrpcConnectionGenerator(tree, options),\n 'ts#agent -> ts#dynamodb': (tree, options) =>\n tsDynamoDBAgentConnectionGenerator(tree, options),\n 'ts#smithy-api -> ts#dynamodb': (tree, options) =>\n tsDynamoDBSmithyConnectionGenerator(tree, options),\n 'ts#mcp-server -> ts#dynamodb': (tree, options) =>\n tsDynamoDBMcpServerConnectionGenerator(tree, options),\n 'ts#react-website -> ts#trpc-api': (tree, options) =>\n trpcReactGenerator(tree, {\n frontendProjectName: options.sourceProject,\n backendProjectName: options.targetProject,\n preferInstallDependencies: options.preferInstallDependencies,\n }),\n 'ts#react-website -> py#fast-api': (tree, options) =>\n fastApiReactGenerator(tree, {\n frontendProjectName: options.sourceProject,\n fastApiProjectName: options.targetProject,\n preferInstallDependencies: options.preferInstallDependencies,\n }),\n 'ts#react-website -> ts#smithy-api': (tree, options) =>\n smithyReactConnectionGenerator(tree, {\n frontendProjectName: options.sourceProject,\n smithyModelOrBackendProjectName: options.targetProject,\n preferInstallDependencies: options.preferInstallDependencies,\n }),\n 'ts#react-website -> ts#agent': (tree, options) =>\n tsAgentReactConnectionGenerator(tree, options),\n 'ts#react-website -> py#agent': (tree, options) =>\n pyAgentReactConnectionGenerator(tree, options),\n 'ts#agent -> ts#mcp-server': (tree, options) =>\n tsAgentMcpConnectionGenerator(tree, options),\n 'ts#agent -> py#mcp-server': (tree, options) =>\n tsAgentMcpConnectionGenerator(tree, options),\n 'py#agent -> ts#mcp-server': (tree, options) =>\n pyAgentMcpConnectionGenerator(tree, options),\n 'py#agent -> py#mcp-server': (tree, options) =>\n pyAgentMcpConnectionGenerator(tree, options),\n 'ts#agent -> ts#agent': (tree, options) =>\n tsAgentA2aConnectionGenerator(tree, options),\n 'ts#agent -> py#agent': (tree, options) =>\n tsAgentA2aConnectionGenerator(tree, options),\n 'py#agent -> ts#agent': (tree, options) =>\n pyAgentA2aConnectionGenerator(tree, options),\n 'py#agent -> py#agent': (tree, options) =>\n pyAgentA2aConnectionGenerator(tree, options),\n 'ts#agent -> agentcore-gateway': (tree, options) =>\n tsAgentGatewayConnectionGenerator(tree, options),\n 'py#agent -> agentcore-gateway': (tree, options) =>\n pyAgentGatewayConnectionGenerator(tree, options),\n 'ts#react-website -> agentcore-gateway': (tree, options) =>\n agentcoreGatewayReactConnectionGenerator(tree, options),\n 'agentcore-gateway -> ts#agent': (tree, options) =>\n agentcoreGatewayAgentConnectionGenerator(tree, options),\n 'agentcore-gateway -> py#agent': (tree, options) =>\n agentcoreGatewayAgentConnectionGenerator(tree, options),\n 'agentcore-gateway -> ts#mcp-server': (tree, options) =>\n agentcoreGatewayMcpConnectionGenerator(tree, options),\n 'agentcore-gateway -> py#mcp-server': (tree, options) =>\n agentcoreGatewayMcpConnectionGenerator(tree, options),\n 'agentcore-gateway -> agentcore-gateway': (tree, options) =>\n agentcoreGatewayGatewayConnectionGenerator(tree, options),\n 'py#fast-api -> py#dynamodb': (tree, options) =>\n pyDynamoDBFastApiConnectionGenerator(tree, options),\n 'py#agent -> py#dynamodb': (tree, options) =>\n pyDynamoDBAgentConnectionGenerator(tree, options),\n 'py#mcp-server -> py#dynamodb': (tree, options) =>\n pyDynamoDBMcpServerConnectionGenerator(tree, options),\n 'py#fast-api -> py#rdb': (tree, options) =>\n pyRdbFastApiConnectionGenerator(tree, options),\n 'py#agent -> py#rdb': (tree, options) =>\n pyRdbAgentConnectionGenerator(tree, options),\n 'py#mcp-server -> py#rdb': (tree, options) =>\n pyRdbMcpServerConnectionGenerator(tree, options),\n} satisfies Record<\n ConnectionKey,\n (tree: Tree, options: ResolvedConnectionOptions) => Promise<any>\n>;\n\n/**\n * Generator for a connection between two projects\n */\nexport const connectionGenerator = async (\n tree: Tree,\n options: ConnectionGeneratorSchema,\n) => {\n const resolved = await resolveConnection(tree, options);\n\n const connectionKey =\n `${resolved.connection.source} -> ${resolved.connection.target}` as ConnectionKey;\n\n return await CONNECTION_GENERATORS[connectionKey](tree, {\n sourceProject: options.sourceProject,\n targetProject: options.targetProject,\n sourceComponent: resolved.sourceComponent,\n targetComponent: resolved.targetComponent,\n preferInstallDependencies: options.preferInstallDependencies,\n });\n};\n\n/**\n * Find a component in project metadata matching the given reference.\n * Checks by name first, then by path, then by generator.\n */\nexport const findComponentInMetadata = (\n projectConfiguration: ProjectConfiguration,\n componentRef: string,\n): ComponentMetadata | undefined => {\n const components: ComponentMetadata[] =\n (projectConfiguration.metadata as any)?.components ?? [];\n\n return (\n components.find((c) => c.name === componentRef) ??\n components.find((c) => c.path === componentRef) ??\n components.find((c) => c.generator === componentRef)\n );\n};\n\n/**\n * Represents a candidate source or target for a connection, which may be\n * the project itself or a specific component within the project.\n */\ninterface ConnectionCandidate {\n readonly type: string;\n readonly component?: ComponentMetadata;\n}\n\n/**\n * A matched connection between source and target candidates.\n */\ninterface ConnectionMatch {\n readonly connection: Connection;\n readonly sourceComponent?: ComponentMetadata;\n readonly targetComponent?: ComponentMetadata;\n}\n\n/**\n * Gather all connection candidates for a project configuration. This includes:\n * - The project-level type (if it's a supported type)\n * - Each component's generator id as a candidate type\n */\nconst gatherCandidates = async (\n tree: Tree,\n projectConfig: ProjectConfiguration,\n): Promise<ConnectionCandidate[]> => {\n const type = await determineProjectTypeFromConfig(tree, projectConfig);\n const components: ComponentMetadata[] =\n (projectConfig.metadata as any)?.components ?? [];\n\n return [\n ...(type ? [{ type: type }] : []),\n ...components.map((component) => ({\n type: component.generator,\n component,\n })),\n ];\n};\n\n/**\n * Validate that a specified component exists in the project metadata.\n * Skips validation for undefined refs and the project sentinel '.'.\n */\nconst validateComponent = (\n componentRef: string | undefined,\n projectConfig: ProjectConfiguration,\n side: 'source' | 'target',\n) => {\n if (!componentRef || componentRef === PROJECT_COMPONENT_SENTINEL) return;\n const found = findComponentInMetadata(projectConfig, componentRef);\n if (!found) {\n const components: ComponentMetadata[] =\n (projectConfig.metadata as any)?.components ?? [];\n throw new Error(\n `Component '${componentRef}' not found in ${side} project ${projectConfig.name}. ` +\n `Available components: ${components.length > 0 ? components.map((c) => c.name ?? c.generator).join(', ') : 'none'}`,\n );\n }\n};\n\n/**\n * Narrow candidates based on the user's specified component reference.\n */\nconst filterConnectionCandidatesForComponentReference = (\n componentRef: string | undefined,\n projectConfig: ProjectConfiguration,\n candidates: ConnectionCandidate[],\n supportedConnections: readonly Connection[],\n side: 'source' | 'target',\n): ConnectionCandidate[] => {\n if (!componentRef) return candidates;\n if (componentRef === PROJECT_COMPONENT_SENTINEL) {\n return candidates.filter((c) => !c.component);\n }\n const component = findComponentInMetadata(projectConfig, componentRef);\n if (!component) return candidates;\n const isConnectionParticipant = supportedConnections.some(\n (c) => c[side] === component.generator,\n );\n if (!isConnectionParticipant) return candidates;\n // Filter to the specific matched component, not all components with the same generator\n return candidates.filter((c) => c.component === component);\n};\n\n/**\n * Resolve the connection to use, considering source/target projects and components.\n */\nexport const resolveConnection = async (\n tree: Tree,\n options: ConnectionGeneratorSchema,\n supportedConnections: readonly Connection[] = SUPPORTED_CONNECTIONS,\n): Promise<ResolvedConnection> => {\n const sourceConfig = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetConfig = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n // Validate explicitly specified components exist\n validateComponent(options.sourceComponent, sourceConfig, 'source');\n validateComponent(options.targetComponent, targetConfig, 'target');\n\n // Gather and narrow candidates\n const sourceCandidates = filterConnectionCandidatesForComponentReference(\n options.sourceComponent,\n sourceConfig,\n await gatherCandidates(tree, sourceConfig),\n supportedConnections,\n 'source',\n );\n const targetCandidates = filterConnectionCandidatesForComponentReference(\n options.targetComponent,\n targetConfig,\n await gatherCandidates(tree, targetConfig),\n supportedConnections,\n 'target',\n );\n\n // Cross-product candidates and find supported connections\n const matches: ConnectionMatch[] = [];\n for (const source of sourceCandidates) {\n for (const target of targetCandidates) {\n const match = supportedConnections.find(\n (c) => c.source === source.type && c.target === target.type,\n );\n if (match) {\n matches.push({\n connection: match,\n sourceComponent: source.component,\n targetComponent: target.component,\n });\n }\n }\n }\n\n if (matches.length === 0) {\n const sourceTypes = [...new Set(sourceCandidates.map((c) => c.type))];\n const targetTypes = [...new Set(targetCandidates.map((c) => c.type))];\n throw new Error(\n `This generator does not support a connection from ${options.sourceProject}${sourceTypes.length > 0 ? ` (${sourceTypes.join(', ')})` : ''} to ${options.targetProject}${targetTypes.length > 0 ? ` (${targetTypes.join(', ')})` : ''}`,\n );\n }\n\n if (matches.length > 1) {\n const connectionDescriptions = matches\n .map((m) => {\n const sourceName = m.sourceComponent?.name;\n const targetName = m.targetComponent?.name;\n const sourceLabel = sourceName\n ? `${sourceName} (${m.connection.source})`\n : m.connection.source;\n const targetLabel = targetName\n ? `${targetName} (${m.connection.target})`\n : m.connection.target;\n return `${sourceLabel} -> ${targetLabel}`;\n })\n .join(', ');\n throw new Error(\n `Ambiguous connection from ${options.sourceProject} to ${options.targetProject}. ` +\n `Multiple supported connections found: ${connectionDescriptions}. ` +\n `Please specify sourceComponent and/or targetComponent to disambiguate.`,\n );\n }\n\n return {\n connection: matches[0].connection,\n sourceComponent: matches[0].sourceComponent,\n targetComponent: matches[0].targetComponent,\n };\n};\n\n/**\n * Determine whether the given project is of a known project type\n */\nexport const determineProjectType = async (\n tree: Tree,\n projectName: string,\n): Promise<ProjectType | undefined> => {\n const projectConfiguration = readProjectConfigurationUnqualified(\n tree,\n projectName,\n );\n return await determineProjectTypeFromConfig(tree, projectConfiguration);\n};\n\n/**\n * Determine whether the given project configuration is of a known project type\n */\nconst determineProjectTypeFromConfig = async (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): Promise<ProjectType | undefined> => {\n // NB: if adding new checks, ensure these go from most to least specific\n // eg. react website is more specific than typescript project\n\n if (await isTrpcApi(tree, projectConfiguration)) {\n return 'ts#trpc-api';\n }\n\n if (isFastApi(tree, projectConfiguration)) {\n return 'py#fast-api';\n }\n\n if (isSmithyApi(tree, projectConfiguration)) {\n return 'ts#smithy-api';\n }\n\n if (isReact(tree, projectConfiguration)) {\n return 'ts#react-website';\n }\n\n if (isRdb(projectConfiguration)) {\n return 'ts#rdb';\n }\n\n if (isTsDynamoDB(projectConfiguration)) {\n return 'ts#dynamodb';\n }\n\n if (isPyDynamoDB(projectConfiguration)) {\n return 'py#dynamodb';\n }\n\n if (isPyRdb(projectConfiguration)) {\n return 'py#rdb';\n }\n\n if (isAgentCoreGateway(projectConfiguration)) {\n return 'agentcore-gateway';\n }\n\n return undefined;\n};\n\nconst sourceRoot = (projectConfiguration: ProjectConfiguration) =>\n projectConfiguration.sourceRoot ??\n joinPathFragments(projectConfiguration.root, 'src');\n\nconst isTrpcApi = async (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): Promise<boolean> => {\n // If the project.json says it's a trpc api, there's no need for introspection\n if ((projectConfiguration.metadata as any)?.apiType === 'trpc') {\n return true;\n }\n\n // Find the src/index.ts\n const indexTs = tree.read(\n joinPathFragments(sourceRoot(projectConfiguration), 'index.ts'),\n 'utf-8',\n );\n if (indexTs === null) {\n return false;\n }\n\n // If the index file exports an AppRouter, it's a trpc api\n if (await hasExportDeclaration(tree, indexTs, 'AppRouter')) {\n return true;\n }\n\n // If there's a src/router.ts or src/lambdas/router.ts which exports an AppRouter, it's a trpc api\n const trpcRouter =\n tree.read(\n joinPathFragments(sourceRoot(projectConfiguration), 'router.ts'),\n 'utf-8',\n ) ??\n tree.read(\n joinPathFragments(\n sourceRoot(projectConfiguration),\n 'lambdas',\n 'router.ts',\n ),\n 'utf-8',\n );\n\n if (trpcRouter === null) {\n return false;\n }\n\n if (await hasExportDeclaration(tree, trpcRouter, 'AppRouter')) {\n return true;\n }\n\n return false;\n};\n\nconst isReact = (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): boolean => {\n // if there's a main.tsx, it's a react app\n return tree.exists(\n joinPathFragments(sourceRoot(projectConfiguration), 'main.tsx'),\n );\n};\n\nconst isFastApi = (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): boolean => {\n // If the project.json says it's a fast api, there's no need for introspection\n if ((projectConfiguration.metadata as any)?.apiType === 'fast-api') {\n return true;\n }\n\n const pyProjectPath = joinPathFragments(\n projectConfiguration.root,\n 'pyproject.toml',\n );\n if (tree.exists(pyProjectPath)) {\n const pyProject = readToml(tree, pyProjectPath);\n if (((pyProject as any)?.project?.dependencies ?? []).includes('fastapi')) {\n return true;\n }\n }\n\n return false;\n};\n\nconst isSmithyApi = (\n _tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): boolean => {\n // Support selecting either the smithy model or backend project\n return [\n SMITHY_PROJECT_GENERATOR_INFO.id,\n TS_SMITHY_API_GENERATOR_INFO.id,\n ].includes(((projectConfiguration.metadata as any) ?? {}).generator);\n};\n\nconst isRdb = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n TS_RDB_GENERATOR_INFO.id;\n\nconst isTsDynamoDB = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n TS_DYNAMODB_GENERATOR_INFO.id;\n\nconst isPyDynamoDB = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n PY_DYNAMODB_GENERATOR_INFO.id;\n\nconst isPyRdb = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n PY_RDB_GENERATOR_INFO.id;\n\nconst isAgentCoreGateway = (\n projectConfiguration: ProjectConfiguration,\n): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n AGENTCORE_GATEWAY_GENERATOR_INFO.id;\n\nexport default connectionGenerator;\n"],"names":["joinPathFragments","agentcoreGatewayAgentConnectionGenerator","agentcoreGatewayGatewayConnectionGenerator","AGENTCORE_GATEWAY_GENERATOR_INFO","agentcoreGatewayMcpConnectionGenerator","agentcoreGatewayReactConnectionGenerator","pyAgentA2aConnectionGenerator","pyAgentGatewayConnectionGenerator","pyAgentMcpConnectionGenerator","pyAgentReactConnectionGenerator","pyDynamoDBAgentConnectionGenerator","pyDynamoDBFastApiConnectionGenerator","PY_DYNAMODB_GENERATOR_INFO","pyDynamoDBMcpServerConnectionGenerator","fastApiReactGenerator","pyRdbAgentConnectionGenerator","pyRdbFastApiConnectionGenerator","PY_RDB_GENERATOR_INFO","pyRdbMcpServerConnectionGenerator","SMITHY_PROJECT_GENERATOR_INFO","smithyReactConnectionGenerator","TS_SMITHY_API_GENERATOR_INFO","trpcReactGenerator","tsAgentA2aConnectionGenerator","tsAgentGatewayConnectionGenerator","tsAgentMcpConnectionGenerator","tsAgentReactConnectionGenerator","tsDynamoDBAgentConnectionGenerator","TS_DYNAMODB_GENERATOR_INFO","tsDynamoDBMcpServerConnectionGenerator","tsDynamoDBSmithyConnectionGenerator","tsDynamoDBTrpcConnectionGenerator","tsRdbAgentConnectionGenerator","TS_RDB_GENERATOR_INFO","tsRdbMcpServerConnectionGenerator","tsRdbSmithyConnectionGenerator","tsRdbTrpcConnectionGenerator","hasExportDeclaration","readProjectConfigurationUnqualified","readToml","SUPPORTED_CONNECTIONS","PROJECT_COMPONENT_SENTINEL","CONNECTION_GENERATORS","tree","options","frontendProjectName","sourceProject","backendProjectName","targetProject","preferInstallDependencies","fastApiProjectName","smithyModelOrBackendProjectName","connectionGenerator","resolved","resolveConnection","connectionKey","connection","source","target","sourceComponent","targetComponent","findComponentInMetadata","projectConfiguration","componentRef","components","metadata","find","c","name","path","generator","gatherCandidates","projectConfig","type","determineProjectTypeFromConfig","map","component","validateComponent","side","found","Error","length","join","filterConnectionCandidatesForComponentReference","candidates","supportedConnections","filter","isConnectionParticipant","some","sourceConfig","targetConfig","sourceCandidates","targetCandidates","matches","match","push","sourceTypes","Set","targetTypes","connectionDescriptions","m","sourceName","targetName","sourceLabel","targetLabel","determineProjectType","projectName","isTrpcApi","isFastApi","isSmithyApi","isReact","isRdb","isTsDynamoDB","isPyDynamoDB","isPyRdb","isAgentCoreGateway","undefined","sourceRoot","root","apiType","indexTs","read","trpcRouter","exists","pyProjectPath","pyProject","project","dependencies","includes","_tree","id"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,QAGZ,aAAa;AACpB,OAAOC,8CAA8C,qDAAkD;AACvG,OAAOC,gDAAgD,uDAAoD;AAC3G,SAASC,gCAAgC,QAAQ,oCAAiC;AAClF,OAAOC,4CAA4C,mDAAgD;AACnG,OAAOC,8CAA8C,qDAAkD;AACvG,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,uCAAuC,8CAA2C;AACzF,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,qCAAqC,4CAAyC;AACrF,OAAOC,wCAAwC,+CAA4C;AAC3F,OAAOC,0CAA0C,kDAA+C;AAChG,SAASC,0BAA0B,QAAQ,8BAA2B;AACtE,OAAOC,4CAA4C,oDAAiD;AACpG,OAAOC,2BAA2B,oCAAiC;AACnE,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,qCAAqC,6CAA0C;AACtF,SAASC,qBAAqB,QAAQ,yBAAsB;AAC5D,OAAOC,uCAAuC,+CAA4C;AAC1F,SAASC,6BAA6B,QAAQ,iCAA8B;AAC5E,OAAOC,oCAAoC,0CAAuC;AAClF,SAASC,4BAA4B,QAAQ,gCAA6B;AAC1E,OAAOC,wBAAwB,6BAA0B;AACzD,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,uCAAuC,8CAA2C;AACzF,OAAOC,mCAAmC,0CAAuC;AACjF,OAAOC,qCAAqC,4CAA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AAMf,qBAAqB,CACzBrD,uBAEA,AAAC,CAAA,AAACA,qBAAqBG,QAAQ,IAAY,CAAC,CAAA,EAAGK,SAAS,KACxDnE,iCAAiC+H,EAAE;AAErC,eAAe9E,oBAAoB"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n joinPathFragments,\n type ProjectConfiguration,\n type Tree,\n} from '@nx/devkit';\nimport agentcoreGatewayAgentConnectionGenerator from '../agentcore-gateway/agent-connection/generator.js';\nimport agentcoreGatewayGatewayConnectionGenerator from '../agentcore-gateway/gateway-connection/generator.js';\nimport { AGENTCORE_GATEWAY_GENERATOR_INFO } from '../agentcore-gateway/generator.js';\nimport agentcoreGatewayMcpConnectionGenerator from '../agentcore-gateway/mcp-connection/generator.js';\nimport agentcoreGatewayReactConnectionGenerator from '../agentcore-gateway/react-connection/generator.js';\nimport pyAgentA2aConnectionGenerator from '../py/agent/a2a-connection/generator.js';\nimport pyAgentGatewayConnectionGenerator from '../py/agent/gateway-connection/generator.js';\nimport pyAgentMcpConnectionGenerator from '../py/agent/mcp-connection/generator.js';\nimport pyAgentReactConnectionGenerator from '../py/agent/react-connection/generator.js';\nimport pyDynamoDBAgentConnectionGenerator from '../py/dynamodb/agent-connection/generator.js';\nimport pyDynamoDBFastApiConnectionGenerator from '../py/dynamodb/fast-api-connection/generator.js';\nimport { PY_DYNAMODB_GENERATOR_INFO } from '../py/dynamodb/generator.js';\nimport pyDynamoDBMcpServerConnectionGenerator from '../py/dynamodb/mcp-server-connection/generator.js';\nimport fastApiReactGenerator from '../py/fast-api/react/generator.js';\nimport pyRdbAgentConnectionGenerator from '../py/rdb/agent-connection/generator.js';\nimport pyRdbFastApiConnectionGenerator from '../py/rdb/fast-api-connection/generator.js';\nimport { PY_RDB_GENERATOR_INFO } from '../py/rdb/generator.js';\nimport pyRdbMcpServerConnectionGenerator from '../py/rdb/mcp-server-connection/generator.js';\nimport { SMITHY_PROJECT_GENERATOR_INFO } from '../smithy/project/generator.js';\nimport smithyReactConnectionGenerator from '../smithy/react-connection/generator.js';\nimport { TS_SMITHY_API_GENERATOR_INFO } from '../smithy/ts/api/generator.js';\nimport trpcReactGenerator from '../trpc/react/generator.js';\nimport tsAgentA2aConnectionGenerator from '../ts/agent/a2a-connection/generator.js';\nimport tsAgentGatewayConnectionGenerator from '../ts/agent/gateway-connection/generator.js';\nimport tsAgentMcpConnectionGenerator from '../ts/agent/mcp-connection/generator.js';\nimport tsAgentReactConnectionGenerator from '../ts/agent/react-connection/generator.js';\nimport tsDynamoDBAgentConnectionGenerator from '../ts/dynamodb/agent-connection/generator.js';\nimport { TS_DYNAMODB_GENERATOR_INFO } from '../ts/dynamodb/generator.js';\nimport tsDynamoDBMcpServerConnectionGenerator from '../ts/dynamodb/mcp-server-connection/generator.js';\nimport tsDynamoDBSmithyConnectionGenerator from '../ts/dynamodb/smithy-connection/generator.js';\nimport tsDynamoDBTrpcConnectionGenerator from '../ts/dynamodb/trpc-connection/generator.js';\nimport tsRdbAgentConnectionGenerator from '../ts/rdb/agent-connection/generator.js';\nimport { TS_RDB_GENERATOR_INFO } from '../ts/rdb/generator.js';\nimport tsRdbMcpServerConnectionGenerator from '../ts/rdb/mcp-server-connection/generator.js';\nimport tsRdbSmithyConnectionGenerator from '../ts/rdb/smithy-connection/generator.js';\nimport tsRdbTrpcConnectionGenerator from '../ts/rdb/trpc-connection/generator.js';\nimport { hasExportDeclaration } from '../utils/ast.js';\nimport {\n type ComponentMetadata,\n readProjectConfigurationUnqualified,\n} from '../utils/nx.js';\nimport { readToml } from '../utils/toml.js';\nimport type { ConnectionGeneratorSchema } from './schema';\nimport {\n type Connection,\n type ConnectionKey,\n SUPPORTED_CONNECTIONS,\n type SUPPORTED_PROJECT_TYPES,\n} from './supported-connections.js';\n\nexport type { Connection };\n\ntype ProjectType = (typeof SUPPORTED_PROJECT_TYPES)[number];\n\n/**\n * Sentinel value for sourceComponent/targetComponent that means\n * \"use the project-level connection, not a component\".\n */\nexport const PROJECT_COMPONENT_SENTINEL = '.';\n\n/**\n * The result of resolving a connection, including the matched connection\n * and any resolved source/target component metadata.\n */\nexport interface ResolvedConnection {\n readonly connection: Connection;\n readonly sourceComponent?: ComponentMetadata;\n readonly targetComponent?: ComponentMetadata;\n}\n\n/**\n * Generators for each connection type\n */\n/**\n * Options passed to connection generators, including resolved component metadata.\n */\nexport interface ResolvedConnectionOptions {\n sourceProject: string;\n targetProject: string;\n sourceComponent?: ComponentMetadata;\n targetComponent?: ComponentMetadata;\n preferInstallDependencies?: boolean;\n}\n\nconst CONNECTION_GENERATORS = {\n 'ts#trpc-api -> ts#rdb': (tree, options) =>\n tsRdbTrpcConnectionGenerator(tree, options),\n 'ts#agent -> ts#rdb': (tree, options) =>\n tsRdbAgentConnectionGenerator(tree, options),\n 'ts#smithy-api -> ts#rdb': (tree, options) =>\n tsRdbSmithyConnectionGenerator(tree, options),\n 'ts#mcp-server -> ts#rdb': (tree, options) =>\n tsRdbMcpServerConnectionGenerator(tree, options),\n 'ts#trpc-api -> ts#dynamodb': (tree, options) =>\n tsDynamoDBTrpcConnectionGenerator(tree, options),\n 'ts#agent -> ts#dynamodb': (tree, options) =>\n tsDynamoDBAgentConnectionGenerator(tree, options),\n 'ts#smithy-api -> ts#dynamodb': (tree, options) =>\n tsDynamoDBSmithyConnectionGenerator(tree, options),\n 'ts#mcp-server -> ts#dynamodb': (tree, options) =>\n tsDynamoDBMcpServerConnectionGenerator(tree, options),\n 'ts#react-website -> ts#trpc-api': (tree, options) =>\n trpcReactGenerator(tree, {\n frontendProjectName: options.sourceProject,\n backendProjectName: options.targetProject,\n preferInstallDependencies: options.preferInstallDependencies,\n }),\n 'ts#react-website -> py#fast-api': (tree, options) =>\n fastApiReactGenerator(tree, {\n frontendProjectName: options.sourceProject,\n fastApiProjectName: options.targetProject,\n preferInstallDependencies: options.preferInstallDependencies,\n }),\n 'ts#react-website -> ts#smithy-api': (tree, options) =>\n smithyReactConnectionGenerator(tree, {\n frontendProjectName: options.sourceProject,\n smithyModelOrBackendProjectName: options.targetProject,\n preferInstallDependencies: options.preferInstallDependencies,\n }),\n 'ts#react-website -> ts#agent': (tree, options) =>\n tsAgentReactConnectionGenerator(tree, options),\n 'ts#react-website -> py#agent': (tree, options) =>\n pyAgentReactConnectionGenerator(tree, options),\n 'ts#agent -> ts#mcp-server': (tree, options) =>\n tsAgentMcpConnectionGenerator(tree, options),\n 'ts#agent -> py#mcp-server': (tree, options) =>\n tsAgentMcpConnectionGenerator(tree, options),\n 'py#agent -> ts#mcp-server': (tree, options) =>\n pyAgentMcpConnectionGenerator(tree, options),\n 'py#agent -> py#mcp-server': (tree, options) =>\n pyAgentMcpConnectionGenerator(tree, options),\n 'ts#agent -> ts#agent': (tree, options) =>\n tsAgentA2aConnectionGenerator(tree, options),\n 'ts#agent -> py#agent': (tree, options) =>\n tsAgentA2aConnectionGenerator(tree, options),\n 'py#agent -> ts#agent': (tree, options) =>\n pyAgentA2aConnectionGenerator(tree, options),\n 'py#agent -> py#agent': (tree, options) =>\n pyAgentA2aConnectionGenerator(tree, options),\n 'ts#agent -> agentcore-gateway': (tree, options) =>\n tsAgentGatewayConnectionGenerator(tree, options),\n 'py#agent -> agentcore-gateway': (tree, options) =>\n pyAgentGatewayConnectionGenerator(tree, options),\n 'ts#react-website -> agentcore-gateway': (tree, options) =>\n agentcoreGatewayReactConnectionGenerator(tree, options),\n 'agentcore-gateway -> ts#agent': (tree, options) =>\n agentcoreGatewayAgentConnectionGenerator(tree, options),\n 'agentcore-gateway -> py#agent': (tree, options) =>\n agentcoreGatewayAgentConnectionGenerator(tree, options),\n 'agentcore-gateway -> ts#mcp-server': (tree, options) =>\n agentcoreGatewayMcpConnectionGenerator(tree, options),\n 'agentcore-gateway -> py#mcp-server': (tree, options) =>\n agentcoreGatewayMcpConnectionGenerator(tree, options),\n 'agentcore-gateway -> agentcore-gateway': (tree, options) =>\n agentcoreGatewayGatewayConnectionGenerator(tree, options),\n 'py#fast-api -> py#dynamodb': (tree, options) =>\n pyDynamoDBFastApiConnectionGenerator(tree, options),\n 'py#agent -> py#dynamodb': (tree, options) =>\n pyDynamoDBAgentConnectionGenerator(tree, options),\n 'py#mcp-server -> py#dynamodb': (tree, options) =>\n pyDynamoDBMcpServerConnectionGenerator(tree, options),\n 'py#fast-api -> py#rdb': (tree, options) =>\n pyRdbFastApiConnectionGenerator(tree, options),\n 'py#agent -> py#rdb': (tree, options) =>\n pyRdbAgentConnectionGenerator(tree, options),\n 'py#mcp-server -> py#rdb': (tree, options) =>\n pyRdbMcpServerConnectionGenerator(tree, options),\n} satisfies Record<\n ConnectionKey,\n (tree: Tree, options: ResolvedConnectionOptions) => Promise<any>\n>;\n\n/**\n * Generator for a connection between two projects\n */\nexport const connectionGenerator = async (\n tree: Tree,\n options: ConnectionGeneratorSchema,\n) => {\n const resolved = await resolveConnection(tree, options);\n\n const connectionKey =\n `${resolved.connection.source} -> ${resolved.connection.target}` as ConnectionKey;\n\n return await CONNECTION_GENERATORS[connectionKey](tree, {\n sourceProject: options.sourceProject,\n targetProject: options.targetProject,\n sourceComponent: resolved.sourceComponent,\n targetComponent: resolved.targetComponent,\n preferInstallDependencies: options.preferInstallDependencies,\n });\n};\n\n/**\n * Find a component in project metadata matching the given reference.\n * Checks by name first, then by path, then by generator.\n */\nexport const findComponentInMetadata = (\n projectConfiguration: ProjectConfiguration,\n componentRef: string,\n): ComponentMetadata | undefined => {\n const components: ComponentMetadata[] =\n (projectConfiguration.metadata as any)?.components ?? [];\n\n return (\n components.find((c) => c.name === componentRef) ??\n components.find((c) => c.path === componentRef) ??\n components.find((c) => c.generator === componentRef)\n );\n};\n\n/**\n * Represents a candidate source or target for a connection, which may be\n * the project itself or a specific component within the project.\n */\ninterface ConnectionCandidate {\n readonly type: string;\n readonly component?: ComponentMetadata;\n}\n\n/**\n * A matched connection between source and target candidates.\n */\ninterface ConnectionMatch {\n readonly connection: Connection;\n readonly sourceComponent?: ComponentMetadata;\n readonly targetComponent?: ComponentMetadata;\n}\n\n/**\n * Gather all connection candidates for a project configuration. This includes:\n * - The project-level type (if it's a supported type)\n * - Each component's generator id as a candidate type\n */\nconst gatherCandidates = async (\n tree: Tree,\n projectConfig: ProjectConfiguration,\n): Promise<ConnectionCandidate[]> => {\n const type = await determineProjectTypeFromConfig(tree, projectConfig);\n const components: ComponentMetadata[] =\n (projectConfig.metadata as any)?.components ?? [];\n\n return [\n ...(type ? [{ type: type }] : []),\n ...components.map((component) => ({\n type: component.generator,\n component,\n })),\n ];\n};\n\n/**\n * Validate that a specified component exists in the project metadata.\n * Skips validation for undefined refs and the project sentinel '.'.\n */\nconst validateComponent = (\n componentRef: string | undefined,\n projectConfig: ProjectConfiguration,\n side: 'source' | 'target',\n) => {\n if (!componentRef || componentRef === PROJECT_COMPONENT_SENTINEL) return;\n const found = findComponentInMetadata(projectConfig, componentRef);\n if (!found) {\n const components: ComponentMetadata[] =\n (projectConfig.metadata as any)?.components ?? [];\n throw new Error(\n `Component '${componentRef}' not found in ${side} project ${projectConfig.name}. ` +\n `Available components: ${components.length > 0 ? components.map((c) => c.name ?? c.generator).join(', ') : 'none'}`,\n );\n }\n};\n\n/**\n * Narrow candidates based on the user's specified component reference.\n */\nconst filterConnectionCandidatesForComponentReference = (\n componentRef: string | undefined,\n projectConfig: ProjectConfiguration,\n candidates: ConnectionCandidate[],\n supportedConnections: readonly Connection[],\n side: 'source' | 'target',\n): ConnectionCandidate[] => {\n if (!componentRef) return candidates;\n if (componentRef === PROJECT_COMPONENT_SENTINEL) {\n return candidates.filter((c) => !c.component);\n }\n const component = findComponentInMetadata(projectConfig, componentRef);\n if (!component) return candidates;\n const isConnectionParticipant = supportedConnections.some(\n (c) => c[side] === component.generator,\n );\n if (!isConnectionParticipant) return candidates;\n // Filter to the specific matched component, not all components with the same generator\n return candidates.filter((c) => c.component === component);\n};\n\n/**\n * Resolve the connection to use, considering source/target projects and components.\n */\nexport const resolveConnection = async (\n tree: Tree,\n options: ConnectionGeneratorSchema,\n supportedConnections: readonly Connection[] = SUPPORTED_CONNECTIONS,\n): Promise<ResolvedConnection> => {\n const sourceConfig = readProjectConfigurationUnqualified(\n tree,\n options.sourceProject,\n );\n const targetConfig = readProjectConfigurationUnqualified(\n tree,\n options.targetProject,\n );\n\n // Validate explicitly specified components exist\n validateComponent(options.sourceComponent, sourceConfig, 'source');\n validateComponent(options.targetComponent, targetConfig, 'target');\n\n // Gather and narrow candidates\n const sourceCandidates = filterConnectionCandidatesForComponentReference(\n options.sourceComponent,\n sourceConfig,\n await gatherCandidates(tree, sourceConfig),\n supportedConnections,\n 'source',\n );\n const targetCandidates = filterConnectionCandidatesForComponentReference(\n options.targetComponent,\n targetConfig,\n await gatherCandidates(tree, targetConfig),\n supportedConnections,\n 'target',\n );\n\n // Cross-product candidates and find supported connections\n const matches: ConnectionMatch[] = [];\n for (const source of sourceCandidates) {\n for (const target of targetCandidates) {\n const match = supportedConnections.find(\n (c) => c.source === source.type && c.target === target.type,\n );\n if (match) {\n matches.push({\n connection: match,\n sourceComponent: source.component,\n targetComponent: target.component,\n });\n }\n }\n }\n\n if (matches.length === 0) {\n const sourceTypes = [...new Set(sourceCandidates.map((c) => c.type))];\n const targetTypes = [...new Set(targetCandidates.map((c) => c.type))];\n throw new Error(\n `This generator does not support a connection from ${options.sourceProject}${sourceTypes.length > 0 ? ` (${sourceTypes.join(', ')})` : ''} to ${options.targetProject}${targetTypes.length > 0 ? ` (${targetTypes.join(', ')})` : ''}`,\n );\n }\n\n if (matches.length > 1) {\n const connectionDescriptions = matches\n .map((m) => {\n const sourceName = m.sourceComponent?.name;\n const targetName = m.targetComponent?.name;\n const sourceLabel = sourceName\n ? `${sourceName} (${m.connection.source})`\n : m.connection.source;\n const targetLabel = targetName\n ? `${targetName} (${m.connection.target})`\n : m.connection.target;\n return `${sourceLabel} -> ${targetLabel}`;\n })\n .join(', ');\n throw new Error(\n `Ambiguous connection from ${options.sourceProject} to ${options.targetProject}. ` +\n `Multiple supported connections found: ${connectionDescriptions}. ` +\n `Please specify sourceComponent and/or targetComponent to disambiguate.`,\n );\n }\n\n return {\n connection: matches[0].connection,\n sourceComponent: matches[0].sourceComponent,\n targetComponent: matches[0].targetComponent,\n };\n};\n\n/**\n * Determine whether the given project is of a known project type\n */\nexport const determineProjectType = async (\n tree: Tree,\n projectName: string,\n): Promise<ProjectType | undefined> => {\n const projectConfiguration = readProjectConfigurationUnqualified(\n tree,\n projectName,\n );\n return await determineProjectTypeFromConfig(tree, projectConfiguration);\n};\n\n/**\n * Determine whether the given project configuration is of a known project type\n */\nconst determineProjectTypeFromConfig = async (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): Promise<ProjectType | undefined> => {\n // NB: if adding new checks, ensure these go from most to least specific\n // eg. react website is more specific than typescript project\n\n if (await isTrpcApi(tree, projectConfiguration)) {\n return 'ts#trpc-api';\n }\n\n if (isFastApi(tree, projectConfiguration)) {\n return 'py#fast-api';\n }\n\n if (isSmithyApi(tree, projectConfiguration)) {\n return 'ts#smithy-api';\n }\n\n if (isReact(tree, projectConfiguration)) {\n return 'ts#react-website';\n }\n\n if (isRdb(projectConfiguration)) {\n return 'ts#rdb';\n }\n\n if (isTsDynamoDB(projectConfiguration)) {\n return 'ts#dynamodb';\n }\n\n if (isPyDynamoDB(projectConfiguration)) {\n return 'py#dynamodb';\n }\n\n if (isPyRdb(projectConfiguration)) {\n return 'py#rdb';\n }\n\n if (isAgentCoreGateway(projectConfiguration)) {\n return 'agentcore-gateway';\n }\n\n return undefined;\n};\n\nconst sourceRoot = (projectConfiguration: ProjectConfiguration) =>\n projectConfiguration.sourceRoot ??\n joinPathFragments(projectConfiguration.root, 'src');\n\nconst isTrpcApi = async (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): Promise<boolean> => {\n // If the project.json says it's a trpc api, there's no need for introspection\n if ((projectConfiguration.metadata as any)?.apiType === 'trpc') {\n return true;\n }\n\n // Find the src/index.ts\n const indexTs = tree.read(\n joinPathFragments(sourceRoot(projectConfiguration), 'index.ts'),\n 'utf-8',\n );\n if (indexTs === null) {\n return false;\n }\n\n // If the index file exports an AppRouter, it's a trpc api\n if (await hasExportDeclaration(tree, indexTs, 'AppRouter')) {\n return true;\n }\n\n // If there's a src/router.ts or src/lambdas/router.ts which exports an AppRouter, it's a trpc api\n const trpcRouter =\n tree.read(\n joinPathFragments(sourceRoot(projectConfiguration), 'router.ts'),\n 'utf-8',\n ) ??\n tree.read(\n joinPathFragments(\n sourceRoot(projectConfiguration),\n 'lambdas',\n 'router.ts',\n ),\n 'utf-8',\n );\n\n if (trpcRouter === null) {\n return false;\n }\n\n if (await hasExportDeclaration(tree, trpcRouter, 'AppRouter')) {\n return true;\n }\n\n return false;\n};\n\nconst isReact = (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): boolean => {\n // if there's a main.tsx, it's a react app\n return tree.exists(\n joinPathFragments(sourceRoot(projectConfiguration), 'main.tsx'),\n );\n};\n\nconst isFastApi = (\n tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): boolean => {\n // If the project.json says it's a fast api, there's no need for introspection\n if ((projectConfiguration.metadata as any)?.apiType === 'fast-api') {\n return true;\n }\n\n const pyProjectPath = joinPathFragments(\n projectConfiguration.root,\n 'pyproject.toml',\n );\n if (tree.exists(pyProjectPath)) {\n const pyProject = readToml(tree, pyProjectPath);\n if (((pyProject as any)?.project?.dependencies ?? []).includes('fastapi')) {\n return true;\n }\n }\n\n return false;\n};\n\nconst isSmithyApi = (\n _tree: Tree,\n projectConfiguration: ProjectConfiguration,\n): boolean => {\n // Support selecting either the smithy model or backend project\n return [\n SMITHY_PROJECT_GENERATOR_INFO.id,\n TS_SMITHY_API_GENERATOR_INFO.id,\n ].includes(((projectConfiguration.metadata as any) ?? {}).generator);\n};\n\nconst isRdb = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n TS_RDB_GENERATOR_INFO.id;\n\nconst isTsDynamoDB = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n TS_DYNAMODB_GENERATOR_INFO.id;\n\nconst isPyDynamoDB = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n PY_DYNAMODB_GENERATOR_INFO.id;\n\nconst isPyRdb = (projectConfiguration: ProjectConfiguration): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n PY_RDB_GENERATOR_INFO.id;\n\nconst isAgentCoreGateway = (\n projectConfiguration: ProjectConfiguration,\n): boolean =>\n ((projectConfiguration.metadata as any) ?? {}).generator ===\n AGENTCORE_GATEWAY_GENERATOR_INFO.id;\n\nexport default connectionGenerator;\n"],"names":["joinPathFragments","agentcoreGatewayAgentConnectionGenerator","agentcoreGatewayGatewayConnectionGenerator","AGENTCORE_GATEWAY_GENERATOR_INFO","agentcoreGatewayMcpConnectionGenerator","agentcoreGatewayReactConnectionGenerator","pyAgentA2aConnectionGenerator","pyAgentGatewayConnectionGenerator","pyAgentMcpConnectionGenerator","pyAgentReactConnectionGenerator","pyDynamoDBAgentConnectionGenerator","pyDynamoDBFastApiConnectionGenerator","PY_DYNAMODB_GENERATOR_INFO","pyDynamoDBMcpServerConnectionGenerator","fastApiReactGenerator","pyRdbAgentConnectionGenerator","pyRdbFastApiConnectionGenerator","PY_RDB_GENERATOR_INFO","pyRdbMcpServerConnectionGenerator","SMITHY_PROJECT_GENERATOR_INFO","smithyReactConnectionGenerator","TS_SMITHY_API_GENERATOR_INFO","trpcReactGenerator","tsAgentA2aConnectionGenerator","tsAgentGatewayConnectionGenerator","tsAgentMcpConnectionGenerator","tsAgentReactConnectionGenerator","tsDynamoDBAgentConnectionGenerator","TS_DYNAMODB_GENERATOR_INFO","tsDynamoDBMcpServerConnectionGenerator","tsDynamoDBSmithyConnectionGenerator","tsDynamoDBTrpcConnectionGenerator","tsRdbAgentConnectionGenerator","TS_RDB_GENERATOR_INFO","tsRdbMcpServerConnectionGenerator","tsRdbSmithyConnectionGenerator","tsRdbTrpcConnectionGenerator","hasExportDeclaration","readProjectConfigurationUnqualified","readToml","SUPPORTED_CONNECTIONS","PROJECT_COMPONENT_SENTINEL","CONNECTION_GENERATORS","tree","options","frontendProjectName","sourceProject","backendProjectName","targetProject","preferInstallDependencies","fastApiProjectName","smithyModelOrBackendProjectName","connectionGenerator","resolved","resolveConnection","connectionKey","connection","source","target","sourceComponent","targetComponent","findComponentInMetadata","projectConfiguration","componentRef","components","metadata","find","c","name","path","generator","gatherCandidates","projectConfig","type","determineProjectTypeFromConfig","map","component","validateComponent","side","found","Error","length","join","filterConnectionCandidatesForComponentReference","candidates","supportedConnections","filter","isConnectionParticipant","some","sourceConfig","targetConfig","sourceCandidates","targetCandidates","matches","match","push","sourceTypes","Set","targetTypes","connectionDescriptions","m","sourceName","targetName","sourceLabel","targetLabel","determineProjectType","projectName","isTrpcApi","isFastApi","isSmithyApi","isReact","isRdb","isTsDynamoDB","isPyDynamoDB","isPyRdb","isAgentCoreGateway","undefined","sourceRoot","root","apiType","indexTs","read","trpcRouter","exists","pyProjectPath","pyProject","project","dependencies","includes","_tree","id"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,QAGZ,aAAa;AACpB,OAAOC,8CAA8C,qDAAqD;AAC1G,OAAOC,gDAAgD,uDAAuD;AAC9G,SAASC,gCAAgC,QAAQ,oCAAoC;AACrF,OAAOC,4CAA4C,mDAAmD;AACtG,OAAOC,8CAA8C,qDAAqD;AAC1G,OAAOC,mCAAmC,0CAA0C;AACpF,OAAOC,uCAAuC,8CAA8C;AAC5F,OAAOC,mCAAmC,0CAA0C;AACpF,OAAOC,qCAAqC,4CAA4C;AACxF,OAAOC,wCAAwC,+CAA+C;AAC9F,OAAOC,0CAA0C,kDAAkD;AACnG,SAASC,0BAA0B,QAAQ,8BAA8B;AACzE,OAAOC,4CAA4C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K,SAAS,KACxDrC,sBAAsBiG,EAAE;AAE1B,MAAMlB,eAAe,CAAClD,uBACpB,AAAC,CAAA,AAACA,qBAAqBG,QAAQ,IAAY,CAAC,CAAA,EAAGK,SAAS,KACxD1C,2BAA2BsG,EAAE;AAE/B,MAAMjB,eAAe,CAACnD,uBACpB,AAAC,CAAA,AAACA,qBAAqBG,QAAQ,IAAY,CAAC,CAAA,EAAGK,SAAS,KACxD1D,2BAA2BsH,EAAE;AAE/B,MAAMhB,UAAU,CAACpD,uBACf,AAAC,CAAA,AAACA,qBAAqBG,QAAQ,IAAY,CAAC,CAAA,EAAGK,SAAS,KACxDrD,sBAAsBiH,EAAE;AAE1B,MAAMf,qBAAqB,CACzBrD,uBAEA,AAAC,CAAA,AAACA,qBAAqBG,QAAQ,IAAY,CAAC,CAAA,EAAGK,SAAS,KACxDnE,iCAAiC+H,EAAE;AAErC,eAAe9E,oBAAoB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/local-dev.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n joinPathFragments,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { applyGritQL } from '../utils/ast';\nimport { toClassName } from '../utils/names';\nimport {\n addDependencyToTargetIfNotPresent,\n readProjectConfigurationUnqualified,\n} from '../utils/nx';\n\nexport interface LocalDevOptions {\n apiName: string;\n url: string;\n additionalDependencyTargets?: string[];\n}\n\n/**\n * Adds the given target project to the source project's dev target\n * Updates the runtime config provider (if it exists)\n */\nexport const addTargetToLocalDev = async (\n tree: Tree,\n sourceProjectName: string,\n targetProjectName: string,\n options: LocalDevOptions,\n) => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n sourceProjectName,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n targetProjectName,\n );\n\n // Target project must have a dev target which is continuous\n if (\n !(\n targetProject.targets?.['dev']?.continuous &&\n sourceProject.targets?.['dev']\n )\n ) {\n return;\n }\n\n // Add a dependency on the dev target\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', {\n projects: [targetProject.name],\n target: 'dev',\n });\n for (const additional of options.additionalDependencyTargets ?? []) {\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', additional);\n }\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n\n // Add an override to runtime-config.json for the dev target to use the local url\n const runtimeConfigProvider = joinPathFragments(\n sourceProject.root,\n 'src',\n 'components',\n 'RuntimeConfig',\n 'index.tsx',\n );\n if (tree.exists(runtimeConfigProvider)) {\n const className = toClassName(options.apiName);\n await applyGritQL(\n tree,\n runtimeConfigProvider,\n `\\`if ($cond) { $stmts }\\` => raw\\`if ($cond) {\\n $stmts\\n runtimeConfig.apis.${className} = '${options.url}';\\n }\\` where { $cond <: contains \\`'local-dev'\\`, $stmts <: within \\`const applyOverrides = $_\\`, $stmts <: not contains \\`runtimeConfig.apis.${className}\\` }`,\n );\n }\n};\n"],"names":["joinPathFragments","updateProjectConfiguration","applyGritQL","toClassName","addDependencyToTargetIfNotPresent","readProjectConfigurationUnqualified","addTargetToLocalDev","tree","sourceProjectName","targetProjectName","options","sourceProject","targetProject","targets","continuous","projects","name","target","additional","additionalDependencyTargets","runtimeConfigProvider","root","exists","className","apiName","url"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,WAAW,QAAQ,kBAAe;AAC3C,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,SACEC,iCAAiC,EACjCC,mCAAmC,QAC9B,iBAAc;AAQrB;;;CAGC,GACD,OAAO,MAAMC,sBAAsB,OACjCC,MACAC,mBACAC,mBACAC;IAEA,MAAMC,gBAAgBN,oCACpBE,MACAC;IAEF,MAAMI,gBAAgBP,oCACpBE,MACAE;IAGF,4DAA4D;IAC5D,IACE,CACEG,CAAAA,cAAcC,OAAO,EAAE,CAAC,MAAM,EAAEC,cAChCH,cAAcE,OAAO,EAAE,CAAC,MAAM,AAAD,GAE/B;QACA;IACF;IAEA,qCAAqC;IACrCT,kCAAkCO,eAAe,OAAO;QACtDI,UAAU;YAACH,cAAcI,IAAI;SAAC;QAC9BC,QAAQ;IACV;IACA,KAAK,MAAMC,cAAcR,QAAQS,2BAA2B,IAAI,EAAE,CAAE;QAClEf,kCAAkCO,eAAe,OAAOO;IAC1D;IACAjB,2BAA2BM,MAAMI,cAAcK,IAAI,EAAEL;IAErD,iFAAiF;IACjF,MAAMS,wBAAwBpB,kBAC5BW,cAAcU,IAAI,EAClB,OACA,cACA,iBACA;IAEF,IAAId,KAAKe,MAAM,CAACF,wBAAwB;QACtC,MAAMG,YAAYpB,YAAYO,QAAQc,OAAO;QAC7C,MAAMtB,YACJK,MACAa,uBACA,CAAC,mFAAmF,EAAEG,UAAU,IAAI,EAAEb,QAAQe,GAAG,CAAC,iJAAiJ,EAAEF,UAAU,IAAI,CAAC;IAExR;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/local-dev.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n joinPathFragments,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { applyGritQL } from '../utils/ast.js';\nimport { toClassName } from '../utils/names.js';\nimport {\n addDependencyToTargetIfNotPresent,\n readProjectConfigurationUnqualified,\n} from '../utils/nx.js';\n\nexport interface LocalDevOptions {\n apiName: string;\n url: string;\n additionalDependencyTargets?: string[];\n}\n\n/**\n * Adds the given target project to the source project's dev target\n * Updates the runtime config provider (if it exists)\n */\nexport const addTargetToLocalDev = async (\n tree: Tree,\n sourceProjectName: string,\n targetProjectName: string,\n options: LocalDevOptions,\n) => {\n const sourceProject = readProjectConfigurationUnqualified(\n tree,\n sourceProjectName,\n );\n const targetProject = readProjectConfigurationUnqualified(\n tree,\n targetProjectName,\n );\n\n // Target project must have a dev target which is continuous\n if (\n !(\n targetProject.targets?.['dev']?.continuous &&\n sourceProject.targets?.['dev']\n )\n ) {\n return;\n }\n\n // Add a dependency on the dev target\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', {\n projects: [targetProject.name],\n target: 'dev',\n });\n for (const additional of options.additionalDependencyTargets ?? []) {\n addDependencyToTargetIfNotPresent(sourceProject, 'dev', additional);\n }\n updateProjectConfiguration(tree, sourceProject.name, sourceProject);\n\n // Add an override to runtime-config.json for the dev target to use the local url\n const runtimeConfigProvider = joinPathFragments(\n sourceProject.root,\n 'src',\n 'components',\n 'RuntimeConfig',\n 'index.tsx',\n );\n if (tree.exists(runtimeConfigProvider)) {\n const className = toClassName(options.apiName);\n await applyGritQL(\n tree,\n runtimeConfigProvider,\n `\\`if ($cond) { $stmts }\\` => raw\\`if ($cond) {\\n $stmts\\n runtimeConfig.apis.${className} = '${options.url}';\\n }\\` where { $cond <: contains \\`'local-dev'\\`, $stmts <: within \\`const applyOverrides = $_\\`, $stmts <: not contains \\`runtimeConfig.apis.${className}\\` }`,\n );\n }\n};\n"],"names":["joinPathFragments","updateProjectConfiguration","applyGritQL","toClassName","addDependencyToTargetIfNotPresent","readProjectConfigurationUnqualified","addTargetToLocalDev","tree","sourceProjectName","targetProjectName","options","sourceProject","targetProject","targets","continuous","projects","name","target","additional","additionalDependencyTargets","runtimeConfigProvider","root","exists","className","apiName","url"],"mappings":"AAAA;;;CAGC,GACD,SACEA,iBAAiB,EAEjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SACEC,iCAAiC,EACjCC,mCAAmC,QAC9B,iBAAiB;AAQxB;;;CAGC,GACD,OAAO,MAAMC,sBAAsB,OACjCC,MACAC,mBACAC,mBACAC;IAEA,MAAMC,gBAAgBN,oCACpBE,MACAC;IAEF,MAAMI,gBAAgBP,oCACpBE,MACAE;IAGF,4DAA4D;IAC5D,IACE,CACEG,CAAAA,cAAcC,OAAO,EAAE,CAAC,MAAM,EAAEC,cAChCH,cAAcE,OAAO,EAAE,CAAC,MAAM,AAAD,GAE/B;QACA;IACF;IAEA,qCAAqC;IACrCT,kCAAkCO,eAAe,OAAO;QACtDI,UAAU;YAACH,cAAcI,IAAI;SAAC;QAC9BC,QAAQ;IACV;IACA,KAAK,MAAMC,cAAcR,QAAQS,2BAA2B,IAAI,EAAE,CAAE;QAClEf,kCAAkCO,eAAe,OAAOO;IAC1D;IACAjB,2BAA2BM,MAAMI,cAAcK,IAAI,EAAEL;IAErD,iFAAiF;IACjF,MAAMS,wBAAwBpB,kBAC5BW,cAAcU,IAAI,EAClB,OACA,cACA,iBACA;IAEF,IAAId,KAAKe,MAAM,CAACF,wBAAwB;QACtC,MAAMG,YAAYpB,YAAYO,QAAQc,OAAO;QAC7C,MAAMtB,YACJK,MACAa,uBACA,CAAC,mFAAmF,EAAEG,UAAU,IAAI,EAAEb,QAAQe,GAAG,CAAC,iJAAiJ,EAAEF,UAAU,IAAI,CAAC;IAExR;AACF,EAAE"}
@@ -1,4 +1,4 @@
1
- import { SUPPORTED_CONNECTIONS, type SUPPORTED_PROJECT_TYPES } from './supported-connections';
1
+ import { SUPPORTED_CONNECTIONS, type SUPPORTED_PROJECT_TYPES } from './supported-connections.js';
2
2
  /**
3
3
  * How to scaffold each end of a connection, derived from the plugin's own
4
4
  * metadata rather than hand-listed.
@@ -158,6 +158,12 @@ const AGENT_TO_GATEWAY = [
158
158
  option: 'auth',
159
159
  equals: 'iam',
160
160
  reason: 'Agent connections require the gateway to authenticate with IAM.'
161
+ },
162
+ {
163
+ side: 'target',
164
+ option: 'protocol',
165
+ equals: 'mcp',
166
+ reason: 'An agent reaches a gateway as an MCP client, so the gateway must serve the mcp protocol. Note a single gateway cannot both front an agent and be called by one, since fronting requires the http protocol.'
161
167
  }
162
168
  ];
163
169
  const GATEWAY_TO_MCP = [
@@ -180,12 +186,6 @@ const GATEWAY_TO_AGENT = [
180
186
  option: 'protocol',
181
187
  equals: 'http',
182
188
  reason: 'Agent runtime targets can only be attached to an http-protocol gateway.'
183
- },
184
- {
185
- side: 'target',
186
- option: 'auth',
187
- equals: 'iam',
188
- reason: 'The gateway signs requests to its agent targets with IAM.'
189
189
  }
190
190
  ];
191
191
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/scaffold-catalog.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport GeneratorsJson from '../../generators.json' with { type: 'json' };\nimport {\n type ConnectionKey,\n SUPPORTED_CONNECTIONS,\n type SUPPORTED_PROJECT_TYPES,\n} from './supported-connections';\n\n/**\n * How to scaffold each end of a connection, derived from the plugin's own\n * metadata rather than hand-listed.\n *\n * Every connection endpoint type is also a generator id, which is what makes the\n * derivation possible:\n *\n * - **kind** — a generator whose schema `required`s a `project` adds a component\n * to an existing project; anything else creates a project of its own.\n * - **host** — a component lands in a project made by its language's base\n * generator (`ts#project` / `py#project`).\n * - **generator + options** — a type whose own generator is `hidden` is reached\n * through the public wrapper that selects it, found by matching the wrapper's\n * enum values against the type's name (`ts#trpc-api` ← `ts#api\n * --framework=trpc`). A visible generator is run directly.\n *\n * - **label** — the generator schema's own `x-label`.\n *\n * The result is that adding a generator and a connection for it needs no edit\n * here at all. The one thing still declared below is the option constraints,\n * which live as imperative guards inside each connection generator and so cannot\n * be read from metadata.\n */\n\n/**\n * Every type that can sit at either end of a connection: the project-level\n * types resolved by introspection, plus the component generator ids recorded in\n * component metadata.\n */\nexport type ConnectionEndpointType =\n | (typeof SUPPORTED_PROJECT_TYPES)[number]\n | (typeof SUPPORTED_CONNECTIONS)[number]['source']\n | (typeof SUPPORTED_CONNECTIONS)[number]['target'];\n\n/**\n * Whether scaffolding an endpoint creates a project of its own, or adds a\n * component to a project that must already exist.\n */\nexport type ScaffoldKind = 'project' | 'component';\n\n/** How to scaffold one end of a connection from the CLI. */\nexport interface ScaffoldRecipe {\n /** Human-readable name for this endpoint type. */\n readonly label: string;\n /** The generator id in `generators.json` that produces this endpoint. */\n readonly generator: string;\n /**\n * Options that select this endpoint type from its generator, for generators\n * producing more than one type (e.g. `framework`).\n */\n readonly options?: Readonly<Record<string, string>>;\n /** Whether the generator creates a project or adds a component to one. */\n readonly kind: ScaffoldKind;\n /**\n * The generator producing a project able to host this component, for\n * `component` recipes. Components are added to an existing project, so one\n * must be scaffolded first.\n */\n readonly host?: {\n readonly generator: string;\n readonly options?: Readonly<Record<string, string>>;\n /**\n * Whether the host project's name is referenced in snake_case. Python\n * project names are snake_cased when qualified, TypeScript ones are not.\n */\n readonly snakeCaseName?: boolean;\n };\n}\n\ntype GeneratorEntry = { schema: string; hidden?: boolean };\n/** The subset of JSON Schema the catalogue and the docs builder read. */\nexport type GeneratorSchema = {\n /**\n * Short display name for the thing this generator produces, used by the docs\n * graph builder's palette. Set it on any generator that can take part in a\n * connection.\n */\n 'x-label'?: string;\n properties?: Record<\n string,\n {\n type?: string;\n description?: string;\n enum?: string[];\n default?: unknown;\n 'x-priority'?: string;\n }\n >;\n required?: string[];\n};\n\ntype Schema = GeneratorSchema;\n\nconst GENERATORS = GeneratorsJson.generators as Record<string, GeneratorEntry>;\n\n/**\n * Resolves a generator's JSON schema by generator id.\n *\n * Injected rather than fixed because the two callers load files differently: the\n * plugin reads from disk (see `./schema-resolver`), while the docs site bundles\n * the schemas for the browser, where `node:fs` does not exist. Keeping this\n * module free of `node:fs` is what lets the browser import it at all.\n */\nexport type SchemaResolver = (generatorId: string) => Schema;\n\n/** The path `generators.json` records for a generator, relative to the plugin root. */\nexport const schemaPathOf = (generatorId: string): string => {\n const entry = GENERATORS[generatorId];\n if (!entry) {\n throw new Error(\n `Scaffold catalog: '${generatorId}' is not in generators.json`,\n );\n }\n return entry.schema;\n};\n\n/** The language prefix of a generator id: `ts` for `ts#agent`, `` for `license`. */\nconst languageOf = (id: string): string =>\n id.includes('#') ? id.slice(0, id.indexOf('#')) : '';\n\n/** Compare ids ignoring the separators that differ between wrapper and variant. */\nconst alike = (a: string, b: string): boolean =>\n a.replace(/[^a-z0-9]/gi, '').toLowerCase() ===\n b.replace(/[^a-z0-9]/gi, '').toLowerCase();\n\n/**\n * The public generator and option value that select a hidden endpoint type.\n *\n * A wrapper like `ts#api` produces several endpoint types, choosing between them\n * with an enum option: `--framework=trpc` yields `ts#trpc-api`. The pairing is\n * found by looking for a same-language public generator with an enum value that\n * reconstructs the endpoint's own name.\n */\nconst findWrapper = (\n endpointType: string,\n schemaOf: SchemaResolver,\n): { generator: string; options: Record<string, string> } | undefined => {\n const language = languageOf(endpointType);\n const name = endpointType.slice(endpointType.indexOf('#') + 1);\n\n for (const [generatorId, entry] of Object.entries(GENERATORS)) {\n if (entry.hidden) continue;\n if (languageOf(generatorId) !== language) continue;\n const wrapperName = generatorId.slice(generatorId.indexOf('#') + 1);\n\n for (const [option, property] of Object.entries(\n schemaOf(generatorId).properties ?? {},\n )) {\n for (const value of property.enum ?? []) {\n // Either the value names the variant outright (`react` for\n // `react-website`), or it qualifies the wrapper's own name\n // (`trpc` + `api` for `trpc-api`).\n if (alike(value, name) || alike(`${value}${wrapperName}`, name)) {\n return { generator: generatorId, options: { [option]: value } };\n }\n }\n }\n }\n return undefined;\n};\n\n/**\n * Derive the recipe for one endpoint type. Exported so a test can assert the\n * derivation against every type the plugin supports.\n */\nexport const deriveScaffoldRecipe = (\n endpointType: string,\n schemaOf: SchemaResolver,\n): ScaffoldRecipe => {\n const own = GENERATORS[endpointType];\n if (!own) {\n throw new Error(\n `Scaffold catalog: connection endpoint '${endpointType}' is not a generator id`,\n );\n }\n\n // A hidden generator is an implementation detail reached through its public\n // wrapper, which is what a user would actually run.\n const wrapper = own.hidden ? findWrapper(endpointType, schemaOf) : undefined;\n if (own.hidden && !wrapper) {\n throw new Error(\n `Scaffold catalog: '${endpointType}' is hidden and no public generator selects it`,\n );\n }\n\n // A generator requiring a `project` adds a component to one; anything else\n // creates its own project.\n const kind: ScaffoldKind = (schemaOf(endpointType).required ?? []).includes(\n 'project',\n )\n ? 'component'\n : 'project';\n\n const language = languageOf(endpointType);\n const hostGenerator = `${language}#project`;\n if (kind === 'component' && !GENERATORS[hostGenerator]) {\n throw new Error(\n `Scaffold catalog: '${endpointType}' is a component but '${hostGenerator}' does not exist to host it`,\n );\n }\n\n return {\n // `x-label` is the short noun a palette entry needs; `title` and\n // `description` are prose aimed at CLI prompts (\"Create a relational database\n // project\"). A generator without one falls back to its id, so a new endpoint\n // type still appears rather than being dropped.\n label: schemaOf(endpointType)['x-label'] ?? endpointType,\n generator: wrapper?.generator ?? endpointType,\n ...(wrapper ? { options: wrapper.options } : {}),\n kind,\n ...(kind === 'component'\n ? {\n host: {\n generator: hostGenerator,\n // Only options the host's schema actually requires, so a base\n // project generator gaining a required option is handled here.\n options: Object.fromEntries(\n (schemaOf(hostGenerator).required ?? [])\n .filter((option) => option !== 'name')\n .map((option) => {\n const property = schemaOf(hostGenerator).properties?.[option];\n const value = property?.default ?? property?.enum?.[0];\n if (value === undefined) {\n throw new Error(\n `Scaffold catalog: '${hostGenerator}' requires '${option}' but its schema offers no value to use`,\n );\n }\n return [option, String(value)];\n }),\n ),\n // Python project names are snake_cased when Nx qualifies them.\n snakeCaseName: language === 'py',\n },\n }\n : {}),\n };\n};\n\n/** Every endpoint type appearing at either end of a supported connection. */\nexport const CONNECTION_ENDPOINT_TYPES: readonly string[] = [\n ...new Set(\n SUPPORTED_CONNECTIONS.flatMap(({ source, target }) => [source, target]),\n ),\n].sort();\n\n/**\n * How to scaffold each connection endpoint type, derived from the generator\n * metadata. A connection added to `SUPPORTED_CONNECTIONS` appears here with no\n * edit to this file.\n */\nexport const buildScaffoldRecipes = (\n schemaOf: SchemaResolver,\n): Readonly<Record<string, ScaffoldRecipe>> =>\n Object.fromEntries(\n CONNECTION_ENDPOINT_TYPES.map((type) => [\n type,\n deriveScaffoldRecipe(type, schemaOf),\n ]),\n );\n\n/**\n * A requirement one end of a connection places on the other's options, mirroring\n * the guard the corresponding connection generator enforces.\n *\n * Declared rather than derived: each guard is an imperative `throw` inside its\n * connection generator, reachable only by running it. Recording them here lets a\n * caller choosing options up front check them first, and the paired test asserts\n * every entry names a real option with a value its enum allows.\n */\nexport interface ConnectionConstraint {\n /** Which end of the connection the constrained option belongs to. */\n readonly side: 'source' | 'target';\n /** The generator option carrying the constrained value. */\n readonly option: string;\n /** The only value accepted, if the option is pinned to one. */\n readonly equals?: string;\n /** A value rejected, for options accepting all but one. */\n readonly notEquals?: string;\n /** Why the constraint exists, phrased for the user choosing the option. */\n readonly reason: string;\n}\n\n/** Reusable constraint shapes, so the map below states each rule once. */\nconst AGENT_TO_AGENT: readonly ConnectionConstraint[] = [\n {\n side: 'target',\n option: 'protocol',\n equals: 'a2a',\n reason: 'Only an A2A agent can be connected to another agent as a tool.',\n },\n {\n side: 'target',\n option: 'auth',\n equals: 'iam',\n reason: 'A2A agent connections authenticate with IAM.',\n },\n];\n\nconst WEBSITE_TO_AGENT: readonly ConnectionConstraint[] = [\n {\n side: 'target',\n option: 'protocol',\n notEquals: 'a2a',\n reason:\n 'A2A agents are reached by other agents, not by a website. Use the http or ag-ui protocol.',\n },\n];\n\nconst AGENT_TO_MCP: readonly ConnectionConstraint[] = [\n {\n side: 'target',\n option: 'auth',\n equals: 'iam',\n reason: 'An agent reaches an MCP server with IAM authentication.',\n },\n];\n\nconst AGENT_TO_GATEWAY: readonly ConnectionConstraint[] = [\n {\n side: 'source',\n option: 'auth',\n equals: 'iam',\n reason: 'Only an IAM-authenticated agent can reach an IAM gateway.',\n },\n {\n side: 'target',\n option: 'auth',\n equals: 'iam',\n reason: 'Agent connections require the gateway to authenticate with IAM.',\n },\n];\n\nconst GATEWAY_TO_MCP: readonly ConnectionConstraint[] = [\n {\n side: 'source',\n option: 'protocol',\n equals: 'mcp',\n reason:\n 'MCP server targets can only be attached to an mcp-protocol gateway.',\n },\n {\n side: 'target',\n option: 'auth',\n equals: 'iam',\n reason: 'A gateway reaches an MCP server target with IAM authentication.',\n },\n];\n\nconst GATEWAY_TO_AGENT: readonly ConnectionConstraint[] = [\n {\n side: 'source',\n option: 'protocol',\n equals: 'http',\n reason:\n 'Agent runtime targets can only be attached to an http-protocol gateway.',\n },\n {\n side: 'target',\n option: 'auth',\n equals: 'iam',\n reason: 'The gateway signs requests to its agent targets with IAM.',\n },\n];\n\n/**\n * The option-level requirements each connection places on its endpoints.\n *\n * Only connections carrying a requirement appear. Keyed by `ConnectionKey`, so a\n * key that no longer names a supported connection is a compile error.\n */\nexport const CONNECTION_CONSTRAINTS = {\n 'ts#react-website -> ts#agent': WEBSITE_TO_AGENT,\n 'ts#react-website -> py#agent': WEBSITE_TO_AGENT,\n 'ts#agent -> ts#agent': AGENT_TO_AGENT,\n 'ts#agent -> py#agent': AGENT_TO_AGENT,\n 'py#agent -> ts#agent': AGENT_TO_AGENT,\n 'py#agent -> py#agent': AGENT_TO_AGENT,\n 'ts#agent -> ts#mcp-server': AGENT_TO_MCP,\n 'ts#agent -> py#mcp-server': AGENT_TO_MCP,\n 'py#agent -> ts#mcp-server': AGENT_TO_MCP,\n 'py#agent -> py#mcp-server': AGENT_TO_MCP,\n 'ts#agent -> agentcore-gateway': AGENT_TO_GATEWAY,\n 'py#agent -> agentcore-gateway': AGENT_TO_GATEWAY,\n 'ts#react-website -> agentcore-gateway': [\n {\n side: 'target',\n option: 'protocol',\n equals: 'http',\n reason:\n 'A website connects to an http-protocol gateway, which proxies requests to its agent targets.',\n },\n ],\n 'agentcore-gateway -> ts#agent': [\n ...GATEWAY_TO_AGENT,\n {\n side: 'target',\n option: 'protocol',\n notEquals: 'http',\n reason:\n 'A TypeScript http agent serves tRPC over WebSocket, which AgentCore Gateway does not support. Use the ag-ui or a2a protocol.',\n },\n ],\n 'agentcore-gateway -> py#agent': GATEWAY_TO_AGENT,\n 'agentcore-gateway -> ts#mcp-server': GATEWAY_TO_MCP,\n 'agentcore-gateway -> py#mcp-server': GATEWAY_TO_MCP,\n 'agentcore-gateway -> agentcore-gateway': [\n {\n side: 'source',\n option: 'protocol',\n equals: 'mcp',\n reason:\n 'A gateway is aggregated into another as an MCP target, so both must be mcp-protocol gateways.',\n },\n {\n side: 'target',\n option: 'protocol',\n equals: 'mcp',\n reason:\n 'A gateway is aggregated into another as an MCP target, so both must be mcp-protocol gateways.',\n },\n {\n side: 'target',\n option: 'auth',\n equals: 'iam',\n reason:\n 'The source gateway signs its request with IAM, so the target gateway must accept IAM.',\n },\n ],\n} as const satisfies Partial<\n Record<ConnectionKey, readonly ConnectionConstraint[]>\n>;\n\n/**\n * A generator run automatically after an endpoint is scaffolded, adding something\n * that endpoint should always have.\n *\n * A website is only useful with authentication in front of it, and `ts#website`\n * does not add it — `ts#website#auth` is a separate follow-up generator. Declared\n * here so the docs graph builder emits it without hardcoding the pairing.\n */\nexport interface FollowUpGenerator {\n /** The generator id to run after the endpoint's own. */\n readonly generator: string;\n /** Options to pass, beyond the `--project` naming the endpoint. */\n readonly options?: Readonly<Record<string, string>>;\n /** What it adds, for the emitted command's comment. */\n readonly adds: string;\n}\n\n/**\n * Generators run automatically after an endpoint type is scaffolded, keyed by\n * endpoint type.\n */\nexport const ENDPOINT_FOLLOW_UPS: Readonly<\n Record<string, readonly FollowUpGenerator[]>\n> = {\n 'ts#react-website': [\n {\n generator: 'ts#website#auth',\n // `cognitoDomain` is derived from the npm scope and project name when\n // omitted, so the command stays short.\n adds: 'Cognito authentication',\n },\n ],\n};\n\n/**\n * An option value a connection works best against, without requiring it.\n *\n * Distinct from `CONNECTION_CONSTRAINTS`: a constraint is a rule the connection\n * generator enforces, whereas a preference is the setting most users want. A\n * React website can call an `http` agent perfectly well, but AG-UI is the\n * protocol built for driving a frontend, so that is what a new connection picks.\n *\n * A caller applies these only where the user has not chosen the option, so a\n * preference never overrides a deliberate decision.\n */\nexport interface ConnectionPreference {\n readonly side: 'source' | 'target';\n readonly option: string;\n readonly value: string;\n /** Why this is the better default, phrased for the user. */\n readonly reason: string;\n}\n\n/** An agent target only attaches to an http gateway, an MCP server only to an mcp one. */\nconst GATEWAY_PREFERS_HTTP: ConnectionPreference = {\n side: 'source',\n option: 'protocol',\n value: 'http',\n reason:\n 'Agent runtime targets are proxied by an http gateway, so attaching an agent selects that protocol.',\n};\n\nconst GATEWAY_PREFERS_MCP: ConnectionPreference = {\n side: 'source',\n option: 'protocol',\n value: 'mcp',\n reason:\n 'MCP server targets are aggregated by an mcp gateway, so attaching an MCP server selects that protocol.',\n};\n\n/**\n * Preferred option values per connection. Keyed by `ConnectionKey`, so a key that\n * no longer names a supported connection is a compile error.\n */\nexport const CONNECTION_PREFERENCES = {\n 'ts#react-website -> ts#agent': [\n {\n side: 'target',\n option: 'protocol',\n value: 'ag-ui',\n reason:\n 'AG-UI is the protocol built for driving a frontend, so a website connection selects it.',\n },\n ],\n 'ts#react-website -> py#agent': [\n {\n side: 'target',\n option: 'protocol',\n value: 'ag-ui',\n reason:\n 'AG-UI is the protocol built for driving a frontend, so a website connection selects it.',\n },\n ],\n // A gateway's protocol is decided by what it fronts, and the two are mutually\n // exclusive: agent runtime targets need an http gateway, MCP server targets an\n // mcp one. The gateway schema defaults to mcp, so only the agent side needs a\n // preference — but both are stated, so whichever target the user attaches\n // first settles the protocol.\n 'agentcore-gateway -> ts#agent': [GATEWAY_PREFERS_HTTP],\n 'agentcore-gateway -> py#agent': [GATEWAY_PREFERS_HTTP],\n 'agentcore-gateway -> ts#mcp-server': [GATEWAY_PREFERS_MCP],\n 'agentcore-gateway -> py#mcp-server': [GATEWAY_PREFERS_MCP],\n 'ts#react-website -> agentcore-gateway': [\n {\n side: 'target',\n option: 'protocol',\n value: 'http',\n reason:\n 'A website reaches a gateway’s agent targets over path-based http routing, so the gateway serves the http protocol.',\n },\n ],\n} as const satisfies Partial<\n Record<ConnectionKey, readonly ConnectionPreference[]>\n>;\n\n/**\n * Connections that must be generated after another, because the generator reads\n * state the earlier one records.\n *\n * The website→gateway generator publishes a route per agent already attached to\n * the gateway, reading them from the gateway project's connection metadata. Run\n * before the gateway→agent connections, it finds none and wires up nothing.\n *\n * Keyed by `ConnectionKey`, so a key that no longer names a supported connection\n * is a compile error.\n */\nexport const CONNECTION_ORDERING = {\n 'ts#react-website -> agentcore-gateway': {\n after: ['agentcore-gateway -> ts#agent', 'agentcore-gateway -> py#agent'],\n reason:\n 'The website connection publishes a route per agent attached to the gateway, so the gateway’s agents must be attached first.',\n },\n} as const satisfies Partial<\n Record<\n ConnectionKey,\n { readonly after: readonly ConnectionKey[]; readonly reason: string }\n >\n>;\n\n/**\n * Connections whose source and target must be distinct projects, because the\n * connection generator refuses to wire a project to itself.\n */\nexport const SELF_CONNECTION_DISALLOWED = [\n 'agentcore-gateway -> agentcore-gateway',\n] as const satisfies readonly ConnectionKey[];\n"],"names":["GeneratorsJson","type","SUPPORTED_CONNECTIONS","GENERATORS","generators","schemaPathOf","generatorId","entry","Error","schema","languageOf","id","includes","slice","indexOf","alike","a","b","replace","toLowerCase","findWrapper","endpointType","schemaOf","language","name","Object","entries","hidden","wrapperName","option","property","properties","value","enum","generator","options","undefined","deriveScaffoldRecipe","own","wrapper","kind","required","hostGenerator","label","host","fromEntries","filter","map","default","String","snakeCaseName","CONNECTION_ENDPOINT_TYPES","Set","flatMap","source","target","sort","buildScaffoldRecipes","AGENT_TO_AGENT","side","equals","reason","WEBSITE_TO_AGENT","notEquals","AGENT_TO_MCP","AGENT_TO_GATEWAY","GATEWAY_TO_MCP","GATEWAY_TO_AGENT","CONNECTION_CONSTRAINTS","ENDPOINT_FOLLOW_UPS","adds","GATEWAY_PREFERS_HTTP","GATEWAY_PREFERS_MCP","CONNECTION_PREFERENCES","CONNECTION_ORDERING","after","SELF_CONNECTION_DISALLOWED"],"mappings":"AAAA;;;CAGC,GACD,OAAOA,oBAAoB,6BAA6B;IAAEC,MAAM;AAAO,EAAE;AACzE,SAEEC,qBAAqB,QAEhB,6BAA0B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AA6C;IACjDZ,MAAM;IACN9B,QAAQ;IACRG,OAAO;IACP6B,QACE;AACJ;AAEA,MAAMW,sBAA4C;IAChDb,MAAM;IACN9B,QAAQ;IACRG,OAAO;IACP6B,QACE;AACJ;AAEA;;;CAGC,GACD,OAAO,MAAMY,yBAAyB;IACpC,gCAAgC;QAC9B;YACEd,MAAM;YACN9B,QAAQ;YACRG,OAAO;YACP6B,QACE;QACJ;KACD;IACD,gCAAgC;QAC9B;YACEF,MAAM;YACN9B,QAAQ;YACRG,OAAO;YACP6B,QACE;QACJ;KACD;IACD,8EAA8E;IAC9E,+EAA+E;IAC/E,8EAA8E;IAC9E,0EAA0E;IAC1E,8BAA8B;IAC9B,iCAAiC;QAACU;KAAqB;IACvD,iCAAiC;QAACA;KAAqB;IACvD,sCAAsC;QAACC;KAAoB;IAC3D,sCAAsC;QAACA;KAAoB;IAC3D,yCAAyC;QACvC;YACEb,MAAM;YACN9B,QAAQ;YACRG,OAAO;YACP6B,QACE;QACJ;KACD;AACH,EAEE;AAEF;;;;;;;;;;CAUC,GACD,OAAO,MAAMa,sBAAsB;IACjC,yCAAyC;QACvCC,OAAO;YAAC;YAAiC;SAAgC;QACzEd,QACE;IACJ;AACF,EAKE;AAEF;;;CAGC,GACD,OAAO,MAAMe,6BAA6B;IACxC;CACD,CAA6C"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/scaffold-catalog.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport GeneratorsJson from '../../generators.json' with { type: 'json' };\nimport {\n type ConnectionKey,\n SUPPORTED_CONNECTIONS,\n type SUPPORTED_PROJECT_TYPES,\n} from './supported-connections.js';\n\n/**\n * How to scaffold each end of a connection, derived from the plugin's own\n * metadata rather than hand-listed.\n *\n * Every connection endpoint type is also a generator id, which is what makes the\n * derivation possible:\n *\n * - **kind** — a generator whose schema `required`s a `project` adds a component\n * to an existing project; anything else creates a project of its own.\n * - **host** — a component lands in a project made by its language's base\n * generator (`ts#project` / `py#project`).\n * - **generator + options** — a type whose own generator is `hidden` is reached\n * through the public wrapper that selects it, found by matching the wrapper's\n * enum values against the type's name (`ts#trpc-api` ← `ts#api\n * --framework=trpc`). A visible generator is run directly.\n *\n * - **label** — the generator schema's own `x-label`.\n *\n * The result is that adding a generator and a connection for it needs no edit\n * here at all. The one thing still declared below is the option constraints,\n * which live as imperative guards inside each connection generator and so cannot\n * be read from metadata.\n */\n\n/**\n * Every type that can sit at either end of a connection: the project-level\n * types resolved by introspection, plus the component generator ids recorded in\n * component metadata.\n */\nexport type ConnectionEndpointType =\n | (typeof SUPPORTED_PROJECT_TYPES)[number]\n | (typeof SUPPORTED_CONNECTIONS)[number]['source']\n | (typeof SUPPORTED_CONNECTIONS)[number]['target'];\n\n/**\n * Whether scaffolding an endpoint creates a project of its own, or adds a\n * component to a project that must already exist.\n */\nexport type ScaffoldKind = 'project' | 'component';\n\n/** How to scaffold one end of a connection from the CLI. */\nexport interface ScaffoldRecipe {\n /** Human-readable name for this endpoint type. */\n readonly label: string;\n /** The generator id in `generators.json` that produces this endpoint. */\n readonly generator: string;\n /**\n * Options that select this endpoint type from its generator, for generators\n * producing more than one type (e.g. `framework`).\n */\n readonly options?: Readonly<Record<string, string>>;\n /** Whether the generator creates a project or adds a component to one. */\n readonly kind: ScaffoldKind;\n /**\n * The generator producing a project able to host this component, for\n * `component` recipes. Components are added to an existing project, so one\n * must be scaffolded first.\n */\n readonly host?: {\n readonly generator: string;\n readonly options?: Readonly<Record<string, string>>;\n /**\n * Whether the host project's name is referenced in snake_case. Python\n * project names are snake_cased when qualified, TypeScript ones are not.\n */\n readonly snakeCaseName?: boolean;\n };\n}\n\ntype GeneratorEntry = { schema: string; hidden?: boolean };\n/** The subset of JSON Schema the catalogue and the docs builder read. */\nexport type GeneratorSchema = {\n /**\n * Short display name for the thing this generator produces, used by the docs\n * graph builder's palette. Set it on any generator that can take part in a\n * connection.\n */\n 'x-label'?: string;\n properties?: Record<\n string,\n {\n type?: string;\n description?: string;\n enum?: string[];\n default?: unknown;\n 'x-priority'?: string;\n }\n >;\n required?: string[];\n};\n\ntype Schema = GeneratorSchema;\n\nconst GENERATORS = GeneratorsJson.generators as Record<string, GeneratorEntry>;\n\n/**\n * Resolves a generator's JSON schema by generator id.\n *\n * Injected rather than fixed because the two callers load files differently: the\n * plugin reads from disk (see `./schema-resolver`), while the docs site bundles\n * the schemas for the browser, where `node:fs` does not exist. Keeping this\n * module free of `node:fs` is what lets the browser import it at all.\n */\nexport type SchemaResolver = (generatorId: string) => Schema;\n\n/** The path `generators.json` records for a generator, relative to the plugin root. */\nexport const schemaPathOf = (generatorId: string): string => {\n const entry = GENERATORS[generatorId];\n if (!entry) {\n throw new Error(\n `Scaffold catalog: '${generatorId}' is not in generators.json`,\n );\n }\n return entry.schema;\n};\n\n/** The language prefix of a generator id: `ts` for `ts#agent`, `` for `license`. */\nconst languageOf = (id: string): string =>\n id.includes('#') ? id.slice(0, id.indexOf('#')) : '';\n\n/** Compare ids ignoring the separators that differ between wrapper and variant. */\nconst alike = (a: string, b: string): boolean =>\n a.replace(/[^a-z0-9]/gi, '').toLowerCase() ===\n b.replace(/[^a-z0-9]/gi, '').toLowerCase();\n\n/**\n * The public generator and option value that select a hidden endpoint type.\n *\n * A wrapper like `ts#api` produces several endpoint types, choosing between them\n * with an enum option: `--framework=trpc` yields `ts#trpc-api`. The pairing is\n * found by looking for a same-language public generator with an enum value that\n * reconstructs the endpoint's own name.\n */\nconst findWrapper = (\n endpointType: string,\n schemaOf: SchemaResolver,\n): { generator: string; options: Record<string, string> } | undefined => {\n const language = languageOf(endpointType);\n const name = endpointType.slice(endpointType.indexOf('#') + 1);\n\n for (const [generatorId, entry] of Object.entries(GENERATORS)) {\n if (entry.hidden) continue;\n if (languageOf(generatorId) !== language) continue;\n const wrapperName = generatorId.slice(generatorId.indexOf('#') + 1);\n\n for (const [option, property] of Object.entries(\n schemaOf(generatorId).properties ?? {},\n )) {\n for (const value of property.enum ?? []) {\n // Either the value names the variant outright (`react` for\n // `react-website`), or it qualifies the wrapper's own name\n // (`trpc` + `api` for `trpc-api`).\n if (alike(value, name) || alike(`${value}${wrapperName}`, name)) {\n return { generator: generatorId, options: { [option]: value } };\n }\n }\n }\n }\n return undefined;\n};\n\n/**\n * Derive the recipe for one endpoint type. Exported so a test can assert the\n * derivation against every type the plugin supports.\n */\nexport const deriveScaffoldRecipe = (\n endpointType: string,\n schemaOf: SchemaResolver,\n): ScaffoldRecipe => {\n const own = GENERATORS[endpointType];\n if (!own) {\n throw new Error(\n `Scaffold catalog: connection endpoint '${endpointType}' is not a generator id`,\n );\n }\n\n // A hidden generator is an implementation detail reached through its public\n // wrapper, which is what a user would actually run.\n const wrapper = own.hidden ? findWrapper(endpointType, schemaOf) : undefined;\n if (own.hidden && !wrapper) {\n throw new Error(\n `Scaffold catalog: '${endpointType}' is hidden and no public generator selects it`,\n );\n }\n\n // A generator requiring a `project` adds a component to one; anything else\n // creates its own project.\n const kind: ScaffoldKind = (schemaOf(endpointType).required ?? []).includes(\n 'project',\n )\n ? 'component'\n : 'project';\n\n const language = languageOf(endpointType);\n const hostGenerator = `${language}#project`;\n if (kind === 'component' && !GENERATORS[hostGenerator]) {\n throw new Error(\n `Scaffold catalog: '${endpointType}' is a component but '${hostGenerator}' does not exist to host it`,\n );\n }\n\n return {\n // `x-label` is the short noun a palette entry needs; `title` and\n // `description` are prose aimed at CLI prompts (\"Create a relational database\n // project\"). A generator without one falls back to its id, so a new endpoint\n // type still appears rather than being dropped.\n label: schemaOf(endpointType)['x-label'] ?? endpointType,\n generator: wrapper?.generator ?? endpointType,\n ...(wrapper ? { options: wrapper.options } : {}),\n kind,\n ...(kind === 'component'\n ? {\n host: {\n generator: hostGenerator,\n // Only options the host's schema actually requires, so a base\n // project generator gaining a required option is handled here.\n options: Object.fromEntries(\n (schemaOf(hostGenerator).required ?? [])\n .filter((option) => option !== 'name')\n .map((option) => {\n const property = schemaOf(hostGenerator).properties?.[option];\n const value = property?.default ?? property?.enum?.[0];\n if (value === undefined) {\n throw new Error(\n `Scaffold catalog: '${hostGenerator}' requires '${option}' but its schema offers no value to use`,\n );\n }\n return [option, String(value)];\n }),\n ),\n // Python project names are snake_cased when Nx qualifies them.\n snakeCaseName: language === 'py',\n },\n }\n : {}),\n };\n};\n\n/** Every endpoint type appearing at either end of a supported connection. */\nexport const CONNECTION_ENDPOINT_TYPES: readonly string[] = [\n ...new Set(\n SUPPORTED_CONNECTIONS.flatMap(({ source, target }) => [source, target]),\n ),\n].sort();\n\n/**\n * How to scaffold each connection endpoint type, derived from the generator\n * metadata. A connection added to `SUPPORTED_CONNECTIONS` appears here with no\n * edit to this file.\n */\nexport const buildScaffoldRecipes = (\n schemaOf: SchemaResolver,\n): Readonly<Record<string, ScaffoldRecipe>> =>\n Object.fromEntries(\n CONNECTION_ENDPOINT_TYPES.map((type) => [\n type,\n deriveScaffoldRecipe(type, schemaOf),\n ]),\n );\n\n/**\n * A requirement one end of a connection places on the other's options, mirroring\n * the guard the corresponding connection generator enforces.\n *\n * Declared rather than derived: each guard is an imperative `throw` inside its\n * connection generator, reachable only by running it. Recording them here lets a\n * caller choosing options up front check them first, and the paired test asserts\n * every entry names a real option with a value its enum allows.\n */\nexport interface ConnectionConstraint {\n /** Which end of the connection the constrained option belongs to. */\n readonly side: 'source' | 'target';\n /** The generator option carrying the constrained value. */\n readonly option: string;\n /** The only value accepted, if the option is pinned to one. */\n readonly equals?: string;\n /** A value rejected, for options accepting all but one. */\n readonly notEquals?: string;\n /** Why the constraint exists, phrased for the user choosing the option. */\n readonly reason: string;\n}\n\n/** Reusable constraint shapes, so the map below states each rule once. */\nconst AGENT_TO_AGENT: readonly ConnectionConstraint[] = [\n {\n side: 'target',\n option: 'protocol',\n equals: 'a2a',\n reason: 'Only an A2A agent can be connected to another agent as a tool.',\n },\n {\n side: 'target',\n option: 'auth',\n equals: 'iam',\n reason: 'A2A agent connections authenticate with IAM.',\n },\n];\n\nconst WEBSITE_TO_AGENT: readonly ConnectionConstraint[] = [\n {\n side: 'target',\n option: 'protocol',\n notEquals: 'a2a',\n reason:\n 'A2A agents are reached by other agents, not by a website. Use the http or ag-ui protocol.',\n },\n];\n\nconst AGENT_TO_MCP: readonly ConnectionConstraint[] = [\n {\n side: 'target',\n option: 'auth',\n equals: 'iam',\n reason: 'An agent reaches an MCP server with IAM authentication.',\n },\n];\n\nconst AGENT_TO_GATEWAY: readonly ConnectionConstraint[] = [\n {\n side: 'source',\n option: 'auth',\n equals: 'iam',\n reason: 'Only an IAM-authenticated agent can reach an IAM gateway.',\n },\n {\n side: 'target',\n option: 'auth',\n equals: 'iam',\n reason: 'Agent connections require the gateway to authenticate with IAM.',\n },\n {\n side: 'target',\n option: 'protocol',\n equals: 'mcp',\n reason:\n 'An agent reaches a gateway as an MCP client, so the gateway must serve the mcp protocol. Note a single gateway cannot both front an agent and be called by one, since fronting requires the http protocol.',\n },\n];\n\nconst GATEWAY_TO_MCP: readonly ConnectionConstraint[] = [\n {\n side: 'source',\n option: 'protocol',\n equals: 'mcp',\n reason:\n 'MCP server targets can only be attached to an mcp-protocol gateway.',\n },\n {\n side: 'target',\n option: 'auth',\n equals: 'iam',\n reason: 'A gateway reaches an MCP server target with IAM authentication.',\n },\n];\n\nconst GATEWAY_TO_AGENT: readonly ConnectionConstraint[] = [\n {\n side: 'source',\n option: 'protocol',\n equals: 'http',\n reason:\n 'Agent runtime targets can only be attached to an http-protocol gateway.',\n },\n];\n\n/**\n * The option-level requirements each connection places on its endpoints.\n *\n * Only connections carrying a requirement appear. Keyed by `ConnectionKey`, so a\n * key that no longer names a supported connection is a compile error.\n */\nexport const CONNECTION_CONSTRAINTS = {\n 'ts#react-website -> ts#agent': WEBSITE_TO_AGENT,\n 'ts#react-website -> py#agent': WEBSITE_TO_AGENT,\n 'ts#agent -> ts#agent': AGENT_TO_AGENT,\n 'ts#agent -> py#agent': AGENT_TO_AGENT,\n 'py#agent -> ts#agent': AGENT_TO_AGENT,\n 'py#agent -> py#agent': AGENT_TO_AGENT,\n 'ts#agent -> ts#mcp-server': AGENT_TO_MCP,\n 'ts#agent -> py#mcp-server': AGENT_TO_MCP,\n 'py#agent -> ts#mcp-server': AGENT_TO_MCP,\n 'py#agent -> py#mcp-server': AGENT_TO_MCP,\n 'ts#agent -> agentcore-gateway': AGENT_TO_GATEWAY,\n 'py#agent -> agentcore-gateway': AGENT_TO_GATEWAY,\n 'ts#react-website -> agentcore-gateway': [\n {\n side: 'target',\n option: 'protocol',\n equals: 'http',\n reason:\n 'A website connects to an http-protocol gateway, which proxies requests to its agent targets.',\n },\n ],\n 'agentcore-gateway -> ts#agent': [\n ...GATEWAY_TO_AGENT,\n {\n side: 'target',\n option: 'protocol',\n notEquals: 'http',\n reason:\n 'A TypeScript http agent serves tRPC over WebSocket, which AgentCore Gateway does not support. Use the ag-ui or a2a protocol.',\n },\n ],\n 'agentcore-gateway -> py#agent': GATEWAY_TO_AGENT,\n 'agentcore-gateway -> ts#mcp-server': GATEWAY_TO_MCP,\n 'agentcore-gateway -> py#mcp-server': GATEWAY_TO_MCP,\n 'agentcore-gateway -> agentcore-gateway': [\n {\n side: 'source',\n option: 'protocol',\n equals: 'mcp',\n reason:\n 'A gateway is aggregated into another as an MCP target, so both must be mcp-protocol gateways.',\n },\n {\n side: 'target',\n option: 'protocol',\n equals: 'mcp',\n reason:\n 'A gateway is aggregated into another as an MCP target, so both must be mcp-protocol gateways.',\n },\n {\n side: 'target',\n option: 'auth',\n equals: 'iam',\n reason:\n 'The source gateway signs its request with IAM, so the target gateway must accept IAM.',\n },\n ],\n} as const satisfies Partial<\n Record<ConnectionKey, readonly ConnectionConstraint[]>\n>;\n\n/**\n * A generator run automatically after an endpoint is scaffolded, adding something\n * that endpoint should always have.\n *\n * A website is only useful with authentication in front of it, and `ts#website`\n * does not add it — `ts#website#auth` is a separate follow-up generator. Declared\n * here so the docs graph builder emits it without hardcoding the pairing.\n */\nexport interface FollowUpGenerator {\n /** The generator id to run after the endpoint's own. */\n readonly generator: string;\n /** Options to pass, beyond the `--project` naming the endpoint. */\n readonly options?: Readonly<Record<string, string>>;\n /** What it adds, for the emitted command's comment. */\n readonly adds: string;\n}\n\n/**\n * Generators run automatically after an endpoint type is scaffolded, keyed by\n * endpoint type.\n */\nexport const ENDPOINT_FOLLOW_UPS: Readonly<\n Record<string, readonly FollowUpGenerator[]>\n> = {\n 'ts#react-website': [\n {\n generator: 'ts#website#auth',\n // `cognitoDomain` is derived from the npm scope and project name when\n // omitted, so the command stays short.\n adds: 'Cognito authentication',\n },\n ],\n};\n\n/**\n * An option value a connection works best against, without requiring it.\n *\n * Distinct from `CONNECTION_CONSTRAINTS`: a constraint is a rule the connection\n * generator enforces, whereas a preference is the setting most users want. A\n * React website can call an `http` agent perfectly well, but AG-UI is the\n * protocol built for driving a frontend, so that is what a new connection picks.\n *\n * A caller applies these only where the user has not chosen the option, so a\n * preference never overrides a deliberate decision.\n */\nexport interface ConnectionPreference {\n readonly side: 'source' | 'target';\n readonly option: string;\n readonly value: string;\n /** Why this is the better default, phrased for the user. */\n readonly reason: string;\n}\n\n/** An agent target only attaches to an http gateway, an MCP server only to an mcp one. */\nconst GATEWAY_PREFERS_HTTP: ConnectionPreference = {\n side: 'source',\n option: 'protocol',\n value: 'http',\n reason:\n 'Agent runtime targets are proxied by an http gateway, so attaching an agent selects that protocol.',\n};\n\nconst GATEWAY_PREFERS_MCP: ConnectionPreference = {\n side: 'source',\n option: 'protocol',\n value: 'mcp',\n reason:\n 'MCP server targets are aggregated by an mcp gateway, so attaching an MCP server selects that protocol.',\n};\n\n/**\n * Preferred option values per connection. Keyed by `ConnectionKey`, so a key that\n * no longer names a supported connection is a compile error.\n */\nexport const CONNECTION_PREFERENCES = {\n 'ts#react-website -> ts#agent': [\n {\n side: 'target',\n option: 'protocol',\n value: 'ag-ui',\n reason:\n 'AG-UI is the protocol built for driving a frontend, so a website connection selects it.',\n },\n ],\n 'ts#react-website -> py#agent': [\n {\n side: 'target',\n option: 'protocol',\n value: 'ag-ui',\n reason:\n 'AG-UI is the protocol built for driving a frontend, so a website connection selects it.',\n },\n ],\n // A gateway's protocol is decided by what it fronts, and the two are mutually\n // exclusive: agent runtime targets need an http gateway, MCP server targets an\n // mcp one. The gateway schema defaults to mcp, so only the agent side needs a\n // preference — but both are stated, so whichever target the user attaches\n // first settles the protocol.\n 'agentcore-gateway -> ts#agent': [GATEWAY_PREFERS_HTTP],\n 'agentcore-gateway -> py#agent': [GATEWAY_PREFERS_HTTP],\n 'agentcore-gateway -> ts#mcp-server': [GATEWAY_PREFERS_MCP],\n 'agentcore-gateway -> py#mcp-server': [GATEWAY_PREFERS_MCP],\n 'ts#react-website -> agentcore-gateway': [\n {\n side: 'target',\n option: 'protocol',\n value: 'http',\n reason:\n 'A website reaches a gateway’s agent targets over path-based http routing, so the gateway serves the http protocol.',\n },\n ],\n} as const satisfies Partial<\n Record<ConnectionKey, readonly ConnectionPreference[]>\n>;\n\n/**\n * Connections that must be generated after another, because the generator reads\n * state the earlier one records.\n *\n * The website→gateway generator publishes a route per agent already attached to\n * the gateway, reading them from the gateway project's connection metadata. Run\n * before the gateway→agent connections, it finds none and wires up nothing.\n *\n * Keyed by `ConnectionKey`, so a key that no longer names a supported connection\n * is a compile error.\n */\nexport const CONNECTION_ORDERING = {\n 'ts#react-website -> agentcore-gateway': {\n after: ['agentcore-gateway -> ts#agent', 'agentcore-gateway -> py#agent'],\n reason:\n 'The website connection publishes a route per agent attached to the gateway, so the gateway’s agents must be attached first.',\n },\n} as const satisfies Partial<\n Record<\n ConnectionKey,\n { readonly after: readonly ConnectionKey[]; readonly reason: string }\n >\n>;\n\n/**\n * Connections whose source and target must be distinct projects, because the\n * connection generator refuses to wire a project to itself.\n */\nexport const SELF_CONNECTION_DISALLOWED = [\n 'agentcore-gateway -> agentcore-gateway',\n] as const satisfies readonly ConnectionKey[];\n"],"names":["GeneratorsJson","type","SUPPORTED_CONNECTIONS","GENERATORS","generators","schemaPathOf","generatorId","entry","Error","schema","languageOf","id","includes","slice","indexOf","alike","a","b","replace","toLowerCase","findWrapper","endpointType","schemaOf","language","name","Object","entries","hidden","wrapperName","option","property","properties","value","enum","generator","options","undefined","deriveScaffoldRecipe","own","wrapper","kind","required","hostGenerator","label","host","fromEntries","filter","map","default","String","snakeCaseName","CONNECTION_ENDPOINT_TYPES","Set","flatMap","source","target","sort","buildScaffoldRecipes","AGENT_TO_AGENT","side","equals","reason","WEBSITE_TO_AGENT","notEquals","AGENT_TO_MCP","AGENT_TO_GATEWAY","GATEWAY_TO_MCP","GATEWAY_TO_AGENT","CONNECTION_CONSTRAINTS","ENDPOINT_FOLLOW_UPS","adds","GATEWAY_PREFERS_HTTP","GATEWAY_PREFERS_MCP","CONNECTION_PREFERENCES","CONNECTION_ORDERING","after","SELF_CONNECTION_DISALLOWED"],"mappings":"AAAA;;;CAGC,GACD,OAAOA,oBAAoB,6BAA6B;IAAEC,MAAM;AAAO,EAAE;AACzE,SAEEC,qBAAqB,QAEhB,6BAA6B;AA+FpC,MAAMC,aAAaH,eAAeI,UAAU;AAY5C,qFAAqF,GACrF,OAAO,MAAMC,eAAe,CAACC;IAC3B,MAAMC,QAAQJ,UAAU,CAACG,YAAY;IACrC,IAAI,CAACC,OAAO;QACV,MAAM,IAAIC,MACR,CAAC,mBAAmB,EAAEF,YAAY,2BAA2B,CAAC;IAElE;IACA,OAAOC,MAAME,MAAM;AACrB,EAAE;AAEF,kFAAkF,GAClF,MAAMC,aAAa,CAACC,KAClBA,GAAGC,QAAQ,CAAC,OAAOD,GAAGE,KAAK,CAAC,GAAGF,GAAGG,OAAO,CAAC,QAAQ;AAEpD,iFAAiF,GACjF,MAAMC,QAAQ,CAACC,GAAWC,IACxBD,EAAEE,OAAO,CAAC,eAAe,IAAIC,WAAW,OACxCF,EAAEC,OAAO,CAAC,eAAe,IAAIC,WAAW;AAE1C;;;;;;;CAOC,GACD,MAAMC,cAAc,CAClBC,cACAC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9B,QAAQ;YACRG,OAAO;YACP6B,QACE;QACJ;KACD;AACH,EAEE;AAEF;;;;;;;;;;CAUC,GACD,OAAO,MAAMa,sBAAsB;IACjC,yCAAyC;QACvCC,OAAO;YAAC;YAAiC;SAAgC;QACzEd,QACE;IACJ;AACF,EAKE;AAEF;;;CAGC,GACD,OAAO,MAAMe,6BAA6B;IACxC;CACD,CAA6C"}
@@ -1,4 +1,4 @@
1
- import { type ScaffoldRecipe, type SchemaResolver } from './scaffold-catalog';
1
+ import { type ScaffoldRecipe, type SchemaResolver } from './scaffold-catalog.js';
2
2
  /** Reads schemas from disk, for the plugin and its tests. */
3
3
  export declare const nodeSchemaResolver: SchemaResolver;
4
4
  /** The scaffold recipes, resolved from the schemas on disk. */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/schema-resolver.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { readFileSync } from 'node:fs';\nimport * as path from 'node:path';\nimport {\n buildScaffoldRecipes,\n type GeneratorSchema,\n type ScaffoldRecipe,\n type SchemaResolver,\n schemaPathOf,\n} from './scaffold-catalog';\n\n/** Reads schemas from disk, for the plugin and its tests. */\nexport const nodeSchemaResolver: SchemaResolver = (() => {\n const cache = new Map<string, GeneratorSchema>();\n return (generatorId: string): GeneratorSchema => {\n const cached = cache.get(generatorId);\n if (cached) return cached;\n // This module lives at src/connection/, and the recorded path is relative to\n // the plugin root, so resolve from two levels up.\n const schemaPath = path.resolve(\n import.meta.dirname,\n '..',\n '..',\n schemaPathOf(generatorId),\n );\n let schema: GeneratorSchema;\n try {\n schema = JSON.parse(readFileSync(schemaPath, 'utf-8'));\n } catch (error) {\n throw new Error(\n `Scaffold catalog: could not read the schema for '${generatorId}' at ${schemaPath}: ${error}`,\n );\n }\n cache.set(generatorId, schema);\n return schema;\n };\n})();\n\n/** The scaffold recipes, resolved from the schemas on disk. */\nexport const SCAFFOLD_RECIPES: Readonly<Record<string, ScaffoldRecipe>> =\n buildScaffoldRecipes(nodeSchemaResolver);\n"],"names":["readFileSync","path","buildScaffoldRecipes","schemaPathOf","nodeSchemaResolver","cache","Map","generatorId","cached","get","schemaPath","resolve","dirname","schema","JSON","parse","error","Error","set","SCAFFOLD_RECIPES"],"mappings":"AAAA;;;CAGC,GACD,SAASA,YAAY,QAAQ,UAAU;AACvC,YAAYC,UAAU,YAAY;AAClC,SACEC,oBAAoB,EAIpBC,YAAY,QACP,wBAAqB;AAE5B,2DAA2D,GAC3D,OAAO,MAAMC,qBAAqC,AAAC,CAAA;IACjD,MAAMC,QAAQ,IAAIC;IAClB,OAAO,CAACC;QACN,MAAMC,SAASH,MAAMI,GAAG,CAACF;QACzB,IAAIC,QAAQ,OAAOA;QACnB,6EAA6E;QAC7E,kDAAkD;QAClD,MAAME,aAAaT,KAAKU,OAAO,CAC7B,YAAYC,OAAO,EACnB,MACA,MACAT,aAAaI;QAEf,IAAIM;QACJ,IAAI;YACFA,SAASC,KAAKC,KAAK,CAACf,aAAaU,YAAY;QAC/C,EAAE,OAAOM,OAAO;YACd,MAAM,IAAIC,MACR,CAAC,iDAAiD,EAAEV,YAAY,KAAK,EAAEG,WAAW,EAAE,EAAEM,OAAO;QAEjG;QACAX,MAAMa,GAAG,CAACX,aAAaM;QACvB,OAAOA;IACT;AACF,CAAA,IAAK;AAEL,6DAA6D,GAC7D,OAAO,MAAMM,mBACXjB,qBAAqBE,oBAAoB"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/connection/schema-resolver.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { readFileSync } from 'node:fs';\nimport * as path from 'node:path';\nimport {\n buildScaffoldRecipes,\n type GeneratorSchema,\n type ScaffoldRecipe,\n type SchemaResolver,\n schemaPathOf,\n} from './scaffold-catalog.js';\n\n/** Reads schemas from disk, for the plugin and its tests. */\nexport const nodeSchemaResolver: SchemaResolver = (() => {\n const cache = new Map<string, GeneratorSchema>();\n return (generatorId: string): GeneratorSchema => {\n const cached = cache.get(generatorId);\n if (cached) return cached;\n // This module lives at src/connection/, and the recorded path is relative to\n // the plugin root, so resolve from two levels up.\n const schemaPath = path.resolve(\n import.meta.dirname,\n '..',\n '..',\n schemaPathOf(generatorId),\n );\n let schema: GeneratorSchema;\n try {\n schema = JSON.parse(readFileSync(schemaPath, 'utf-8'));\n } catch (error) {\n throw new Error(\n `Scaffold catalog: could not read the schema for '${generatorId}' at ${schemaPath}: ${error}`,\n );\n }\n cache.set(generatorId, schema);\n return schema;\n };\n})();\n\n/** The scaffold recipes, resolved from the schemas on disk. */\nexport const SCAFFOLD_RECIPES: Readonly<Record<string, ScaffoldRecipe>> =\n buildScaffoldRecipes(nodeSchemaResolver);\n"],"names":["readFileSync","path","buildScaffoldRecipes","schemaPathOf","nodeSchemaResolver","cache","Map","generatorId","cached","get","schemaPath","resolve","dirname","schema","JSON","parse","error","Error","set","SCAFFOLD_RECIPES"],"mappings":"AAAA;;;CAGC,GACD,SAASA,YAAY,QAAQ,UAAU;AACvC,YAAYC,UAAU,YAAY;AAClC,SACEC,oBAAoB,EAIpBC,YAAY,QACP,wBAAwB;AAE/B,2DAA2D,GAC3D,OAAO,MAAMC,qBAAqC,AAAC,CAAA;IACjD,MAAMC,QAAQ,IAAIC;IAClB,OAAO,CAACC;QACN,MAAMC,SAASH,MAAMI,GAAG,CAACF;QACzB,IAAIC,QAAQ,OAAOA;QACnB,6EAA6E;QAC7E,kDAAkD;QAClD,MAAME,aAAaT,KAAKU,OAAO,CAC7B,YAAYC,OAAO,EACnB,MACA,MACAT,aAAaI;QAEf,IAAIM;QACJ,IAAI;YACFA,SAASC,KAAKC,KAAK,CAACf,aAAaU,YAAY;QAC/C,EAAE,OAAOM,OAAO;YACd,MAAM,IAAIC,MACR,CAAC,iDAAiD,EAAEV,YAAY,KAAK,EAAEG,WAAW,EAAE,EAAEM,OAAO;QAEjG;QACAX,MAAMa,GAAG,CAACX,aAAaM;QACvB,OAAOA;IACT;AACF,CAAA,IAAK;AAEL,6DAA6D,GAC7D,OAAO,MAAMM,mBACXjB,qBAAqBE,oBAAoB"}
package/src/index.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- export * from './utils/config';
5
+ export * from './utils/config/index.js';
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../packages/nx-plugin/src/index.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nexport * from './utils/config';\n"],"names":[],"mappings":"AAAA;;;CAGC,GACD,cAAc,0BAAiB"}
1
+ {"version":3,"sources":["../../../../packages/nx-plugin/src/index.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nexport * from './utils/config/index.js';\n"],"names":[],"mappings":"AAAA;;;CAGC,GACD,cAAc,0BAA0B"}