@webiny/project-aws 6.6.0-alpha.13 → 6.6.0-alpha.14

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 (66) hide show
  1. package/_templates/extensions/TenantStorages/ddb/api/graphql/src/index.ts +25 -0
  2. package/_templates/extensions/TenantStorages/ddb/api/graphql/src/web.ts +17 -0
  3. package/_templates/extensions/TenantStorages/ddb-os/api/graphql/src/index.ts +25 -0
  4. package/_templates/extensions/TenantStorages/ddb-os/api/graphql/src/web.ts +17 -0
  5. package/_templates/extensions/TenantStorages/pg/api/graphql/src/index.ts +25 -0
  6. package/_templates/extensions/TenantStorages/pg/api/graphql/src/web.ts +16 -0
  7. package/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.d.ts +3 -2
  8. package/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.js +7 -3
  9. package/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.js.map +1 -1
  10. package/extensions/Postgres/ReplaceApiLambdaFnHandlers.d.ts +3 -2
  11. package/extensions/Postgres/ReplaceApiLambdaFnHandlers.js +6 -2
  12. package/extensions/Postgres/ReplaceApiLambdaFnHandlers.js.map +1 -1
  13. package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.js +6 -8
  14. package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.js.map +1 -1
  15. package/extensions/Postgres/assertPostgresNetwork.d.ts +19 -0
  16. package/extensions/Postgres/assertPostgresNetwork.js +16 -0
  17. package/extensions/Postgres/assertPostgresNetwork.js.map +1 -0
  18. package/extensions/Postgres/copyPgRuntimeModules.js +1 -1
  19. package/extensions/Postgres/copyPgRuntimeModules.js.map +1 -1
  20. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.d.ts +17 -2
  21. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +26 -19
  22. package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js.map +1 -1
  23. package/extensions/ProjectAws/TenantStorages/AddTenantStorages.d.ts +34 -0
  24. package/extensions/ProjectAws/TenantStorages/AddTenantStorages.js +55 -0
  25. package/extensions/ProjectAws/TenantStorages/AddTenantStorages.js.map +1 -0
  26. package/extensions/ProjectAws/TenantStorages/ApplyTenantStoragesApiEntry.d.ts +26 -0
  27. package/extensions/ProjectAws/TenantStorages/ApplyTenantStoragesApiEntry.js +49 -0
  28. package/extensions/ProjectAws/TenantStorages/ApplyTenantStoragesApiEntry.js.map +1 -0
  29. package/extensions/ProjectAws/TenantStorages/CopyPgModulesForTenantStorages.d.ts +17 -0
  30. package/extensions/ProjectAws/TenantStorages/CopyPgModulesForTenantStorages.js +26 -0
  31. package/extensions/ProjectAws/TenantStorages/CopyPgModulesForTenantStorages.js.map +1 -0
  32. package/extensions/ProjectAws/TenantStorages/EnsureStoragesNotRemoved.d.ts +41 -0
  33. package/extensions/ProjectAws/TenantStorages/EnsureStoragesNotRemoved.js +55 -0
  34. package/extensions/ProjectAws/TenantStorages/EnsureStoragesNotRemoved.js.map +1 -0
  35. package/extensions/ProjectAws/TenantStorages/ValidateTenantStoragesBeforeCoreDeploy.d.ts +48 -0
  36. package/extensions/ProjectAws/TenantStorages/ValidateTenantStoragesBeforeCoreDeploy.js +78 -0
  37. package/extensions/ProjectAws/TenantStorages/ValidateTenantStoragesBeforeCoreDeploy.js.map +1 -0
  38. package/extensions/ProjectAws.js +11 -1
  39. package/extensions/ProjectAws.js.map +1 -1
  40. package/infra.d.ts +11 -0
  41. package/infra.js +4 -1
  42. package/infra.js.map +1 -1
  43. package/package.json +12 -12
  44. package/project.d.ts +3 -2
  45. package/pulumi/apps/api/ApiSchemaSetup.d.ts +34 -12
  46. package/pulumi/apps/api/ApiSchemaSetup.js +30 -7
  47. package/pulumi/apps/api/ApiSchemaSetup.js.map +1 -1
  48. package/pulumi/apps/api/createApiPulumiApp.js +14 -7
  49. package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
  50. package/pulumi/apps/common/CoreOutput.d.ts +11 -0
  51. package/pulumi/apps/common/CoreOutput.js +2 -1
  52. package/pulumi/apps/common/CoreOutput.js.map +1 -1
  53. package/pulumi/apps/core/CorePostgres.d.ts +2 -0
  54. package/pulumi/apps/core/CorePostgres.js +24 -19
  55. package/pulumi/apps/core/CorePostgres.js.map +1 -1
  56. package/pulumi/apps/core/coreVpcEndpoints.d.ts +7 -0
  57. package/pulumi/apps/core/coreVpcEndpoints.js +15 -11
  58. package/pulumi/apps/core/coreVpcEndpoints.js.map +1 -1
  59. package/pulumi/apps/core/createCorePulumiApp.js +8 -1
  60. package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
  61. package/pulumi/apps/extensions/getTenantStoragesFromExtension.d.ts +19 -0
  62. package/pulumi/apps/extensions/getTenantStoragesFromExtension.js +32 -0
  63. package/pulumi/apps/extensions/getTenantStoragesFromExtension.js.map +1 -0
  64. package/pulumi/extensions/index.d.ts +8 -0
  65. package/pulumi/extensions/index.js +2 -1
  66. package/pulumi/extensions/index.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/ProjectAws.js","sources":["../../src/extensions/ProjectAws.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n AdminBeforeBuild,\n AdminBeforeWatch,\n ApiBeforeWatch,\n DatabaseSetup,\n ExtensionDefinitions,\n Project,\n ProjectImplementation\n} from \"@webiny/project/extensions/index.js\";\nimport { AdminAfterDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { AfterDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiAfterDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiBeforeDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { BeforeDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { CoreBeforeDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { createPathResolver } from \"@webiny/project\";\nimport { CliCommand } from \"@webiny/cli-core/extensions/index.js\";\nimport { CorePulumi } from \"~/pulumi/extensions/CorePulumi.js\";\nimport \"./registerExtensionImplementations.js\";\n\nconst p = createPathResolver(import.meta.dirname);\n\nexport const ProjectAws = () => {\n return (\n <>\n <Project />\n\n {/* Database Setup - default to DynamoDB only */}\n <DatabaseSetup setupName=\"ddb\" />\n\n {/* Set database setup output value in Core stack */}\n <CorePulumi src={p(\"ProjectAws/SetDatabaseSetupOutput.js\")} />\n\n {/* Stack Output Services */}\n <ProjectImplementation src={p(\"ProjectAws/CoreStackOutputService.js\")} singleton />\n <ProjectImplementation src={p(\"ProjectAws/ApiStackOutputService.js\")} singleton />\n <ProjectImplementation src={p(\"ProjectAws/AdminStackOutputService.js\")} singleton />\n\n <ProjectImplementation src={p(\"../features/InvokeLambdaFunction.js\")} singleton />\n <ProjectImplementation src={p(\"../features/ApiGqlClient.js\")} singleton />\n\n <AdminAfterDeploy src={p(\"ProjectAws/UploadAdminAppToS3.js\")} />\n\n <ApiAfterDeploy src={p(\"ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js\")} />\n <ExtensionDefinitions src={p(\"definitions.js\")} />\n <ExtensionDefinitions src={p(\"ProjectAws/definitions.js\")} />\n\n {/* Admin env vars */}\n <AdminBeforeBuild src={p(\"ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js\")} />\n <AdminBeforeWatch src={p(\"ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js\")} />\n\n {/* Deployment gates — AWS-only (there is no Pulumi stack output to check off-AWS) */}\n {/* First, so its message wins: watch can't reach Aurora, deployed or not. */}\n <ApiBeforeWatch src={p(\"ProjectAws/RefuseApiWatchWithPostgres.js\")} />\n <ApiBeforeWatch src={p(\"ProjectAws/EnsureApiDeployedBeforeWatch.js\")} />\n <AdminBeforeBuild src={p(\"ProjectAws/EnsureApiDeployedBeforeAdminBuild.js\")} />\n <AdminBeforeWatch src={p(\"ProjectAws/EnsureApiDeployedBeforeAdminWatch.js\")} />\n <ApiBeforeDeploy src={p(\"ProjectAws/EnsureCoreDeployedBeforeApiDeploy.js\")} />\n <CoreBeforeDeploy src={p(\"ProjectAws/ValidateProductionPulumiState.js\")} />\n <CoreBeforeDeploy src={p(\"ProjectAws/EnsurePostgresSetupUnchanged.js\")} />\n\n {/* Deploy-time hooks — standalone hosting type has no deploy command, so these are AWS-only */}\n <BeforeDeploy src={p(\"ProjectAws/EnsureTelemetryEnabledForOss.js\")} />\n <BeforeDeploy src={p(\"ProjectAws/ValidateEncryptionBeforeDeploy.js\")} />\n <AdminAfterDeploy src={p(\"ProjectAws/TelemetryNoLongerNewUser.js\")} />\n\n {/* AWS credentials check */}\n <BeforeDeploy src={p(\"ProjectAws/EnsureAwsCredentialsBeforeDeploy.js\")} />\n\n {/* Blue-green */}\n <CliCommand src={p(\"ProjectAws/BlueGreenDeployments/SetPrimaryVariantCliCommand.js\")} />\n <BeforeDeploy src={p(\"ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.js\")} />\n <AfterDeploy\n src={p(\"ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.js\")}\n />\n </>\n );\n};\n"],"names":["p","createPathResolver","ProjectAws","Project","DatabaseSetup","CorePulumi","ProjectImplementation","AdminAfterDeploy","ApiAfterDeploy","ExtensionDefinitions","AdminBeforeBuild","AdminBeforeWatch","ApiBeforeWatch","ApiBeforeDeploy","CoreBeforeDeploy","BeforeDeploy","CliCommand","AfterDeploy"],"mappings":";;;;;;;AAqBA,MAAMA,IAAIC,mBAAmB,YAAY,OAAO;AAEzC,MAAMC,aAAa,IACf,WAAP,GACI,wDACI,oBAACC,SAAOA,OAAAA,WAAAA,GAGR,oBAACC,eAAaA;QAAC,WAAU;sBAGzB,oBAACC,YAAUA;QAAC,KAAKL,EAAE;sBAGnB,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAAyC;sBACvE,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAAwC;sBACtE,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAA0C;sBAExE,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAAwC;sBACtE,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAAgC;sBAE9D,oBAACO,kBAAgBA;QAAC,KAAKP,EAAE;sBAEzB,oBAACQ,gBAAcA;QAAC,KAAKR,EAAE;sBACvB,oBAACS,sBAAoBA;QAAC,KAAKT,EAAE;sBAC7B,oBAACS,sBAAoBA;QAAC,KAAKT,EAAE;sBAG7B,oBAACU,kBAAgBA;QAAC,KAAKV,EAAE;sBACzB,oBAACW,kBAAgBA;QAAC,KAAKX,EAAE;sBAIzB,oBAACY,gBAAcA;QAAC,KAAKZ,EAAE;sBACvB,oBAACY,gBAAcA;QAAC,KAAKZ,EAAE;sBACvB,oBAACU,kBAAgBA;QAAC,KAAKV,EAAE;sBACzB,oBAACW,kBAAgBA;QAAC,KAAKX,EAAE;sBACzB,oBAACa,iBAAeA;QAAC,KAAKb,EAAE;sBACxB,oBAACc,kBAAgBA;QAAC,KAAKd,EAAE;sBACzB,oBAACc,kBAAgBA;QAAC,KAAKd,EAAE;sBAGzB,oBAACe,cAAYA;QAAC,KAAKf,EAAE;sBACrB,oBAACe,cAAYA;QAAC,KAAKf,EAAE;sBACrB,oBAACO,kBAAgBA;QAAC,KAAKP,EAAE;sBAGzB,oBAACe,cAAYA;QAAC,KAAKf,EAAE;sBAGrB,oBAACgB,YAAUA;QAAC,KAAKhB,EAAE;sBACnB,oBAACe,cAAYA;QAAC,KAAKf,EAAE;sBACrB,oBAACiB,aAAWA;QACR,KAAKjB,EAAE"}
