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

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 (194) hide show
  1. package/_templates/appTemplates/api/graphql/package.json +2 -2
  2. package/_templates/appTemplates/api/graphql/src/index.ts +2 -2
  3. package/_templates/appTemplates/api/graphql/src/web.ts +15 -0
  4. package/_templates/appTemplates/api/graphql/webiny.config.ts +6 -1
  5. package/_templates/extensions/OpenSearch/api/graphql/src/index.ts +2 -2
  6. package/_templates/extensions/OpenSearch/api/graphql/src/web.ts +15 -0
  7. package/_templates/extensions/Postgres/api/graphql/src/index.ts +17 -0
  8. package/_templates/extensions/Postgres/api/graphql/src/web.ts +15 -0
  9. package/api.d.ts +6 -6
  10. package/api.js +3 -2
  11. package/api.js.map +1 -1
  12. package/apps/createApiApp.d.ts +18 -1
  13. package/apps/createCoreApp.d.ts +1 -1
  14. package/decorators/GetPulumiServiceWithDownloadInfo.d.ts +1 -3
  15. package/decorators/GetPulumiServiceWithDownloadInfo.js +15 -11
  16. package/decorators/GetPulumiServiceWithDownloadInfo.js.map +1 -1
  17. package/extensions/ApiRoute.d.ts +2 -1
  18. package/extensions/ApiRoute.js.map +1 -1
  19. package/extensions/AuroraPostgresCluster.d.ts +12 -0
  20. package/extensions/AuroraPostgresCluster.js +30 -0
  21. package/extensions/AuroraPostgresCluster.js.map +1 -0
  22. package/extensions/Postgres/AddCorePostgres.d.ts +27 -0
  23. package/extensions/Postgres/AddCorePostgres.js +52 -0
  24. package/extensions/Postgres/AddCorePostgres.js.map +1 -0
  25. package/extensions/Postgres/CopyPgModulesAfterApiBuild.d.ts +16 -0
  26. package/extensions/Postgres/CopyPgModulesAfterApiBuild.js +42 -0
  27. package/extensions/Postgres/CopyPgModulesAfterApiBuild.js.map +1 -0
  28. package/extensions/Postgres/ReplaceApiLambdaFnHandlers.d.ts +17 -0
  29. package/extensions/Postgres/ReplaceApiLambdaFnHandlers.js +33 -0
  30. package/extensions/Postgres/ReplaceApiLambdaFnHandlers.js.map +1 -0
  31. package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.d.ts +23 -0
  32. package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.js +41 -0
  33. package/extensions/Postgres/ValidatePostgresBeforeCoreDeploy.js.map +1 -0
  34. package/extensions/Postgres/copyPgRuntimeModules.d.ts +27 -0
  35. package/extensions/Postgres/copyPgRuntimeModules.js +124 -0
  36. package/extensions/Postgres/copyPgRuntimeModules.js.map +1 -0
  37. package/extensions/Postgres/rds-ca-bundle.pem +2888 -0
  38. package/extensions/Postgres/rdsCaBundle.d.ts +13 -0
  39. package/extensions/Postgres/rdsCaBundle.js +7 -0
  40. package/extensions/Postgres/rdsCaBundle.js.map +1 -0
  41. package/extensions/ProjectAws/EnsurePostgresSetupUnchanged.d.ts +20 -0
  42. package/extensions/ProjectAws/EnsurePostgresSetupUnchanged.js +34 -0
  43. package/extensions/ProjectAws/EnsurePostgresSetupUnchanged.js.map +1 -0
  44. package/extensions/ProjectAws/RefuseApiWatchWithPostgres.d.ts +20 -0
  45. package/extensions/ProjectAws/RefuseApiWatchWithPostgres.js +27 -0
  46. package/extensions/ProjectAws/RefuseApiWatchWithPostgres.js.map +1 -0
  47. package/extensions/ProjectAws.js +4 -0
  48. package/extensions/ProjectAws.js.map +1 -1
  49. package/extensions/definitions.js +3 -1
  50. package/extensions/definitions.js.map +1 -1
  51. package/extensions/index.d.ts +4 -1
  52. package/extensions/index.js +3 -2
  53. package/extensions/registerExtensionImplementations.js +3 -1
  54. package/extensions/registerExtensionImplementations.js.map +1 -1
  55. package/extensions/toCloudFrontPathPattern.d.ts +5 -0
  56. package/extensions/toCloudFrontPathPattern.js +8 -0
  57. package/extensions/toCloudFrontPathPattern.js.map +1 -0
  58. package/features/Watch/AwsWatch.js +1 -0
  59. package/features/Watch/AwsWatch.js.map +1 -1
  60. package/features/Watch/forwarder/createForwarderZip.d.ts +8 -0
  61. package/features/Watch/forwarder/createForwarderZip.js +19 -0
  62. package/features/Watch/forwarder/createForwarderZip.js.map +1 -0
  63. package/features/Watch/forwarder/lambdaHandler.cjs +124 -0
  64. package/features/Watch/forwarder/lambdaHandler.d.cts +1 -0
  65. package/features/Watch/forwarder/mqtt.cjs +4 -0
  66. package/features/Watch/forwarder/mqtt.d.cts +1 -0
  67. package/features/Watch/forwarder/webHandler.d.mts +1 -0
  68. package/features/Watch/forwarder/webHandler.mjs +298 -0
  69. package/features/Watch/replaceLambdaFunctions.d.ts +2 -0
  70. package/features/Watch/replaceLambdaFunctions.js +44 -3
  71. package/features/Watch/replaceLambdaFunctions.js.map +1 -1
  72. package/features/Watch/replaceWebFunction.d.ts +44 -0
  73. package/features/Watch/replaceWebFunction.js +119 -0
  74. package/features/Watch/replaceWebFunction.js.map +1 -0
  75. package/infra.d.ts +13 -0
  76. package/infra.js +8 -6
  77. package/infra.js.map +1 -1
  78. package/package.json +21 -17
  79. package/project.d.ts +1 -0
  80. package/pulumi/apps/admin/createAdminPulumiApp.js +1 -2
  81. package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
  82. package/pulumi/apps/api/ApiCloudfront.d.ts +5 -0
  83. package/pulumi/apps/api/ApiCloudfront.js +71 -198
  84. package/pulumi/apps/api/ApiCloudfront.js.map +1 -1
  85. package/pulumi/apps/api/ApiFileManager.d.ts +8 -1
  86. package/pulumi/apps/api/ApiFileManager.js +11 -1
  87. package/pulumi/apps/api/ApiFileManager.js.map +1 -1
  88. package/pulumi/apps/api/ApiGraphql.d.ts +1 -1
  89. package/pulumi/apps/api/ApiGraphql.js +78 -69
  90. package/pulumi/apps/api/ApiGraphql.js.map +1 -1
  91. package/pulumi/apps/api/ApiGraphqlWeb.d.ts +45 -0
  92. package/pulumi/apps/api/ApiGraphqlWeb.js +280 -0
  93. package/pulumi/apps/api/ApiGraphqlWeb.js.map +1 -0
  94. package/pulumi/apps/api/ApiOutput.d.ts +1 -0
  95. package/pulumi/apps/api/ApiOutput.js +2 -1
  96. package/pulumi/apps/api/ApiOutput.js.map +1 -1
  97. package/pulumi/apps/api/ApiSchemaSetup.d.ts +86 -0
  98. package/pulumi/apps/api/ApiSchemaSetup.js +139 -0
  99. package/pulumi/apps/api/ApiSchemaSetup.js.map +1 -0
  100. package/pulumi/apps/api/apiDynamoDb.d.ts +6 -0
  101. package/pulumi/apps/api/apiDynamoDb.js +20 -0
  102. package/pulumi/apps/api/apiDynamoDb.js.map +1 -0
  103. package/pulumi/apps/api/apiServiceManifests.d.ts +24 -0
  104. package/pulumi/apps/api/apiServiceManifests.js +27 -0
  105. package/pulumi/apps/api/apiServiceManifests.js.map +1 -0
  106. package/pulumi/apps/api/backgroundTask/types.js.map +1 -1
  107. package/pulumi/apps/api/cloudfront/addWebRouteBehavior.d.ts +8 -0
  108. package/pulumi/apps/api/cloudfront/addWebRouteBehavior.js +26 -0
  109. package/pulumi/apps/api/cloudfront/addWebRouteBehavior.js.map +1 -0
  110. package/pulumi/apps/api/cloudfront/allowFunctionUrlInvoke.d.ts +17 -0
  111. package/pulumi/apps/api/cloudfront/allowFunctionUrlInvoke.js +27 -0
  112. package/pulumi/apps/api/cloudfront/allowFunctionUrlInvoke.js.map +1 -0
  113. package/pulumi/apps/api/cloudfront/allowWebFunctionInvoke.d.ts +8 -0
  114. package/pulumi/apps/api/cloudfront/allowWebFunctionInvoke.js +31 -0
  115. package/pulumi/apps/api/cloudfront/allowWebFunctionInvoke.js.map +1 -0
  116. package/pulumi/apps/api/cloudfront/constants.d.ts +24 -0
  117. package/pulumi/apps/api/cloudfront/constants.js +43 -0
  118. package/pulumi/apps/api/cloudfront/constants.js.map +1 -0
  119. package/pulumi/apps/api/cloudfront/createFilesRouting.d.ts +10 -0
  120. package/pulumi/apps/api/cloudfront/createFilesRouting.js +35 -0
  121. package/pulumi/apps/api/cloudfront/createFilesRouting.js.map +1 -0
  122. package/pulumi/apps/api/cloudfront/createGatewayRouting.d.ts +10 -0
  123. package/pulumi/apps/api/cloudfront/createGatewayRouting.js +48 -0
  124. package/pulumi/apps/api/cloudfront/createGatewayRouting.js.map +1 -0
  125. package/pulumi/apps/api/cloudfront/createStreamRouting.d.ts +10 -0
  126. package/pulumi/apps/api/cloudfront/createStreamRouting.js +87 -0
  127. package/pulumi/apps/api/cloudfront/createStreamRouting.js.map +1 -0
  128. package/pulumi/apps/api/cloudfront/createWebRouting.d.ts +13 -0
  129. package/pulumi/apps/api/cloudfront/createWebRouting.js +140 -0
  130. package/pulumi/apps/api/cloudfront/createWebRouting.js.map +1 -0
  131. package/pulumi/apps/api/createApiPulumiApp.d.ts +22 -4
  132. package/pulumi/apps/api/createApiPulumiApp.js +122 -81
  133. package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
  134. package/pulumi/apps/api/index.d.ts +2 -0
  135. package/pulumi/apps/api/index.js +2 -0
  136. package/pulumi/apps/api/isRouteNameAllowed.d.ts +7 -0
  137. package/pulumi/apps/api/isRouteNameAllowed.js +6 -0
  138. package/pulumi/apps/api/isRouteNameAllowed.js.map +1 -0
  139. package/pulumi/apps/common/CoreOutput.d.ts +13 -0
  140. package/pulumi/apps/common/CoreOutput.js +17 -2
  141. package/pulumi/apps/common/CoreOutput.js.map +1 -1
  142. package/pulumi/apps/core/CoreCognito.d.ts +14 -0
  143. package/pulumi/apps/core/CoreCognito.js +34 -1
  144. package/pulumi/apps/core/CoreCognito.js.map +1 -1
  145. package/pulumi/apps/core/CoreOpenSearch.js +12 -6
  146. package/pulumi/apps/core/CoreOpenSearch.js.map +1 -1
  147. package/pulumi/apps/core/CorePostgres.d.ts +48 -0
  148. package/pulumi/apps/core/CorePostgres.js +262 -0
  149. package/pulumi/apps/core/CorePostgres.js.map +1 -0
  150. package/pulumi/apps/core/cognitoIdentityProviders/configure.js +11 -0
  151. package/pulumi/apps/core/cognitoIdentityProviders/configure.js.map +1 -1
  152. package/pulumi/apps/core/coreDynamoDb.d.ts +19 -0
  153. package/pulumi/apps/core/coreDynamoDb.js +34 -0
  154. package/pulumi/apps/core/coreDynamoDb.js.map +1 -0
  155. package/pulumi/apps/core/coreServiceManifests.d.ts +31 -0
  156. package/pulumi/apps/core/coreServiceManifests.js +31 -0
  157. package/pulumi/apps/core/coreServiceManifests.js.map +1 -0
  158. package/pulumi/apps/core/coreVpcEndpoints.d.ts +14 -0
  159. package/pulumi/apps/core/coreVpcEndpoints.js +55 -0
  160. package/pulumi/apps/core/coreVpcEndpoints.js.map +1 -0
  161. package/pulumi/apps/core/createCorePulumiApp.d.ts +1 -1
  162. package/pulumi/apps/core/createCorePulumiApp.js +18 -78
  163. package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
  164. package/pulumi/apps/core/index.d.ts +1 -0
  165. package/pulumi/apps/core/index.js +1 -0
  166. package/pulumi/apps/extensions/getPostgresConfigFromExtension.d.ts +15 -0
  167. package/pulumi/apps/extensions/getPostgresConfigFromExtension.js +16 -0
  168. package/pulumi/apps/extensions/getPostgresConfigFromExtension.js.map +1 -0
  169. package/pulumi/apps/extensions/getVpcConfigFromExtension.d.ts +4 -0
  170. package/pulumi/apps/extensions/isWebFunctionEnabled.d.ts +5 -0
  171. package/pulumi/apps/extensions/isWebFunctionEnabled.js +9 -0
  172. package/pulumi/apps/extensions/isWebFunctionEnabled.js.map +1 -0
  173. package/pulumi/apps/extensions/projectUsesPostgres.d.ts +2 -0
  174. package/pulumi/apps/extensions/projectUsesPostgres.js +10 -0
  175. package/pulumi/apps/extensions/projectUsesPostgres.js.map +1 -0
  176. package/pulumi/apps/react/adminSettingsItem.d.ts +17 -0
  177. package/pulumi/apps/react/adminSettingsItem.js +28 -0
  178. package/pulumi/apps/react/adminSettingsItem.js.map +1 -0
  179. package/pulumi/apps/react/createReactPulumiApp.js +6 -19
  180. package/pulumi/apps/react/createReactPulumiApp.js.map +1 -1
  181. package/pulumi/extensions/index.d.ts +12 -45
  182. package/pulumi/extensions/index.js +2 -1
  183. package/pulumi/extensions/index.js.map +1 -1
  184. package/pulumi/types.d.ts +5 -0
  185. package/pulumi/utils/lambdaEnvVariables.js +2 -2
  186. package/pulumi/utils/lambdaEnvVariables.js.map +1 -1
  187. package/pulumi/utils/tagResources.js +2 -0
  188. package/pulumi/utils/tagResources.js.map +1 -1
  189. package/pulumi/utils/withServiceManifest.d.ts +35 -1
  190. package/pulumi/utils/withServiceManifest.js +53 -9
  191. package/pulumi/utils/withServiceManifest.js.map +1 -1
  192. package/services/PulumiGetStackOutputService/mapStackOutput.js +1 -1
  193. package/services/PulumiGetStackOutputService/mapStackOutput.js.map +1 -1
  194. package/features/Watch/handler/handler.zip +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulumi/apps/api/apiDynamoDb.js","sources":["../../../../src/pulumi/apps/api/apiDynamoDb.ts"],"sourcesContent":["import type * as pulumi from \"@pulumi/pulumi\";\nimport type { PulumiApp } from \"@webiny/pulumi\";\nimport type { CoreOutput } from \"~/pulumi/apps/common/CoreOutput.js\";\n\n/*\n * The api app's references to the core's DynamoDB tables. With `<Infra.AuroraPostgres />` the core\n * has neither the primary nor the audit logs table, so there is no env or output for them. The\n * OpenSearch table belongs to `CoreOpenSearch` and exists whenever OpenSearch is configured, with\n * or without Postgres, so its env stays. The GraphQL policy's DynamoDB statement follows the\n * core's output instead (see `ApiGraphql`).\n */\n\nexport type DynamoDbLambdaEnv = Partial<\n Record<\"DB_TABLE\" | \"DB_TABLE_AUDIT_LOGS\" | \"DB_TABLE_OPENSEARCH\", pulumi.Output<unknown>>\n>;\n\n/* The env that names the core's DynamoDB tables, for the GraphQL functions. */\nexport const getDynamoDbLambdaEnv = (\n core: CoreOutput,\n usesPostgres: boolean\n): DynamoDbLambdaEnv => {\n if (usesPostgres) {\n // Unset (undefined) without OpenSearch, as before.\n return { DB_TABLE_OPENSEARCH: core.opensearchDynamodbTableName };\n }\n return {\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_AUDIT_LOGS: core.auditLogsDynamodbTableName,\n DB_TABLE_OPENSEARCH: core.opensearchDynamodbTableName\n };\n};\n\n/* The api stack outputs that name the core's DynamoDB tables. */\nexport const addDynamoDbOutputs = (app: PulumiApp, core: CoreOutput, usesPostgres: boolean) => {\n if (usesPostgres) {\n return;\n }\n app.addOutputs({\n dynamoDbTable: core.primaryDynamodbTableName,\n auditLogsDynamoDbTable: core.auditLogsDynamodbTableName\n });\n};\n"],"names":["getDynamoDbLambdaEnv","core","usesPostgres","addDynamoDbOutputs","app"],"mappings":"AAiBO,MAAMA,uBAAuB,CAChCC,MACAC;IAEA,IAAIA,cAEA,OAAO;QAAE,qBAAqBD,KAAK,2BAA2B;IAAC;IAEnE,OAAO;QACH,UAAUA,KAAK,wBAAwB;QACvC,qBAAqBA,KAAK,0BAA0B;QACpD,qBAAqBA,KAAK,2BAA2B;IACzD;AACJ;AAGO,MAAME,qBAAqB,CAACC,KAAgBH,MAAkBC;IACjE,IAAIA,cACA;IAEJE,IAAI,UAAU,CAAC;QACX,eAAeH,KAAK,wBAAwB;QAC5C,wBAAwBA,KAAK,0BAA0B;IAC3D;AACJ"}
