@webiny/project-aws 6.3.0-beta.4 → 6.4.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (393) hide show
  1. package/_templates/appTemplates/admin/src/index.tsx +0 -3
  2. package/abstractions/ApiGqlClient.js +2 -1
  3. package/abstractions/ApiGqlClient.js.map +1 -1
  4. package/abstractions/InvokeLambdaFunction.js +2 -1
  5. package/abstractions/InvokeLambdaFunction.js.map +1 -1
  6. package/abstractions/features/pulumi/AdminPulumi.js +2 -1
  7. package/abstractions/features/pulumi/AdminPulumi.js.map +1 -1
  8. package/abstractions/features/pulumi/ApiPulumi.js +2 -1
  9. package/abstractions/features/pulumi/ApiPulumi.js.map +1 -1
  10. package/abstractions/features/pulumi/CorePulumi.js +2 -1
  11. package/abstractions/features/pulumi/CorePulumi.js.map +1 -1
  12. package/abstractions/features/pulumi/index.js +0 -2
  13. package/abstractions/index.js +0 -2
  14. package/abstractions/services/AdminStackOutputService.js +2 -1
  15. package/abstractions/services/AdminStackOutputService.js.map +1 -1
  16. package/abstractions/services/ApiStackOutputService.js +2 -1
  17. package/abstractions/services/ApiStackOutputService.js.map +1 -1
  18. package/abstractions/services/CoreStackOutputService.js +2 -1
  19. package/abstractions/services/CoreStackOutputService.js.map +1 -1
  20. package/admin.js +5 -4
  21. package/admin.js.map +1 -1
  22. package/api.js +13 -12
  23. package/api.js.map +1 -1
  24. package/apps/createAdminApp.js +11 -12
  25. package/apps/createAdminApp.js.map +1 -1
  26. package/apps/createAdminAppConfig.js +12 -18
  27. package/apps/createAdminAppConfig.js.map +1 -1
  28. package/apps/createApiApp.js +17 -22
  29. package/apps/createApiApp.js.map +1 -1
  30. package/apps/createBlueGreenApp.js +13 -16
  31. package/apps/createBlueGreenApp.js.map +1 -1
  32. package/apps/createCoreApp.js +12 -13
  33. package/apps/createCoreApp.js.map +1 -1
  34. package/apps/createReactAppConfig.d.ts +0 -7
  35. package/apps/createReactAppConfig.js +56 -69
  36. package/apps/createReactAppConfig.js.map +1 -1
  37. package/apps/createSyncSystemApp.js +8 -7
  38. package/apps/createSyncSystemApp.js.map +1 -1
  39. package/apps/index.js +0 -2
  40. package/cli.js +3 -2
  41. package/cli.js.map +1 -1
  42. package/exports/extensions.js +0 -2
  43. package/exports/infra/admin.js +0 -2
  44. package/exports/infra/api.js +0 -2
  45. package/exports/infra/core.js +0 -2
  46. package/exports/infra.js +1 -3
  47. package/extensions/ApiLambdaFunction.js +45 -56
  48. package/extensions/ApiLambdaFunction.js.map +1 -1
  49. package/extensions/ApiRoute.js +90 -104
  50. package/extensions/ApiRoute.js.map +1 -1
  51. package/extensions/AwsDefaultRegion.js +17 -16
  52. package/extensions/AwsDefaultRegion.js.map +1 -1
  53. package/extensions/Cms/ModelFieldCompression.js +16 -15
  54. package/extensions/Cms/ModelFieldCompression.js.map +1 -1
  55. package/extensions/Encryption.js +30 -29
  56. package/extensions/Encryption.js.map +1 -1
  57. package/extensions/Mailer/Smtp.js +15 -14
  58. package/extensions/Mailer/Smtp.js.map +1 -1
  59. package/extensions/Mailer/Smtp.test.js +117 -131
  60. package/extensions/Mailer/Smtp.test.js.map +1 -1
  61. package/extensions/Mailer/SmtpParamsSchema.js +11 -14
  62. package/extensions/Mailer/SmtpParamsSchema.js.map +1 -1
  63. package/extensions/OpenSearch/EnsureOsServiceRoleBeforeCoreDeploy.js +25 -30
  64. package/extensions/OpenSearch/EnsureOsServiceRoleBeforeCoreDeploy.js.map +1 -1
  65. package/extensions/OpenSearch/EnsureOsWasDeployed.js +14 -24
  66. package/extensions/OpenSearch/EnsureOsWasDeployed.js.map +1 -1
  67. package/extensions/OpenSearch/InjectDdbEsLambdaFnHandler.js +25 -21
  68. package/extensions/OpenSearch/InjectDdbEsLambdaFnHandler.js.map +1 -1
  69. package/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.js +26 -22
  70. package/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.js.map +1 -1
  71. package/extensions/OpenSearch.js +30 -31
  72. package/extensions/OpenSearch.js.map +1 -1
  73. package/extensions/ProjectAws/AdminStackOutputService.js +0 -2
  74. package/extensions/ProjectAws/ApiStackOutputService.js +0 -2
  75. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +65 -74
  76. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js.map +1 -1
  77. package/extensions/ProjectAws/AutoInstall.js +15 -14
  78. package/extensions/ProjectAws/AutoInstall.js.map +1 -1
  79. package/extensions/ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.js +15 -19
  80. package/extensions/ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.js.map +1 -1
  81. package/extensions/ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.js +56 -45
  82. package/extensions/ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.js.map +1 -1
  83. package/extensions/ProjectAws/BlueGreenDeployments/SetPrimaryVariantCliCommand.js +57 -55
  84. package/extensions/ProjectAws/BlueGreenDeployments/SetPrimaryVariantCliCommand.js.map +1 -1
  85. package/extensions/ProjectAws/BuildAppWorkspace.js +49 -54
  86. package/extensions/ProjectAws/BuildAppWorkspace.js.map +1 -1
  87. package/extensions/ProjectAws/CoreStackOutputService.js +0 -2
  88. package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js +26 -30
  89. package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js.map +1 -1
  90. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js +25 -38
  91. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js.map +1 -1
  92. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js +22 -17
  93. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js.map +1 -1
  94. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js +22 -17
  95. package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js.map +1 -1
  96. package/extensions/ProjectAws/SetDatabaseSetupOutput.js +20 -21
  97. package/extensions/ProjectAws/SetDatabaseSetupOutput.js.map +1 -1
  98. package/extensions/ProjectAws/UploadAdminAppToS3.js +53 -58
  99. package/extensions/ProjectAws/UploadAdminAppToS3.js.map +1 -1
  100. package/extensions/ProjectAws/definitions.js +13 -6
  101. package/extensions/ProjectAws/definitions.js.map +1 -1
  102. package/extensions/ProjectAws.js +44 -45
  103. package/extensions/ProjectAws.js.map +1 -1
  104. package/extensions/RegisterRoutesPulumi.js +24 -29
  105. package/extensions/RegisterRoutesPulumi.js.map +1 -1
  106. package/extensions/definitions.js +10 -3
  107. package/extensions/definitions.js.map +1 -1
  108. package/extensions/index.js +0 -2
  109. package/features/ApiGqlClient.js +46 -51
  110. package/features/ApiGqlClient.js.map +1 -1
  111. package/features/InvokeLambdaFunction.js +30 -32
  112. package/features/InvokeLambdaFunction.js.map +1 -1
  113. package/features/index.js +0 -2
  114. package/index.js +0 -2
  115. package/infra.js +57 -59
  116. package/infra.js.map +1 -1
  117. package/package.json +14 -14
  118. package/project.js +7 -6
  119. package/project.js.map +1 -1
  120. package/pulumi/apps/admin/createAdminPulumiApp.js +36 -44
  121. package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
  122. package/pulumi/apps/admin/index.js +0 -2
  123. package/pulumi/apps/api/ApiBackgroundTask.js +153 -137
  124. package/pulumi/apps/api/ApiBackgroundTask.js.map +1 -1
  125. package/pulumi/apps/api/ApiCloudfront.js +188 -130
  126. package/pulumi/apps/api/ApiCloudfront.js.map +1 -1
  127. package/pulumi/apps/api/ApiFileManager.js +34 -33
  128. package/pulumi/apps/api/ApiFileManager.js.map +1 -1
  129. package/pulumi/apps/api/ApiGateway.js +67 -74
  130. package/pulumi/apps/api/ApiGateway.js.map +1 -1
  131. package/pulumi/apps/api/ApiGraphql.js +223 -152
  132. package/pulumi/apps/api/ApiGraphql.js.map +1 -1
  133. package/pulumi/apps/api/ApiOutput.js +29 -30
  134. package/pulumi/apps/api/ApiOutput.js.map +1 -1
  135. package/pulumi/apps/api/ApiScheduler.js +94 -92
  136. package/pulumi/apps/api/ApiScheduler.js.map +1 -1
  137. package/pulumi/apps/api/ApiWebsocket.js +141 -133
  138. package/pulumi/apps/api/ApiWebsocket.js.map +1 -1
  139. package/pulumi/apps/api/backgroundTask/definition.js +122 -144
  140. package/pulumi/apps/api/backgroundTask/definition.js.map +1 -1
  141. package/pulumi/apps/api/backgroundTask/policy.js +37 -23
  142. package/pulumi/apps/api/backgroundTask/policy.js.map +1 -1
  143. package/pulumi/apps/api/backgroundTask/role.js +29 -29
  144. package/pulumi/apps/api/backgroundTask/role.js.map +1 -1
  145. package/pulumi/apps/api/backgroundTask/types.js +9 -11
  146. package/pulumi/apps/api/backgroundTask/types.js.map +1 -1
  147. package/pulumi/apps/api/createApiPulumiApp.js +206 -274
  148. package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
  149. package/pulumi/apps/api/handleGuardDutyEvents.js +54 -51
  150. package/pulumi/apps/api/handleGuardDutyEvents.js.map +1 -1
  151. package/pulumi/apps/api/index.js +0 -2
  152. package/pulumi/apps/awsUtils.js +21 -24
  153. package/pulumi/apps/awsUtils.js.map +1 -1
  154. package/pulumi/apps/blueGreen/BlueGreenRouterApiGateway.js +37 -40
  155. package/pulumi/apps/blueGreen/BlueGreenRouterApiGateway.js.map +1 -1
  156. package/pulumi/apps/blueGreen/BlueGreenRouterCloudFront.js +83 -91
  157. package/pulumi/apps/blueGreen/BlueGreenRouterCloudFront.js.map +1 -1
  158. package/pulumi/apps/blueGreen/BlueGreenRouterCloudFrontStore.js +17 -16
  159. package/pulumi/apps/blueGreen/BlueGreenRouterCloudFrontStore.js.map +1 -1
  160. package/pulumi/apps/blueGreen/cloudfront/createCloudFrontDefaultCacheBehaviorPolicies.js +13 -12
  161. package/pulumi/apps/blueGreen/cloudfront/createCloudFrontDefaultCacheBehaviorPolicies.js.map +1 -1
  162. package/pulumi/apps/blueGreen/cloudfront/createCloudFrontFunctionDomainMap.js +9 -14
  163. package/pulumi/apps/blueGreen/cloudfront/createCloudFrontFunctionDomainMap.js.map +1 -1
  164. package/pulumi/apps/blueGreen/cloudfront/createOriginId.js +5 -7
  165. package/pulumi/apps/blueGreen/cloudfront/createOriginId.js.map +1 -1
  166. package/pulumi/apps/blueGreen/constants.js +15 -3
  167. package/pulumi/apps/blueGreen/constants.js.map +1 -1
  168. package/pulumi/apps/blueGreen/createBlueGreenPulumiApp.js +77 -103
  169. package/pulumi/apps/blueGreen/createBlueGreenPulumiApp.js.map +1 -1
  170. package/pulumi/apps/blueGreen/domains/attachDomainsToOutput.js +20 -26
  171. package/pulumi/apps/blueGreen/domains/attachDomainsToOutput.js.map +1 -1
  172. package/pulumi/apps/blueGreen/domains/convertApplicationDomains.js +17 -20
  173. package/pulumi/apps/blueGreen/domains/convertApplicationDomains.js.map +1 -1
  174. package/pulumi/apps/blueGreen/domains/getApplicationDomains.js +51 -61
  175. package/pulumi/apps/blueGreen/domains/getApplicationDomains.js.map +1 -1
  176. package/pulumi/apps/blueGreen/domains/resolveDomains.js +24 -38
  177. package/pulumi/apps/blueGreen/domains/resolveDomains.js.map +1 -1
  178. package/pulumi/apps/blueGreen/functions/buildHandlerFunction.js +7 -14
  179. package/pulumi/apps/blueGreen/functions/buildHandlerFunction.js.map +1 -1
  180. package/pulumi/apps/blueGreen/functions/handler.js +1 -57
  181. package/pulumi/apps/blueGreen/functions/handler.js.map +1 -1
  182. package/pulumi/apps/blueGreen/types.js +0 -3
  183. package/pulumi/apps/blueGreen/validation/validateDeployments.js +19 -24
  184. package/pulumi/apps/blueGreen/validation/validateDeployments.js.map +1 -1
  185. package/pulumi/apps/common/CoreOutput.js +34 -37
  186. package/pulumi/apps/common/CoreOutput.js.map +1 -1
  187. package/pulumi/apps/common/VpcConfig.js +20 -20
  188. package/pulumi/apps/common/VpcConfig.js.map +1 -1
  189. package/pulumi/apps/common/index.js +0 -2
  190. package/pulumi/apps/core/CoreAuditLogsDynamo.js +245 -182
  191. package/pulumi/apps/core/CoreAuditLogsDynamo.js.map +1 -1
  192. package/pulumi/apps/core/CoreCognito.js +117 -106
  193. package/pulumi/apps/core/CoreCognito.js.map +1 -1
  194. package/pulumi/apps/core/CoreDynamo.js +91 -70
  195. package/pulumi/apps/core/CoreDynamo.js.map +1 -1
  196. package/pulumi/apps/core/CoreEventBus.js +10 -9
  197. package/pulumi/apps/core/CoreEventBus.js.map +1 -1
  198. package/pulumi/apps/core/CoreFileManager.js +76 -68
  199. package/pulumi/apps/core/CoreFileManager.js.map +1 -1
  200. package/pulumi/apps/core/CoreOpenSearch.js +281 -305
  201. package/pulumi/apps/core/CoreOpenSearch.js.map +1 -1
  202. package/pulumi/apps/core/CoreVpc.js +155 -156
  203. package/pulumi/apps/core/CoreVpc.js.map +1 -1
  204. package/pulumi/apps/core/WatchCommand.js +94 -96
  205. package/pulumi/apps/core/WatchCommand.js.map +1 -1
  206. package/pulumi/apps/core/cognitoIdentityProviders/amazon.js +16 -22
  207. package/pulumi/apps/core/cognitoIdentityProviders/amazon.js.map +1 -1
  208. package/pulumi/apps/core/cognitoIdentityProviders/apple.js +16 -17
  209. package/pulumi/apps/core/cognitoIdentityProviders/apple.js.map +1 -1
  210. package/pulumi/apps/core/cognitoIdentityProviders/configure.js +44 -50
  211. package/pulumi/apps/core/cognitoIdentityProviders/configure.js.map +1 -1
  212. package/pulumi/apps/core/cognitoIdentityProviders/facebook.js +16 -17
  213. package/pulumi/apps/core/cognitoIdentityProviders/facebook.js.map +1 -1
  214. package/pulumi/apps/core/cognitoIdentityProviders/getIdpConfig.js +7 -8
  215. package/pulumi/apps/core/cognitoIdentityProviders/getIdpConfig.js.map +1 -1
  216. package/pulumi/apps/core/cognitoIdentityProviders/google.js +16 -17
  217. package/pulumi/apps/core/cognitoIdentityProviders/google.js.map +1 -1
  218. package/pulumi/apps/core/cognitoIdentityProviders/index.js +0 -2
  219. package/pulumi/apps/core/cognitoIdentityProviders/oidc.js +17 -18
  220. package/pulumi/apps/core/cognitoIdentityProviders/oidc.js.map +1 -1
  221. package/pulumi/apps/core/configureS3BucketMalwareProtection.js +251 -188
  222. package/pulumi/apps/core/configureS3BucketMalwareProtection.js.map +1 -1
  223. package/pulumi/apps/core/createCorePulumiApp.js +212 -280
  224. package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
  225. package/pulumi/apps/core/index.js +0 -2
  226. package/pulumi/apps/core/webinyWatchCommand/handler.js +45 -32
  227. package/pulumi/apps/core/webinyWatchCommand/handler.js.map +1 -1
  228. package/pulumi/apps/createAppBucket.js +157 -146
  229. package/pulumi/apps/createAppBucket.js.map +1 -1
  230. package/pulumi/apps/customDomain.js +7 -6
  231. package/pulumi/apps/customDomain.js.map +1 -1
  232. package/pulumi/apps/extensions/getAwsTagsFromExtension.js +8 -7
  233. package/pulumi/apps/extensions/getAwsTagsFromExtension.js.map +1 -1
  234. package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js +6 -7
  235. package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js.map +1 -1
  236. package/pulumi/apps/extensions/getOsConfigFromExtension.js +17 -41
  237. package/pulumi/apps/extensions/getOsConfigFromExtension.js.map +1 -1
  238. package/pulumi/apps/extensions/getVpcConfigFromExtension.js +13 -25
  239. package/pulumi/apps/extensions/getVpcConfigFromExtension.js.map +1 -1
  240. package/pulumi/apps/index.js +0 -3
  241. package/pulumi/apps/lambdaUtils.js +57 -61
  242. package/pulumi/apps/lambdaUtils.js.map +1 -1
  243. package/pulumi/apps/react/createReactPulumiApp.js +108 -129
  244. package/pulumi/apps/react/createReactPulumiApp.js.map +1 -1
  245. package/pulumi/apps/react/index.js +0 -2
  246. package/pulumi/apps/syncSystem/SyncSystemDynamo.js +77 -62
  247. package/pulumi/apps/syncSystem/SyncSystemDynamo.js.map +1 -1
  248. package/pulumi/apps/syncSystem/SyncSystemDynamoDb.js +74 -57
  249. package/pulumi/apps/syncSystem/SyncSystemDynamoDb.js.map +1 -1
  250. package/pulumi/apps/syncSystem/SyncSystemEventBus.js +77 -71
  251. package/pulumi/apps/syncSystem/SyncSystemEventBus.js.map +1 -1
  252. package/pulumi/apps/syncSystem/SyncSystemLambda.js +154 -86
  253. package/pulumi/apps/syncSystem/SyncSystemLambda.js.map +1 -1
  254. package/pulumi/apps/syncSystem/SyncSystemOutput.js +14 -13
  255. package/pulumi/apps/syncSystem/SyncSystemOutput.js.map +1 -1
  256. package/pulumi/apps/syncSystem/SyncSystemResolverLambda.js +56 -60
  257. package/pulumi/apps/syncSystem/SyncSystemResolverLambda.js.map +1 -1
  258. package/pulumi/apps/syncSystem/SyncSystemSQS.js +25 -49
  259. package/pulumi/apps/syncSystem/SyncSystemSQS.js.map +1 -1
  260. package/pulumi/apps/syncSystem/SyncSystemWorkerLambda.js +44 -43
  261. package/pulumi/apps/syncSystem/SyncSystemWorkerLambda.js.map +1 -1
  262. package/pulumi/apps/syncSystem/addTableItems.js +35 -45
  263. package/pulumi/apps/syncSystem/addTableItems.js.map +1 -1
  264. package/pulumi/apps/syncSystem/api/addServiceManifest.js +12 -14
  265. package/pulumi/apps/syncSystem/api/addServiceManifest.js.map +1 -1
  266. package/pulumi/apps/syncSystem/api/attachCognitoPermissions.js +49 -55
  267. package/pulumi/apps/syncSystem/api/attachCognitoPermissions.js.map +1 -1
  268. package/pulumi/apps/syncSystem/api/attachDynamoDbPermissions.js +88 -40
  269. package/pulumi/apps/syncSystem/api/attachDynamoDbPermissions.js.map +1 -1
  270. package/pulumi/apps/syncSystem/api/attachEventBusPermissions.js +37 -43
  271. package/pulumi/apps/syncSystem/api/attachEventBusPermissions.js.map +1 -1
  272. package/pulumi/apps/syncSystem/api/attachS3Permissions.js +51 -47
  273. package/pulumi/apps/syncSystem/api/attachS3Permissions.js.map +1 -1
  274. package/pulumi/apps/syncSystem/api/index.js +28 -46
  275. package/pulumi/apps/syncSystem/api/index.js.map +1 -1
  276. package/pulumi/apps/syncSystem/constants.js +2 -1
  277. package/pulumi/apps/syncSystem/constants.js.map +1 -1
  278. package/pulumi/apps/syncSystem/createSyncResourceName.js +2 -7
  279. package/pulumi/apps/syncSystem/createSyncResourceName.js.map +1 -1
  280. package/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js +101 -166
  281. package/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js.map +1 -1
  282. package/pulumi/apps/syncSystem/customApp.js +12 -16
  283. package/pulumi/apps/syncSystem/customApp.js.map +1 -1
  284. package/pulumi/apps/syncSystem/getSyncSystemOutput.js +5 -6
  285. package/pulumi/apps/syncSystem/getSyncSystemOutput.js.map +1 -1
  286. package/pulumi/apps/syncSystem/lambda/createSyncSystemResolverLambdaPolicy.js +108 -42
  287. package/pulumi/apps/syncSystem/lambda/createSyncSystemResolverLambdaPolicy.js.map +1 -1
  288. package/pulumi/apps/syncSystem/types.js +0 -3
  289. package/pulumi/constants.js +2 -1
  290. package/pulumi/constants.js.map +1 -1
  291. package/pulumi/env/awsRegion.js +3 -2
  292. package/pulumi/env/awsRegion.js.map +1 -1
  293. package/pulumi/env/base.js +11 -27
  294. package/pulumi/env/base.js.map +1 -1
  295. package/pulumi/env/env.js +3 -2
  296. package/pulumi/env/env.js.map +1 -1
  297. package/pulumi/env/projectName.js +3 -2
  298. package/pulumi/env/projectName.js.map +1 -1
  299. package/pulumi/env/variant.js +4 -3
  300. package/pulumi/env/variant.js.map +1 -1
  301. package/pulumi/extensions/AdminCustomDomains.js +15 -11
  302. package/pulumi/extensions/AdminCustomDomains.js.map +1 -1
  303. package/pulumi/extensions/AdminPulumi.js +16 -19
  304. package/pulumi/extensions/AdminPulumi.js.map +1 -1
  305. package/pulumi/extensions/ApiCustomDomains.js +15 -11
  306. package/pulumi/extensions/ApiCustomDomains.js.map +1 -1
  307. package/pulumi/extensions/ApiPulumi.js +16 -19
  308. package/pulumi/extensions/ApiPulumi.js.map +1 -1
  309. package/pulumi/extensions/AwsTags.js +11 -10
  310. package/pulumi/extensions/AwsTags.js.map +1 -1
  311. package/pulumi/extensions/BlueGreenDeployments.js +29 -26
  312. package/pulumi/extensions/BlueGreenDeployments.js.map +1 -1
  313. package/pulumi/extensions/CorePulumi.js +16 -19
  314. package/pulumi/extensions/CorePulumi.js.map +1 -1
  315. package/pulumi/extensions/OpenSearch.js +16 -15
  316. package/pulumi/extensions/OpenSearch.js.map +1 -1
  317. package/pulumi/extensions/Vpc.js +21 -20
  318. package/pulumi/extensions/Vpc.js.map +1 -1
  319. package/pulumi/extensions/index.js +12 -10
  320. package/pulumi/extensions/index.js.map +1 -1
  321. package/pulumi/features/AdminPulumi/AdminPulumi.js +18 -14
  322. package/pulumi/features/AdminPulumi/AdminPulumi.js.map +1 -1
  323. package/pulumi/features/AdminPulumi/index.js +0 -2
  324. package/pulumi/features/ApiPulumi/ApiPulumi.js +18 -14
  325. package/pulumi/features/ApiPulumi/ApiPulumi.js.map +1 -1
  326. package/pulumi/features/ApiPulumi/index.js +0 -2
  327. package/pulumi/features/CorePulumi/CorePulumi.js +18 -14
  328. package/pulumi/features/CorePulumi/CorePulumi.js.map +1 -1
  329. package/pulumi/features/CorePulumi/index.js +0 -2
  330. package/pulumi/features/index.js +0 -2
  331. package/pulumi/index.js +0 -2
  332. package/pulumi/types.js +0 -3
  333. package/pulumi/utils/addDomainsUrlsOutputs.js +20 -37
  334. package/pulumi/utils/addDomainsUrlsOutputs.js.map +1 -1
  335. package/pulumi/utils/addServiceManifestTableItem.js +12 -15
  336. package/pulumi/utils/addServiceManifestTableItem.js.map +1 -1
  337. package/pulumi/utils/crawlDirectory.js +10 -15
  338. package/pulumi/utils/crawlDirectory.js.map +1 -1
  339. package/pulumi/utils/createAssetArchive.js +5 -6
  340. package/pulumi/utils/createAssetArchive.js.map +1 -1
  341. package/pulumi/utils/dynamodb.js +26 -27
  342. package/pulumi/utils/dynamodb.js.map +1 -1
  343. package/pulumi/utils/getPresignedPost.js +27 -30
  344. package/pulumi/utils/getPresignedPost.js.map +1 -1
  345. package/pulumi/utils/index.js +1 -3
  346. package/pulumi/utils/lambdaEnvVariables.js +42 -54
  347. package/pulumi/utils/lambdaEnvVariables.js.map +1 -1
  348. package/pulumi/utils/tagResources.js +248 -28
  349. package/pulumi/utils/tagResources.js.map +1 -1
  350. package/pulumi/utils/uploadFolderToS3.js +101 -131
  351. package/pulumi/utils/uploadFolderToS3.js.map +1 -1
  352. package/pulumi/utils/withServiceManifest.js +28 -37
  353. package/pulumi/utils/withServiceManifest.js.map +1 -1
  354. package/services/AdminStackOutputService.js +14 -11
  355. package/services/AdminStackOutputService.js.map +1 -1
  356. package/services/ApiStackOutputService.js +14 -11
  357. package/services/ApiStackOutputService.js.map +1 -1
  358. package/services/CoreStackOutputService.js +14 -11
  359. package/services/CoreStackOutputService.js.map +1 -1
  360. package/utils/getTemplatesFolderPath.js +8 -10
  361. package/utils/getTemplatesFolderPath.js.map +1 -1
  362. package/utils/index.js +0 -2
  363. package/abstractions/features/pulumi/index.js.map +0 -1
  364. package/abstractions/index.js.map +0 -1
  365. package/apps/index.js.map +0 -1
  366. package/exports/extensions.js.map +0 -1
  367. package/exports/infra/admin.js.map +0 -1
  368. package/exports/infra/api.js.map +0 -1
  369. package/exports/infra/core.js.map +0 -1
  370. package/exports/infra.js.map +0 -1
  371. package/extensions/ProjectAws/AdminStackOutputService.js.map +0 -1
  372. package/extensions/ProjectAws/ApiStackOutputService.js.map +0 -1
  373. package/extensions/ProjectAws/CoreStackOutputService.js.map +0 -1
  374. package/extensions/index.js.map +0 -1
  375. package/features/index.js.map +0 -1
  376. package/index.js.map +0 -1
  377. package/pulumi/apps/admin/index.js.map +0 -1
  378. package/pulumi/apps/api/index.js.map +0 -1
  379. package/pulumi/apps/blueGreen/types.js.map +0 -1
  380. package/pulumi/apps/common/index.js.map +0 -1
  381. package/pulumi/apps/core/cognitoIdentityProviders/index.js.map +0 -1
  382. package/pulumi/apps/core/index.js.map +0 -1
  383. package/pulumi/apps/index.js.map +0 -1
  384. package/pulumi/apps/react/index.js.map +0 -1
  385. package/pulumi/apps/syncSystem/types.js.map +0 -1
  386. package/pulumi/features/AdminPulumi/index.js.map +0 -1
  387. package/pulumi/features/ApiPulumi/index.js.map +0 -1
  388. package/pulumi/features/CorePulumi/index.js.map +0 -1
  389. package/pulumi/features/index.js.map +0 -1
  390. package/pulumi/index.js.map +0 -1
  391. package/pulumi/types.js.map +0 -1
  392. package/pulumi/utils/index.js.map +0 -1
  393. package/utils/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["path","invariant","createBuildAdmin","createWatchAdmin","NO_ENV_MESSAGE","createEmptyReactConfig","options","babelModifiers","commandsModifiers","customEnvModifiers","entryModifiers","loadEnvVars","envVars","reduce","env","modifier","Object","assign","process","createOverrides","defaultEntry","join","cwd","entry","babel","config","commands","build","overrides","watch","push","customEnv","seal","createReactAppConfig","customizer"],"sources":["createReactAppConfig.ts"],"sourcesContent":["import path from \"path\";\nimport invariant from \"invariant\";\nimport {\n type BuildAppConfigOverrides,\n createBuildAdmin,\n createWatchAdmin\n} from \"@webiny/build-tools\";\n\nexport interface RunCommandOptions {\n cwd: string;\n command: string;\n env: string;\n variant: string;\n\n [key: string]: any;\n}\n\nexport interface ReactAppConfigCustomizerParams {\n options: RunCommandOptions;\n config: ReactAppConfig;\n}\n\nexport interface ReactAppConfigModifier {\n (params: ReactAppConfigCustomizerParams): void;\n}\n\nexport interface ReactAppFactoryParams {\n options: RunCommandOptions;\n}\n\nexport interface ReactAppCommands {\n [key: string]: () => Promise<any>;\n}\n\nexport interface ReactAppCommandsModifier {\n (commands: ReactAppCommands): ReactAppCommands;\n}\n\nexport interface ReactAppFactory {\n (params: ReactAppFactoryParams): { commands: ReactAppCommands };\n}\n\nexport interface BabelConfig {\n [key: string]: any;\n}\n\nexport interface BabelConfigModifier {\n (config: BabelConfig): BabelConfig;\n}\n\nexport interface EntryModifier {\n (entry: string): string;\n}\n\nexport interface ReactAppEnv {\n [key: string]: string | number | boolean | undefined | string[] | number[];\n}\n\nexport interface CustomEnvModifier {\n (env: ReactAppEnv): ReactAppEnv;\n}\n\nexport interface ReactAppConfig {\n seal(): { commands: ReactAppCommands };\n\n babel(modifier: BabelConfigModifier): void;\n\n entry(modifier: EntryModifier): void;\n\n customEnv(modifier: CustomEnvModifier): void;\n\n commands(commands: ReactAppCommandsModifier): void;\n}\n\nconst NO_ENV_MESSAGE = `Please specify the environment via the \"--env\" argument, for example: \"--env dev\".`;\n\nfunction createEmptyReactConfig(options: RunCommandOptions): ReactAppConfig {\n const babelModifiers: BabelConfigModifier[] = [];\n const commandsModifiers: ReactAppCommandsModifier[] = [];\n const customEnvModifiers: CustomEnvModifier[] = [];\n const entryModifiers: EntryModifier[] = [];\n\n const loadEnvVars = async () => {\n // Run all custom env var modifiers.\n const envVars = customEnvModifiers.reduce<ReactAppEnv>(\n (env, modifier) => modifier(env),\n {}\n );\n Object.assign(process.env, envVars);\n };\n\n const createOverrides = (): BuildAppConfigOverrides => {\n const defaultEntry = path.join(options.cwd, \"src\", \"index.tsx\");\n\n return {\n entry: entryModifiers.reduce((entry, modifier) => modifier(entry), defaultEntry),\n babel(config) {\n return babelModifiers.reduce((config, modifier) => modifier(config), config);\n }\n };\n };\n\n const commands: ReactAppCommands = {\n async build() {\n invariant(options.env, NO_ENV_MESSAGE);\n\n await loadEnvVars();\n\n return createBuildAdmin({ cwd: process.cwd(), overrides: createOverrides() })(options);\n },\n async watch() {\n invariant(options.env, NO_ENV_MESSAGE);\n\n await loadEnvVars();\n\n return createWatchAdmin({ cwd: process.cwd(), overrides: createOverrides() })(options);\n }\n };\n\n return {\n commands(modifier) {\n commandsModifiers.push(modifier);\n },\n babel(modifier) {\n babelModifiers.push(modifier);\n },\n customEnv(modifier: CustomEnvModifier) {\n customEnvModifiers.push(modifier);\n },\n entry(modifier) {\n entryModifiers.push(modifier);\n },\n seal() {\n return {\n commands: commandsModifiers.reduce(\n (commands, modifier) => modifier(commands),\n commands\n )\n };\n }\n };\n}\n\nexport function createReactAppConfig(customizer?: ReactAppConfigModifier): ReactAppFactory {\n return ({ options }) => {\n const config = createEmptyReactConfig(options);\n\n if (typeof customizer === \"function\") {\n customizer({ options, config });\n }\n\n // Generate config object to be returned to the CLI\n return config.seal();\n };\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,OAAOC,SAAS,MAAM,WAAW;AACjC,SAEIC,gBAAgB,EAChBC,gBAAgB,QACb,qBAAqB;AAoE5B,MAAMC,cAAc,GAAG,oFAAoF;AAE3G,SAASC,sBAAsBA,CAACC,OAA0B,EAAkB;EACxE,MAAMC,cAAqC,GAAG,EAAE;EAChD,MAAMC,iBAA6C,GAAG,EAAE;EACxD,MAAMC,kBAAuC,GAAG,EAAE;EAClD,MAAMC,cAA+B,GAAG,EAAE;EAE1C,MAAMC,WAAW,GAAG,MAAAA,CAAA,KAAY;IAC5B;IACA,MAAMC,OAAO,GAAGH,kBAAkB,CAACI,MAAM,CACrC,CAACC,GAAG,EAAEC,QAAQ,KAAKA,QAAQ,CAACD,GAAG,CAAC,EAChC,CAAC,CACL,CAAC;IACDE,MAAM,CAACC,MAAM,CAACC,OAAO,CAACJ,GAAG,EAAEF,OAAO,CAAC;EACvC,CAAC;EAED,MAAMO,eAAe,GAAGA,CAAA,KAA+B;IACnD,MAAMC,YAAY,GAAGpB,IAAI,CAACqB,IAAI,CAACf,OAAO,CAACgB,GAAG,EAAE,KAAK,EAAE,WAAW,CAAC;IAE/D,OAAO;MACHC,KAAK,EAAEb,cAAc,CAACG,MAAM,CAAC,CAACU,KAAK,EAAER,QAAQ,KAAKA,QAAQ,CAACQ,KAAK,CAAC,EAAEH,YAAY,CAAC;MAChFI,KAAKA,CAACC,MAAM,EAAE;QACV,OAAOlB,cAAc,CAACM,MAAM,CAAC,CAACY,MAAM,EAAEV,QAAQ,KAAKA,QAAQ,CAACU,MAAM,CAAC,EAAEA,MAAM,CAAC;MAChF;IACJ,CAAC;EAC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ACvF,OAAO,CAAC;IAAE5B;EAAQ,CAAC,KAAK;IACpB,MAAMmB,MAAM,GAAGpB,sBAAsB,CAACC,OAAO,CAAC;IAE9C,IAAI,OAAO4B,UAAU,KAAK,UAAU,EAAE;MAClCA,UAAU,CAAC;QAAE5B,OAAO;QAAEmB;MAAO,CAAC,CAAC;IACnC;;IAEA;IACA,OAAOA,MAAM,CAACO,IAAI,CAAC,CAAC;EACxB,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"file":"apps/createReactAppConfig.js","sources":["../../src/apps/createReactAppConfig.ts"],"sourcesContent":["import path from \"path\";\nimport invariant from \"invariant\";\nimport {\n type BuildAppConfigOverrides,\n createBuildAdmin,\n createWatchAdmin\n} from \"@webiny/build-tools\";\n\nexport interface RunCommandOptions {\n cwd: string;\n command: string;\n env: string;\n variant: string;\n\n [key: string]: any;\n}\n\nexport interface ReactAppConfigCustomizerParams {\n options: RunCommandOptions;\n config: ReactAppConfig;\n}\n\nexport interface ReactAppConfigModifier {\n (params: ReactAppConfigCustomizerParams): void;\n}\n\nexport interface ReactAppFactoryParams {\n options: RunCommandOptions;\n}\n\nexport interface ReactAppCommands {\n [key: string]: () => Promise<any>;\n}\n\nexport interface ReactAppCommandsModifier {\n (commands: ReactAppCommands): ReactAppCommands;\n}\n\nexport interface ReactAppFactory {\n (params: ReactAppFactoryParams): { commands: ReactAppCommands };\n}\n\nexport interface EntryModifier {\n (entry: string): string;\n}\n\nexport interface ReactAppEnv {\n [key: string]: string | number | boolean | undefined | string[] | number[];\n}\n\nexport interface CustomEnvModifier {\n (env: ReactAppEnv): ReactAppEnv;\n}\n\nexport interface ReactAppConfig {\n seal(): { commands: ReactAppCommands };\n\n entry(modifier: EntryModifier): void;\n\n customEnv(modifier: CustomEnvModifier): void;\n\n commands(commands: ReactAppCommandsModifier): void;\n}\n\nconst NO_ENV_MESSAGE = `Please specify the environment via the \"--env\" argument, for example: \"--env dev\".`;\n\nfunction createEmptyReactConfig(options: RunCommandOptions): ReactAppConfig {\n const commandsModifiers: ReactAppCommandsModifier[] = [];\n const customEnvModifiers: CustomEnvModifier[] = [];\n const entryModifiers: EntryModifier[] = [];\n\n const loadEnvVars = async () => {\n // Run all custom env var modifiers.\n const envVars = customEnvModifiers.reduce<ReactAppEnv>(\n (env, modifier) => modifier(env),\n {}\n );\n Object.assign(process.env, envVars);\n };\n\n const createOverrides = (): BuildAppConfigOverrides => {\n const defaultEntry = path.join(options.cwd, \"src\", \"index.tsx\");\n\n return {\n entry: entryModifiers.reduce((entry, modifier) => modifier(entry), defaultEntry)\n };\n };\n\n const commands: ReactAppCommands = {\n async build() {\n invariant(options.env, NO_ENV_MESSAGE);\n\n await loadEnvVars();\n\n return createBuildAdmin({ cwd: process.cwd(), overrides: createOverrides() })(options);\n },\n async watch() {\n invariant(options.env, NO_ENV_MESSAGE);\n\n await loadEnvVars();\n\n return createWatchAdmin({ cwd: process.cwd(), overrides: createOverrides() })(options);\n }\n };\n\n return {\n commands(modifier) {\n commandsModifiers.push(modifier);\n },\n customEnv(modifier: CustomEnvModifier) {\n customEnvModifiers.push(modifier);\n },\n entry(modifier) {\n entryModifiers.push(modifier);\n },\n seal() {\n return {\n commands: commandsModifiers.reduce(\n (commands, modifier) => modifier(commands),\n commands\n )\n };\n }\n };\n}\n\nexport function createReactAppConfig(customizer?: ReactAppConfigModifier): ReactAppFactory {\n return ({ options }) => {\n const config = createEmptyReactConfig(options);\n\n if (typeof customizer === \"function\") {\n customizer({ options, config });\n }\n\n // Generate config object to be returned to the CLI\n return config.seal();\n };\n}\n"],"names":["NO_ENV_MESSAGE","createEmptyReactConfig","options","commandsModifiers","customEnvModifiers","entryModifiers","loadEnvVars","envVars","env","modifier","Object","process","createOverrides","defaultEntry","path","entry","commands","invariant","createBuildAdmin","createWatchAdmin","createReactAppConfig","customizer","config"],"mappings":";;;AAgEA,MAAMA,iBAAiB;AAEvB,SAASC,uBAAuBC,OAA0B;IACtD,MAAMC,oBAAgD,EAAE;IACxD,MAAMC,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ystem/createSyncSystemPulumiApp.js";