1
+ {"version":3,"file":"extensions/ProjectAws.js","sources":["../../src/extensions/ProjectAws.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n AdminBeforeBuild,\n AdminBeforeWatch,\n ApiAfterBuild,\n ApiBeforeWatch,\n DatabaseSetup,\n ExtensionDefinitions,\n Project,\n ProjectDecorator,\n ProjectImplementation\n} from \"@webiny/project/extensions/index.js\";\nimport { AdminAfterDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { AfterDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiAfterDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiBeforeDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { BeforeDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { CoreBeforeDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { createPathResolver } from \"@webiny/project\";\nimport { CliCommand } from \"@webiny/cli-core/extensions/index.js\";\nimport { CorePulumi } from \"~/pulumi/extensions/CorePulumi.js\";\nimport \"./registerExtensionImplementations.js\";\n\nconst p = createPathResolver(import.meta.dirname);\n\nexport const ProjectAws = () => {\n return (\n <>\n <Project />\n\n {/* Database Setup - default to DynamoDB only */}\n <DatabaseSetup setupName=\"ddb\" />\n\n {/* Set database setup output value in Core stack */}\n <CorePulumi src={p(\"ProjectAws/SetDatabaseSetupOutput.js\")} />\n\n {/* Stack Output Services */}\n <ProjectImplementation src={p(\"ProjectAws/CoreStackOutputService.js\")} singleton />\n <ProjectImplementation src={p(\"ProjectAws/ApiStackOutputService.js\")} singleton />\n <ProjectImplementation src={p(\"ProjectAws/AdminStackOutputService.js\")} singleton />\n\n <ProjectImplementation src={p(\"../features/InvokeLambdaFunction.js\")} singleton />\n <ProjectImplementation src={p(\"../features/ApiGqlClient.js\")} singleton />\n\n <AdminAfterDeploy src={p(\"ProjectAws/UploadAdminAppToS3.js\")} />\n\n <ApiAfterDeploy src={p(\"ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js\")} />\n <ExtensionDefinitions src={p(\"definitions.js\")} />\n <ExtensionDefinitions src={p(\"ProjectAws/definitions.js\")} />\n\n {/* Admin env vars */}\n <AdminBeforeBuild src={p(\"ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js\")} />\n <AdminBeforeWatch src={p(\"ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js\")} />\n\n {/* Deployment gates — AWS-only (there is no Pulumi stack output to check off-AWS) */}\n {/* First, so its message wins: watch can't reach Aurora, deployed or not. */}\n <ApiBeforeWatch src={p(\"ProjectAws/RefuseApiWatchWithPostgres.js\")} />\n <ApiBeforeWatch src={p(\"ProjectAws/EnsureApiDeployedBeforeWatch.js\")} />\n <AdminBeforeBuild src={p(\"ProjectAws/EnsureApiDeployedBeforeAdminBuild.js\")} />\n <AdminBeforeWatch src={p(\"ProjectAws/EnsureApiDeployedBeforeAdminWatch.js\")} />\n <ApiBeforeDeploy src={p(\"ProjectAws/EnsureCoreDeployedBeforeApiDeploy.js\")} />\n <CoreBeforeDeploy src={p(\"ProjectAws/ValidateProductionPulumiState.js\")} />\n <CoreBeforeDeploy src={p(\"ProjectAws/EnsurePostgresSetupUnchanged.js\")} />\n\n {/*\n * Tenant storages (<Infra.TenantStorage.AuroraPostgres>): rendered here, once, and each\n * hook reads every declaration from the config. The guard runs even when a declaration is\n * deleted, and the output it compares with is written on every deploy. Without\n * declarations, only the storages line is printed and an empty list is written.\n */}\n <CoreBeforeDeploy\n src={p(\"ProjectAws/TenantStorages/ValidateTenantStoragesBeforeCoreDeploy.js\")}\n />\n <CoreBeforeDeploy src={p(\"ProjectAws/TenantStorages/EnsureStoragesNotRemoved.js\")} />\n <CorePulumi src={p(\"ProjectAws/TenantStorages/AddTenantStorages.js\")} />\n <ProjectDecorator src={p(\"ProjectAws/TenantStorages/ApplyTenantStoragesApiEntry.js\")} />\n <ApiAfterBuild src={p(\"ProjectAws/TenantStorages/CopyPgModulesForTenantStorages.js\")} />\n\n {/* Deploy-time hooks — standalone hosting type has no deploy command, so these are AWS-only */}\n <BeforeDeploy src={p(\"ProjectAws/EnsureTelemetryEnabledForOss.js\")} />\n <BeforeDeploy src={p(\"ProjectAws/ValidateEncryptionBeforeDeploy.js\")} />\n <AdminAfterDeploy src={p(\"ProjectAws/TelemetryNoLongerNewUser.js\")} />\n\n {/* AWS credentials check */}\n <BeforeDeploy src={p(\"ProjectAws/EnsureAwsCredentialsBeforeDeploy.js\")} />\n\n {/* Blue-green */}\n <CliCommand src={p(\"ProjectAws/BlueGreenDeployments/SetPrimaryVariantCliCommand.js\")} />\n <BeforeDeploy src={p(\"ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.js\")} />\n <AfterDeploy\n src={p(\"ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.js\")}\n />\n </>\n );\n};\n"],"names":["p","createPathResolver","ProjectAws","Project","DatabaseSetup","CorePulumi","ProjectImplementation","AdminAfterDeploy","ApiAfterDeploy","ExtensionDefinitions","AdminBeforeBuild","AdminBeforeWatch","ApiBeforeWatch","ApiBeforeDeploy","CoreBeforeDeploy","ProjectDecorator","ApiAfterBuild","BeforeDeploy","CliCommand","AfterDeploy"],"mappings":";;;;;;;AAuBA,MAAMA,IAAIC,mBAAmB,YAAY,OAAO;AAEzC,MAAMC,aAAa,IACf,WAAP,GACI,wDACI,oBAACC,SAAOA,OAAAA,WAAAA,GAGR,oBAACC,eAAaA;QAAC,WAAU;sBAGzB,oBAACC,YAAUA;QAAC,KAAKL,EAAE;sBAGnB,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAAyC;sBACvE,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAAwC;sBACtE,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAA0C;sBAExE,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAAwC;sBACtE,oBAACM,uBAAqBA;QAAC,KAAKN,EAAE;QAAgC;sBAE9D,oBAACO,kBAAgBA;QAAC,KAAKP,EAAE;sBAEzB,oBAACQ,gBAAcA;QAAC,KAAKR,EAAE;sBACvB,oBAACS,sBAAoBA;QAAC,KAAKT,EAAE;sBAC7B,oBAACS,sBAAoBA;QAAC,KAAKT,EAAE;sBAG7B,oBAACU,kBAAgBA;QAAC,KAAKV,EAAE;sBACzB,oBAACW,kBAAgBA;QAAC,KAAKX,EAAE;sBAIzB,oBAACY,gBAAcA;QAAC,KAAKZ,EAAE;sBACvB,oBAACY,gBAAcA;QAAC,KAAKZ,EAAE;sBACvB,oBAACU,kBAAgBA;QAAC,KAAKV,EAAE;sBACzB,oBAACW,kBAAgBA;QAAC,KAAKX,EAAE;sBACzB,oBAACa,iBAAeA;QAAC,KAAKb,EAAE;sBACxB,oBAACc,kBAAgBA;QAAC,KAAKd,EAAE;sBACzB,oBAACc,kBAAgBA;QAAC,KAAKd,EAAE;sBAQzB,oBAACc,kBAAgBA;QACb,KAAKd,EAAE;sBAEX,oBAACc,kBAAgBA;QAAC,KAAKd,EAAE;sBACzB,oBAACK,YAAUA;QAAC,KAAKL,EAAE;sBACnB,oBAACe,kBAAgBA;QAAC,KAAKf,EAAE;sBACzB,oBAACgB,eAAaA;QAAC,KAAKhB,EAAE;sBAGtB,oBAACiB,cAAYA;QAAC,KAAKjB,EAAE;sBACrB,oBAACiB,cAAYA;QAAC,KAAKjB,EAAE;sBACrB,oBAACO,kBAAgBA;QAAC,KAAKP,EAAE;sBAGzB,oBAACiB,cAAYA;QAAC,KAAKjB,EAAE;sBAGrB,oBAACkB,YAAUA;QAAC,KAAKlB,EAAE;sBACnB,oBAACiB,cAAYA;QAAC,KAAKjB,EAAE;sBACrB,oBAACmB,aAAWA;QACR,KAAKnB,EAAE"}
package/infra.d.ts CHANGED
@@ -49,6 +49,17 @@ export declare const Infra: {
49
49
  readers: import("zod").ZodOptional<import("zod").ZodNumber>;
50
50
  rdsProxy: import("zod").ZodOptional<import("zod").ZodBoolean>;
51
51
  }, import("zod/v4/core").$strip>>;