@@ -0,0 +1,24 @@
1
+ import type * as aws from "@pulumi/aws";
2
+ import type { PulumiAppResource } from "@webiny/pulumi";
3
+ import type { ServiceManifest } from "../../../pulumi/utils/addServiceManifestTableItem.js";
4
+ export interface ApiServiceManifestsParams {
5
+ cloudfront: PulumiAppResource<typeof aws.cloudfront.Distribution>;
6
+ graphql: {
7
+ functions: {
8
+ graphql: PulumiAppResource<typeof aws.lambda.Function>;
9
+ };
10
+ };
11
+ backgroundTask: {
12
+ stepFunction: PulumiAppResource<typeof aws.sfn.StateMachine>;
13
+ };
14
+ scheduler: {
15
+ invokeRole: PulumiAppResource<typeof aws.iam.Role>;
16
+ };
17
+ }
18
+ /**
19
+ * The service manifests the api deploy publishes: `api` (its URL, the background-task state
20
+ * machine, its CloudFront distribution) and `scheduler` (the function the scheduler invokes, and
21
+ * the role it does it with). The API reads them through service discovery: from DynamoDB, and on
22
+ * Postgres from the database, where the schema setup stores them.
23
+ */
24
+ export declare const createApiServiceManifests: (params: ApiServiceManifestsParams) => ServiceManifest[];
@@ -0,0 +1,27 @@
1
+ import { getDistributionUrl } from "../../utils/getDistributionUrl.js";
2
+ const createApiServiceManifests = (params)=>{
3
+ const { cloudfront, graphql, backgroundTask, scheduler } = params;
4
+ return [
5
+ {
6
+ name: "api",
7
+ manifest: {
8
+ url: getDistributionUrl(cloudfront),
9
+ bgTaskSfn: backgroundTask.stepFunction.output.arn,
10
+ cloudfront: {
11
+ distributionId: cloudfront.output.id,
12
+ domain: cloudfront.output.domainName.apply((v)=>`https://${v}`)
13
+ }
14
+ }
15
+ },
16
+ {
17
+ name: "scheduler",
18
+ manifest: {
19
+ lambdaArn: graphql.functions.graphql.output.arn,
20
+ roleArn: scheduler.invokeRole.output.arn
21
+ }
22
+ }
23
+ ];
24
+ };
25
+ export { createApiServiceManifests };
26
+
27
+ //# sourceMappingURL=apiServiceManifests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulumi/apps/api/apiServiceManifests.js","sources":["../../../../src/pulumi/apps/api/apiServiceManifests.ts"],"sourcesContent":["import type * as aws from \"@pulumi/aws\";\nimport type { PulumiAppResource } from \"@webiny/pulumi\";\nimport type { ServiceManifest } from \"~/pulumi/utils/addServiceManifestTableItem.js\";\nimport { getDistributionUrl } from \"~/pulumi/utils/getDistributionUrl.js\";\n\nexport interface ApiServiceManifestsParams {\n cloudfront: PulumiAppResource<typeof aws.cloudfront.Distribution>;\n graphql: { functions: { graphql: PulumiAppResource<typeof aws.lambda.Function> } };\n backgroundTask: { stepFunction: PulumiAppResource<typeof aws.sfn.StateMachine> };\n scheduler: { invokeRole: PulumiAppResource<typeof aws.iam.Role> };\n}\n\n/**\n * The service manifests the api deploy publishes: `api` (its URL, the background-task state\n * machine, its CloudFront distribution) and `scheduler` (the function the scheduler invokes, and\n * the role it does it with). The API reads them through service discovery: from DynamoDB, and on\n * Postgres from the database, where the schema setup stores them.\n */\nexport const createApiServiceManifests = (params: ApiServiceManifestsParams): ServiceManifest[] => {\n const { cloudfront, graphql, backgroundTask, scheduler } = params;\n return [\n {\n name: \"api\",\n manifest: {\n // Read by the API through `PublicUrls.getApiUrl()`.\n url: getDistributionUrl(cloudfront),\n bgTaskSfn: backgroundTask.stepFunction.output.arn,\n cloudfront: {\n distributionId: cloudfront.output.id,\n domain: cloudfront.output.domainName.apply(v => `https://${v}`)\n }\n }\n },\n {\n name: \"scheduler\",\n manifest: {\n lambdaArn: graphql.functions.graphql.output.arn,\n roleArn: scheduler.invokeRole.output.arn\n }\n }\n ];\n};\n"],"names":["createApiServiceManifests","params","cloudfront","graphql","backgroundTask","scheduler","getDistributionUrl","v"],"mappings":";AAkBO,MAAMA,4BAA4B,CAACC;IACtC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAEC,cAAc,EAAEC,SAAS,EAAE,GAAGJ;IAC3D,OAAO;QACH;YACI,MAAM;YACN,UAAU;gBAEN,KAAKK,mBAAmBJ;gBACxB,WAAWE,eAAe,YAAY,CAAC,MAAM,CAAC,GAAG;gBACjD,YAAY;oBACR,gBAAgBF,WAAW,MAAM,CAAC,EAAE;oBACpC,QAAQA,WAAW,MAAM,CAAC,UAAU,CAAC,KAAK,CAACK,CAAAA,IAAK,CAAC,QAAQ,EAAEA,GAAG;gBAClE;YACJ;QACJ;QACA;YACI,MAAM;YACN,UAAU;gBACN,WAAWJ,QAAQ,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG;gBAC/C,SAASE,UAAU,UAAU,CAAC,MAAM,CAAC,GAAG;YAC5C;QACJ;KACH;AACL"}
@@ -1 +1 @@
1
- {"version":3,"file":"pulumi/apps/api/backgroundTask/types.js","sources":["../../../../../src/pulumi/apps/api/backgroundTask/types.ts"],"sourcesContent":["import type * as pulumi from \"@pulumi/pulumi\";\n\n/**\n * Update types if required. Try to avoid generic objects\n */\nexport enum StepFunctionDefinitionStatesType {\n Task = \"Task\",\n Pass = \"Pass\",\n Choice = \"Choice\",\n Wait = \"Wait\",\n Fail = \"Fail\",\n Succeed = \"Succeed\"\n}\n\nexport interface StepFunctionDefinitionStatesCatch {\n ErrorEquals: string[];\n Next: string;\n ResultPath?: string;\n}\n\nexport interface StepFunctionDefinitionStatesChoiceBase {\n Variable: string;\n Next: string;\n StringEquals?: string;\n StringMatches?: string;\n IsPresent?: boolean;\n IsNull?: boolean;\n}\n\nexport interface StepFunctionDefinitionStatesChoiceAndItem {\n Variable: string;\n StringEquals?: string;\n StringMatches?: string;\n IsPresent?: boolean;\n IsTimestamp?: boolean;\n IsNumeric?: boolean;\n NumericGreaterThan?: number;\n}\nexport interface StepFunctionDefinitionStatesChoiceAnd {\n And: StepFunctionDefinitionStatesChoiceAndItem[];\n Next: string;\n}\n\nexport type StepFunctionDefinitionStatesChoice =\n | StepFunctionDefinitionStatesChoiceBase\n | StepFunctionDefinitionStatesChoiceAnd;\n\nexport interface StepFunctionDefinitionStatesTypeBase {\n Type: StepFunctionDefinitionStatesType;\n Comment?: string;\n InputPath?: string;\n OutputPath?: string;\n}\n\nexport interface StepFunctionDefinitionStatesTypeTask extends StepFunctionDefinitionStatesTypeBase {\n Type: StepFunctionDefinitionStatesType.Task;\n Resource: pulumi.Input<string>;\n Next: string;\n ResultPath?: string;\n Parameters: Record<string, any>;\n Catch: StepFunctionDefinitionStatesCatch[];\n End?: boolean;\n}\n\nexport interface StepFunctionDefinitionStatesTypePass extends StepFunctionDefinitionStatesTypeBase {\n Type: StepFunctionDefinitionStatesType.Pass;\n Next: string;\n ResultPath?: string;\n Parameters: Record<string, any>;\n End?: boolean;\n}\n\nexport interface StepFunctionDefinitionStatesTypeChoice extends StepFunctionDefinitionStatesTypeBase {\n Type: StepFunctionDefinitionStatesType.Choice;\n Choices: StepFunctionDefinitionStatesChoice[];\n Default?: string;\n}\n\nexport interface StepFunctionDefinitionStatesTypeFail extends StepFunctionDefinitionStatesTypeBase {\n Type: StepFunctionDefinitionStatesType.Fail;\n Error?: string;\n Cause?: string;\n CausePath?: string;\n ErrorPath?: string;\n}\n\nexport interface StepFunctionDefinitionStatesTypeSucceed extends StepFunctionDefinitionStatesTypeBase {\n Type: StepFunctionDefinitionStatesType.Succeed;\n}\n\nexport interface StepFunctionDefinitionStatesTypeWait extends StepFunctionDefinitionStatesTypeBase {\n Next: string;\n Seconds?: number;\n Timestamp?: string;\n SecondsPath?: string;\n TimestampPath?: string;\n}\n\nexport type StepFunctionDefinitionStatesTypes =\n | StepFunctionDefinitionStatesTypeTask\n | StepFunctionDefinitionStatesTypePass\n | StepFunctionDefinitionStatesTypeChoice\n | StepFunctionDefinitionStatesTypeFail\n | StepFunctionDefinitionStatesTypeSucceed\n | StepFunctionDefinitionStatesTypeWait;\n\nexport interface StepFunctionDefinition {\n Comment: string;\n StartAt: string;\n States: {\n [key: string]: StepFunctionDefinitionStatesTypes;\n };\n}\n"],"names":["StepFunctionDefinitionStatesType"],"mappings":"AAKO,IAAKA,yCAAgCA,WAAAA,GAAAA,SAAhCA,gCAAgC;;;;;;;WAAhCA"}
1
+ {"version":3,"file":"pulumi/apps/api/backgroundTask/types.js","sources":["../../../../../src/pulumi/apps/api/backgroundTask/types.ts"],"sourcesContent":["import type * as pulumi from \"@pulumi/pulumi\";\n\n/**\n * Update types if required. Try to avoid generic objects\n */\nexport enum StepFunctionDefinitionStatesType {\n Task = \"Task\",\n Pass = \"Pass\",\n Choice = \"Choice\",\n Wait = \"Wait\",\n Fail = \"Fail\",\n Succeed = \"Succeed\"\n}\n\nexport interface StepFunctionDefinitionStatesCatch {\n ErrorEquals: string[];\n Next: string;\n ResultPath?: string;\n}\n\nexport interface StepFunctionDefinitionStatesChoiceBase {\n Variable: string;\n Next: string;\n StringEquals?: string;\n StringMatches?: string;\n IsPresent?: boolean;\n IsNull?: boolean;\n}\n\nexport interface StepFunctionDefinitionStatesChoiceAndItem {\n Variable: string;\n StringEquals?: string;\n StringMatches?: string;\n IsPresent?: boolean;\n IsTimestamp?: boolean;\n IsNumeric?: boolean;\n NumericGreaterThan?: number;\n}\nexport interface StepFunctionDefinitionStatesChoiceAnd {\n And: StepFunctionDefinitionStatesChoiceAndItem[];\n Next: string;\n}\n\nexport type StepFunctionDefinitionStatesChoice =\n | StepFunctionDefinitionStatesChoiceBase\n | StepFunctionDefinitionStatesChoiceAnd;\n\nexport interface StepFunctionDefinitionStatesTypeBase {\n Type: StepFunctionDefinitionStatesType;\n Comment?: string;\n InputPath?: string;\n OutputPath?: string;\n}\n\nexport interface StepFunctionDefinitionStatesTypeTask extends StepFunctionDefinitionStatesTypeBase {\n Type: StepFunctionDefinitionStatesType.Task;\n Resource: pulumi.Input<string>;\n Next: string;\n ResultPath?: string;\n Parameters: Record<string, any>;\n Catch: StepFunctionDefinitionStatesCatch[];\n End?: boolean;\n}\n\nexport interface StepFunctionDefinitionStatesTypePass extends StepFunctionDefinitionStatesTypeBase {\n Type: StepFunctionDefinitionStatesType.Pass;\n Next: string;\n ResultPath?: string;\n Parameters: Record<string, any>;\n End?: boolean;\n}\n\nexport interface StepFunctionDefinitionStatesTypeChoice extends StepFunctionDefinitionStatesTypeBase {\n Type: StepFunctionDefinitionStatesType.Choice;\n Choices: StepFunctionDefinitionStatesChoice[];\n Default?: string;\n}\n\nexport interface StepFunctionDefinitionStatesTypeFail extends StepFunctionDefinitionStatesTypeBase {\n Type: StepFunctionDefinitionStatesType.Fail;\n Error?: string;\n Cause?: string;\n CausePath?: string;\n ErrorPath?: string;\n}\n\nexport interface StepFunctionDefinitionStatesTypeSucceed extends StepFunctionDefinitionStatesTypeBase {\n Type: StepFunctionDefinitionStatesType.Succeed;\n}\n\nexport interface StepFunctionDefinitionStatesTypeWait extends StepFunctionDefinitionStatesTypeBase {\n Next: string;\n Seconds?: number;\n Timestamp?: string;\n SecondsPath?: string;\n TimestampPath?: string;\n}\n\nexport type StepFunctionDefinitionStatesTypes =\n | StepFunctionDefinitionStatesTypeTask\n | StepFunctionDefinitionStatesTypePass\n | StepFunctionDefinitionStatesTypeChoice\n | StepFunctionDefinitionStatesTypeFail\n | StepFunctionDefinitionStatesTypeSucceed\n | StepFunctionDefinitionStatesTypeWait;\n\nexport interface StepFunctionDefinition {\n Comment: string;\n StartAt: string;\n States: {\n [key: string]: StepFunctionDefinitionStatesTypes;\n };\n}\n"],"names":["StepFunctionDefinitionStatesType"],"mappings":"AAKO,IAAKA,yCAAgCA,WAAAA,GAAAA,SAAAA,gCAAAA"}
@@ -0,0 +1,8 @@
1
+ import * as aws from "@pulumi/aws";
2
+ import * as pulumi from "@pulumi/pulumi";
3
+ import type { PulumiAppResource } from "@webiny/pulumi";
4
+ /**
5
+ * Routes one more path to the web function. The new behavior is a copy of the `/graphql` one with a
6
+ * different path pattern and the route cache policy, and it goes right before it.
7
+ */
8
+ export declare function addWebRouteBehavior(distribution: PulumiAppResource<typeof aws.cloudfront.Distribution>, routePath: string, routeCachePolicyId: pulumi.Input<string>): void;
@@ -0,0 +1,26 @@
1
+ import { toCloudFrontPathPattern } from "../../../../extensions/toCloudFrontPathPattern.js";
2
+ import { WEB_ORIGIN_ID } from "./constants.js";
3
+ function addWebRouteBehavior(distribution, routePath, routeCachePolicyId) {
4
+ const pathPattern = toCloudFrontPathPattern(routePath);
5
+ distribution.config.orderedCacheBehaviors((current)=>{
6
+ if (!Array.isArray(current)) throw new Error("The API distribution's ordered cache behaviors must be a plain array.");
7
+ const behaviors = current;
8
+ const alreadyRouted = behaviors.some((behavior)=>behavior.pathPattern === pathPattern);
9
+ if (alreadyRouted) return behaviors;
10
+ const graphqlIndex = behaviors.findIndex((behavior)=>behavior.targetOriginId === WEB_ORIGIN_ID && "/graphql" === behavior.pathPattern);
11
+ if (-1 === graphqlIndex) throw new Error("The API distribution has no `/graphql` behavior on the web function.");
12
+ const routeBehavior = {
13
+ ...behaviors[graphqlIndex],
14
+ pathPattern,
15
+ cachePolicyId: routeCachePolicyId
16
+ };
17
+ const result = [
18
+ ...behaviors
19
+ ];
20
+ result.splice(graphqlIndex, 0, routeBehavior);
21
+ return result;
22
+ });
23
+ }
24
+ export { addWebRouteBehavior };
25
+
26
+ //# sourceMappingURL=addWebRouteBehavior.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulumi/apps/api/cloudfront/addWebRouteBehavior.js","sources":["../../../../../src/pulumi/apps/api/cloudfront/addWebRouteBehavior.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport type { PulumiAppResource } from \"@webiny/pulumi\";\nimport { toCloudFrontPathPattern } from \"~/extensions/toCloudFrontPathPattern.js\";\nimport type { OrderedCacheBehavior } from \"./constants.js\";\nimport { WEB_ORIGIN_ID } from \"./constants.js\";\n\n/**\n * Routes one more path to the web function. The new behavior is a copy of the `/graphql` one with a\n * different path pattern and the route cache policy, and it goes right before it.\n */\nexport function addWebRouteBehavior(\n distribution: PulumiAppResource<typeof aws.cloudfront.Distribution>,\n routePath: string,\n routeCachePolicyId: pulumi.Input<string>\n): void {\n const pathPattern = toCloudFrontPathPattern(routePath);\n\n distribution.config.orderedCacheBehaviors(current => {\n if (!Array.isArray(current)) {\n throw new Error(\n \"The API distribution's ordered cache behaviors must be a plain array.\"\n );\n }\n\n const behaviors: OrderedCacheBehavior[] = current;\n const alreadyRouted = behaviors.some(behavior => behavior.pathPattern === pathPattern);\n if (alreadyRouted) {\n // Several methods on one path share a behavior; the router matches the method.\n return behaviors;\n }\n\n const graphqlIndex = behaviors.findIndex(behavior => {\n return behavior.targetOriginId === WEB_ORIGIN_ID && behavior.pathPattern === \"/graphql\";\n });\n if (graphqlIndex === -1) {\n throw new Error(\"The API distribution has no `/graphql` behavior on the web function.\");\n }\n\n const routeBehavior = {\n ...behaviors[graphqlIndex],\n pathPattern,\n cachePolicyId: routeCachePolicyId\n };\n const result = [...behaviors];\n result.splice(graphqlIndex, 0, routeBehavior);\n return result;\n });\n}\n"],"names":["addWebRouteBehavior","distribution","routePath","routeCachePolicyId","pathPattern","toCloudFrontPathPattern","current","Array","Error","behaviors","alreadyRouted","behavior","graphqlIndex","WEB_ORIGIN_ID","routeBehavior","result"],"mappings":";;AAWO,SAASA,oBACZC,YAAmE,EACnEC,SAAiB,EACjBC,kBAAwC;IAExC,MAAMC,cAAcC,wBAAwBH;IAE5CD,aAAa,MAAM,CAAC,qBAAqB,CAACK,CAAAA;QACtC,IAAI,CAACC,MAAM,OAAO,CAACD,UACf,MAAM,IAAIE,MACN;QAIR,MAAMC,YAAoCH;QAC1C,MAAMI,gBAAgBD,UAAU,IAAI,CAACE,CAAAA,WAAYA,SAAS,WAAW,KAAKP;QAC1E,IAAIM,eAEA,OAAOD;QAGX,MAAMG,eAAeH,UAAU,SAAS,CAACE,CAAAA,WAC9BA,SAAS,cAAc,KAAKE,iBAAiBF,AAAyB,eAAzBA,SAAS,WAAW;QAE5E,IAAIC,AAAiB,OAAjBA,cACA,MAAM,IAAIJ,MAAM;QAGpB,MAAMM,gBAAgB;YAClB,GAAGL,SAAS,CAACG,aAAa;YAC1BR;YACA,eAAeD;QACnB;QACA,MAAMY,SAAS;eAAIN;SAAU;QAC7BM,OAAO,MAAM,CAACH,cAAc,GAAGE;QAC/B,OAAOC;IACX;AACJ"}
@@ -0,0 +1,17 @@
1
+ import type * as pulumi from "@pulumi/pulumi";
2
+ import type { PulumiApp } from "@webiny/pulumi";
3
+ interface AllowFunctionUrlInvokeParams {
4
+ name: string;
5
+ functionName: pulumi.Input<string>;
6
+ distributionArn: pulumi.Input<string>;
7
+ }
8
+ /**
9
+ * Lets the distribution, and nothing else, call a Function URL. Created after the distribution,
10
+ * because it needs its ARN.
11
+ *
12
+ * BOTH statements are required. The OAC-for-Lambda docs list `lambda:InvokeFunctionUrl` AND
13
+ * `lambda:InvokeFunction`; with only the former, Lambda's authorizer rejects every signed request
14
+ * from CloudFront with `AccessDeniedException` and the function is never invoked.
15
+ */
16
+ export declare function allowFunctionUrlInvoke(app: PulumiApp, params: AllowFunctionUrlInvokeParams): void;
17
+ export {};
@@ -0,0 +1,27 @@
1
+ import * as __rspack_external__pulumi_aws_9e2bee2d from "@pulumi/aws";
2
+ function allowFunctionUrlInvoke(app, params) {
3
+ app.addResource(__rspack_external__pulumi_aws_9e2bee2d.lambda.Permission, {
4
+ name: `${params.name}-url-cloudfront-invoke`,
5
+ config: {
6
+ action: "lambda:InvokeFunctionUrl",
7
+ function: params.functionName,
8
+ principal: "cloudfront.amazonaws.com",
9
+ sourceArn: params.distributionArn,
10
+ functionUrlAuthType: "AWS_IAM",
11
+ statementId: "allow-cloudfront-invoke-function-url"
12
+ }
13
+ });
14
+ app.addResource(__rspack_external__pulumi_aws_9e2bee2d.lambda.Permission, {
15
+ name: `${params.name}-cloudfront-invoke-function`,
16
+ config: {
17
+ action: "lambda:InvokeFunction",
18
+ function: params.functionName,
19
+ principal: "cloudfront.amazonaws.com",
20
+ sourceArn: params.distributionArn,
21
+ statementId: "allow-cloudfront-invoke-function"
22
+ }
23
+ });
24
+ }
25
+ export { allowFunctionUrlInvoke };
26
+
27
+ //# sourceMappingURL=allowFunctionUrlInvoke.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulumi/apps/api/cloudfront/allowFunctionUrlInvoke.js","sources":["../../../../../src/pulumi/apps/api/cloudfront/allowFunctionUrlInvoke.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type * as pulumi from \"@pulumi/pulumi\";\nimport type { PulumiApp } from \"@webiny/pulumi\";\n\ninterface AllowFunctionUrlInvokeParams {\n name: string;\n functionName: pulumi.Input<string>;\n distributionArn: pulumi.Input<string>;\n}\n\n/**\n * Lets the distribution, and nothing else, call a Function URL. Created after the distribution,\n * because it needs its ARN.\n *\n * BOTH statements are required. The OAC-for-Lambda docs list `lambda:InvokeFunctionUrl` AND\n * `lambda:InvokeFunction`; with only the former, Lambda's authorizer rejects every signed request\n * from CloudFront with `AccessDeniedException` and the function is never invoked.\n */\nexport function allowFunctionUrlInvoke(app: PulumiApp, params: AllowFunctionUrlInvokeParams) {\n app.addResource(aws.lambda.Permission, {\n name: `${params.name}-url-cloudfront-invoke`,\n config: {\n action: \"lambda:InvokeFunctionUrl\",\n function: params.functionName,\n principal: \"cloudfront.amazonaws.com\",\n sourceArn: params.distributionArn,\n functionUrlAuthType: \"AWS_IAM\",\n statementId: \"allow-cloudfront-invoke-function-url\"\n }\n });\n\n app.addResource(aws.lambda.Permission, {\n name: `${params.name}-cloudfront-invoke-function`,\n config: {\n action: \"lambda:InvokeFunction\",\n function: params.functionName,\n principal: \"cloudfront.amazonaws.com\",\n sourceArn: params.distributionArn,\n statementId: \"allow-cloudfront-invoke-function\"\n }\n });\n}\n"],"names":["allowFunctionUrlInvoke","app","params","aws"],"mappings":";AAkBO,SAASA,uBAAuBC,GAAc,EAAEC,MAAoC;IACvFD,IAAI,WAAW,CAACE,uCAAAA,MAAAA,CAAAA,UAAqB,EAAE;QACnC,MAAM,GAAGD,OAAO,IAAI,CAAC,sBAAsB,CAAC;QAC5C,QAAQ;YACJ,QAAQ;YACR,UAAUA,OAAO,YAAY;YAC7B,WAAW;YACX,WAAWA,OAAO,eAAe;YACjC,qBAAqB;YACrB,aAAa;QACjB;IACJ;IAEAD,IAAI,WAAW,CAACE,uCAAAA,MAAAA,CAAAA,UAAqB,EAAE;QACnC,MAAM,GAAGD,OAAO,IAAI,CAAC,2BAA2B,CAAC;QACjD,QAAQ;YACJ,QAAQ;YACR,UAAUA,OAAO,YAAY;YAC7B,WAAW;YACX,WAAWA,OAAO,eAAe;YACjC,aAAa;QACjB;IACJ;AACJ"}
@@ -0,0 +1,8 @@
1
+ import * as pulumi from "@pulumi/pulumi";
2
+ import type { PulumiApp } from "@webiny/pulumi";
3
+ import type { ApiGraphqlWeb } from "../ApiGraphqlWeb.js";
4
+ /**
5
+ * Lets the distribution, and nothing else, invoke the web function endpoint. The resource is the
6
+ * function; the statement names the endpoint.
7
+ */
8
+ export declare function allowWebFunctionInvoke(app: PulumiApp, graphqlWeb: ApiGraphqlWeb, distributionArn: pulumi.Input<string>): void;
@@ -0,0 +1,31 @@
1
+ import * as __rspack_external__pulumi_aws_9e2bee2d from "@pulumi/aws";
2
+ import * as __rspack_external__pulumi_pulumi_f3e773ed from "@pulumi/pulumi";
3
+ function allowWebFunctionInvoke(app, graphqlWeb, distributionArn) {
4
+ app.addResource(__rspack_external__pulumi_aws_9e2bee2d.lambdaweb.ResourcePolicy, {
5
+ name: "graphql-web-cloudfront-invoke",
6
+ config: {
7
+ resourceArn: graphqlWeb.fn.output.arn,
8
+ policy: __rspack_external__pulumi_pulumi_f3e773ed.jsonStringify({
9
+ Version: "2012-10-17",
10
+ Statement: [
11
+ {
12
+ Effect: "Allow",
13
+ Principal: {
14
+ Service: "cloudfront.amazonaws.com"
15
+ },
16
+ Action: "lambda:InvokeWebFunctionEndpoint",
17
+ Resource: graphqlWeb.endpoint.output.arn,
18
+ Condition: {
19
+ StringEquals: {
20
+ "aws:SourceArn": distributionArn
21
+ }
22
+ }
23
+ }
24
+ ]
25
+ })
26
+ }
27
+ });
28
+ }
29
+ export { allowWebFunctionInvoke };
30
+
31
+ //# sourceMappingURL=allowWebFunctionInvoke.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulumi/apps/api/cloudfront/allowWebFunctionInvoke.js","sources":["../../../../../src/pulumi/apps/api/cloudfront/allowWebFunctionInvoke.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport type { PulumiApp } from \"@webiny/pulumi\";\nimport type { ApiGraphqlWeb } from \"../ApiGraphqlWeb.js\";\n\n/**\n * Lets the distribution, and nothing else, invoke the web function endpoint. The resource is the\n * function; the statement names the endpoint.\n */\nexport function allowWebFunctionInvoke(\n app: PulumiApp,\n graphqlWeb: ApiGraphqlWeb,\n distributionArn: pulumi.Input<string>\n) {\n app.addResource(aws.lambdaweb.ResourcePolicy, {\n name: \"graphql-web-cloudfront-invoke\",\n config: {\n resourceArn: graphqlWeb.fn.output.arn,\n policy: pulumi.jsonStringify({\n Version: \"2012-10-17\",\n Statement: [\n {\n Effect: \"Allow\",\n Principal: { Service: \"cloudfront.amazonaws.com\" },\n Action: \"lambda:InvokeWebFunctionEndpoint\",\n Resource: graphqlWeb.endpoint.output.arn,\n Condition: {\n StringEquals: { \"aws:SourceArn\": distributionArn }\n }\n }\n ]\n })\n }\n });\n}\n"],"names":["allowWebFunctionInvoke","app","graphqlWeb","distributionArn","aws","pulumi"],"mappings":";;AASO,SAASA,uBACZC,GAAc,EACdC,UAAyB,EACzBC,eAAqC;IAErCF,IAAI,WAAW,CAACG,uCAAAA,SAAAA,CAAAA,cAA4B,EAAE;QAC1C,MAAM;QACN,QAAQ;YACJ,aAAaF,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG;YACrC,QAAQG,0CAAAA,aAAoB,CAAC;gBACzB,SAAS;gBACT,WAAW;oBACP;wBACI,QAAQ;wBACR,WAAW;4BAAE,SAAS;wBAA2B;wBACjD,QAAQ;wBACR,UAAUH,WAAW,QAAQ,CAAC,MAAM,CAAC,GAAG;wBACxC,WAAW;4BACP,cAAc;gCAAE,iBAAiBC;4BAAgB;wBACrD;oBACJ;iBACH;YACL;QACJ;IACJ;AACJ"}
@@ -0,0 +1,24 @@
1
+ import type * as aws from "@pulumi/aws";
2
+ export declare const MANAGED_CACHING_DISABLED_POLICY_ID = "4135ea2d-6df8-44a3-9df3-4b5a84be39ad";
3
+ export declare const STREAM_ORIGIN_ID = "graphql-stream-function-url";
4
+ export declare const WEB_ORIGIN_ID = "graphql-web-function-endpoint";
5
+ export declare const FILES_ORIGIN_ID = "fm-download-function-url";
6
+ export declare const ALL_METHODS: string[];
7
+ /**
8
+ * Viewer headers every API origin needs. The header lists of the web function's and the files'
9
+ * behaviors are built from this one, so a new `X-Webiny-*` header is added in one place.
10
+ * `FORWARD_HEADERS` and the stream policy predate it and are left as they are, so projects that turn
11
+ * the web function off see no change to their distribution.
12
+ */
13
+ export declare const API_VIEWER_HEADERS: string[];
14
+ export declare const CORS_PREFLIGHT_HEADERS: string[];
15
+ /**
16
+ * The headers forwarded to API Gateway, and to `fm-download` without the web function.
17
+ */
18
+ export declare const FORWARD_HEADERS: string[];
19
+ export declare const ID_TOKEN_COOKIES: {
20
+ forward: string;
21
+ whitelistedNames: string[];
22
+ };
23
+ export type OrderedCacheBehavior = aws.types.input.cloudfront.DistributionOrderedCacheBehavior;
24
+ export type DistributionOrigin = aws.types.input.cloudfront.DistributionOrigin;
@@ -0,0 +1,43 @@
1
+ const MANAGED_CACHING_DISABLED_POLICY_ID = "4135ea2d-6df8-44a3-9df3-4b5a84be39ad";
2
+ const STREAM_ORIGIN_ID = "graphql-stream-function-url";
3
+ const WEB_ORIGIN_ID = "graphql-web-function-endpoint";
4
+ const FILES_ORIGIN_ID = "fm-download-function-url";
5
+ const ALL_METHODS = [
6
+ "GET",
7
+ "HEAD",
8
+ "OPTIONS",
9
+ "PUT",
10
+ "POST",
11
+ "PATCH",
12
+ "DELETE"
13
+ ];
14
+ const API_VIEWER_HEADERS = [
15
+ "Origin",
16
+ "Accept",
17
+ "Accept-Language",
18
+ "X-Tenant",
19
+ "X-Webiny-Sdk",
20
+ "X-Webiny-Debug"
21
+ ];
22
+ const CORS_PREFLIGHT_HEADERS = [
23
+ "Access-Control-Request-Method",
24
+ "Access-Control-Request-Headers"
25
+ ];
26
+ const FORWARD_HEADERS = [
27
+ "Origin",
28
+ "Authorization",
29
+ "Accept",
30
+ "Accept-Language",
31
+ "X-Tenant",
32
+ "X-Webiny-Sdk",
33
+ "X-Webiny-Debug"
34
+ ];
35
+ const ID_TOKEN_COOKIES = {
36
+ forward: "whitelist",
37
+ whitelistedNames: [
38
+ "wby-id-token"
39
+ ]
40
+ };
41
+ export { ALL_METHODS, API_VIEWER_HEADERS, CORS_PREFLIGHT_HEADERS, FILES_ORIGIN_ID, FORWARD_HEADERS, ID_TOKEN_COOKIES, MANAGED_CACHING_DISABLED_POLICY_ID, STREAM_ORIGIN_ID, WEB_ORIGIN_ID };
42
+
43
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulumi/apps/api/cloudfront/constants.js","sources":["../../../../../src/pulumi/apps/api/cloudfront/constants.ts"],"sourcesContent":["import type * as aws from \"@pulumi/aws\";\n\n// AWS's `Managed-CachingDisabled` cache policy. Managed policy IDs are global constants — the same\n// value in every account and region — so this is hardcoded rather than resolved via\n// `aws.cloudfront.getCachePolicyOutput({ name: \"Managed-CachingDisabled\" })` the way\n// `createCloudFrontDefaultCacheBehaviorPolicies` does. The lookup would need\n// `cloudfront:ListCachePolicies` on the deploy role, and that is not worth adding to every\n// project's default deployment path just to avoid a constant AWS itself documents.\nexport const MANAGED_CACHING_DISABLED_POLICY_ID = \"4135ea2d-6df8-44a3-9df3-4b5a84be39ad\";\n\nexport const STREAM_ORIGIN_ID = \"graphql-stream-function-url\";\nexport const WEB_ORIGIN_ID = \"graphql-web-function-endpoint\";\nexport const FILES_ORIGIN_ID = \"fm-download-function-url\";\n\nexport const ALL_METHODS = [\"GET\", \"HEAD\", \"OPTIONS\", \"PUT\", \"POST\", \"PATCH\", \"DELETE\"];\n\n/**\n * Viewer headers every API origin needs. The header lists of the web function's and the files'\n * behaviors are built from this one, so a new `X-Webiny-*` header is added in one place.\n * `FORWARD_HEADERS` and the stream policy predate it and are left as they are, so projects that turn\n * the web function off see no change to their distribution.\n */\nexport const API_VIEWER_HEADERS = [\n \"Origin\",\n \"Accept\",\n \"Accept-Language\",\n \"X-Tenant\",\n \"X-Webiny-Sdk\",\n // Narrows the debugger's capture. Without it the edge drops the header silently.\n \"X-Webiny-Debug\"\n];\n\n// Needed for CORS preflight: without them the origin can't build a correct 204.\nexport const CORS_PREFLIGHT_HEADERS = [\n \"Access-Control-Request-Method\",\n \"Access-Control-Request-Headers\"\n];\n\n/**\n * The headers forwarded to API Gateway, and to `fm-download` without the web function.\n */\nexport const FORWARD_HEADERS = [\n \"Origin\",\n \"Authorization\",\n \"Accept\",\n \"Accept-Language\",\n \"X-Tenant\",\n \"X-Webiny-Sdk\",\n // Narrows the debugger's capture. Without it here the edge drops the header silently.\n \"X-Webiny-Debug\"\n];\n\nexport const ID_TOKEN_COOKIES = {\n forward: \"whitelist\",\n whitelistedNames: [\"wby-id-token\"]\n};\n\nexport type OrderedCacheBehavior = aws.types.input.cloudfront.DistributionOrderedCacheBehavior;\nexport type DistributionOrigin = aws.types.input.cloudfront.DistributionOrigin;\n"],"names":["MANAGED_CACHING_DISABLED_POLICY_ID","STREAM_ORIGIN_ID","WEB_ORIGIN_ID","FILES_ORIGIN_ID","ALL_METHODS","API_VIEWER_HEADERS","CORS_PREFLIGHT_HEADERS","FORWARD_HEADERS","ID_TOKEN_COOKIES"],"mappings":"AAQO,MAAMA,qCAAqC;AAE3C,MAAMC,mBAAmB;AACzB,MAAMC,gBAAgB;AACtB,MAAMC,kBAAkB;AAExB,MAAMC,cAAc;IAAC;IAAO;IAAQ;IAAW;IAAO;IAAQ;IAAS;CAAS;AAQhF,MAAMC,qBAAqB;IAC9B;IACA;IACA;IACA;IACA;IAEA;CACH;AAGM,MAAMC,yBAAyB;IAClC;IACA;CACH;AAKM,MAAMC,kBAAkB;IAC3B;IACA;IACA;IACA;IACA;IACA;IAEA;CACH;AAEM,MAAMC,mBAAmB;IAC5B,SAAS;IACT,kBAAkB;QAAC;KAAe;AACtC"}
@@ -0,0 +1,10 @@
1
+ import * as aws from "@pulumi/aws";
2
+ import type { PulumiApp } from "@webiny/pulumi";
3
+ import type { ApiFileManager } from "../ApiFileManager.js";
4
+ /**
5
+ * `fm-download` behind its Function URL, for when there is no API Gateway. Same setup as the
6
+ * streaming function's URL: AWS_IAM on the URL, an OAC that signs every request.
7
+ */
8
+ export declare function createFilesRouting(app: PulumiApp, fileManager: ApiFileManager): {
9
+ origin: aws.types.input.cloudfront.DistributionOrigin;
10
+ };
@@ -0,0 +1,35 @@
1
+ import { FILES_ORIGIN_ID } from "./constants.js";
2
+ import * as __rspack_external__pulumi_aws_9e2bee2d from "@pulumi/aws";
3
+ function createFilesRouting(app, fileManager) {
4
+ const functionUrl = fileManager.functionUrl;
5
+ if (!functionUrl) throw new Error("`fm-download` has no Function URL to route file requests to.");
6
+ const oac = app.addResource(__rspack_external__pulumi_aws_9e2bee2d.cloudfront.OriginAccessControl, {
7
+ name: "api-files-oac",
8
+ config: {
9
+ description: "Signs CloudFront requests to the fm-download Lambda Function URL",
10
+ originAccessControlOriginType: "lambda",
11
+ signingBehavior: "always",
12
+ signingProtocol: "sigv4"
13
+ }
14
+ });
15
+ const domainName = functionUrl.output.functionUrl.apply((url)=>new URL(url).hostname);
16
+ const origin = {
17
+ domainName,
18
+ originId: FILES_ORIGIN_ID,
19
+ originAccessControlId: oac.output.id,
20
+ customOriginConfig: {
21
+ httpPort: 80,
22
+ httpsPort: 443,
23
+ originProtocolPolicy: "https-only",
24
+ originSslProtocols: [
25
+ "TLSv1.2"
26
+ ]
27
+ }
28
+ };
29
+ return {
30
+ origin
31
+ };
32
+ }
33
+ export { createFilesRouting };
34
+
35
+ //# sourceMappingURL=createFilesRouting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulumi/apps/api/cloudfront/createFilesRouting.js","sources":["../../../../../src/pulumi/apps/api/cloudfront/createFilesRouting.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { PulumiApp } from \"@webiny/pulumi\";\nimport type { ApiFileManager } from \"../ApiFileManager.js\";\nimport type { DistributionOrigin } from \"./constants.js\";\nimport { FILES_ORIGIN_ID } from \"./constants.js\";\n\n/**\n * `fm-download` behind its Function URL, for when there is no API Gateway. Same setup as the\n * streaming function's URL: AWS_IAM on the URL, an OAC that signs every request.\n */\nexport function createFilesRouting(app: PulumiApp, fileManager: ApiFileManager) {\n const functionUrl = fileManager.functionUrl;\n if (!functionUrl) {\n throw new Error(\"`fm-download` has no Function URL to route file requests to.\");\n }\n\n const oac = app.addResource(aws.cloudfront.OriginAccessControl, {\n name: \"api-files-oac\",\n config: {\n description: \"Signs CloudFront requests to the fm-download Lambda Function URL\",\n originAccessControlOriginType: \"lambda\",\n signingBehavior: \"always\",\n signingProtocol: \"sigv4\"\n }\n });\n\n const domainName = functionUrl.output.functionUrl.apply((url: string) => new URL(url).hostname);\n const origin: DistributionOrigin = {\n domainName,\n originId: FILES_ORIGIN_ID,\n originAccessControlId: oac.output.id,\n customOriginConfig: {\n httpPort: 80,\n httpsPort: 443,\n originProtocolPolicy: \"https-only\",\n originSslProtocols: [\"TLSv1.2\"]\n }\n };\n\n return { origin };\n}\n"],"names":["createFilesRouting","app","fileManager","functionUrl","Error","oac","aws","domainName","url","URL","origin","FILES_ORIGIN_ID"],"mappings":";;AAUO,SAASA,mBAAmBC,GAAc,EAAEC,WAA2B;IAC1E,MAAMC,cAAcD,YAAY,WAAW;IAC3C,IAAI,CAACC,aACD,MAAM,IAAIC,MAAM;IAGpB,MAAMC,MAAMJ,IAAI,WAAW,CAACK,uCAAAA,UAAAA,CAAAA,mBAAkC,EAAE;QAC5D,MAAM;QACN,QAAQ;YACJ,aAAa;YACb,+BAA+B;YAC/B,iBAAiB;YACjB,iBAAiB;QACrB;IACJ;IAEA,MAAMC,aAAaJ,YAAY,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAACK,MAAgB,IAAIC,IAAID,KAAK,QAAQ;IAC9F,MAAME,SAA6B;QAC/BH;QACA,UAAUI;QACV,uBAAuBN,IAAI,MAAM,CAAC,EAAE;QACpC,oBAAoB;YAChB,UAAU;YACV,WAAW;YACX,sBAAsB;YACtB,oBAAoB;gBAAC;aAAU;QACnC;IACJ;IAEA,OAAO;QAAEK;IAAO;AACpB"}
@@ -0,0 +1,10 @@
1
+ import type { ApiGateway } from "../ApiGateway.js";
2
+ /**
3
+ * API Gateway's origin and the `/cms*` and `/wb/*` behaviors, for projects that turn the web function
4
+ * off. API Gateway also serves files and `/graphql` there, through the default behavior.
5
+ */
6
+ export declare function createGatewayRouting(gateway: ApiGateway): {
7
+ origin: import("@pulumi/aws/types/input.js").cloudfront.DistributionOrigin;
8
+ originId: import("@pulumi/pulumi").Output<string>;
9
+ behaviors: import("@pulumi/aws/types/input.js").cloudfront.DistributionOrderedCacheBehavior[];
10
+ };
@@ -0,0 +1,48 @@
1
+ import { ALL_METHODS, FORWARD_HEADERS } from "./constants.js";
2
+ function createGatewayRouting(gateway) {
3
+ const originId = gateway.api.output.name;
4
+ const origin = {
5
+ domainName: gateway.stage.output.invokeUrl.apply((url)=>new URL(url).hostname),
6
+ originPath: gateway.stage.output.invokeUrl.apply((url)=>new URL(url).pathname),
7
+ originId,
8
+ customOriginConfig: {
9
+ httpPort: 80,
10
+ httpsPort: 443,
11
+ originProtocolPolicy: "https-only",
12
+ originSslProtocols: [
13
+ "TLSv1.2"
14
+ ]
15
+ }
16
+ };
17
+ const behaviors = [];
18
+ for (const pathPattern of [
19
+ "/cms*",
20
+ "/wb/*"
21
+ ])behaviors.push({
22
+ compress: true,
23
+ allowedMethods: ALL_METHODS,
24
+ cachedMethods: [
25
+ "GET",
26
+ "HEAD",
27
+ "OPTIONS"
28
+ ],
29
+ forwardedValues: {
30
+ cookies: {
31
+ forward: "none"
32
+ },
33
+ headers: FORWARD_HEADERS,
34
+ queryString: true
35
+ },
36
+ pathPattern,
37
+ viewerProtocolPolicy: "allow-all",
38
+ targetOriginId: originId
39
+ });
40
+ return {
41
+ origin,
42
+ originId,
43
+ behaviors
44
+ };
45
+ }
46
+ export { createGatewayRouting };
47
+
48
+ //# sourceMappingURL=createGatewayRouting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulumi/apps/api/cloudfront/createGatewayRouting.js","sources":["../../../../../src/pulumi/apps/api/cloudfront/createGatewayRouting.ts"],"sourcesContent":["import type { ApiGateway } from \"../ApiGateway.js\";\nimport type { DistributionOrigin, OrderedCacheBehavior } from \"./constants.js\";\nimport { ALL_METHODS, FORWARD_HEADERS } from \"./constants.js\";\n\n/**\n * API Gateway's origin and the `/cms*` and `/wb/*` behaviors, for projects that turn the web function\n * off. API Gateway also serves files and `/graphql` there, through the default behavior.\n */\nexport function createGatewayRouting(gateway: ApiGateway) {\n const originId = gateway.api.output.name;\n\n const origin: DistributionOrigin = {\n domainName: gateway.stage.output.invokeUrl.apply((url: string) => new URL(url).hostname),\n originPath: gateway.stage.output.invokeUrl.apply((url: string) => new URL(url).pathname),\n originId,\n customOriginConfig: {\n httpPort: 80,\n httpsPort: 443,\n originProtocolPolicy: \"https-only\",\n originSslProtocols: [\"TLSv1.2\"]\n }\n };\n\n const behaviors: OrderedCacheBehavior[] = [];\n for (const pathPattern of [\"/cms*\", \"/wb/*\"]) {\n behaviors.push({\n compress: true,\n allowedMethods: ALL_METHODS,\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies: {\n forward: \"none\"\n },\n headers: FORWARD_HEADERS,\n queryString: true\n },\n pathPattern,\n viewerProtocolPolicy: \"allow-all\",\n targetOriginId: originId\n });\n }\n\n return { origin, originId, behaviors };\n}\n"],"names":["createGatewayRouting","gateway","originId","origin","url","URL","behaviors","pathPattern","ALL_METHODS","FORWARD_HEADERS"],"mappings":";AAQO,SAASA,qBAAqBC,OAAmB;IACpD,MAAMC,WAAWD,QAAQ,GAAG,CAAC,MAAM,CAAC,IAAI;IAExC,MAAME,SAA6B;QAC/B,YAAYF,QAAQ,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAACG,MAAgB,IAAIC,IAAID,KAAK,QAAQ;QACvF,YAAYH,QAAQ,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAACG,MAAgB,IAAIC,IAAID,KAAK,QAAQ;QACvFF;QACA,oBAAoB;YAChB,UAAU;YACV,WAAW;YACX,sBAAsB;YACtB,oBAAoB;gBAAC;aAAU;QACnC;IACJ;IAEA,MAAMI,YAAoC,EAAE;IAC5C,KAAK,MAAMC,eAAe;QAAC;QAAS;KAAQ,CACxCD,UAAU,IAAI,CAAC;QACX,UAAU;QACV,gBAAgBE;QAChB,eAAe;YAAC;YAAO;YAAQ;SAAU;QACzC,iBAAiB;YACb,SAAS;gBACL,SAAS;YACb;YACA,SAASC;YACT,aAAa;QACjB;QACAF;QACA,sBAAsB;QACtB,gBAAgBL;IACpB;IAGJ,OAAO;QAAEC;QAAQD;QAAUI;IAAU;AACzC"}
@@ -0,0 +1,10 @@
1
+ import * as aws from "@pulumi/aws";
2
+ import type { PulumiApp } from "@webiny/pulumi";
3
+ import type { ApiGraphqlStream } from "../ApiGraphqlStream.js";
4
+ /**
5
+ * The streaming function's origin (its Function URL) and the `/stream/*` behavior.
6
+ */
7
+ export declare function createStreamRouting(app: PulumiApp, graphqlStream: ApiGraphqlStream): {
8
+ origin: aws.types.input.cloudfront.DistributionOrigin;
9
+ behavior: aws.types.input.cloudfront.DistributionOrderedCacheBehavior;
10
+ };
@@ -0,0 +1,87 @@
1
+ import { MANAGED_CACHING_DISABLED_POLICY_ID, STREAM_ORIGIN_ID } from "./constants.js";
2
+ import * as __rspack_external__pulumi_aws_9e2bee2d from "@pulumi/aws";
3
+ function createStreamRouting(app, graphqlStream) {
4
+ const oac = app.addResource(__rspack_external__pulumi_aws_9e2bee2d.cloudfront.OriginAccessControl, {
5
+ name: "api-stream-oac",
6
+ config: {
7
+ description: "Signs CloudFront requests to the streaming Lambda Function URL",
8
+ originAccessControlOriginType: "lambda",
9
+ signingBehavior: "always",
10
+ signingProtocol: "sigv4"
11
+ }
12
+ });
13
+ const originRequestPolicy = app.addResource(__rspack_external__pulumi_aws_9e2bee2d.cloudfront.OriginRequestPolicy, {
14
+ name: "api-stream-origin-request-policy",
15
+ config: {
16
+ comment: "Headers/cookies forwarded to the streaming Lambda Function URL origin",
17
+ headersConfig: {
18
+ headerBehavior: "whitelist",
19
+ headers: {
20
+ items: [
21
+ "Origin",
22
+ "Accept",
23
+ "Accept-Language",
24
+ "Access-Control-Request-Method",
25
+ "Access-Control-Request-Headers",
26
+ "X-Tenant",
27
+ "X-Webiny-Sdk",
28
+ "X-Webiny-Authorization"
29
+ ]
30
+ }
31
+ },
32
+ cookiesConfig: {
33
+ cookieBehavior: "whitelist",
34
+ cookies: {
35
+ items: [
36
+ "wby-id-token"
37
+ ]
38
+ }
39
+ },
40
+ queryStringsConfig: {
41
+ queryStringBehavior: "all"
42
+ }
43
+ }
44
+ });
45
+ const origin = {
46
+ domainName: graphqlStream.functionUrlDomain,
47
+ originId: STREAM_ORIGIN_ID,
48
+ originAccessControlId: oac.output.id,
49
+ customOriginConfig: {
50
+ httpPort: 80,
51
+ httpsPort: 443,
52
+ originProtocolPolicy: "https-only",
53
+ originSslProtocols: [
54
+ "TLSv1.2"
55
+ ],
56
+ originReadTimeout: 60
57
+ }
58
+ };
59
+ const behavior = {
60
+ compress: false,
61
+ allowedMethods: [
62
+ "GET",
63
+ "HEAD",
64
+ "OPTIONS",
65
+ "PUT",
66
+ "POST",
67
+ "PATCH",
68
+ "DELETE"
69
+ ],
70
+ cachedMethods: [
71
+ "GET",
72
+ "HEAD"
73
+ ],
74
+ cachePolicyId: MANAGED_CACHING_DISABLED_POLICY_ID,
75
+ originRequestPolicyId: originRequestPolicy.output.id,
76
+ pathPattern: "/stream/*",
77
+ viewerProtocolPolicy: "https-only",
78
+ targetOriginId: STREAM_ORIGIN_ID
79
+ };
80
+ return {
81
+ origin,
82
+ behavior
83
+ };
84
+ }
85
+ export { createStreamRouting };
86
+
87
+ //# sourceMappingURL=createStreamRouting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pulumi/apps/api/cloudfront/createStreamRouting.js","sources":["../../../../../src/pulumi/apps/api/cloudfront/createStreamRouting.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { PulumiApp } from \"@webiny/pulumi\";\nimport type { ApiGraphqlStream } from \"../ApiGraphqlStream.js\";\nimport type { DistributionOrigin, OrderedCacheBehavior } from \"./constants.js\";\nimport { MANAGED_CACHING_DISABLED_POLICY_ID, STREAM_ORIGIN_ID } from \"./constants.js\";\n\n/**\n * The streaming function's origin (its Function URL) and the `/stream/*` behavior.\n */\nexport function createStreamRouting(app: PulumiApp, graphqlStream: ApiGraphqlStream) {\n // Lets CloudFront sign requests to the Lambda Function URL with SigV4, so the URL itself can\n // stay on AWS_IAM authorization instead of being reachable from the internet.\n const oac = app.addResource(aws.cloudfront.OriginAccessControl, {\n name: \"api-stream-oac\",\n config: {\n description: \"Signs CloudFront requests to the streaming Lambda Function URL\",\n originAccessControlOriginType: \"lambda\",\n signingBehavior: \"always\",\n signingProtocol: \"sigv4\"\n }\n });\n\n // The streaming behavior uses a cache policy + origin request policy instead of the legacy\n // `forwardedValues` the other behaviors use, because legacy forwarded values are deprecated\n // and this policy also has to forward the two CORS preflight headers (see below).\n //\n // It is NOT what fixed the `AccessDeniedException` that made Lambda reject every signed\n // CloudFront request — that was a missing `lambda:InvokeFunction` permission (see\n // `allowFunctionUrlInvoke`). Recorded because the wrong cause was assumed first.\n //\n // Do NOT replace this with a managed origin request policy. `Managed-AllViewer` forwards\n // `Host`, which breaks OAC signing against a Function URL origin.\n // `Managed-AllViewerExceptHostHeader` (used for the blue/green router in this same package)\n // fixes `Host` but still forwards `Authorization`, which OAC signing owns here — see below.\n const originRequestPolicy = app.addResource(aws.cloudfront.OriginRequestPolicy, {\n name: \"api-stream-origin-request-policy\",\n config: {\n comment: \"Headers/cookies forwarded to the streaming Lambda Function URL origin\",\n headersConfig: {\n headerBehavior: \"whitelist\",\n headers: {\n items: [\n \"Origin\",\n \"Accept\",\n \"Accept-Language\",\n // Required for CORS preflight: without these the origin can't build a\n // correct 204, so the browser blocks the real request.\n \"Access-Control-Request-Method\",\n \"Access-Control-Request-Headers\",\n \"X-Tenant\",\n \"X-Webiny-Sdk\",\n // `Authorization` is deliberately ABSENT — OAC signing owns that header.\n // Clients send their token in `X-Webiny-Authorization` instead.\n \"X-Webiny-Authorization\"\n ]\n }\n },\n cookiesConfig: {\n cookieBehavior: \"whitelist\",\n cookies: { items: [\"wby-id-token\"] }\n },\n queryStringsConfig: { queryStringBehavior: \"all\" }\n }\n });\n\n const origin: DistributionOrigin = {\n // Lambda Function URL origin for streaming routes. A Function URL is a plain\n // HTTPS endpoint, hence customOriginConfig; the OAC is what makes CloudFront\n // sign the request so the URL can require AWS_IAM.\n domainName: graphqlStream.functionUrlDomain,\n originId: STREAM_ORIGIN_ID,\n originAccessControlId: oac.output.id,\n customOriginConfig: {\n httpPort: 80,\n httpsPort: 443,\n originProtocolPolicy: \"https-only\",\n originSslProtocols: [\"TLSv1.2\"],\n // NOT a cap on how long a response may stream. It is an IDLE timeout,\n // applied twice: to time-to-first-byte, and to the gap between any two\n // subsequent packets. A stream that keeps emitting can run as long as the\n // Lambda lives (300s here); only silence longer than this kills it.\n //\n // Raised from the 30s default because that is shorter than a slow model's\n // time to first token: CloudFront would abandon the stream while the Lambda\n // kept working. 60s is the ceiling without an AWS quota increase — a route\n // whose quiet gaps could exceed it must emit SSE heartbeat comments\n // (`: ping\\n\\n`), which clients ignore by spec, resetting the timer.\n originReadTimeout: 60\n }\n };\n\n const behavior: OrderedCacheBehavior = {\n // Streaming routes (SSE). Must come before the other behaviors so `/stream/*`\n // never falls through to the API Gateway origin, which cannot stream.\n //\n // `compress: false` is load-bearing: CloudFront compression buffers small\n // chunks, which defeats incremental delivery even though the origin streams.\n compress: false,\n allowedMethods: [\"GET\", \"HEAD\", \"OPTIONS\", \"PUT\", \"POST\", \"PATCH\", \"DELETE\"],\n cachedMethods: [\"GET\", \"HEAD\"],\n // Nothing on a streaming route is cacheable. TTLs must NOT be set\n // alongside a cache policy.\n cachePolicyId: MANAGED_CACHING_DISABLED_POLICY_ID,\n originRequestPolicyId: originRequestPolicy.output.id,\n pathPattern: \"/stream/*\",\n // Stricter than the other behaviors' `allow-all` on purpose: a streaming route\n // carries an auth token in a header, so plain HTTP is never acceptable here.\n viewerProtocolPolicy: \"https-only\",\n targetOriginId: STREAM_ORIGIN_ID\n };\n\n return { origin, behavior };\n}\n"],"names":["createStreamRouting","app","graphqlStream","oac","aws","originRequestPolicy","origin","STREAM_ORIGIN_ID","behavior","MANAGED_CACHING_DISABLED_POLICY_ID"],"mappings":";;AASO,SAASA,oBAAoBC,GAAc,EAAEC,aAA+B;IAG/E,MAAMC,MAAMF,IAAI,WAAW,CAACG,uCAAAA,UAAAA,CAAAA,mBAAkC,EAAE;QAC5D,MAAM;QACN,QAAQ;YACJ,aAAa;YACb,+BAA+B;YAC/B,iBAAiB;YACjB,iBAAiB;QACrB;IACJ;IAcA,MAAMC,sBAAsBJ,IAAI,WAAW,CAACG,uCAAAA,UAAAA,CAAAA,mBAAkC,EAAE;QAC5E,MAAM;QACN,QAAQ;YACJ,SAAS;YACT,eAAe;gBACX,gBAAgB;gBAChB,SAAS;oBACL,OAAO;wBACH;wBACA;wBACA;wBAGA;wBACA;wBACA;wBACA;wBAGA;qBACH;gBACL;YACJ;YACA,eAAe;gBACX,gBAAgB;gBAChB,SAAS;oBAAE,OAAO;wBAAC;qBAAe;gBAAC;YACvC;YACA,oBAAoB;gBAAE,qBAAqB;YAAM;QACrD;IACJ;IAEA,MAAME,SAA6B;QAI/B,YAAYJ,cAAc,iBAAiB;QAC3C,UAAUK;QACV,uBAAuBJ,IAAI,MAAM,CAAC,EAAE;QACpC,oBAAoB;YAChB,UAAU;YACV,WAAW;YACX,sBAAsB;YACtB,oBAAoB;gBAAC;aAAU;YAW/B,mBAAmB;QACvB;IACJ;IAEA,MAAMK,WAAiC;QAMnC,UAAU;QACV,gBAAgB;YAAC;YAAO;YAAQ;YAAW;YAAO;YAAQ;YAAS;SAAS;QAC5E,eAAe;YAAC;YAAO;SAAO;QAG9B,eAAeC;QACf,uBAAuBJ,oBAAoB,MAAM,CAAC,EAAE;QACpD,aAAa;QAGb,sBAAsB;QACtB,gBAAgBE;IACpB;IAEA,OAAO;QAAED;QAAQE;IAAS;AAC9B"}
@@ -0,0 +1,13 @@
1
+ import * as aws from "@pulumi/aws";
2
+ import type { PulumiApp } from "@webiny/pulumi";
3
+ import type { ApiGraphqlWeb } from "../ApiGraphqlWeb.js";
4
+ /**
5
+ * The web function's origin and behaviors: `/graphql` and `/cms*` without caching, and `/wb/*` with
6
+ * caching keyed on the auth headers. `<Api.Route>` paths are added to these later, by
7
+ * `addWebRouteBehavior`, with `routeCachePolicyId`.
8
+ */
9
+ export declare function createWebRouting(app: PulumiApp, graphqlWeb: ApiGraphqlWeb): {
10
+ origin: aws.types.input.cloudfront.DistributionOrigin;
11
+ behaviors: aws.types.input.cloudfront.DistributionOrderedCacheBehavior[];
12
+ routeCachePolicyId: import("@pulumi/pulumi").Output<string>;
13
+ };