2
- export function createSyncSystemApp() {
3
- return {
4
- id: "sync",
5
- name: "Sync System",
6
- description: "Your project's Sync System.",
7
- pulumi: createSyncSystemPulumiApp()
8
- };
2
+ function createSyncSystemApp() {
3
+ return {
4
+ id: "sync",
5
+ name: "Sync System",
6
+ description: "Your project's Sync System.",
7
+ pulumi: createSyncSystemPulumiApp()
8
+ };
9
9
  }
10
+ export { createSyncSystemApp };
10
11
 
11
12
  //# sourceMappingURL=createSyncSystemApp.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createSyncSystemPulumiApp","createSyncSystemApp","id","name","description","pulumi"],"sources":["createSyncSystemApp.ts"],"sourcesContent":["import { createSyncSystemPulumiApp } from \"~/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js\";\n\nexport function createSyncSystemApp() {\n return {\n id: \"sync\",\n name: \"Sync System\",\n description: \"Your project's Sync System.\",\n pulumi: createSyncSystemPulumiApp()\n };\n}\n"],"mappings":"AAAA,SAASA,yBAAyB;AAElC,OAAO,SAASC,mBAAmBA,CAAA,EAAG;EAClC,OAAO;IACHC,EAAE,EAAE,MAAM;IACVC,IAAI,EAAE,aAAa;IACnBC,WAAW,EAAE,6BAA6B;IAC1CC,MAAM,EAAEL,yBAAyB,CAAC;EACtC,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"file":"apps/createSyncSystemApp.js","sources":["../../src/apps/createSyncSystemApp.ts"],"sourcesContent":["import { createSyncSystemPulumiApp } from \"~/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js\";\n\nexport function createSyncSystemApp() {\n return {\n id: \"sync\",\n name: \"Sync System\",\n description: \"Your project's Sync System.\",\n pulumi: createSyncSystemPulumiApp()\n };\n}\n"],"names":["createSyncSystemApp","createSyncSystemPulumiApp"],"mappings":";AAEO,SAASA;IACZ,OAAO;QACH,IAAI;QACJ,MAAM;QACN,aAAa;QACb,QAAQC;IACZ;AACJ"}
package/apps/index.js CHANGED
@@ -5,5 +5,3 @@ export * from "./createAdminAppConfig.js";
5
5
  export * from "./createReactAppConfig.js";
6
6
  export * from "./createBlueGreenApp.js";
7
7
  export * from "./createSyncSystemApp.js";
8
-
9
- //# sourceMappingURL=index.js.map
package/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { CliCommand } from "@webiny/cli-core/extensions/index.js";
2
- export const Cli = {
3
- Command: CliCommand
2
+ const Cli = {
3
+ Command: CliCommand
4
4
  };
5
+ export { Cli };
5
6
 
6
7
  //# sourceMappingURL=cli.js.map
package/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["CliCommand","Cli","Command"],"sources":["cli.ts"],"sourcesContent":["import { CliCommand } from \"@webiny/cli-core/extensions/index.js\";\n\nexport const Cli = {\n Command: CliCommand\n};\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,sCAAsC;AAEjE,OAAO,MAAMC,GAAG,GAAG;EACfC,OAAO,EAAEF;AACb,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"cli.js","sources":["../src/cli.ts"],"sourcesContent":["import { CliCommand } from \"@webiny/cli-core/extensions/index.js\";\n\nexport const Cli = {\n Command: CliCommand\n};\n"],"names":["Cli","CliCommand"],"mappings":";AAEO,MAAMA,MAAM;IACf,SAASC;AACb"}
@@ -3,5 +3,3 @@ export { Admin } from "../admin.js";
3
3
  export { Cli } from "../cli.js";
4
4
  export { Infra } from "../infra.js";
5
5
  export { Project } from "../project.js";
6
-
7
- //# sourceMappingURL=extensions.js.map
@@ -1,4 +1,2 @@
1
1
  export { AdminPulumi } from "../../abstractions/features/pulumi/AdminPulumi.js";
2
2
  export { AdminStackOutputService as GetAdminStackOutput } from "../../abstractions/services/AdminStackOutputService.js";
3
-
4
- //# sourceMappingURL=admin.js.map
@@ -1,4 +1,2 @@
1
1
  export { ApiPulumi } from "../../abstractions/features/pulumi/ApiPulumi.js";
2
2
  export { ApiStackOutputService as GetApiStackOutput } from "../../abstractions/services/ApiStackOutputService.js";
3
-
4
- //# sourceMappingURL=api.js.map
@@ -1,4 +1,2 @@
1
1
  export { CorePulumi } from "../../abstractions/features/pulumi/CorePulumi.js";
2
2
  export { CoreStackOutputService as GetCoreStackOutput } from "../../abstractions/services/CoreStackOutputService.js";
3
-
4
- //# sourceMappingURL=core.js.map
package/exports/infra.js CHANGED
@@ -1,3 +1 @@
1
- export { ApiStackOutputService as ApiStackOutput, CoreStackOutputService as CoreStackOutput, ApiGqlClient, AdminStackOutputService as AdminStackOutput, InvokeLambdaFunction } from "../abstractions/index.js";
2
-
3
- //# sourceMappingURL=infra.js.map
1
+ export { AdminStackOutputService as AdminStackOutput, ApiGqlClient, ApiStackOutputService as ApiStackOutput, CoreStackOutputService as CoreStackOutput, InvokeLambdaFunction } from "../abstractions/index.js";
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import react from "react";
2
2
  import path from "path";
3
3
  import fs from "fs";
4
4
  import { z } from "zod";
@@ -6,63 +6,52 @@ import { replaceInPath } from "replace-in-path";
6
6
  import { defineExtension } from "@webiny/project/defineExtension/index.js";
7
7
  import { zodSrcPath } from "@webiny/project/defineExtension/zodTypes/zodSrcPath.js";
8
8
  import { ExtensionSrcResolver } from "@webiny/project/utils/index.js";
9
- import { ApiPulumi as ApiPulumiAbstraction } from "../abstractions/features/pulumi/index.js";
10
- import { ApiPulumi } from "../pulumi/extensions/ApiPulumi.js";
9
+ import { ApiPulumi } from "../abstractions/features/pulumi/index.js";
10
+ import { ApiPulumi as ApiPulumi_js_ApiPulumi } from "../pulumi/extensions/ApiPulumi.js";
11
11
  import { getTemplatesFolderPath } from "../utils/index.js";
12
- export const ApiLambdaFunction = defineExtension({
13
- type: "Api/LambdaFunction",
14
- tags: {
15
- runtimeContext: "app-build",
16
- appName: "api"
17
- },
18
- description: "Add a custom Lambda function to the API app.",
19
- multiple: true,
20
- paramsSchema: ({
21
- project
22
- }) => {
23
- return z.object({
24
- functionSrc: zodSrcPath({
25
- project
26
- }),
27
- pulumiSrc: zodSrcPath({
28
- project,
29
- abstraction: ApiPulumiAbstraction
30
- })
31
- });
32
- },
33
- async build(params, ctx) {
34
- const absoluteFunctionSrc = ExtensionSrcResolver.resolvePath(params.functionSrc, ctx.project);
35
-
36
- // Derive function name from the handler file name (without extension).
37
- const functionName = path.parse(absoluteFunctionSrc).name;
38
- const fnWorkspacePath = ctx.project.paths.workspaceFolder.join("apps", "api", functionName).toString();
39
-
40
- // 1. Scaffold from template if the folder doesn't exist yet.
41
- if (!fs.existsSync(fnWorkspacePath)) {
42
- const templatePath = path.join(getTemplatesFolderPath(), "extensions", "ApiLambdaFunction");
43
- fs.cpSync(templatePath, fnWorkspacePath, {
44
- recursive: true
45
- });
46
-
47
- // Replace the {{functionName}} placeholder in package.json.
48
- replaceInPath(path.join(fnWorkspacePath, "package.json"), {
49
- find: "{{functionName}}",
50
- replaceWith: functionName
51
- });
12
+ const ApiLambdaFunction = defineExtension({
13
+ type: "Api/LambdaFunction",
14
+ tags: {
15
+ runtimeContext: "app-build",
16
+ appName: "api"
17
+ },
18
+ description: "Add a custom Lambda function to the API app.",
19
+ multiple: true,
20
+ paramsSchema: ({ project })=>z.object({
21
+ functionSrc: zodSrcPath({
22
+ project
23
+ }),
24
+ pulumiSrc: zodSrcPath({
25
+ project,
26
+ abstraction: ApiPulumi
27
+ })
28
+ }),
29
+ async build (params, ctx) {
30
+ const absoluteFunctionSrc = ExtensionSrcResolver.resolvePath(params.functionSrc, ctx.project);
31
+ const functionName = path.parse(absoluteFunctionSrc).name;
32
+ const fnWorkspacePath = ctx.project.paths.workspaceFolder.join("apps", "api", functionName).toString();
33
+ if (!fs.existsSync(fnWorkspacePath)) {
34
+ const templatePath = path.join(getTemplatesFolderPath(), "extensions", "ApiLambdaFunction");
35
+ fs.cpSync(templatePath, fnWorkspacePath, {
36
+ recursive: true
37
+ });
38
+ replaceInPath(path.join(fnWorkspacePath, "package.json"), {
39
+ find: "{{functionName}}",
40
+ replaceWith: functionName
41
+ });
42
+ }
43
+ const srcDir = path.join(fnWorkspacePath, "src");
44
+ fs.mkdirSync(srcDir, {
45
+ recursive: true
46
+ });
47
+ fs.copyFileSync(absoluteFunctionSrc, path.join(srcDir, "index.ts"));
48
+ },
49
+ render (props) {
50
+ return /*#__PURE__*/ react.createElement(ApiPulumi_js_ApiPulumi, {
51
+ src: props.pulumiSrc
52
+ });
52
53
  }
53
-
54
- // 2. Copy user's handler file → <functionName>/src/index.ts.
55
- const srcDir = path.join(fnWorkspacePath, "src");
56
- fs.mkdirSync(srcDir, {
57
- recursive: true
58
- });
59
- fs.copyFileSync(absoluteFunctionSrc, path.join(srcDir, "index.ts"));
60
- },
61
- render(props) {
62
- return /*#__PURE__*/React.createElement(ApiPulumi, {
63
- src: props.pulumiSrc
64
- });
65
- }
66
54
  });
55
+ export { ApiLambdaFunction };
67
56
 
68
57
  //# sourceMappingURL=ApiLambdaFunction.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","path","fs","z","replaceInPath","defineExtension","zodSrcPath","ExtensionSrcResolver","ApiPulumi","ApiPulumiAbstraction","getTemplatesFolderPath","ApiLambdaFunction","type","tags","runtimeContext","appName","description","multiple","paramsSchema","project","object","functionSrc","pulumiSrc","abstraction","build","params","ctx","absoluteFunctionSrc","resolvePath","functionName","parse","name","fnWorkspacePath","paths","workspaceFolder","join","toString","existsSync","templatePath","cpSync","recursive","find","replaceWith","srcDir","mkdirSync","copyFileSync","render","props","createElement","src"],"sources":["ApiLambdaFunction.tsx"],"sourcesContent":["import React from \"react\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { z } from \"zod\";\nimport { replaceInPath } from \"replace-in-path\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { zodSrcPath } from \"@webiny/project/defineExtension/zodTypes/zodSrcPath.js\";\nimport { ExtensionSrcResolver } from \"@webiny/project/utils/index.js\";\nimport { ApiPulumi as ApiPulumiAbstraction } from \"~/abstractions/features/pulumi/index.js\";\nimport { ApiPulumi } from \"~/pulumi/extensions/ApiPulumi.js\";\nimport { getTemplatesFolderPath } from \"~/utils/index.js\";\n\nexport const ApiLambdaFunction = defineExtension({\n type: \"Api/LambdaFunction\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Add a custom Lambda function to the API app.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n functionSrc: zodSrcPath({ project }),\n pulumiSrc: zodSrcPath({ project, abstraction: ApiPulumiAbstraction })\n });\n },\n async build(params, ctx) {\n const absoluteFunctionSrc = ExtensionSrcResolver.resolvePath(\n params.functionSrc,\n ctx.project\n );\n\n // Derive function name from the handler file name (without extension).\n const functionName = path.parse(absoluteFunctionSrc).name;\n\n const fnWorkspacePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", functionName)\n .toString();\n\n // 1. Scaffold from template if the folder doesn't exist yet.\n if (!fs.existsSync(fnWorkspacePath)) {\n const templatePath = path.join(\n getTemplatesFolderPath(),\n \"extensions\",\n \"ApiLambdaFunction\"\n );\n\n fs.cpSync(templatePath, fnWorkspacePath, { recursive: true });\n\n // Replace the {{functionName}} placeholder in package.json.\n replaceInPath(path.join(fnWorkspacePath, \"package.json\"), {\n find: \"{{functionName}}\",\n replaceWith: functionName\n });\n }\n\n // 2. Copy user's handler file → <functionName>/src/index.ts.\n const srcDir = path.join(fnWorkspacePath, \"src\");\n fs.mkdirSync(srcDir, { recursive: true });\n fs.copyFileSync(absoluteFunctionSrc, path.join(srcDir, \"index.ts\"));\n },\n render(props) {\n return <ApiPulumi src={props.pulumiSrc} />;\n }\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,EAAE,MAAM,IAAI;AACnB,SAASC,CAAC,QAAQ,KAAK;AACvB,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,eAAe,QAAQ,0CAA0C;AAC1E,SAASC,UAAU,QAAQ,wDAAwD;AACnF,SAASC,oBAAoB,QAAQ,gCAAgC;AACrE,SAASC,SAAS,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C,IAAI,CAACH,eAAe,EAAE,cAAc,CAAC,EAAE;QACtDS,IAAI,EAAE,kBAAkB;QACxBC,WAAW,EAAEb;MACjB,CAAC,CAAC;IACN;;IAEA;IACA,MAAMc,MAAM,GAAG1C,IAAI,CAACkC,IAAI,CAACH,eAAe,EAAE,KAAK,CAAC;IAChD9B,EAAE,CAAC0C,SAAS,CAACD,MAAM,EAAE;MAAEH,SAAS,EAAE;IAAK,CAAC,CAAC;IACzCtC,EAAE,CAAC2C,YAAY,CAAClB,mBAAmB,EAAE1B,IAAI,CAACkC,IAAI,CAACQ,MAAM,EAAE,UAAU,CAAC,CAAC;EACvE,CAAC;EACDG,MAAMA,CAACC,KAAK,EAAE;IACV,oBAAO/C,KAAA,CAAAgD,aAAA,CAACxC,SAAS;MAACyC,GAAG,EAAEF,KAAK,CAACzB;IAAU,CAAE,CAAC;EAC9C;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"extensions/ApiLambdaFunction.js","sources":["../../src/extensions/ApiLambdaFunction.tsx"],"sourcesContent":["import React from \"react\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { z } from \"zod\";\nimport { replaceInPath } from \"replace-in-path\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { zodSrcPath } from \"@webiny/project/defineExtension/zodTypes/zodSrcPath.js\";\nimport { ExtensionSrcResolver } from \"@webiny/project/utils/index.js\";\nimport { ApiPulumi as ApiPulumiAbstraction } from \"~/abstractions/features/pulumi/index.js\";\nimport { ApiPulumi } from \"~/pulumi/extensions/ApiPulumi.js\";\nimport { getTemplatesFolderPath } from \"~/utils/index.js\";\n\nexport const ApiLambdaFunction = defineExtension({\n type: \"Api/LambdaFunction\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Add a custom Lambda function to the API app.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n functionSrc: zodSrcPath({ project }),\n pulumiSrc: zodSrcPath({ project, abstraction: ApiPulumiAbstraction })\n });\n },\n async build(params, ctx) {\n const absoluteFunctionSrc = ExtensionSrcResolver.resolvePath(\n params.functionSrc,\n ctx.project\n );\n\n // Derive function name from the handler file name (without extension).\n const functionName = path.parse(absoluteFunctionSrc).name;\n\n const fnWorkspacePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", functionName)\n .toString();\n\n // 1. Scaffold from template if the folder doesn't exist yet.\n if (!fs.existsSync(fnWorkspacePath)) {\n const templatePath = path.join(\n getTemplatesFolderPath(),\n \"extensions\",\n \"ApiLambdaFunction\"\n );\n\n fs.cpSync(templatePath, fnWorkspacePath, { recursive: true });\n\n // Replace the {{functionName}} placeholder in package.json.\n replaceInPath(path.join(fnWorkspacePath, \"package.json\"), {\n find: \"{{functionName}}\",\n replaceWith: functionName\n });\n }\n\n // 2. Copy user's handler file → <functionName>/src/index.ts.\n const srcDir = path.join(fnWorkspacePath, \"src\");\n fs.mkdirSync(srcDir, { recursive: true });\n fs.copyFileSync(absoluteFunctionSrc, path.join(srcDir, \"index.ts\"));\n },\n render(props) {\n return <ApiPulumi src={props.pulumiSrc} />;\n }\n});\n"],"names":["ApiLambdaFunction","defineExtension","project","z","zodSrcPath","ApiPulumiAbstraction","params","ctx","absoluteFunctionSrc","ExtensionSrcResolver","functionName","path","fnWorkspacePath","fs","templatePath","getTemplatesFolderPath","replaceInPath","srcDir","props","ApiPulumi"],"mappings":";;;;;;;;;;;AAYO,MAAMA,oBAAoBC,gBAAgB;IAC7C,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAM;IACpD,aAAa;IACb,UAAU;IACV,cAAc,CAAC,EAAEC,OAAO,EAAE,GACfC,EAAE,MAAM,CAAC;YACZ,aAAaC,WAAW;gBAAEF;YAAQ;YAClC,WAAWE,WAAW;gBAAEF;gBAAS,aAAaG;YAAqB;QACvE;IAEJ,MAAM,OAAMC,MAAM,EAAEC,GAAG;QACnB,MAAMC,sBAAsBC,qBAAqB,WAAW,CACxDH,OAAO,WAAW,EAClBC,IAAI,OAAO;QAIf,MAAMG,eAAeC,KAAK,KAAK,CAACH,qBAAqB,IAAI;QAEzD,MAAMI,kBAAkBL,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CACpD,IAAI,CAAC,QAAQ,OAAOG,cACpB,QAAQ;QAGb,IAAI,CAACG,GAAG,UAAU,CAACD,kBAAkB;YACjC,MAAME,eAAeH,KAAK,IAAI,CAC1BI,0BACA,cACA;YAGJF,GAAG,MAAM,CAACC,cAAcF,iBAAiB;gBAAE,WAAW;YAAK;YAG3DI,cAAcL,KAAK,IAAI,CAACC,iBAAiB,iBAAiB;gBACtD,MAAM;gBACN,aAAaF;YACjB;QACJ;QAGA,MAAMO,SAASN,KAAK,IAAI,CAACC,iBAAiB;QAC1CC,GAAG,SAAS,CAACI,QAAQ;YAAE,WAAW;QAAK;QACvCJ,GAAG,YAAY,CAACL,qBAAqBG,KAAK,IAAI,CAACM,QAAQ;IAC3D;IACA,QAAOC,KAAK;QACR,OAAO,WAAP,GAAO,oBAACC,wBAASA;YAAC,KAAKD,MAAM,SAAS;;IAC1C;AACJ"}
@@ -1,6 +1,6 @@
1
- import React from "react";
1
+ import react from "react";
2
2
  import path from "path";
3
- import crypto from "crypto";
3
+ import crypto_0 from "crypto";
4
4
  import { z } from "zod";
5
5
  import { Node, Project } from "ts-morph";
6
6
  import { defineExtension } from "@webiny/project/defineExtension/index.js";
@@ -9,112 +9,98 @@ import { ExtensionSrcResolver } from "@webiny/project/utils/index.js";
9
9
  import { ApiPulumi } from "../pulumi/extensions/ApiPulumi.js";
10
10
  import { createPathResolver } from "@webiny/project";
11
11
  const p = createPathResolver(import.meta.dirname);
12
- const HTTP_METHODS = ["DELETE", "GET", "HEAD", "PATCH", "POST", "PUT", "OPTIONS", "ANY"];
12
+ const HTTP_METHODS = [
13
+ "DELETE",
14
+ "GET",
15
+ "HEAD",
16
+ "PATCH",
17
+ "POST",
18
+ "PUT",
19
+ "OPTIONS",
20
+ "ANY"
21
+ ];
13
22
  const METHOD_HANDLER = {
14
- DELETE: "onDelete",
15
- GET: "onGet",
16
- HEAD: "onHead",
17
- PATCH: "onPatch",
18
- POST: "onPost",
19
- PUT: "onPut",
20
- OPTIONS: "onOptions",
21
- ANY: "onAll"
23
+ DELETE: "onDelete",
24
+ GET: "onGet",
25
+ HEAD: "onHead",
26
+ PATCH: "onPatch",
27
+ POST: "onPost",
28
+ PUT: "onPut",
29
+ OPTIONS: "onOptions",
30
+ ANY: "onAll"
22
31
  };
23
- export const ApiRoute = defineExtension({
24
- type: "Api/Route",
25
- tags: {
26
- runtimeContext: "app-build",
27
- appName: "api"
28
- },
29
- description: "Register a custom REST route on the API Gateway + GraphQL Lambda.",
30
- multiple: true,
31
- paramsSchema: ({
32
- project
33
- }) => {
34
- return z.object({
35
- path: z.string().startsWith("/"),
36
- method: z.enum(HTTP_METHODS),
37
- // TODO: add zodSrcPath abstraction validation once Route abstraction is wired to zodSrcPath.
38
- src: zodSrcPath({
39
- project
40
- }),
41
- routeName: z.string().optional()
42
- });
43
- },
44
- async build(params, ctx) {
45
- const extensionsTsFilePath = ctx.project.paths.workspaceFolder.join("apps", "api", "graphql", "src", "extensions.ts").toString();
46
- const absoluteSrcFilePath = ExtensionSrcResolver.resolvePath(params.src, ctx.project);
47
-
48
- // Stable alias to avoid naming conflicts across multiple routes.
49
- const hash = crypto.createHash("sha256").update(params.src).digest("hex");
50
- const alias = `ApiRoute_${hash.slice(-10)}`;
51
- const importPath = path.relative(path.dirname(extensionsTsFilePath), absoluteSrcFilePath).replace(/\.tsx?$/, ".js");
52
- const tsProject = new Project();
53
- tsProject.addSourceFileAtPath(extensionsTsFilePath);
54
- const source = tsProject.getSourceFileOrThrow(extensionsTsFilePath);
55
-
56
- // Skip if the route handler is already registered.
57
- if (source.getImportDeclaration(importPath)) {
58
- return;
59
- }
60
-
61
- // Insert handler import after the last existing import.
62
- let insertIndex = 1;
63
- const importDeclarations = source.getImportDeclarations();
64
- if (importDeclarations.length) {
65
- insertIndex = importDeclarations[importDeclarations.length - 1].getChildIndex() + 1;
66
- }
67
- source.insertImportDeclaration(insertIndex, {
68
- defaultImport: alias,
69
- moduleSpecifier: importPath
70
- });
71
-
72
- // Ensure createContextPlugin import exists.
73
- const ctxPluginPath = "@webiny/api/plugins/ContextPlugin.js";
74
- if (!source.getImportDeclaration(ctxPluginPath)) {
75
- const lastIdx = source.getImportDeclarations()[source.getImportDeclarations().length - 1].getChildIndex() + 1;
76
- source.insertImportDeclaration(lastIdx, {
77
- namedImports: ["createContextPlugin"],
78
- moduleSpecifier: ctxPluginPath
79
- });
80
- }
81
-
82
- // Ensure createRoute and Route are imported from @webiny/handler.
83
- const handlerImportPath = "@webiny/handler";
84
- const existingHandlerImport = source.getImportDeclaration(handlerImportPath);
85
- const requiredHandlerImports = ["createRoute", "Route"];
86
- if (!existingHandlerImport) {
87
- const lastIdx = source.getImportDeclarations()[source.getImportDeclarations().length - 1].getChildIndex() + 1;
88
- source.insertImportDeclaration(lastIdx, {
89
- namedImports: requiredHandlerImports,
90
- moduleSpecifier: handlerImportPath
91
- });
92
- } else {
93
- const present = existingHandlerImport.getNamedImports().map(i => i.getName());
94
- for (const name of requiredHandlerImports) {
95
- if (!present.includes(name)) {
96
- existingHandlerImport.addNamedImport(name);
32
+ const ApiRoute = defineExtension({
33
+ type: "Api/Route",
34
+ tags: {
35
+ runtimeContext: "app-build",
36
+ appName: "api"
37
+ },
38
+ description: "Register a custom REST route on the API Gateway + GraphQL Lambda.",
39
+ multiple: true,
40
+ paramsSchema: ({ project })=>z.object({
41
+ path: z.string().startsWith("/"),
42
+ method: z["enum"](HTTP_METHODS),
43
+ src: zodSrcPath({
44
+ project
45
+ }),
46
+ routeName: z.string().optional()
47
+ }),
48
+ async build (params, ctx) {
49
+ const extensionsTsFilePath = ctx.project.paths.workspaceFolder.join("apps", "api", "graphql", "src", "extensions.ts").toString();
50
+ const absoluteSrcFilePath = ExtensionSrcResolver.resolvePath(params.src, ctx.project);
51
+ const hash = crypto_0.createHash("sha256").update(params.src).digest("hex");
52
+ const alias = `ApiRoute_${hash.slice(-10)}`;
53
+ const importPath = path.relative(path.dirname(extensionsTsFilePath), absoluteSrcFilePath).replace(/\.tsx?$/, ".js");
54
+ const tsProject = new Project();
55
+ tsProject.addSourceFileAtPath(extensionsTsFilePath);
56
+ const source = tsProject.getSourceFileOrThrow(extensionsTsFilePath);
57
+ if (source.getImportDeclaration(importPath)) return;
58
+ let insertIndex = 1;
59
+ const importDeclarations = source.getImportDeclarations();
60
+ if (importDeclarations.length) insertIndex = importDeclarations[importDeclarations.length - 1].getChildIndex() + 1;
61
+ source.insertImportDeclaration(insertIndex, {
62
+ defaultImport: alias,
63
+ moduleSpecifier: importPath
64
+ });
65
+ const ctxPluginPath = "@webiny/api/plugins/ContextPlugin.js";
66
+ if (!source.getImportDeclaration(ctxPluginPath)) {
67
+ const lastIdx = source.getImportDeclarations()[source.getImportDeclarations().length - 1].getChildIndex() + 1;
68
+ source.insertImportDeclaration(lastIdx, {
69
+ namedImports: [
70
+ "createContextPlugin"
71
+ ],
72
+ moduleSpecifier: ctxPluginPath
73
+ });
74
+ }
75
+ const handlerImportPath = "@webiny/handler";
76
+ const existingHandlerImport = source.getImportDeclaration(handlerImportPath);
77
+ const requiredHandlerImports = [
78
+ "createRoute",
79
+ "Route"
80
+ ];
81
+ if (existingHandlerImport) {
82
+ const present = existingHandlerImport.getNamedImports().map((i)=>i.getName());
83
+ for (const name of requiredHandlerImports)if (!present.includes(name)) existingHandlerImport.addNamedImport(name);
84
+ } else {
85
+ const lastIdx = source.getImportDeclarations()[source.getImportDeclarations().length - 1].getChildIndex() + 1;
86
+ source.insertImportDeclaration(lastIdx, {
87
+ namedImports: requiredHandlerImports,
88
+ moduleSpecifier: handlerImportPath
89
+ });
97
90
  }
98
- }
91
+ const onMethod = METHOD_HANDLER[params.method];
92
+ const routePath = params.path;
93
+ const pluginsArray = source.getFirstDescendant((node)=>Node.isArrayLiteralExpression(node));
94
+ pluginsArray.addElement(`\ncreateContextPlugin(ctx => {\n\tregisterExtension(ctx.container, ${alias});\n})`);
95
+ pluginsArray.addElement(`\ncreateRoute(({ ${onMethod}, context }) => {\n\t${onMethod}("${routePath}", async (request, reply) => {\n\t\tconst instance = context.container.resolveAll(Route).find(i => i instanceof ${alias})!;\n\t\treturn instance.execute(request, reply);\n\t});\n})`);
96
+ await source.save();
97
+ },
98
+ render () {
99
+ return /*#__PURE__*/ react.createElement(ApiPulumi, {
100
+ src: p("RegisterRoutesPulumi.js")
101
+ });
99
102
  }
100
- const onMethod = METHOD_HANDLER[params.method];
101
- const routePath = params.path;
102
- const pluginsArray = source.getFirstDescendant(node => Node.isArrayLiteralExpression(node));
103
-
104
- // Register factory in DI container.
105
- pluginsArray.addElement(`\ncreateContextPlugin(ctx => {\n\tregisterExtension(ctx.container, ${alias});\n})`);
106
-
107
- // Register Fastify route with hardcoded path/method.
108
- // We use resolveAll(Route) + instanceof to find the correct handler when multiple
109
- // Api.Route extensions are registered.
110
- pluginsArray.addElement(`\ncreateRoute(({ ${onMethod}, context }) => {\n` + `\t${onMethod}("${routePath}", async (request, reply) => {\n` + `\t\tconst instance = context.container.resolveAll(Route).find(i => i instanceof ${alias})!;\n` + `\t\treturn instance.execute(request, reply);\n` + `\t});\n` + `})`);
111
- await source.save();
112
- },
113
- render() {
114
- return /*#__PURE__*/React.createElement(ApiPulumi, {
115
- src: p("RegisterRoutesPulumi.js")
116
- });
117
- }
118
103
  });
104
+ export { ApiRoute };
119
105
 
120
106
  //# sourceMappingURL=ApiRoute.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","path","crypto","z","Node","Project","defineExtension","zodSrcPath","ExtensionSrcResolver","ApiPulumi","createPathResolver","p","import","meta","dirname","HTTP_METHODS","METHOD_HANDLER","DELETE","GET","HEAD","PATCH","POST","PUT","OPTIONS","ANY","ApiRoute","type","tags","runtimeContext","appName","description","multiple","paramsSchema","project","object","string","startsWith","method","enum","src","routeName","optional","build","params","ctx","extensionsTsFilePath","paths","workspaceFolder","join","toString","absoluteSrcFilePath","resolvePath","hash","createHash","update","digest","alias","slice","importPath","relative","replace","tsProject","addSourceFileAtPath","source","getSourceFileOrThrow","getImportDeclaration","insertIndex","importDeclarations","getImportDeclarations","length","getChildIndex","insertImportDeclaration","defaultImport","moduleSpecifier","ctxPluginPath","lastIdx","namedImports","handlerImportPath","existingHandlerImport","requiredHandlerImports","present","getNamedImports","map","i","getName","name","includes","addNamedImport","onMethod","routePath","pluginsArray","getFirstDescendant","node","isArrayLiteralExpression","addElement","save","render","createElement"],"sources":["ApiRoute.tsx"],"sourcesContent":["import React from \"react\";\nimport path from \"path\";\nimport crypto from \"crypto\";\nimport { z } from \"zod\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { zodSrcPath } from \"@webiny/project/defineExtension/zodTypes/zodSrcPath.js\";\nimport { ExtensionSrcResolver } from \"@webiny/project/utils/index.js\";\nimport { ApiPulumi } from \"~/pulumi/extensions/ApiPulumi.js\";\nimport { createPathResolver } from \"@webiny/project\";\n\nconst p = createPathResolver(import.meta.dirname);\n\nconst HTTP_METHODS = [\"DELETE\", \"GET\", \"HEAD\", \"PATCH\", \"POST\", \"PUT\", \"OPTIONS\", \"ANY\"] as const;\n\nconst METHOD_HANDLER: Record<string, string> = {\n DELETE: \"onDelete\",\n GET: \"onGet\",\n HEAD: \"onHead\",\n PATCH: \"onPatch\",\n POST: \"onPost\",\n PUT: \"onPut\",\n OPTIONS: \"onOptions\",\n ANY: \"onAll\"\n};\n\nexport const ApiRoute = defineExtension({\n type: \"Api/Route\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Register a custom REST route on the API Gateway + GraphQL Lambda.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n path: z.string().startsWith(\"/\"),\n method: z.enum(HTTP_METHODS),\n // TODO: add zodSrcPath abstraction validation once Route abstraction is wired to zodSrcPath.\n src: zodSrcPath({ project }),\n routeName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const absoluteSrcFilePath = ExtensionSrcResolver.resolvePath(params.src, ctx.project);\n\n // Stable alias to avoid naming conflicts across multiple routes.\n const hash = crypto.createHash(\"sha256\").update(params.src).digest(\"hex\");\n const alias = `ApiRoute_${hash.slice(-10)}`;\n\n const importPath = path\n .relative(path.dirname(extensionsTsFilePath), absoluteSrcFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n const tsProject = new Project();\n tsProject.addSourceFileAtPath(extensionsTsFilePath);\n const source = tsProject.getSourceFileOrThrow(extensionsTsFilePath);\n\n // Skip if the route handler is already registered.\n if (source.getImportDeclaration(importPath)) {\n return;\n }\n\n // Insert handler import after the last existing import.\n let insertIndex = 1;\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n insertIndex = importDeclarations[importDeclarations.length - 1].getChildIndex() + 1;\n }\n\n source.insertImportDeclaration(insertIndex, {\n defaultImport: alias,\n moduleSpecifier: importPath\n });\n\n // Ensure createContextPlugin import exists.\n const ctxPluginPath = \"@webiny/api/plugins/ContextPlugin.js\";\n if (!source.getImportDeclaration(ctxPluginPath)) {\n const lastIdx =\n source\n .getImportDeclarations()\n [source.getImportDeclarations().length - 1].getChildIndex() + 1;\n source.insertImportDeclaration(lastIdx, {\n namedImports: [\"createContextPlugin\"],\n moduleSpecifier: ctxPluginPath\n });\n }\n\n // Ensure createRoute and Route are imported from @webiny/handler.\n const handlerImportPath = \"@webiny/handler\";\n const existingHandlerImport = source.getImportDeclaration(handlerImportPath);\n const requiredHandlerImports = [\"createRoute\", \"Route\"];\n if (!existingHandlerImport) {\n const lastIdx =\n source\n .getImportDeclarations()\n [source.getImportDeclarations().length - 1].getChildIndex() + 1;\n source.insertImportDeclaration(lastIdx, {\n namedImports: requiredHandlerImports,\n moduleSpecifier: handlerImportPath\n });\n } else {\n const present = existingHandlerImport.getNamedImports().map(i => i.getName());\n for (const name of requiredHandlerImports) {\n if (!present.includes(name)) {\n existingHandlerImport.addNamedImport(name);\n }\n }\n }\n\n const onMethod = METHOD_HANDLER[params.method];\n const routePath = params.path as `/${string}`;\n\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n // Register factory in DI container.\n pluginsArray.addElement(\n `\\ncreateContextPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${alias});\\n})`\n );\n\n // Register Fastify route with hardcoded path/method.\n // We use resolveAll(Route) + instanceof to find the correct handler when multiple\n // Api.Route extensions are registered.\n pluginsArray.addElement(\n `\\ncreateRoute(({ ${onMethod}, context }) => {\\n` +\n `\\t${onMethod}(\"${routePath}\", async (request, reply) => {\\n` +\n `\\t\\tconst instance = context.container.resolveAll(Route).find(i => i instanceof ${alias})!;\\n` +\n `\\t\\treturn instance.execute(request, reply);\\n` +\n `\\t});\\n` +\n `})`\n );\n\n await source.save();\n },\n render() {\n return <ApiPulumi src={p(\"RegisterRoutesPulumi.js\")} />;\n }\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,MAAM,MAAM,QAAQ;AAC3B,SAASC,CAAC,QAAQ,KAAK;AACvB,SAASC,IAAI,EAAEC,OAAO,QAAgC,UAAU;AAChE,SAASC,eAAe,QAAQ,0CAA0C;AAC1E,SAASC,UAAU,QAAQ,wDAAwD;AACnF,SAASC,oBAAoB,QAAQ,gCAAgC;AACrE,SAASC,SAAS;AAClB,SAASC,kBAAkB,QAAQ,iBAAiB;AAEpD,MAAMC,CAAC,GAAGD,kBAAkB,CAACE,MAAM,CAACC,IAAI,CAACC,OAAO,CAAC;AAEjD,MAAMC,YAAY,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM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Y,CAACI,UAAU,CACnB,sEAAsEtC,KAAK,QAC/E,CAAC;;IAED;IACA;IACA;IACAkC,YAAY,CAACI,UAAU,CACnB,oBAAoBN,QAAQ,qBAAqB,GAC7C,KAAKA,QAAQ,KAAKC,SAAS,kCAAkC,GAC7D,mFAAmFjC,KAAK,OAAO,GAC/F,gDAAgD,GAChD,SAAS,GACT,IACR,CAAC;IAED,MAAMO,MAAM,CAACgC,IAAI,CAAC,CAAC;EACvB,CAAC;EACDC,MAAMA,CAAA,EAAG;IACL,oBAAOhG,KAAA,CAAAiG,aAAA,CAACxF,SAAS;MAAC8B,GAAG,EAAE5B,CAAC,CAAC,yBAAyB;IAAE,CAAE,CAAC;EAC3D;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"extensions/ApiRoute.js","sources":["../../src/extensions/ApiRoute.tsx"],"sourcesContent":["import React from \"react\";\nimport path from \"path\";\nimport crypto from \"crypto\";\nimport { z } from \"zod\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { zodSrcPath } from \"@webiny/project/defineExtension/zodTypes/zodSrcPath.js\";\nimport { ExtensionSrcResolver } from \"@webiny/project/utils/index.js\";\nimport { ApiPulumi } from \"~/pulumi/extensions/ApiPulumi.js\";\nimport { createPathResolver } from \"@webiny/project\";\n\nconst p = createPathResolver(import.meta.dirname);\n\nconst HTTP_METHODS = [\"DELETE\", \"GET\", \"HEAD\", \"PATCH\", \"POST\", \"PUT\", \"OPTIONS\", \"ANY\"] as const;\n\nconst METHOD_HANDLER: Record<string, string> = {\n DELETE: \"onDelete\",\n GET: \"onGet\",\n HEAD: \"onHead\",\n PATCH: \"onPatch\",\n POST: \"onPost\",\n PUT: \"onPut\",\n OPTIONS: \"onOptions\",\n ANY: \"onAll\"\n};\n\nexport const ApiRoute = defineExtension({\n type: \"Api/Route\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Register a custom REST route on the API Gateway + GraphQL Lambda.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n path: z.string().startsWith(\"/\"),\n method: z.enum(HTTP_METHODS),\n // TODO: add zodSrcPath abstraction validation once Route abstraction is wired to zodSrcPath.\n src: zodSrcPath({ project }),\n routeName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const absoluteSrcFilePath = ExtensionSrcResolver.resolvePath(params.src, ctx.project);\n\n // Stable alias to avoid naming conflicts across multiple routes.\n const hash = crypto.createHash(\"sha256\").update(params.src).digest(\"hex\");\n const alias = `ApiRoute_${hash.slice(-10)}`;\n\n const importPath = path\n .relative(path.dirname(extensionsTsFilePath), absoluteSrcFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n const tsProject = new Project();\n tsProject.addSourceFileAtPath(extensionsTsFilePath);\n const source = tsProject.getSourceFileOrThrow(extensionsTsFilePath);\n\n // Skip if the route handler is already registered.\n if (source.getImportDeclaration(importPath)) {\n return;\n }\n\n // Insert handler import after the last existing import.\n let insertIndex = 1;\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n insertIndex = importDeclarations[importDeclarations.length - 1].getChildIndex() + 1;\n }\n\n source.insertImportDeclaration(insertIndex, {\n defaultImport: alias,\n moduleSpecifier: importPath\n });\n\n // Ensure createContextPlugin import exists.\n const ctxPluginPath = \"@webiny/api/plugins/ContextPlugin.js\";\n if (!source.getImportDeclaration(ctxPluginPath)) {\n const lastIdx =\n source\n .getImportDeclarations()\n [source.getImportDeclarations().length - 1].getChildIndex() + 1;\n source.insertImportDeclaration(lastIdx, {\n namedImports: [\"createContextPlugin\"],\n moduleSpecifier: ctxPluginPath\n });\n }\n\n // Ensure createRoute and Route are imported from @webiny/handler.\n const handlerImportPath = \"@webiny/handler\";\n const existingHandlerImport = source.getImportDeclaration(handlerImportPath);\n const requiredHandlerImports = [\"createRoute\", \"Route\"];\n if (!existingHandlerImport) {\n const lastIdx =\n source\n .getImportDeclarations()\n [source.getImportDeclarations().length - 1].getChildIndex() + 1;\n source.insertImportDeclaration(lastIdx, {\n namedImports: requiredHandlerImports,\n moduleSpecifier: handlerImportPath\n });\n } else {\n const present = existingHandlerImport.getNamedImports().map(i => i.getName());\n for (const name of requiredHandlerImports) {\n if (!present.includes(name)) {\n existingHandlerImport.addNamedImport(name);\n }\n }\n }\n\n const onMethod = METHOD_HANDLER[params.method];\n const routePath = params.path as `/${string}`;\n\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n // Register factory in DI container.\n pluginsArray.addElement(\n `\\ncreateContextPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${alias});\\n})`\n );\n\n // Register Fastify route with hardcoded path/method.\n // We use resolveAll(Route) + instanceof to find the correct handler when multiple\n // Api.Route extensions are registered.\n pluginsArray.addElement(\n `\\ncreateRoute(({ ${onMethod}, context }) => {\\n` +\n `\\t${onMethod}(\"${routePath}\", async (request, reply) => {\\n` +\n `\\t\\tconst instance = context.container.resolveAll(Route).find(i => i instanceof ${alias})!;\\n` +\n `\\t\\treturn instance.execute(request, reply);\\n` +\n `\\t});\\n` +\n `})`\n );\n\n await source.save();\n },\n render() {\n return <ApiPulumi src={p(\"RegisterRoutesPulumi.js\")} />;\n }\n});\n"],"names":["p","createPathResolver","HTTP_METHODS","METHOD_HANDLER","ApiRoute","defineExtension","project","z","zodSrcPath","params","ctx","extensionsTsFilePath","absoluteSrcFilePath","ExtensionSrcResolver","hash","crypto","alias","importPath","path","tsProject","Project","source","insertIndex","importDeclarations","ctxPluginPath","lastIdx","handlerImportPath","existingHandlerImport","requiredHandlerImports","present","i","name","onMethod","routePath","pluginsArray","node","Node","ApiPulumi"],"mappings":";;;;;;;;;;AAWA,MAAMA,IAAIC,mBAAmB,YAAY,OAAO;AAEhD,MAAMC,eAAe;IAAC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D,MAAMK,OAAO,IAAI;IACrB;IACA;QACI,OAAO,WAAP,GAAO,oBAACgB,WAASA;YAAC,KAAKrC,EAAE;;IAC7B;AACJ"}
@@ -1,22 +1,23 @@
1
- import React from "react";
1
+ import react from "react";
2
2
  import { z } from "zod";
3
3
  import { defineExtension } from "@webiny/project/defineExtension/index.js";
4
4
  import { EnvVar } from "@webiny/project/extensions/index.js";
5
- export const AwsDefaultRegion = defineExtension({
6
- type: "Aws/DefaultRegion",
7
- tags: {
8
- runtimeContext: "project"
9
- },
10
- description: "Set the default AWS region for the project.",
11
- paramsSchema: z.object({
12
- name: z.string().describe("The AWS region name.")
13
- }),
14
- render(props) {
15
- return /*#__PURE__*/React.createElement(EnvVar, {
16
- varName: "AWS_REGION",
17
- value: props.name
18
- });
19
- }
5
+ const AwsDefaultRegion = defineExtension({
6
+ type: "Aws/DefaultRegion",
7
+ tags: {
8
+ runtimeContext: "project"
9
+ },
10
+ description: "Set the default AWS region for the project.",
11
+ paramsSchema: z.object({
12
+ name: z.string().describe("The AWS region name.")
13
+ }),
14
+ render (props) {
15
+ return /*#__PURE__*/ react.createElement(EnvVar, {
16
+ varName: "AWS_REGION",
17
+ value: props.name
18
+ });
19
+ }
20
20
  });
21
+ export { AwsDefaultRegion };
21
22
 
22
23
  //# sourceMappingURL=AwsDefaultRegion.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","z","defineExtension","EnvVar","AwsDefaultRegion","type","tags","runtimeContext","description","paramsSchema","object","name","string","describe","render","props","createElement","varName","value"],"sources":["AwsDefaultRegion.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { EnvVar } from \"@webiny/project/extensions/index.js\";\n\nexport const AwsDefaultRegion = defineExtension({\n type: \"Aws/DefaultRegion\",\n tags: { runtimeContext: \"project\" },\n description: \"Set the default AWS region for the project.\",\n paramsSchema: z.object({\n name: z.string().describe(\"The AWS region name.\")\n }),\n render(props) {\n return <EnvVar varName=\"AWS_REGION\" value={props.name} />;\n }\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,CAAC,QAAQ,KAAK;AACvB,SAASC,eAAe,QAAQ,0CAA0C;AAC1E,SAASC,MAAM,QAAQ,qCAAqC;AAE5D,OAAO,MAAMC,gBAAgB,GAAGF,eAAe,CAAC;EAC5CG,IAAI,EAAE,mBAAmB;EACzBC,IAAI,EAAE;IAAEC,cAAc,EAAE;EAAU,CAAC;EACnCC,WAAW,EAAE,6CAA6C;EAC1DC,YAAY,EAAER,CAAC,CAACS,MAAM,CAAC;IACnBC,IAAI,EAAEV,CAAC,CAACW,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,sBAAsB;EACpD,CAAC,CAAC;EACFC,MAAMA,CAACC,KAAK,EAAE;IACV,oBAAOf,KAAA,CAAAgB,aAAA,CAACb,MAAM;MAACc,OAAO,EAAC,YAAY;MAACC,KAAK,EAAEH,KAAK,CAACJ;IAAK,CAAE,CAAC;EAC7D;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"extensions/AwsDefaultRegion.js","sources":["../../src/extensions/AwsDefaultRegion.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { EnvVar } from \"@webiny/project/extensions/index.js\";\n\nexport const AwsDefaultRegion = defineExtension({\n type: \"Aws/DefaultRegion\",\n tags: { runtimeContext: \"project\" },\n description: \"Set the default AWS region for the project.\",\n paramsSchema: z.object({\n name: z.string().describe(\"The AWS region name.\")\n }),\n render(props) {\n return <EnvVar varName=\"AWS_REGION\" value={props.name} />;\n }\n});\n"],"names":["AwsDefaultRegion","defineExtension","z","props","EnvVar"],"mappings":";;;;AAKO,MAAMA,mBAAmBC,gBAAgB;IAC5C,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QACnB,MAAMA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC9B;IACA,QAAOC,KAAK;QACR,OAAO,WAAP,GAAO,oBAACC,QAAMA;YAAC,SAAQ;YAAa,OAAOD,MAAM,IAAI;;IACzD;AACJ"}