52
+ TenantStorage: {
53
+ AuroraPostgres: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<import("zod").ZodObject<{
54
+ id: import("zod").ZodString;
55
+ label: import("zod").ZodString;
56
+ retired: import("zod").ZodOptional<import("zod").ZodBoolean>;
57
+ minCapacity: import("zod").ZodOptional<import("zod").ZodNumber>;
58
+ maxCapacity: import("zod").ZodOptional<import("zod").ZodNumber>;
59
+ readers: import("zod").ZodOptional<import("zod").ZodNumber>;
60
+ rdsProxy: import("zod").ZodOptional<import("zod").ZodBoolean>;
61
+ }, import("zod/v4/core").$strip>>;
62
+ };
52
63
  BlueGreenDeployments: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<import("zod").ZodObject<{
53
64
  enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
54
65
  domains: import("zod").ZodObject<{
package/infra.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AdminAfterBuild, AdminBeforeBuild, AdminBeforeWatch, ApiAfterBuild, ApiBeforeBuild, ApiBeforeWatch, CoreAfterBuild, CoreBeforeBuild, CoreBeforeWatch, EnvVar, ProductionEnvironments } from "@webiny/project/extensions/index.js";
2
- import { AdminAfterDeploy, AdminBeforeDeploy, AdminStackOutputValue, ApiAfterDeploy, ApiBeforeDeploy, ApiMaxBundleSize, ApiStackOutputValue, ApiWebFunction, AuroraPostgres, CoreAfterDeploy, CoreBeforeDeploy, CoreStackOutputValue, Encryption, Hashing, PulumiResourceNamePrefix } from "@webiny/project-extensions-aws/extensions/index.js";
2
+ import { AdminAfterDeploy, AdminBeforeDeploy, AdminStackOutputValue, ApiAfterDeploy, ApiBeforeDeploy, ApiMaxBundleSize, ApiStackOutputValue, ApiWebFunction, AuroraPostgres, CoreAfterDeploy, CoreBeforeDeploy, CoreStackOutputValue, Encryption, Hashing, PulumiResourceNamePrefix, TenantStorageAuroraPostgres } from "@webiny/project-extensions-aws/extensions/index.js";
3
3
  import { AdminCustomDomains, AdminPulumi, ApiCustomDomains, ApiPulumi, AwsTags, BlueGreenDeployments, CorePulumi, DynamoDbPitr, S3BucketVersioning, Vpc } from "./pulumi/extensions/index.js";
4
4
  import { OpenSearch } from "./extensions/OpenSearch.js";
5
5
  import { AwsDefaultRegion } from "@webiny/project-extensions-aws/extensions/AwsDefaultRegion.js";
@@ -19,6 +19,9 @@ const Infra = {
19
19
  Encryption: Encryption,
20
20
  Vpc: Vpc,
21
21
  AuroraPostgres: AuroraPostgres,
22
+ TenantStorage: {
23
+ AuroraPostgres: TenantStorageAuroraPostgres
24
+ },
22
25
  BlueGreenDeployments: BlueGreenDeployments,
23
26
  OpenSearch: OpenSearch,
24
27
  PulumiResourceNamePrefix: PulumiResourceNamePrefix,
package/infra.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"infra.js","sources":["../src/infra.ts"],"sourcesContent":["import {\n AdminAfterBuild,\n AdminBeforeBuild,\n AdminBeforeWatch,\n ApiAfterBuild,\n ApiBeforeBuild,\n ApiBeforeWatch,\n CoreAfterBuild,\n CoreBeforeBuild,\n CoreBeforeWatch,\n ProductionEnvironments\n} from \"@webiny/project/extensions/index.js\";\nimport { AdminAfterDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { AdminBeforeDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiAfterDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiBeforeDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { CoreAfterDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { CoreBeforeDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { PulumiResourceNamePrefix } from \"@webiny/project-extensions-aws/extensions/index.js\";\n\nimport { CorePulumi, ApiPulumi, AdminPulumi } from \"./pulumi/extensions/index.js\";\n\nimport {\n AdminCustomDomains,\n ApiCustomDomains,\n AwsTags,\n BlueGreenDeployments,\n DynamoDbPitr,\n S3BucketVersioning,\n Vpc\n} from \"./pulumi/extensions/index.js\";\n\nimport { OpenSearch } from \"./extensions/OpenSearch.js\";\nimport { AuroraPostgres } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { AdminStackOutputValue } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiStackOutputValue } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { CoreStackOutputValue } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { AwsDefaultRegion } from \"@webiny/project-extensions-aws/extensions/AwsDefaultRegion.js\";\nimport { ApiLambdaFunction } from \"./extensions/ApiLambdaFunction.js\";\nimport { EnvVar } from \"@webiny/project/extensions/index.js\";\nimport { Encryption } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { Hashing } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiMaxBundleSize } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiWebFunction } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport {\n EnvIs,\n EnvIsNot,\n EnvIsProd,\n EnvIsNotProd,\n useEnv,\n CiIs,\n CiIsNot\n} from \"@webiny/project/extensions/infra/index.js\";\n\nexport { useEnv };\n\n// Core app resources. Exposed under Infra.Core, and top-level for backward compatibility.\nconst DynamoDb = {\n Pitr: DynamoDbPitr\n};\n\nconst S3Bucket = {\n Versioning: S3BucketVersioning\n};\n\nexport const Infra = {\n // Grouped crypto config surface.\n Crypto: {\n Encryption,\n Hashing\n },\n // Kept top-level for backward compatibility (prefer Infra.Crypto.Encryption going forward).\n Encryption,\n Vpc,\n AuroraPostgres,\n BlueGreenDeployments,\n // Kept top-level for backward compatibility (prefer Infra.Core.OpenSearch going forward).\n OpenSearch,\n PulumiResourceNamePrefix,\n ProductionEnvironments,\n EnvVar,\n // Kept top-level for backward compatibility (prefer Infra.Core.DynamoDb and Infra.Core.S3Bucket).\n DynamoDb,\n S3Bucket,\n Aws: {\n DefaultRegion: AwsDefaultRegion,\n Tags: AwsTags\n },\n Env: {\n useEnv,\n Is: EnvIs,\n IsNot: EnvIsNot,\n IsProd: EnvIsProd,\n IsNotProd: EnvIsNotProd\n },\n Ci: {\n Is: CiIs,\n IsNot: CiIsNot\n },\n Admin: {\n BeforeBuild: AdminBeforeBuild,\n BeforeDeploy: AdminBeforeDeploy,\n BeforeWatch: AdminBeforeWatch,\n AfterBuild: AdminAfterBuild,\n AfterDeploy: AdminAfterDeploy,\n Pulumi: AdminPulumi,\n CustomDomains: AdminCustomDomains,\n StackOutputValue: AdminStackOutputValue\n },\n Api: {\n BeforeBuild: ApiBeforeBuild,\n BeforeDeploy: ApiBeforeDeploy,\n BeforeWatch: ApiBeforeWatch,\n AfterBuild: ApiAfterBuild,\n AfterDeploy: ApiAfterDeploy,\n Pulumi: ApiPulumi,\n CustomDomains: ApiCustomDomains,\n StackOutputValue: ApiStackOutputValue,\n LambdaFunction: ApiLambdaFunction,\n MaxBundleSize: ApiMaxBundleSize,\n WebFunction: ApiWebFunction\n },\n Core: {\n BeforeBuild: CoreBeforeBuild,\n BeforeDeploy: CoreBeforeDeploy,\n BeforeWatch: CoreBeforeWatch,\n AfterBuild: CoreAfterBuild,\n AfterDeploy: CoreAfterDeploy,\n Pulumi: CorePulumi,\n StackOutputValue: CoreStackOutputValue,\n DynamoDb,\n OpenSearch,\n S3Bucket\n }\n};\n"],"names":["DynamoDb","DynamoDbPitr","S3Bucket","S3BucketVersioning","Infra","Encryption","Hashing","Vpc","AuroraPostgres","BlueGreenDeployments","OpenSearch","PulumiResourceNamePrefix","ProductionEnvironments","EnvVar","AwsDefaultRegion","AwsTags","useEnv","EnvIs","EnvIsNot","EnvIsProd","EnvIsNotProd","CiIs","CiIsNot","AdminBeforeBuild","AdminBeforeDeploy","AdminBeforeWatch","AdminAfterBuild","AdminAfterDeploy","AdminPulumi","AdminCustomDomains","AdminStackOutputValue","ApiBeforeBuild","ApiBeforeDeploy","ApiBeforeWatch","ApiAfterBuild","ApiAfterDeploy","ApiPulumi","ApiCustomDomains","ApiStackOutputValue","ApiLambdaFunction","ApiMaxBundleSize","ApiWebFunction","CoreBeforeBuild","CoreBeforeDeploy","CoreBeforeWatch","CoreAfterBuild","CoreAfterDeploy","CorePulumi","CoreStackOutputValue"],"mappings":";;;;;;;AAyDA,MAAMA,WAAW;IACb,MAAMC;AACV;AAEA,MAAMC,WAAW;IACb,YAAYC;AAChB;AAEO,MAAMC,QAAQ;IAEjB,QAAQ;QACJC,YAAUA;QACVC,SAAOA;IACX;IAEAD,YAAUA;IACVE,KAAGA;IACHC,gBAAcA;IACdC,sBAAoBA;IAEpBC,YAAUA;IACVC,0BAAwBA;IACxBC,wBAAsBA;IACtBC,QAAMA;IAENb;IACAE;IACA,KAAK;QACD,eAAeY;QACf,MAAMC;IACV;IACA,KAAK;QACDC,QAAMA;QACN,IAAIC;QACJ,OAAOC;QACP,QAAQC;QACR,WAAWC;IACf;IACA,IAAI;QACA,IAAIC;QACJ,OAAOC;IACX;IACA,OAAO;QACH,aAAaC;QACb,cAAcC;QACd,aAAaC;QACb,YAAYC;QACZ,aAAaC;QACb,QAAQC;QACR,eAAeC;QACf,kBAAkBC;IACtB;IACA,KAAK;QACD,aAAaC;QACb,cAAcC;QACd,aAAaC;QACb,YAAYC;QACZ,aAAaC;QACb,QAAQC;QACR,eAAeC;QACf,kBAAkBC;QAClB,gBAAgBC;QAChB,eAAeC;QACf,aAAaC;IACjB;IACA,MAAM;QACF,aAAaC;QACb,cAAcC;QACd,aAAaC;QACb,YAAYC;QACZ,aAAaC;QACb,QAAQC;QACR,kBAAkBC;QAClBhD;QACAU,YAAUA;QACVR;IACJ;AACJ"}
1
+ {"version":3,"file":"infra.js","sources":["../src/infra.ts"],"sourcesContent":["import {\n AdminAfterBuild,\n AdminBeforeBuild,\n AdminBeforeWatch,\n ApiAfterBuild,\n ApiBeforeBuild,\n ApiBeforeWatch,\n CoreAfterBuild,\n CoreBeforeBuild,\n CoreBeforeWatch,\n ProductionEnvironments\n} from \"@webiny/project/extensions/index.js\";\nimport { AdminAfterDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { AdminBeforeDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiAfterDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiBeforeDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { CoreAfterDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { CoreBeforeDeploy } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { PulumiResourceNamePrefix } from \"@webiny/project-extensions-aws/extensions/index.js\";\n\nimport { CorePulumi, ApiPulumi, AdminPulumi } from \"./pulumi/extensions/index.js\";\n\nimport {\n AdminCustomDomains,\n ApiCustomDomains,\n AwsTags,\n BlueGreenDeployments,\n DynamoDbPitr,\n S3BucketVersioning,\n Vpc\n} from \"./pulumi/extensions/index.js\";\n\nimport { OpenSearch } from \"./extensions/OpenSearch.js\";\nimport { AuroraPostgres } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { TenantStorageAuroraPostgres } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { AdminStackOutputValue } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiStackOutputValue } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { CoreStackOutputValue } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { AwsDefaultRegion } from \"@webiny/project-extensions-aws/extensions/AwsDefaultRegion.js\";\nimport { ApiLambdaFunction } from \"./extensions/ApiLambdaFunction.js\";\nimport { EnvVar } from \"@webiny/project/extensions/index.js\";\nimport { Encryption } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { Hashing } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiMaxBundleSize } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport { ApiWebFunction } from \"@webiny/project-extensions-aws/extensions/index.js\";\nimport {\n EnvIs,\n EnvIsNot,\n EnvIsProd,\n EnvIsNotProd,\n useEnv,\n CiIs,\n CiIsNot\n} from \"@webiny/project/extensions/infra/index.js\";\n\nexport { useEnv };\n\n// Core app resources. Exposed under Infra.Core, and top-level for backward compatibility.\nconst DynamoDb = {\n Pitr: DynamoDbPitr\n};\n\nconst S3Bucket = {\n Versioning: S3BucketVersioning\n};\n\nexport const Infra = {\n // Grouped crypto config surface.\n Crypto: {\n Encryption,\n Hashing\n },\n // Kept top-level for backward compatibility (prefer Infra.Crypto.Encryption going forward).\n Encryption,\n Vpc,\n AuroraPostgres,\n /*\n * Extra storages tenants can be placed on. Anything under `TenantStorage` is an extra storage;\n * any other database component (or none: DynamoDB) is the default storage, root's.\n */\n TenantStorage: {\n AuroraPostgres: TenantStorageAuroraPostgres\n },\n BlueGreenDeployments,\n // Kept top-level for backward compatibility (prefer Infra.Core.OpenSearch going forward).\n OpenSearch,\n PulumiResourceNamePrefix,\n ProductionEnvironments,\n EnvVar,\n // Kept top-level for backward compatibility (prefer Infra.Core.DynamoDb and Infra.Core.S3Bucket).\n DynamoDb,\n S3Bucket,\n Aws: {\n DefaultRegion: AwsDefaultRegion,\n Tags: AwsTags\n },\n Env: {\n useEnv,\n Is: EnvIs,\n IsNot: EnvIsNot,\n IsProd: EnvIsProd,\n IsNotProd: EnvIsNotProd\n },\n Ci: {\n Is: CiIs,\n IsNot: CiIsNot\n },\n Admin: {\n BeforeBuild: AdminBeforeBuild,\n BeforeDeploy: AdminBeforeDeploy,\n BeforeWatch: AdminBeforeWatch,\n AfterBuild: AdminAfterBuild,\n AfterDeploy: AdminAfterDeploy,\n Pulumi: AdminPulumi,\n CustomDomains: AdminCustomDomains,\n StackOutputValue: AdminStackOutputValue\n },\n Api: {\n BeforeBuild: ApiBeforeBuild,\n BeforeDeploy: ApiBeforeDeploy,\n BeforeWatch: ApiBeforeWatch,\n AfterBuild: ApiAfterBuild,\n AfterDeploy: ApiAfterDeploy,\n Pulumi: ApiPulumi,\n CustomDomains: ApiCustomDomains,\n StackOutputValue: ApiStackOutputValue,\n LambdaFunction: ApiLambdaFunction,\n MaxBundleSize: ApiMaxBundleSize,\n WebFunction: ApiWebFunction\n },\n Core: {\n BeforeBuild: CoreBeforeBuild,\n BeforeDeploy: CoreBeforeDeploy,\n BeforeWatch: CoreBeforeWatch,\n AfterBuild: CoreAfterBuild,\n AfterDeploy: CoreAfterDeploy,\n Pulumi: CorePulumi,\n StackOutputValue: CoreStackOutputValue,\n DynamoDb,\n OpenSearch,\n S3Bucket\n }\n};\n"],"names":["DynamoDb","DynamoDbPitr","S3Bucket","S3BucketVersioning","Infra","Encryption","Hashing","Vpc","AuroraPostgres","TenantStorageAuroraPostgres","BlueGreenDeployments","OpenSearch","PulumiResourceNamePrefix","ProductionEnvironments","EnvVar","AwsDefaultRegion","AwsTags","useEnv","EnvIs","EnvIsNot","EnvIsProd","EnvIsNotProd","CiIs","CiIsNot","AdminBeforeBuild","AdminBeforeDeploy","AdminBeforeWatch","AdminAfterBuild","AdminAfterDeploy","AdminPulumi","AdminCustomDomains","AdminStackOutputValue","ApiBeforeBuild","ApiBeforeDeploy","ApiBeforeWatch","ApiAfterBuild","ApiAfterDeploy","ApiPulumi","ApiCustomDomains","ApiStackOutputValue","ApiLambdaFunction","ApiMaxBundleSize","ApiWebFunction","CoreBeforeBuild","CoreBeforeDeploy","CoreBeforeWatch","CoreAfterBuild","CoreAfterDeploy","CorePulumi","CoreStackOutputValue"],"mappings":";;;;;;;AA0DA,MAAMA,WAAW;IACb,MAAMC;AACV;AAEA,MAAMC,WAAW;IACb,YAAYC;AAChB;AAEO,MAAMC,QAAQ;IAEjB,QAAQ;QACJC,YAAUA;QACVC,SAAOA;IACX;IAEAD,YAAUA;IACVE,KAAGA;IACHC,gBAAcA;IAKd,eAAe;QACX,gBAAgBC;IACpB;IACAC,sBAAoBA;IAEpBC,YAAUA;IACVC,0BAAwBA;IACxBC,wBAAsBA;IACtBC,QAAMA;IAENd;IACAE;IACA,KAAK;QACD,eAAea;QACf,MAAMC;IACV;IACA,KAAK;QACDC,QAAMA;QACN,IAAIC;QACJ,OAAOC;QACP,QAAQC;QACR,WAAWC;IACf;IACA,IAAI;QACA,IAAIC;QACJ,OAAOC;IACX;IACA,OAAO;QACH,aAAaC;QACb,cAAcC;QACd,aAAaC;QACb,YAAYC;QACZ,aAAaC;QACb,QAAQC;QACR,eAAeC;QACf,kBAAkBC;IACtB;IACA,KAAK;QACD,aAAaC;QACb,cAAcC;QACd,aAAaC;QACb,YAAYC;QACZ,aAAaC;QACb,QAAQC;QACR,eAAeC;QACf,kBAAkBC;QAClB,gBAAgBC;QAChB,eAAeC;QACf,aAAaC;IACjB;IACA,MAAM;QACF,aAAaC;QACb,cAAcC;QACd,aAAaC;QACb,YAAYC;QACZ,aAAaC;QACb,QAAQC;QACR,kBAAkBC;QAClBjD;QACAW,YAAUA;QACVT;IACJ;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/project-aws",
3
- "version": "6.6.0-alpha.13",
3
+ "version": "6.6.0-alpha.14",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -21,17 +21,17 @@
21
21
  "@pulumi/pulumi": "^3.277.0",
22
22
  "@pulumi/random": "4.21.6",
23
23
  "@vercel/nft": "1.11.11",
24
- "@webiny/aws-layers": "6.6.0-alpha.13",
25
- "@webiny/aws-sdk": "6.6.0-alpha.13",
26
- "@webiny/cli-core": "6.6.0-alpha.13",
24
+ "@webiny/aws-layers": "6.6.0-alpha.14",
25
+ "@webiny/aws-sdk": "6.6.0-alpha.14",
26
+ "@webiny/cli-core": "6.6.0-alpha.14",
27
27
  "@webiny/di": "2.0.0",
28
- "@webiny/global-config": "6.6.0-alpha.13",
29
- "@webiny/mailer-smtp": "6.6.0-alpha.13",
30
- "@webiny/project": "6.6.0-alpha.13",
31
- "@webiny/project-extensions-aws": "6.6.0-alpha.13",
32
- "@webiny/pulumi": "6.6.0-alpha.13",
33
- "@webiny/pulumi-sdk": "6.6.0-alpha.13",
34
- "@webiny/utils": "6.6.0-alpha.13",
28
+ "@webiny/global-config": "6.6.0-alpha.14",
29
+ "@webiny/mailer-smtp": "6.6.0-alpha.14",
30
+ "@webiny/project": "6.6.0-alpha.14",
31
+ "@webiny/project-extensions-aws": "6.6.0-alpha.14",
32
+ "@webiny/pulumi": "6.6.0-alpha.14",
33
+ "@webiny/pulumi-sdk": "6.6.0-alpha.14",
34
+ "@webiny/utils": "6.6.0-alpha.14",
35
35
  "adm-zip": "0.6.1",
36
36
  "chalk": "6.0.1",
37
37
  "execa": "10.2.1",
@@ -52,7 +52,7 @@
52
52
  "@types/adm-zip": "0.6.0",
53
53
  "@types/lodash": "4.17.27",
54
54
  "@types/ncp": "2.0.8",
55
- "@webiny/build-tools": "6.6.0-alpha.13",
55
+ "@webiny/build-tools": "6.6.0-alpha.14",
56
56
  "typescript": "7.0.2",
57
57
  "vitest": "5.1.1"
58
58
  },
package/project.d.ts CHANGED
@@ -6,12 +6,12 @@ export declare const Project: {
6
6
  enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
7
7
  }, import("zod/v4/core").$strip>>;
8
8
  AutoInstall: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<import("zod").ZodObject<{
9
- adminUser: import("zod").ZodObject<{
9
+ adminUser: import("zod").ZodOptional<import("zod").ZodObject<{
10
10
  firstName: import("zod").ZodString;
11
11
  lastName: import("zod").ZodString;
12
12
  email: import("zod").ZodString;
13
13
  password: import("zod").ZodString;
14
- }, import("zod/v4/core").$strip>;
14
+ }, import("zod/v4/core").$strip>>;
15
15
  }, import("zod/v4/core").$strip>>;
16
16
  FeatureFlags: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<import("zod").ZodObject<{
17
17
  features: import("zod").ZodObject<{
@@ -52,6 +52,7 @@ export declare const Project: {
52
52
  activityLog: import("zod").ZodOptional<import("zod").ZodBoolean>;
53
53
  }, import("zod/v4/core").$strip>]>>;
54
54
  webhooks: import("zod").ZodOptional<import("zod").ZodBoolean>;
55
+ perTenantStorage: import("zod").ZodOptional<import("zod").ZodBoolean>;
55
56
  }, import("zod/v4/core").$strip>;
56
57
  }, import("zod/v4/core").$strip>>;
57
58
  BugReporter: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<import("zod").ZodObject<{
@@ -1,7 +1,7 @@
1
1
  import * as pulumi from "@pulumi/pulumi";
2
2
  import * as aws from "@pulumi/aws";
3
3
  import type { PulumiAppModule } from "@webiny/pulumi";
4
- import type { PostgresOutputs } from "../../../pulumi/apps/common/CoreOutput.js";
4
+ import type { PostgresOutputs, TenantStorageOutput } from "../../../pulumi/apps/common/CoreOutput.js";
5
5
  import type { PostgresExtensionConfig } from "../../../pulumi/apps/extensions/getPostgresConfigFromExtension.js";
6
6
  import type { ServiceManifest } from "../../../pulumi/utils/addServiceManifestTableItem.js";
7
7
  export declare const SQL_SCHEMA_SETUP_EVENT = "WebinySqlSchemaSetup";
@@ -33,15 +33,35 @@ export declare const getPostgresLambdaEnv: (pg: PostgresOutputs) => PostgresLamb
33
33
  export declare const getPostgresLambdaEnvFromCore: (core: pulumi.Output<PostgresOutputs>) => Record<keyof PostgresLambdaEnv, pulumi.Output<string>>;
34
34
  /**
35
35
  * Env only the API's web function gets, on top of the `graphql` Lambda's (and over it), with
36
- * `<Infra.AuroraPostgres />`. Nothing without Postgres.
36
+ * `<Infra.AuroraPostgres />` or a `<Infra.TenantStorage.AuroraPostgres>`. Nothing without Postgres.
37
37
  *
38
- * - `WEBINY_PG_POOL_MAX`: its pool size. One web function environment serves several requests at
39
- * once, so it needs more than the 1 connection the plain Lambda functions keep.
38
+ * - `WEBINY_PG_POOL_MAX`: its pool size, for each Postgres storage. One web function environment
39
+ * serves several requests at once, so it needs more than the 1 connection the plain Lambda
40
+ * functions keep.
40
41
  * - `NODE_EXTRA_CA_CERTS`: the RDS CA bundle shipped in its code. Its runtime has no
41
42
  * `/var/runtime/ca-cert.pem`, the bundle the plain Lambda functions verify the database with.
42
43
  */
43
44
  export declare const getPostgresWebFunctionEnv: (postgres: Pick<PostgresExtensionConfig, "poolSize"> | undefined) => Record<string, string>;
44
- export declare const createPostgresSecretPolicy: (secretArn: string) => aws.iam.PolicyDocument;
45
+ export declare const TENANT_STORAGES_ENV = "WEBINY_TENANT_STORAGES";
46
+ /**
47
+ * The value of `WEBINY_TENANT_STORAGES` for the core's `storages` output: a JSON list of
48
+ * `{ id, label, retired, type, connection }`, where `connection` holds the storage's `WEBINY_PG_*`
49
+ * settings, as `getPostgresLambdaEnv` builds them for the default storage's cluster. Retired storages
50
+ * are in it: tenants already on them keep running there.
51
+ */
52
+ export declare const getTenantStoragesLambdaEnv: (storages: TenantStorageOutput[]) => string;
53
+ /**
54
+ * The env an API function gets with a `<Infra.TenantStorage.AuroraPostgres>`: the storages'
55
+ * connections, and the RDS certificates the plain Lambda functions verify every cluster with (the
56
+ * web function's env replaces it with the bundle shipped in its code).
57
+ */
58
+ export declare const getTenantStoragesLambdaEnvFromCore: (core: pulumi.Output<{
59
+ storages: TenantStorageOutput[] | undefined;
60
+ }>) => {
61
+ WEBINY_TENANT_STORAGES: pulumi.Output<string>;
62
+ NODE_EXTRA_CA_CERTS: string;
63
+ };
64
+ export declare const createPostgresSecretPolicy: (secretArns: string | string[]) => aws.iam.PolicyDocument;
45
65
  export declare const createSchemaSetupEvent: (serviceManifests: ServiceManifest[]) => {
46
66
  WebinySqlSchemaSetup: {
47
67
  serviceManifests: {
@@ -59,20 +79,22 @@ export declare const createSchemaSetupEvent: (serviceManifests: ServiceManifest[
59
79
  */
60
80
  export declare const getSchemaSetupServiceManifests: (coreManifests: ServiceManifest[] | undefined, apiManifests: ServiceManifest[]) => ServiceManifest[];
61
81
  export interface ApiSchemaSetupParams {
62
- postgres: pulumi.Output<PostgresOutputs>;
82
+ postgres?: pulumi.Output<PostgresOutputs>;
83
+ tenantStorages?: pulumi.Output<TenantStorageOutput[] | undefined>;
63
84
  serviceManifests: pulumi.Input<ServiceManifest[]>;
64
85
  trigger?: string;
65
86
  }
66
87
  export type ApiSchemaSetup = PulumiAppModule<typeof ApiSchemaSetup>;
67
88
  /**
68
- * The API on Postgres, at deploy time:
69
- * - lets the API role read the database password from the core's secret;
89
+ * The API's Postgres storages, at deploy time: the default storage's cluster
90
+ * (`<Infra.AuroraPostgres />`) and each `<Infra.TenantStorage.AuroraPostgres>`'s.
91
+ * - lets the API role read the database passwords from the clusters' secrets;
70
92
  * - adds the `schema-setup` function: the GraphQL function's bundle, role, env and VPC, with time
71
93
  * for the setup and no route to it;
72
- * - invokes it on every deploy with the `WebinySqlSchemaSetup` event. A failed setup fails the
73
- * deploy, so the schema is in place before the after-deploy hooks (AutoInstall) run. With RDS
74
- * Proxy the setup also waits until the proxy accepts the API's connections, and fails the deploy
75
- * when it doesn't within 10 minutes.
94
+ * - invokes it on every deploy with the `WebinySqlSchemaSetup` event, which sets every cluster up,
95
+ * each on its own writer. A failed setup fails the deploy, so the schema is in place before the
96
+ * after-deploy hooks (AutoInstall) run. With RDS Proxy the setup also waits until the proxy accepts
97
+ * the API's connections, and fails the deploy when it doesn't within 10 minutes.
76
98
  *
77
99
  * The GraphQL function gets the `WEBINY_PG_*` env from `createApiPulumiApp`, before this module
78
100
  * copies its config.
@@ -50,7 +50,22 @@ const getPostgresWebFunctionEnv = (postgres)=>{
50
50
  NODE_EXTRA_CA_CERTS: WEB_FUNCTION_RDS_CA_CERTS
51
51
  };
52
52
  };
53
- const createPostgresSecretPolicy = (secretArn)=>({
53
+ const TENANT_STORAGES_ENV = "WEBINY_TENANT_STORAGES";
54
+ const getTenantStoragesLambdaEnv = (storages)=>JSON.stringify(storages.map((storage)=>{
55
+ const { NODE_EXTRA_CA_CERTS, ...connection } = getPostgresLambdaEnv(storage);
56
+ return {
57
+ id: storage.id,
58
+ label: storage.label,
59
+ retired: true === storage.retired,
60
+ type: "postgres",
61
+ connection
62
+ };
63
+ }));
64
+ const getTenantStoragesLambdaEnvFromCore = (core)=>({
65
+ [TENANT_STORAGES_ENV]: core.apply(({ storages })=>getTenantStoragesLambdaEnv(storages ?? [])),
66
+ NODE_EXTRA_CA_CERTS: LAMBDA_RDS_CA_CERTS
67
+ });
68
+ const createPostgresSecretPolicy = (secretArns)=>({
54
69
  Version: "2012-10-17",
55
70
  Statement: [
56
71
  {
@@ -59,8 +74,8 @@ const createPostgresSecretPolicy = (secretArn)=>({
59
74
  Action: [
60
75
  "secretsmanager:GetSecretValue"
61
76
  ],
62
- Resource: [
63
- secretArn
77
+ Resource: Array.isArray(secretArns) ? secretArns : [
78
+ secretArns
64
79
  ]
65
80
  }
66
81
  ]
@@ -92,9 +107,17 @@ const ApiSchemaSetup = createAppModule({
92
107
  name: "api-lambda-pg-secret",
93
108
  config: {
94
109
  role: graphql.role.output.id,
95
- policy: params.postgres.apply((pg)=>{
96
- const { WEBINY_PG_SECRET_ARN } = getPostgresLambdaEnv(pg);
97
- return JSON.stringify(createPostgresSecretPolicy(WEBINY_PG_SECRET_ARN));
110
+ policy: __rspack_external__pulumi_pulumi_f3e773ed.all([
111
+ params.postgres,
112
+ params.tenantStorages
113
+ ]).apply(([postgres, storages])=>{
114
+ const arns = [
115
+ ...postgres ? [
116
+ getPostgresLambdaEnv(postgres).WEBINY_PG_SECRET_ARN
117
+ ] : [],
118
+ ...(storages ?? []).map((storage)=>getPostgresLambdaEnv(storage).WEBINY_PG_SECRET_ARN)
119
+ ];
120
+ return JSON.stringify(createPostgresSecretPolicy(arns));
98
121
  })
99
122
  }
100
123
  });
@@ -134,6 +157,6 @@ const ApiSchemaSetup = createAppModule({
134
157
  };
135
158
  }
136
159
  });
137
- export { ApiSchemaSetup, ApiSchemaSetupLambdaName, SQL_SCHEMA_SETUP_EVENT, createPostgresSecretPolicy, createSchemaSetupEvent, getPostgresLambdaEnv, getPostgresLambdaEnvFromCore, getPostgresWebFunctionEnv, getSchemaSetupServiceManifests };
160
+ export { ApiSchemaSetup, ApiSchemaSetupLambdaName, SQL_SCHEMA_SETUP_EVENT, TENANT_STORAGES_ENV, createPostgresSecretPolicy, createSchemaSetupEvent, getPostgresLambdaEnv, getPostgresLambdaEnvFromCore, getPostgresWebFunctionEnv, getSchemaSetupServiceManifests, getTenantStoragesLambdaEnv, getTenantStoragesLambdaEnvFromCore };
138
161
 
139
162
  //# sourceMappingURL=ApiSchemaSetup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pulumi/apps/api/ApiSchemaSetup.js","sources":["../../../../src/pulumi/apps/api/ApiSchemaSetup.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\nimport type { PostgresOutputs } from \"~/pulumi/apps/common/CoreOutput.js\";\nimport type { PostgresExtensionConfig } from \"~/pulumi/apps/extensions/getPostgresConfigFromExtension.js\";\nimport type { ServiceManifest } from \"~/pulumi/utils/addServiceManifestTableItem.js\";\nimport { WEB_FUNCTION_RDS_CA_CERTS } from \"~/extensions/Postgres/rdsCaBundle.js\";\nimport { ApiGraphql } from \"./ApiGraphql.js\";\n\n/* The event `@webiny/api-composition-aws-pg` answers with the schema setup. */\nexport const SQL_SCHEMA_SETUP_EVENT = \"WebinySqlSchemaSetup\";\n\nexport const ApiSchemaSetupLambdaName = \"schema-setup\";\n\n/* The CA bundle of the Lambda Node.js runtime, which has the Amazon RDS certificates. */\nconst LAMBDA_RDS_CA_CERTS = \"/var/runtime/ca-cert.pem\";\n\nconst POSTGRES_DEFAULT_PORT = 5432;\n\nexport interface PostgresLambdaEnv {\n WEBINY_PG_HOST: string;\n WEBINY_PG_WRITER_HOST: string;\n WEBINY_PG_PORT: string;\n WEBINY_PG_DATABASE: string;\n WEBINY_PG_USER: string;\n WEBINY_PG_SECRET_ARN: string;\n WEBINY_PG_SSL: string;\n NODE_EXTRA_CA_CERTS: string;\n}\n\nconst POSTGRES_LAMBDA_ENV_NAMES: Array<keyof PostgresLambdaEnv> = [\n \"WEBINY_PG_HOST\",\n \"WEBINY_PG_WRITER_HOST\",\n \"WEBINY_PG_PORT\",\n \"WEBINY_PG_DATABASE\",\n \"WEBINY_PG_USER\",\n \"WEBINY_PG_SECRET_ARN\",\n \"WEBINY_PG_SSL\",\n \"NODE_EXTRA_CA_CERTS\"\n];\n\n/**\n * The env vars an API function connects to Postgres with, from the core stack's Postgres outputs.\n * The API goes through the RDS Proxy when the core has one, else to the cluster's writer; the schema\n * setup always goes to the writer (`WEBINY_PG_WRITER_HOST`). Over TLS, verified against the RDS\n * certificates of the Lambda runtime. No password: the functions read it from the secret.\n *\n * Throws when the core stack has no Postgres database, which is the case until `deploy core` runs\n * with `<Infra.AuroraPostgres />`.\n */\nexport const getPostgresLambdaEnv = (pg: PostgresOutputs): PostgresLambdaEnv => {\n const missing = ([\"pgWriterHost\", \"pgDatabase\", \"pgUser\", \"pgSecretArn\"] as const).filter(\n name => !pg[name]\n );\n if (missing.length) {\n throw new Error(\n `The core app has no Postgres database (missing outputs: ${missing.join(\", \")}). ` +\n \"Deploy the core app with `<Infra.AuroraPostgres />` first: `yarn webiny deploy core`.\"\n );\n }\n\n return {\n WEBINY_PG_HOST: (pg.pgProxyHost || pg.pgWriterHost) as string,\n WEBINY_PG_WRITER_HOST: pg.pgWriterHost as string,\n WEBINY_PG_PORT: String(pg.pgPort || POSTGRES_DEFAULT_PORT),\n WEBINY_PG_DATABASE: pg.pgDatabase as string,\n WEBINY_PG_USER: pg.pgUser as string,\n WEBINY_PG_SECRET_ARN: pg.pgSecretArn as string,\n WEBINY_PG_SSL: \"true\",\n NODE_EXTRA_CA_CERTS: LAMBDA_RDS_CA_CERTS\n };\n};\n\n/**\n * {@link getPostgresLambdaEnv} for the core stack's output, one Pulumi output per env var, so it can\n * be spread into a function's env next to the other variables.\n */\nexport const getPostgresLambdaEnvFromCore = (\n core: pulumi.Output<PostgresOutputs>\n): Record<keyof PostgresLambdaEnv, pulumi.Output<string>> => {\n const env = core.apply(getPostgresLambdaEnv);\n return Object.fromEntries(\n POSTGRES_LAMBDA_ENV_NAMES.map(name => [name, env.apply(values => values[name])])\n ) as Record<keyof PostgresLambdaEnv, pulumi.Output<string>>;\n};\n\n/**\n * Env only the API's web function gets, on top of the `graphql` Lambda's (and over it), with\n * `<Infra.AuroraPostgres />`. Nothing without Postgres.\n *\n * - `WEBINY_PG_POOL_MAX`: its pool size. One web function environment serves several requests at\n * once, so it needs more than the 1 connection the plain Lambda functions keep.\n * - `NODE_EXTRA_CA_CERTS`: the RDS CA bundle shipped in its code. Its runtime has no\n * `/var/runtime/ca-cert.pem`, the bundle the plain Lambda functions verify the database with.\n */\nexport const getPostgresWebFunctionEnv = (\n postgres: Pick<PostgresExtensionConfig, \"poolSize\"> | undefined\n): Record<string, string> => {\n if (!postgres) {\n return {};\n }\n return {\n WEBINY_PG_POOL_MAX: String(postgres.poolSize),\n NODE_EXTRA_CA_CERTS: WEB_FUNCTION_RDS_CA_CERTS\n };\n};\n\n/* Lets the API functions read the database password, and nothing else, from the core's secret. */\nexport const createPostgresSecretPolicy = (secretArn: string): aws.iam.PolicyDocument => {\n return {\n Version: \"2012-10-17\",\n Statement: [\n {\n Sid: \"PermissionForPostgresSecret\",\n Effect: \"Allow\",\n Action: [\"secretsmanager:GetSecretValue\"],\n Resource: [secretArn]\n }\n ]\n };\n};\n\n/* The event the deploy invokes the schema-setup function with. */\nexport const createSchemaSetupEvent = (serviceManifests: ServiceManifest[]) => {\n return {\n [SQL_SCHEMA_SETUP_EVENT]: {\n serviceManifests: serviceManifests.map(({ name, manifest }) => ({ name, manifest }))\n }\n };\n};\n\n/**\n * The manifests the api deploy stores: the core's (from the core stack output; the core deploys\n * before this function exists), then the api app's own. On a repeated name the api's own wins.\n *\n * Throws when the core stack has no service manifests: a core deployed before the core put them\n * in its output. Its `core` manifest would never reach the database.\n */\nexport const getSchemaSetupServiceManifests = (\n coreManifests: ServiceManifest[] | undefined,\n apiManifests: ServiceManifest[]\n): ServiceManifest[] => {\n if (!coreManifests) {\n throw new Error(\n \"The core app's stack output has no service manifests, which the api deploy stores \" +\n \"in the database. Deploy the core app again: `yarn webiny deploy core`.\"\n );\n }\n\n const byName = new Map<string, ServiceManifest>();\n for (const manifest of [...coreManifests, ...apiManifests]) {\n byName.set(manifest.name, manifest);\n }\n return [...byName.values()];\n};\n\nexport interface ApiSchemaSetupParams {\n /* The core stack's Postgres outputs. */\n postgres: pulumi.Output<PostgresOutputs>;\n /* Stored in the database by the setup, for service discovery. */\n serviceManifests: pulumi.Input<ServiceManifest[]>;\n /* Changes on every deploy, so every deploy runs the setup. Replaced in tests. */\n trigger?: string;\n}\n\nexport type ApiSchemaSetup = PulumiAppModule<typeof ApiSchemaSetup>;\n\n/**\n * The API on Postgres, at deploy time:\n * - lets the API role read the database password from the core's secret;\n * - adds the `schema-setup` function: the GraphQL function's bundle, role, env and VPC, with time\n * for the setup and no route to it;\n * - invokes it on every deploy with the `WebinySqlSchemaSetup` event. A failed setup fails the\n * deploy, so the schema is in place before the after-deploy hooks (AutoInstall) run. With RDS\n * Proxy the setup also waits until the proxy accepts the API's connections, and fails the deploy\n * when it doesn't within 10 minutes.\n *\n * The GraphQL function gets the `WEBINY_PG_*` env from `createApiPulumiApp`, before this module\n * copies its config.\n */\nexport const ApiSchemaSetup = createAppModule({\n name: \"ApiSchemaSetup\",\n config(app: PulumiApp, params: ApiSchemaSetupParams) {\n const graphql = app.getModule(ApiGraphql);\n\n const secretPolicy = app.addResource(aws.iam.RolePolicy, {\n name: \"api-lambda-pg-secret\",\n config: {\n role: graphql.role.output.id,\n policy: params.postgres.apply(pg => {\n const { WEBINY_PG_SECRET_ARN } = getPostgresLambdaEnv(pg);\n return JSON.stringify(createPostgresSecretPolicy(WEBINY_PG_SECRET_ARN));\n })\n }\n });\n\n const baseConfig = graphql.functions.graphql.config.clone();\n\n const schemaSetup = app.addResource(aws.lambda.Function, {\n name: ApiSchemaSetupLambdaName,\n config: {\n ...baseConfig,\n description: \"Sets the Webiny API up on Postgres. Invoked by every deploy.\",\n // Lambda's maximum. Creating the tables of a new database takes longer than a request\n // may, and with RDS Proxy the setup then waits (up to 10 minutes) until the proxy\n // accepts the API's connections: a new proxy refuses them for a few minutes.\n timeout: 900,\n loggingConfig: {\n logFormat: \"JSON\"\n }\n }\n });\n\n const invocation = app.addResource(aws.lambda.Invocation, {\n name: ApiSchemaSetupLambdaName,\n config: {\n functionName: schemaSetup.output.name,\n input: pulumi\n .output(params.serviceManifests)\n .apply(manifests =>\n JSON.stringify(createSchemaSetupEvent(manifests as ServiceManifest[]))\n ),\n triggers: {\n deploy: params.trigger ?? new Date().toISOString()\n }\n },\n opts: {\n // The function reads the password from the secret as soon as it runs.\n dependsOn: [secretPolicy.output]\n }\n });\n\n return {\n secretPolicy,\n functions: {\n schemaSetup\n },\n invocation\n };\n }\n});\n"],"names":["SQL_SCHEMA_SETUP_EVENT","ApiSchemaSetupLambdaName","LAMBDA_RDS_CA_CERTS","POSTGRES_DEFAULT_PORT","POSTGRES_LAMBDA_ENV_NAMES","getPostgresLambdaEnv","pg","missing","name","Error","String","getPostgresLambdaEnvFromCore","core","env","Object","values","getPostgresWebFunctionEnv","postgres","WEB_FUNCTION_RDS_CA_CERTS","createPostgresSecretPolicy","secretArn","createSchemaSetupEvent","serviceManifests","manifest","getSchemaSetupServiceManifests","coreManifests","apiManifests","byName","Map","ApiSchemaSetup","createAppModule","app","params","graphql","ApiGraphql","secretPolicy","aws","WEBINY_PG_SECRET_ARN","JSON","baseConfig","schemaSetup","invocation","pulumi","manifests","Date"],"mappings":"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"}
1
+ {"version":3,"file":"pulumi/apps/api/ApiSchemaSetup.js","sources":["../../../../src/pulumi/apps/api/ApiSchemaSetup.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\nimport type { PostgresOutputs, TenantStorageOutput } from \"~/pulumi/apps/common/CoreOutput.js\";\nimport type { PostgresExtensionConfig } from \"~/pulumi/apps/extensions/getPostgresConfigFromExtension.js\";\nimport type { ServiceManifest } from \"~/pulumi/utils/addServiceManifestTableItem.js\";\nimport { WEB_FUNCTION_RDS_CA_CERTS } from \"~/extensions/Postgres/rdsCaBundle.js\";\nimport { ApiGraphql } from \"./ApiGraphql.js\";\n\n/* The event `@webiny/api-composition-aws-pg` answers with the schema setup. */\nexport const SQL_SCHEMA_SETUP_EVENT = \"WebinySqlSchemaSetup\";\n\nexport const ApiSchemaSetupLambdaName = \"schema-setup\";\n\n/* The CA bundle of the Lambda Node.js runtime, which has the Amazon RDS certificates. */\nconst LAMBDA_RDS_CA_CERTS = \"/var/runtime/ca-cert.pem\";\n\nconst POSTGRES_DEFAULT_PORT = 5432;\n\nexport interface PostgresLambdaEnv {\n WEBINY_PG_HOST: string;\n WEBINY_PG_WRITER_HOST: string;\n WEBINY_PG_PORT: string;\n WEBINY_PG_DATABASE: string;\n WEBINY_PG_USER: string;\n WEBINY_PG_SECRET_ARN: string;\n WEBINY_PG_SSL: string;\n NODE_EXTRA_CA_CERTS: string;\n}\n\nconst POSTGRES_LAMBDA_ENV_NAMES: Array<keyof PostgresLambdaEnv> = [\n \"WEBINY_PG_HOST\",\n \"WEBINY_PG_WRITER_HOST\",\n \"WEBINY_PG_PORT\",\n \"WEBINY_PG_DATABASE\",\n \"WEBINY_PG_USER\",\n \"WEBINY_PG_SECRET_ARN\",\n \"WEBINY_PG_SSL\",\n \"NODE_EXTRA_CA_CERTS\"\n];\n\n/**\n * The env vars an API function connects to Postgres with, from the core stack's Postgres outputs.\n * The API goes through the RDS Proxy when the core has one, else to the cluster's writer; the schema\n * setup always goes to the writer (`WEBINY_PG_WRITER_HOST`). Over TLS, verified against the RDS\n * certificates of the Lambda runtime. No password: the functions read it from the secret.\n *\n * Throws when the core stack has no Postgres database, which is the case until `deploy core` runs\n * with `<Infra.AuroraPostgres />`.\n */\nexport const getPostgresLambdaEnv = (pg: PostgresOutputs): PostgresLambdaEnv => {\n const missing = ([\"pgWriterHost\", \"pgDatabase\", \"pgUser\", \"pgSecretArn\"] as const).filter(\n name => !pg[name]\n );\n if (missing.length) {\n throw new Error(\n `The core app has no Postgres database (missing outputs: ${missing.join(\", \")}). ` +\n \"Deploy the core app with `<Infra.AuroraPostgres />` first: `yarn webiny deploy core`.\"\n );\n }\n\n return {\n WEBINY_PG_HOST: (pg.pgProxyHost || pg.pgWriterHost) as string,\n WEBINY_PG_WRITER_HOST: pg.pgWriterHost as string,\n WEBINY_PG_PORT: String(pg.pgPort || POSTGRES_DEFAULT_PORT),\n WEBINY_PG_DATABASE: pg.pgDatabase as string,\n WEBINY_PG_USER: pg.pgUser as string,\n WEBINY_PG_SECRET_ARN: pg.pgSecretArn as string,\n WEBINY_PG_SSL: \"true\",\n NODE_EXTRA_CA_CERTS: LAMBDA_RDS_CA_CERTS\n };\n};\n\n/**\n * {@link getPostgresLambdaEnv} for the core stack's output, one Pulumi output per env var, so it can\n * be spread into a function's env next to the other variables.\n */\nexport const getPostgresLambdaEnvFromCore = (\n core: pulumi.Output<PostgresOutputs>\n): Record<keyof PostgresLambdaEnv, pulumi.Output<string>> => {\n const env = core.apply(getPostgresLambdaEnv);\n return Object.fromEntries(\n POSTGRES_LAMBDA_ENV_NAMES.map(name => [name, env.apply(values => values[name])])\n ) as Record<keyof PostgresLambdaEnv, pulumi.Output<string>>;\n};\n\n/**\n * Env only the API's web function gets, on top of the `graphql` Lambda's (and over it), with\n * `<Infra.AuroraPostgres />` or a `<Infra.TenantStorage.AuroraPostgres>`. Nothing without Postgres.\n *\n * - `WEBINY_PG_POOL_MAX`: its pool size, for each Postgres storage. One web function environment\n * serves several requests at once, so it needs more than the 1 connection the plain Lambda\n * functions keep.\n * - `NODE_EXTRA_CA_CERTS`: the RDS CA bundle shipped in its code. Its runtime has no\n * `/var/runtime/ca-cert.pem`, the bundle the plain Lambda functions verify the database with.\n */\nexport const getPostgresWebFunctionEnv = (\n postgres: Pick<PostgresExtensionConfig, \"poolSize\"> | undefined\n): Record<string, string> => {\n if (!postgres) {\n return {};\n }\n return {\n WEBINY_PG_POOL_MAX: String(postgres.poolSize),\n NODE_EXTRA_CA_CERTS: WEB_FUNCTION_RDS_CA_CERTS\n };\n};\n\n/* The env var the API reads its extra storages from (`createAwsPgTenantStorages`). */\nexport const TENANT_STORAGES_ENV = \"WEBINY_TENANT_STORAGES\";\n\n/**\n * The value of `WEBINY_TENANT_STORAGES` for the core's `storages` output: a JSON list of\n * `{ id, label, retired, type, connection }`, where `connection` holds the storage's `WEBINY_PG_*`\n * settings, as `getPostgresLambdaEnv` builds them for the default storage's cluster. Retired storages\n * are in it: tenants already on them keep running there.\n */\nexport const getTenantStoragesLambdaEnv = (storages: TenantStorageOutput[]): string => {\n return JSON.stringify(\n storages.map(storage => {\n // The CA bundle is the process's: the functions get it once, for every storage.\n const { NODE_EXTRA_CA_CERTS, ...connection } = getPostgresLambdaEnv(storage);\n void NODE_EXTRA_CA_CERTS;\n return {\n id: storage.id,\n label: storage.label,\n retired: storage.retired === true,\n type: \"postgres\",\n connection\n };\n })\n );\n};\n\n/**\n * The env an API function gets with a `<Infra.TenantStorage.AuroraPostgres>`: the storages'\n * connections, and the RDS certificates the plain Lambda functions verify every cluster with (the\n * web function's env replaces it with the bundle shipped in its code).\n */\nexport const getTenantStoragesLambdaEnvFromCore = (\n core: pulumi.Output<{ storages: TenantStorageOutput[] | undefined }>\n) => {\n return {\n [TENANT_STORAGES_ENV]: core.apply(({ storages }) =>\n getTenantStoragesLambdaEnv(storages ?? [])\n ),\n NODE_EXTRA_CA_CERTS: LAMBDA_RDS_CA_CERTS\n };\n};\n\n/*\n * Lets the API functions read the database passwords, and nothing else, from the secrets of the\n * deploy's clusters: the default storage's and every extra storage's.\n */\nexport const createPostgresSecretPolicy = (\n secretArns: string | string[]\n): aws.iam.PolicyDocument => {\n return {\n Version: \"2012-10-17\",\n Statement: [\n {\n Sid: \"PermissionForPostgresSecret\",\n Effect: \"Allow\",\n Action: [\"secretsmanager:GetSecretValue\"],\n Resource: Array.isArray(secretArns) ? secretArns : [secretArns]\n }\n ]\n };\n};\n\n/* The event the deploy invokes the schema-setup function with. */\nexport const createSchemaSetupEvent = (serviceManifests: ServiceManifest[]) => {\n return {\n [SQL_SCHEMA_SETUP_EVENT]: {\n serviceManifests: serviceManifests.map(({ name, manifest }) => ({ name, manifest }))\n }\n };\n};\n\n/**\n * The manifests the api deploy stores: the core's (from the core stack output; the core deploys\n * before this function exists), then the api app's own. On a repeated name the api's own wins.\n *\n * Throws when the core stack has no service manifests: a core deployed before the core put them\n * in its output. Its `core` manifest would never reach the database.\n */\nexport const getSchemaSetupServiceManifests = (\n coreManifests: ServiceManifest[] | undefined,\n apiManifests: ServiceManifest[]\n): ServiceManifest[] => {\n if (!coreManifests) {\n throw new Error(\n \"The core app's stack output has no service manifests, which the api deploy stores \" +\n \"in the database. Deploy the core app again: `yarn webiny deploy core`.\"\n );\n }\n\n const byName = new Map<string, ServiceManifest>();\n for (const manifest of [...coreManifests, ...apiManifests]) {\n byName.set(manifest.name, manifest);\n }\n return [...byName.values()];\n};\n\nexport interface ApiSchemaSetupParams {\n /* The core stack's Postgres outputs, with `<Infra.AuroraPostgres />` (a Postgres default storage). */\n postgres?: pulumi.Output<PostgresOutputs>;\n /* The core stack's `storages`, with a `<Infra.TenantStorage.AuroraPostgres>`. */\n tenantStorages?: pulumi.Output<TenantStorageOutput[] | undefined>;\n /*\n * Stored in the default storage's database by the setup, for service discovery. None on a\n * DynamoDB default storage, which keeps them in DynamoDB.\n */\n serviceManifests: pulumi.Input<ServiceManifest[]>;\n /* Changes on every deploy, so every deploy runs the setup. Replaced in tests. */\n trigger?: string;\n}\n\nexport type ApiSchemaSetup = PulumiAppModule<typeof ApiSchemaSetup>;\n\n/**\n * The API's Postgres storages, at deploy time: the default storage's cluster\n * (`<Infra.AuroraPostgres />`) and each `<Infra.TenantStorage.AuroraPostgres>`'s.\n * - lets the API role read the database passwords from the clusters' secrets;\n * - adds the `schema-setup` function: the GraphQL function's bundle, role, env and VPC, with time\n * for the setup and no route to it;\n * - invokes it on every deploy with the `WebinySqlSchemaSetup` event, which sets every cluster up,\n * each on its own writer. A failed setup fails the deploy, so the schema is in place before the\n * after-deploy hooks (AutoInstall) run. With RDS Proxy the setup also waits until the proxy accepts\n * the API's connections, and fails the deploy when it doesn't within 10 minutes.\n *\n * The GraphQL function gets the `WEBINY_PG_*` env from `createApiPulumiApp`, before this module\n * copies its config.\n */\nexport const ApiSchemaSetup = createAppModule({\n name: \"ApiSchemaSetup\",\n config(app: PulumiApp, params: ApiSchemaSetupParams) {\n const graphql = app.getModule(ApiGraphql);\n\n const secretPolicy = app.addResource(aws.iam.RolePolicy, {\n name: \"api-lambda-pg-secret\",\n config: {\n role: graphql.role.output.id,\n policy: pulumi\n .all([params.postgres, params.tenantStorages])\n .apply(([postgres, storages]) => {\n const arns = [\n ...(postgres\n ? [getPostgresLambdaEnv(postgres).WEBINY_PG_SECRET_ARN]\n : []),\n ...(storages ?? []).map(storage => {\n return getPostgresLambdaEnv(storage).WEBINY_PG_SECRET_ARN;\n })\n ];\n return JSON.stringify(createPostgresSecretPolicy(arns));\n })\n }\n });\n\n const baseConfig = graphql.functions.graphql.config.clone();\n\n const schemaSetup = app.addResource(aws.lambda.Function, {\n name: ApiSchemaSetupLambdaName,\n config: {\n ...baseConfig,\n description: \"Sets the Webiny API up on Postgres. Invoked by every deploy.\",\n // Lambda's maximum. Creating the tables of a new database takes longer than a request\n // may, and with RDS Proxy the setup then waits (up to 10 minutes) until the proxy\n // accepts the API's connections: a new proxy refuses them for a few minutes.\n timeout: 900,\n loggingConfig: {\n logFormat: \"JSON\"\n }\n }\n });\n\n const invocation = app.addResource(aws.lambda.Invocation, {\n name: ApiSchemaSetupLambdaName,\n config: {\n functionName: schemaSetup.output.name,\n input: pulumi\n .output(params.serviceManifests)\n .apply(manifests =>\n JSON.stringify(createSchemaSetupEvent(manifests as ServiceManifest[]))\n ),\n triggers: {\n deploy: params.trigger ?? new Date().toISOString()\n }\n },\n opts: {\n // The function reads the password from the secret as soon as it runs.\n dependsOn: [secretPolicy.output]\n }\n });\n\n return {\n secretPolicy,\n functions: {\n schemaSetup\n },\n invocation\n };\n }\n});\n"],"names":["SQL_SCHEMA_SETUP_EVENT","ApiSchemaSetupLambdaName","LAMBDA_RDS_CA_CERTS","POSTGRES_DEFAULT_PORT","POSTGRES_LAMBDA_ENV_NAMES","getPostgresLambdaEnv","pg","missing","name","Error","String","getPostgresLambdaEnvFromCore","core","env","Object","values","getPostgresWebFunctionEnv","postgres","WEB_FUNCTION_RDS_CA_CERTS","TENANT_STORAGES_ENV","getTenantStoragesLambdaEnv","storages","JSON","storage","NODE_EXTRA_CA_CERTS","connection","getTenantStoragesLambdaEnvFromCore","createPostgresSecretPolicy","secretArns","Array","createSchemaSetupEvent","serviceManifests","manifest","getSchemaSetupServiceManifests","coreManifests","apiManifests","byName","Map","ApiSchemaSetup","createAppModule","app","params","graphql","ApiGraphql","secretPolicy","aws","pulumi","arns","baseConfig","schemaSetup","invocation","manifests","Date"],"mappings":"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"}
@@ -13,7 +13,9 @@ import { isWebFunctionEnabled } from "../extensions/isWebFunctionEnabled.js";
13
13
  import { getOsConfigFromExtension } from "../extensions/getOsConfigFromExtension.js";
14
14
  import { getPostgresConfigFromExtension } from "../extensions/getPostgresConfigFromExtension.js";
15
15
  import { projectUsesPostgres } from "../extensions/projectUsesPostgres.js";
16
- import { ApiSchemaSetup, getPostgresLambdaEnvFromCore, getPostgresWebFunctionEnv, getSchemaSetupServiceManifests } from "./ApiSchemaSetup.js";
16
+ import { ApiSchemaSetup, getPostgresLambdaEnvFromCore, getPostgresWebFunctionEnv, getSchemaSetupServiceManifests, getTenantStoragesLambdaEnvFromCore } from "./ApiSchemaSetup.js";
17
+ import { getTenantStoragesFromExtension } from "../extensions/getTenantStoragesFromExtension.js";
18
+ import { POSTGRES_DEFAULT_POOL_SIZE } from "@webiny/project-extensions-aws/extensions/AuroraPostgresCluster.js";
17
19
  import { createApiServiceManifests } from "./apiServiceManifests.js";
18
20
  import { addDynamoDbOutputs, getDynamoDbLambdaEnv } from "./apiDynamoDb.js";
19
21
  import { handleGuardDutyEvents } from "./handleGuardDutyEvents.js";
@@ -36,6 +38,7 @@ const createApiPulumiApp = ()=>{
36
38
  const openSearchExtensionConfig = getOsConfigFromExtension(projectConfig);
37
39
  const postgresConfig = getPostgresConfigFromExtension(projectConfig);
38
40
  const usesPostgres = Boolean(postgresConfig);
41
+ const hasTenantStorages = getTenantStoragesFromExtension(projectConfig).length > 0;
39
42
  let searchEngineParams = null;
40
43
  if (openSearchExtensionConfig) searchEngineParams = openSearchExtensionConfig;
41
44
  if (searchEngineParams) {
@@ -102,7 +105,8 @@ const createApiPulumiApp = ()=>{
102
105
  S3_BUCKET: core.fileManagerBucketId,
103
106
  EVENT_BUS: core.eventBusArn,
104
107
  OKTA_ISSUER: process.env["OKTA_ISSUER"],
105
- ...usesPostgres ? getPostgresLambdaEnvFromCore(core) : {}
108
+ ...usesPostgres ? getPostgresLambdaEnvFromCore(core) : {},
109
+ ...hasTenantStorages ? getTenantStoragesLambdaEnvFromCore(core) : {}
106
110
  };
107
111
  const graphql = app.addModule(ApiGraphql, {
108
112
  env: graphqlEnv
@@ -128,7 +132,9 @@ const createApiPulumiApp = ()=>{
128
132
  graphqlWeb = app.addModule(ApiGraphqlWeb, {
129
133
  namePrefix: pulumiResourceNamePrefix ?? "",
130
134
  vpc: graphqlWebVpc,
131
- env: getPostgresWebFunctionEnv(postgresConfig)
135
+ env: getPostgresWebFunctionEnv(postgresConfig ?? (hasTenantStorages ? {
136
+ poolSize: POSTGRES_DEFAULT_POOL_SIZE
137
+ } : void 0))
132
138
  });
133
139
  app.addOutputs({
134
140
  graphqlWebFunctionName: graphqlWeb.fn.output.functionName,
@@ -150,12 +156,13 @@ const createApiPulumiApp = ()=>{
150
156
  const cloudfront = app.addModule(ApiCloudfront);
151
157
  const backgroundTask = app.addModule(ApiBackgroundTask);
152
158
  const scheduler = app.addModule(ApiScheduler);
153
- const schemaSetup = usesPostgres ? app.addModule(ApiSchemaSetup, {
154
- postgres: core,
155
- serviceManifests: __rspack_external__pulumi_pulumi_f3e773ed.all([
159
+ const schemaSetup = usesPostgres || hasTenantStorages ? app.addModule(ApiSchemaSetup, {
160
+ postgres: usesPostgres ? core : void 0,
161
+ tenantStorages: hasTenantStorages ? core.apply((output)=>output.storages) : void 0,
162
+ serviceManifests: usesPostgres ? __rspack_external__pulumi_pulumi_f3e773ed.all([
156
163
  core.serviceManifests,
157
164
  app.getServiceManifests()
158
- ]).apply(([coreManifests, apiManifests])=>getSchemaSetupServiceManifests(coreManifests, apiManifests))
165
+ ]).apply(([coreManifests, apiManifests])=>getSchemaSetupServiceManifests(coreManifests, apiManifests)) : []
159
166
  }) : null;
160
167
  const [apiCustomDomains] = projectConfig.extensionsByType(ApiCustomDomains);
161
168
  if (apiCustomDomains) {