quidproquo-deploy-awscdk 0.0.263 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/lib/commonjs/constructs/base/createDefaultResourceAlarm.d.ts +25 -0
  2. package/lib/commonjs/constructs/base/createDefaultResourceAlarm.js +43 -0
  3. package/lib/commonjs/constructs/basic/DomainCertificateLookup.d.ts +16 -0
  4. package/lib/commonjs/constructs/basic/DomainCertificateLookup.js +24 -0
  5. package/lib/commonjs/constructs/basic/Function.js +3 -4
  6. package/lib/commonjs/constructs/basic/LambdaLayers.js +10 -2
  7. package/lib/commonjs/constructs/basic/SubdomainName.d.ts +2 -1
  8. package/lib/commonjs/constructs/basic/SubdomainName.js +12 -6
  9. package/lib/commonjs/constructs/basic/WebserverRoll.js +9 -15
  10. package/lib/commonjs/constructs/basic/index.d.ts +1 -2
  11. package/lib/commonjs/constructs/basic/index.js +1 -2
  12. package/lib/commonjs/constructs/feature/config/alarm/QpqConfigAwsAlarm.js +22 -26
  13. package/lib/commonjs/constructs/feature/config/cloudTrail/QpqBootstrapConfigCloudTrailConstruct.d.ts +9 -0
  14. package/lib/commonjs/constructs/feature/config/cloudTrail/QpqBootstrapConfigCloudTrailConstruct.js +98 -0
  15. package/lib/commonjs/constructs/feature/config/cloudTrail/index.d.ts +1 -0
  16. package/lib/commonjs/constructs/feature/config/cloudTrail/index.js +17 -0
  17. package/lib/commonjs/constructs/feature/config/index.d.ts +1 -0
  18. package/lib/commonjs/constructs/feature/config/index.js +1 -0
  19. package/lib/commonjs/constructs/feature/core/ai/QpqCoreAiConstruct.d.ts +5 -0
  20. package/lib/commonjs/constructs/feature/core/ai/QpqCoreAiConstruct.js +17 -0
  21. package/lib/commonjs/constructs/feature/core/ai/index.d.ts +1 -0
  22. package/lib/commonjs/constructs/feature/{webserver/domain → core/ai}/index.js +1 -1
  23. package/lib/commonjs/constructs/feature/core/auth/QpqInfCoreUserDirectoryConstruct.d.ts +1 -1
  24. package/lib/commonjs/constructs/feature/core/auth/QpqInfCoreUserDirectoryConstruct.js +43 -54
  25. package/lib/commonjs/constructs/feature/core/eventBus/QpqCoreEventBusConstruct.js +14 -0
  26. package/lib/commonjs/constructs/feature/core/index.d.ts +1 -0
  27. package/lib/commonjs/constructs/feature/core/index.js +1 -0
  28. package/lib/commonjs/constructs/feature/core/keyValueStore/QpqCoreKeyValueStoreConstruct.d.ts +1 -1
  29. package/lib/commonjs/constructs/feature/core/keyValueStore/QpqCoreKeyValueStoreConstruct.js +66 -7
  30. package/lib/commonjs/constructs/feature/core/queue/QpqCoreQueueConstruct.js +23 -4
  31. package/lib/commonjs/constructs/feature/core/storageDrive/QpqApiCoreStorageDriveConstruct.js +9 -0
  32. package/lib/commonjs/constructs/feature/core/storageDrive/QpqCoreStorageDriveConstruct.d.ts +7 -1
  33. package/lib/commonjs/constructs/feature/core/storageDrive/QpqCoreStorageDriveConstruct.js +61 -8
  34. package/lib/commonjs/constructs/feature/webserver/api/ApiQpqWebserverApiConstruct.js +67 -1
  35. package/lib/commonjs/constructs/feature/webserver/api/{BootstrapQpqWebserverApiConstruct.d.ts → DomainQpqWebserverApiConstruct.d.ts} +3 -3
  36. package/lib/commonjs/constructs/feature/webserver/api/{BootstrapQpqWebserverApiConstruct.js → DomainQpqWebserverApiConstruct.js} +5 -4
  37. package/lib/commonjs/constructs/feature/webserver/api/index.d.ts +1 -1
  38. package/lib/commonjs/constructs/feature/webserver/api/index.js +1 -1
  39. package/lib/commonjs/constructs/feature/webserver/certificate/QpqWebserverCertificateConstruct.d.ts +8 -0
  40. package/lib/commonjs/constructs/feature/webserver/certificate/QpqWebserverCertificateConstruct.js +9 -9
  41. package/lib/commonjs/constructs/feature/webserver/domainProxy/WebQpqWebserverDomainProxyConstruct.js +14 -12
  42. package/lib/commonjs/constructs/feature/webserver/index.d.ts +0 -1
  43. package/lib/commonjs/constructs/feature/webserver/index.js +0 -1
  44. package/lib/commonjs/constructs/feature/webserver/redirect/QpqWebserverSubdomainRedirectConstruct.js +2 -0
  45. package/lib/commonjs/constructs/feature/webserver/webEntry/WebQpqWebserverWebEntryConstruct.js +25 -30
  46. package/lib/commonjs/constructs/feature/webserver/webEntry/utils/securityHeaders.js +21 -15
  47. package/lib/commonjs/constructs/feature/webserver/websocket/QpqApiWebserverWebsocketConstruct.js +2 -1
  48. package/lib/commonjs/stacks/BootstrapQpqServiceStack.js +4 -5
  49. package/lib/commonjs/stacks/DomainCertificateStack.d.ts +15 -0
  50. package/lib/commonjs/stacks/DomainCertificateStack.js +87 -0
  51. package/lib/commonjs/stacks/DomainQpqServiceStack.d.ts +7 -0
  52. package/lib/commonjs/stacks/DomainQpqServiceStack.js +25 -0
  53. package/lib/commonjs/stacks/InfQpqServiceStack.js +7 -7
  54. package/lib/commonjs/stacks/createDomainCertificateStacks.d.ts +13 -0
  55. package/lib/commonjs/stacks/createDomainCertificateStacks.js +59 -0
  56. package/lib/commonjs/stacks/index.d.ts +3 -0
  57. package/lib/commonjs/stacks/index.js +3 -0
  58. package/lib/commonjs/utils/qpqAwsCdkNamingUtils.d.ts +1 -0
  59. package/lib/commonjs/utils/qpqAwsCdkNamingUtils.js +2 -1
  60. package/lib/esm/constructs/base/createDefaultResourceAlarm.d.ts +25 -0
  61. package/lib/esm/constructs/base/createDefaultResourceAlarm.js +37 -0
  62. package/lib/esm/constructs/basic/DomainCertificateLookup.d.ts +16 -0
  63. package/lib/esm/constructs/basic/DomainCertificateLookup.js +20 -0
  64. package/lib/esm/constructs/basic/Function.js +3 -4
  65. package/lib/esm/constructs/basic/LambdaLayers.js +11 -3
  66. package/lib/esm/constructs/basic/SubdomainName.d.ts +2 -1
  67. package/lib/esm/constructs/basic/SubdomainName.js +13 -7
  68. package/lib/esm/constructs/basic/WebserverRoll.js +9 -15
  69. package/lib/esm/constructs/basic/index.d.ts +1 -2
  70. package/lib/esm/constructs/basic/index.js +1 -2
  71. package/lib/esm/constructs/feature/config/alarm/QpqConfigAwsAlarm.js +23 -27
  72. package/lib/esm/constructs/feature/config/cloudTrail/QpqBootstrapConfigCloudTrailConstruct.d.ts +9 -0
  73. package/lib/esm/constructs/feature/config/cloudTrail/QpqBootstrapConfigCloudTrailConstruct.js +60 -0
  74. package/lib/esm/constructs/feature/config/cloudTrail/index.d.ts +1 -0
  75. package/lib/esm/constructs/feature/config/cloudTrail/index.js +1 -0
  76. package/lib/esm/constructs/feature/config/index.d.ts +1 -0
  77. package/lib/esm/constructs/feature/config/index.js +1 -0
  78. package/lib/esm/constructs/feature/core/ai/QpqCoreAiConstruct.d.ts +5 -0
  79. package/lib/esm/constructs/feature/core/ai/QpqCoreAiConstruct.js +13 -0
  80. package/lib/esm/constructs/feature/core/ai/index.d.ts +1 -0
  81. package/lib/esm/constructs/feature/core/ai/index.js +1 -0
  82. package/lib/esm/constructs/feature/core/auth/QpqInfCoreUserDirectoryConstruct.d.ts +1 -1
  83. package/lib/esm/constructs/feature/core/auth/QpqInfCoreUserDirectoryConstruct.js +43 -54
  84. package/lib/esm/constructs/feature/core/eventBus/QpqCoreEventBusConstruct.js +16 -2
  85. package/lib/esm/constructs/feature/core/index.d.ts +1 -0
  86. package/lib/esm/constructs/feature/core/index.js +1 -0
  87. package/lib/esm/constructs/feature/core/keyValueStore/QpqCoreKeyValueStoreConstruct.d.ts +1 -1
  88. package/lib/esm/constructs/feature/core/keyValueStore/QpqCoreKeyValueStoreConstruct.js +67 -8
  89. package/lib/esm/constructs/feature/core/queue/QpqCoreQueueConstruct.js +23 -4
  90. package/lib/esm/constructs/feature/core/storageDrive/QpqApiCoreStorageDriveConstruct.js +9 -0
  91. package/lib/esm/constructs/feature/core/storageDrive/QpqCoreStorageDriveConstruct.d.ts +7 -1
  92. package/lib/esm/constructs/feature/core/storageDrive/QpqCoreStorageDriveConstruct.js +59 -7
  93. package/lib/esm/constructs/feature/webserver/api/ApiQpqWebserverApiConstruct.js +35 -2
  94. package/lib/esm/constructs/feature/webserver/api/{BootstrapQpqWebserverApiConstruct.d.ts → DomainQpqWebserverApiConstruct.d.ts} +3 -3
  95. package/lib/esm/constructs/feature/webserver/api/{BootstrapQpqWebserverApiConstruct.js → DomainQpqWebserverApiConstruct.js} +3 -2
  96. package/lib/esm/constructs/feature/webserver/api/index.d.ts +1 -1
  97. package/lib/esm/constructs/feature/webserver/api/index.js +1 -1
  98. package/lib/esm/constructs/feature/webserver/certificate/QpqWebserverCertificateConstruct.d.ts +8 -0
  99. package/lib/esm/constructs/feature/webserver/certificate/QpqWebserverCertificateConstruct.js +9 -9
  100. package/lib/esm/constructs/feature/webserver/domainProxy/WebQpqWebserverDomainProxyConstruct.js +13 -12
  101. package/lib/esm/constructs/feature/webserver/index.d.ts +0 -1
  102. package/lib/esm/constructs/feature/webserver/index.js +0 -1
  103. package/lib/esm/constructs/feature/webserver/redirect/QpqWebserverSubdomainRedirectConstruct.js +2 -0
  104. package/lib/esm/constructs/feature/webserver/webEntry/WebQpqWebserverWebEntryConstruct.js +26 -31
  105. package/lib/esm/constructs/feature/webserver/webEntry/utils/securityHeaders.js +20 -15
  106. package/lib/esm/constructs/feature/webserver/websocket/QpqApiWebserverWebsocketConstruct.js +2 -1
  107. package/lib/esm/stacks/BootstrapQpqServiceStack.js +5 -6
  108. package/lib/esm/stacks/DomainCertificateStack.d.ts +15 -0
  109. package/lib/esm/stacks/DomainCertificateStack.js +86 -0
  110. package/lib/esm/stacks/DomainQpqServiceStack.d.ts +7 -0
  111. package/lib/esm/stacks/DomainQpqServiceStack.js +21 -0
  112. package/lib/esm/stacks/InfQpqServiceStack.js +8 -8
  113. package/lib/esm/stacks/createDomainCertificateStacks.d.ts +13 -0
  114. package/lib/esm/stacks/createDomainCertificateStacks.js +55 -0
  115. package/lib/esm/stacks/index.d.ts +3 -0
  116. package/lib/esm/stacks/index.js +3 -0
  117. package/lib/esm/utils/qpqAwsCdkNamingUtils.d.ts +1 -0
  118. package/lib/esm/utils/qpqAwsCdkNamingUtils.js +1 -0
  119. package/package.json +7 -7
  120. package/src/constructs/base/createDefaultResourceAlarm.ts +55 -0
  121. package/src/constructs/basic/DomainCertificateLookup.ts +28 -0
  122. package/src/constructs/basic/Function.ts +3 -4
  123. package/src/constructs/basic/LambdaLayers.ts +13 -3
  124. package/src/constructs/basic/SubdomainName.ts +15 -8
  125. package/src/constructs/basic/WebserverRoll.ts +9 -18
  126. package/src/constructs/basic/index.ts +1 -2
  127. package/src/constructs/feature/config/alarm/QpqConfigAwsAlarm.ts +27 -30
  128. package/src/constructs/feature/config/cloudTrail/QpqBootstrapConfigCloudTrailConstruct.ts +81 -0
  129. package/src/constructs/feature/config/cloudTrail/index.ts +1 -0
  130. package/src/constructs/feature/config/index.ts +1 -0
  131. package/src/constructs/feature/core/ai/QpqCoreAiConstruct.ts +19 -0
  132. package/src/constructs/feature/core/ai/index.ts +1 -0
  133. package/src/constructs/feature/core/auth/QpqInfCoreUserDirectoryConstruct.ts +49 -57
  134. package/src/constructs/feature/core/eventBus/QpqCoreEventBusConstruct.ts +16 -2
  135. package/src/constructs/feature/core/index.ts +1 -0
  136. package/src/constructs/feature/core/keyValueStore/QpqCoreKeyValueStoreConstruct.ts +74 -8
  137. package/src/constructs/feature/core/queue/QpqCoreQueueConstruct.ts +25 -4
  138. package/src/constructs/feature/core/storageDrive/QpqApiCoreStorageDriveConstruct.ts +10 -0
  139. package/src/constructs/feature/core/storageDrive/QpqCoreStorageDriveConstruct.ts +78 -7
  140. package/src/constructs/feature/webserver/api/ApiQpqWebserverApiConstruct.ts +37 -2
  141. package/src/constructs/feature/webserver/api/{BootstrapQpqWebserverApiConstruct.ts → DomainQpqWebserverApiConstruct.ts} +5 -4
  142. package/src/constructs/feature/webserver/api/index.ts +1 -1
  143. package/src/constructs/feature/webserver/certificate/QpqWebserverCertificateConstruct.ts +9 -11
  144. package/src/constructs/feature/webserver/domainProxy/WebQpqWebserverDomainProxyConstruct.ts +21 -12
  145. package/src/constructs/feature/webserver/index.ts +0 -1
  146. package/src/constructs/feature/webserver/redirect/QpqWebserverSubdomainRedirectConstruct.ts +2 -0
  147. package/src/constructs/feature/webserver/webEntry/WebQpqWebserverWebEntryConstruct.ts +32 -34
  148. package/src/constructs/feature/webserver/webEntry/utils/securityHeaders.ts +29 -15
  149. package/src/constructs/feature/webserver/websocket/QpqApiWebserverWebsocketConstruct.ts +2 -1
  150. package/src/stacks/BootstrapQpqServiceStack.ts +10 -11
  151. package/src/stacks/DomainCertificateStack.ts +109 -0
  152. package/src/stacks/DomainQpqServiceStack.ts +33 -0
  153. package/src/stacks/InfQpqServiceStack.ts +10 -9
  154. package/src/stacks/createDomainCertificateStacks.ts +70 -0
  155. package/src/stacks/index.ts +3 -0
  156. package/src/utils/qpqAwsCdkNamingUtils.ts +1 -0
  157. package/lib/commonjs/constructs/basic/DnsValidatedCertificate.d.ts +0 -18
  158. package/lib/commonjs/constructs/basic/DnsValidatedCertificate.js +0 -68
  159. package/lib/commonjs/constructs/basic/InfQpqWebserverServiceDomainsConstruct.d.ts +0 -7
  160. package/lib/commonjs/constructs/basic/InfQpqWebserverServiceDomainsConstruct.js +0 -31
  161. package/lib/commonjs/constructs/basic/ServiceDomain.d.ts +0 -8
  162. package/lib/commonjs/constructs/basic/ServiceDomain.js +0 -43
  163. package/lib/commonjs/constructs/feature/core/alarm/QpqConfigAwsAlarm.d.ts +0 -9
  164. package/lib/commonjs/constructs/feature/core/alarm/QpqConfigAwsAlarm.js +0 -88
  165. package/lib/commonjs/constructs/feature/webserver/domain/QpqWebserverDomainConstruct.d.ts +0 -11
  166. package/lib/commonjs/constructs/feature/webserver/domain/QpqWebserverDomainConstruct.js +0 -47
  167. package/lib/commonjs/constructs/feature/webserver/domain/index.d.ts +0 -1
  168. package/lib/esm/constructs/basic/DnsValidatedCertificate.d.ts +0 -18
  169. package/lib/esm/constructs/basic/DnsValidatedCertificate.js +0 -33
  170. package/lib/esm/constructs/basic/InfQpqWebserverServiceDomainsConstruct.d.ts +0 -7
  171. package/lib/esm/constructs/basic/InfQpqWebserverServiceDomainsConstruct.js +0 -27
  172. package/lib/esm/constructs/basic/ServiceDomain.d.ts +0 -8
  173. package/lib/esm/constructs/basic/ServiceDomain.js +0 -39
  174. package/lib/esm/constructs/feature/core/alarm/QpqConfigAwsAlarm.d.ts +0 -9
  175. package/lib/esm/constructs/feature/core/alarm/QpqConfigAwsAlarm.js +0 -50
  176. package/lib/esm/constructs/feature/webserver/domain/QpqWebserverDomainConstruct.d.ts +0 -11
  177. package/lib/esm/constructs/feature/webserver/domain/QpqWebserverDomainConstruct.js +0 -42
  178. package/lib/esm/constructs/feature/webserver/domain/index.d.ts +0 -1
  179. package/lib/esm/constructs/feature/webserver/domain/index.js +0 -1
  180. package/src/constructs/basic/DnsValidatedCertificate.ts +0 -54
  181. package/src/constructs/basic/InfQpqWebserverServiceDomainsConstruct.ts +0 -39
  182. package/src/constructs/basic/ServiceDomain.ts +0 -55
  183. package/src/constructs/feature/core/alarm/QpqConfigAwsAlarm.ts +0 -62
  184. package/src/constructs/feature/webserver/domain/QpqWebserverDomainConstruct.ts +0 -60
  185. package/src/constructs/feature/webserver/domain/index.ts +0 -1
@@ -0,0 +1,25 @@
1
+ import { QPQConfig } from 'quidproquo-core';
2
+ import { aws_cloudwatch } from 'aws-cdk-lib';
3
+ import { Construct } from 'constructs';
4
+ export interface DefaultResourceAlarmProps {
5
+ /** Construct id (also seeds the per-event-bus action ids). */
6
+ id: string;
7
+ alarmName: string;
8
+ metric: aws_cloudwatch.IMetric;
9
+ threshold: number;
10
+ comparisonOperator?: aws_cloudwatch.ComparisonOperator;
11
+ evaluationPeriods?: number;
12
+ datapointsToAlarm?: number;
13
+ }
14
+ /** Event buses that error/alarm notifications route to (from `defineNotifyError`). */
15
+ export declare const getNotifyErrorEventBusNames: (qpqConfig: QPQConfig) => string[];
16
+ /**
17
+ * Create a sensible default alarm for a resource and route it to the service's
18
+ * error-notification event bus(es).
19
+ *
20
+ * Opt-in: this is a no-op unless the service declares a `defineNotifyError`. We
21
+ * reuse that config's target bus so default alarms land wherever errors already
22
+ * do (no separate ops-routing concept). If a NotifyError exists but names no
23
+ * bus, the alarm is still created (visible in console / dashboards) but unrouted.
24
+ */
25
+ export declare const createDefaultResourceAlarm: (scope: Construct, qpqConfig: QPQConfig, props: DefaultResourceAlarmProps) => void;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDefaultResourceAlarm = exports.getNotifyErrorEventBusNames = void 0;
4
+ const quidproquo_core_1 = require("quidproquo-core");
5
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
6
+ // Imported by direct path (not the ../feature/core barrel) to avoid an import
7
+ // cycle: resource constructs import this helper, and the barrel re-exports those
8
+ // same resource constructs.
9
+ const QpqCoreEventBusConstruct_1 = require("../feature/core/eventBus/QpqCoreEventBusConstruct");
10
+ /** Event buses that error/alarm notifications route to (from `defineNotifyError`). */
11
+ const getNotifyErrorEventBusNames = (qpqConfig) => {
12
+ const names = quidproquo_core_1.qpqCoreUtils.getNotifyErrorConfigs(qpqConfig).flatMap((config) => config.onAlarm.publishToEventBus || []);
13
+ return [...new Set(names)];
14
+ };
15
+ exports.getNotifyErrorEventBusNames = getNotifyErrorEventBusNames;
16
+ /**
17
+ * Create a sensible default alarm for a resource and route it to the service's
18
+ * error-notification event bus(es).
19
+ *
20
+ * Opt-in: this is a no-op unless the service declares a `defineNotifyError`. We
21
+ * reuse that config's target bus so default alarms land wherever errors already
22
+ * do (no separate ops-routing concept). If a NotifyError exists but names no
23
+ * bus, the alarm is still created (visible in console / dashboards) but unrouted.
24
+ */
25
+ const createDefaultResourceAlarm = (scope, qpqConfig, props) => {
26
+ var _a, _b;
27
+ if (quidproquo_core_1.qpqCoreUtils.getNotifyErrorConfigs(qpqConfig).length === 0) {
28
+ return;
29
+ }
30
+ const alarm = new aws_cdk_lib_1.aws_cloudwatch.Alarm(scope, props.id, {
31
+ alarmName: props.alarmName,
32
+ metric: props.metric,
33
+ threshold: props.threshold,
34
+ comparisonOperator: (_a = props.comparisonOperator) !== null && _a !== void 0 ? _a : aws_cdk_lib_1.aws_cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
35
+ evaluationPeriods: (_b = props.evaluationPeriods) !== null && _b !== void 0 ? _b : 1,
36
+ datapointsToAlarm: props.datapointsToAlarm,
37
+ });
38
+ (0, exports.getNotifyErrorEventBusNames)(qpqConfig).forEach((busName) => {
39
+ const eventBus = QpqCoreEventBusConstruct_1.QpqCoreEventBusConstruct.fromOtherStack(scope, `${props.id}-bus-${busName}`, qpqConfig, busName);
40
+ alarm.addAlarmAction(new aws_cdk_lib_1.aws_cloudwatch_actions.SnsAction(eventBus.topic));
41
+ });
42
+ };
43
+ exports.createDefaultResourceAlarm = createDefaultResourceAlarm;
@@ -0,0 +1,16 @@
1
+ import { aws_certificatemanager } from 'aws-cdk-lib';
2
+ import { Construct } from 'constructs';
3
+ /**
4
+ * Service-side helper to import an ACM certificate previously created by a DomainCertificateStack.
5
+ *
6
+ * The domain phase writes the cert ARN into an SSM parameter in the deploy region, keyed by region.
7
+ * This helper reads that parameter as a deploy-time CloudFormation token and imports the cert by ARN.
8
+ * Resolution is deferred to CloudFormation at deploy time (via valueForStringParameter), so synth does
9
+ * not require the domain stack to have been deployed yet.
10
+ *
11
+ * @param scope CDK construct scope (typically the service stack/construct)
12
+ * @param certRegion 'us-east-1' for CloudFront, deploy region for regional resources
13
+ * @param rootDomain The same un-prefixed apex passed to the matching defineDomainCertificate entry
14
+ * @param idSuffix Unique suffix for the CDK construct id (scope-local)
15
+ */
16
+ export declare const lookupDomainCertificate: (scope: Construct, certRegion: string, rootDomain: string, idSuffix: string) => aws_certificatemanager.ICertificate;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lookupDomainCertificate = void 0;
4
+ const quidproquo_config_aws_1 = require("quidproquo-config-aws");
5
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
6
+ /**
7
+ * Service-side helper to import an ACM certificate previously created by a DomainCertificateStack.
8
+ *
9
+ * The domain phase writes the cert ARN into an SSM parameter in the deploy region, keyed by region.
10
+ * This helper reads that parameter as a deploy-time CloudFormation token and imports the cert by ARN.
11
+ * Resolution is deferred to CloudFormation at deploy time (via valueForStringParameter), so synth does
12
+ * not require the domain stack to have been deployed yet.
13
+ *
14
+ * @param scope CDK construct scope (typically the service stack/construct)
15
+ * @param certRegion 'us-east-1' for CloudFront, deploy region for regional resources
16
+ * @param rootDomain The same un-prefixed apex passed to the matching defineDomainCertificate entry
17
+ * @param idSuffix Unique suffix for the CDK construct id (scope-local)
18
+ */
19
+ const lookupDomainCertificate = (scope, certRegion, rootDomain, idSuffix) => {
20
+ const paramName = quidproquo_config_aws_1.qpqConfigAwsUtils.getDomainCertificateArnSsmParameterName(certRegion, rootDomain);
21
+ const certArn = aws_cdk_lib_1.aws_ssm.StringParameter.valueForStringParameter(scope, paramName);
22
+ return aws_cdk_lib_1.aws_certificatemanager.Certificate.fromCertificateArn(scope, `domain-cert-${idSuffix}`, certArn);
23
+ };
24
+ exports.lookupDomainCertificate = lookupDomainCertificate;
@@ -53,7 +53,7 @@ class Function extends QpqConstructBlock_1.QpqConstructBlock {
53
53
  this.lambdaFunction = new aws_cdk_lib_1.aws_lambda.Function(this, functionId, {
54
54
  functionName: props.functionName,
55
55
  timeout: cdk.Duration.seconds(props.timeoutInSeconds || 25),
56
- runtime: aws_cdk_lib_1.aws_lambda.Runtime.NODEJS_20_X,
56
+ runtime: aws_cdk_lib_1.aws_lambda.Runtime.NODEJS_22_X,
57
57
  memorySize: props.memoryInBytes || serviceInfo.lambdaMaxMemoryInMiB || 1024,
58
58
  layers: props.apiLayerVersions,
59
59
  code: aws_cdk_lib_1.aws_lambda.Code.fromAsset((0, upath_1.join)(utils_1.qpqAwsCdkPathUtils.getApiBuildPathFullPath(props.qpqConfig), props.functionType)),
@@ -62,10 +62,9 @@ class Function extends QpqConstructBlock_1.QpqConstructBlock {
62
62
  reservedConcurrentExecutions: quidproquo_config_aws_2.qpqConfigAwsUtils.isReservedConcurrencyDisabled(props.qpqConfig)
63
63
  ? undefined
64
64
  : props.reservedConcurrentExecutions,
65
- // TODO: Make this optional
66
- tracing: aws_cdk_lib_1.aws_lambda.Tracing.DISABLED,
65
+ tracing: quidproquo_config_aws_2.qpqConfigAwsUtils.isTracingDisabled(props.qpqConfig) ? aws_cdk_lib_1.aws_lambda.Tracing.DISABLED : aws_cdk_lib_1.aws_lambda.Tracing.ACTIVE,
67
66
  logGroup: new aws_cdk_lib_1.aws_logs.LogGroup(this, 'LogGroup', {
68
- retention: aws_cdk_lib_1.aws_logs.RetentionDays.ONE_WEEK,
67
+ retention: aws_cdk_lib_1.aws_logs.RetentionDays.ONE_YEAR,
69
68
  removalPolicy: cdk.RemovalPolicy.DESTROY,
70
69
  }),
71
70
  role: props.role,
@@ -23,15 +23,23 @@ class LambdaLayers extends QpqConstructBlock_1.QpqConstructBlock {
23
23
  constructor(scope, id, props) {
24
24
  super(scope, id, props);
25
25
  const apiLayers = (0, exports.getLambdaLayersWithFullPaths)(props.qpqConfig);
26
- this.layers = apiLayers.map((layer) => {
26
+ const userLayers = apiLayers.map((layer) => {
27
27
  return layer.buildPath
28
28
  ? new aws_cdk_lib_1.aws_lambda.LayerVersion(this, `${layer.name}-layer`, {
29
29
  layerVersionName: quidproquo_actionprocessor_awslambda_1.awsNamingUtils.getQpqRuntimeResourceNameFromConfig(layer.name, props.qpqConfig),
30
30
  code: new aws_cdk_lib_1.aws_lambda.AssetCode(layer.buildPath),
31
- compatibleRuntimes: [aws_cdk_lib_1.aws_lambda.Runtime.NODEJS_20_X],
31
+ compatibleRuntimes: [aws_cdk_lib_1.aws_lambda.Runtime.NODEJS_22_X],
32
32
  })
33
33
  : aws_cdk_lib_1.aws_lambda.LayerVersion.fromLayerVersionArn(this, `${layer.name}-layer-ref`, layer.layerArn);
34
34
  });
35
+ // Always-on: the qpq-log-extension ships story logs to S3 off the function's
36
+ // response path. Attached to every function via apiLayerVersions.
37
+ const logExtensionLayer = new aws_cdk_lib_1.aws_lambda.LayerVersion(this, 'qpq-log-extension-layer', {
38
+ layerVersionName: quidproquo_actionprocessor_awslambda_1.awsNamingUtils.getQpqRuntimeResourceNameFromConfig('qpq-log-extension', props.qpqConfig),
39
+ code: new aws_cdk_lib_1.aws_lambda.AssetCode((0, quidproquo_actionprocessor_awslambda_1.getLogExtensionLayerPath)()),
40
+ compatibleRuntimes: [aws_cdk_lib_1.aws_lambda.Runtime.NODEJS_22_X],
41
+ });
42
+ this.layers = [...userLayers, logExtensionLayer];
35
43
  }
36
44
  }
37
45
  exports.LambdaLayers = LambdaLayers;
@@ -4,10 +4,11 @@ import { QpqConstructBlock, QpqConstructBlockProps } from '../base/QpqConstructB
4
4
  export interface SubdomainNameProps extends QpqConstructBlockProps {
5
5
  subdomain: string;
6
6
  apexDomain: string;
7
+ rootDomain: string;
7
8
  }
8
9
  export declare class SubdomainName extends QpqConstructBlock {
9
10
  readonly domainName: aws_apigateway.DomainName;
10
- readonly certificate: aws_certificatemanager.Certificate;
11
+ readonly certificate: aws_certificatemanager.ICertificate;
11
12
  readonly targetARecord: aws_route53.RecordTarget;
12
13
  readonly deployDomain: string;
13
14
  constructor(scope: Construct, id: string, props: SubdomainNameProps);
@@ -1,20 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SubdomainName = void 0;
4
+ const quidproquo_config_aws_1 = require("quidproquo-config-aws");
5
+ const quidproquo_webserver_1 = require("quidproquo-webserver");
4
6
  const aws_cdk_lib_1 = require("aws-cdk-lib");
5
7
  const QpqConstructBlock_1 = require("../base/QpqConstructBlock");
8
+ const DomainCertificateLookup_1 = require("./DomainCertificateLookup");
6
9
  class SubdomainName extends QpqConstructBlock_1.QpqConstructBlock {
7
10
  constructor(scope, id, props) {
8
11
  super(scope, id, props);
9
12
  this.deployDomain = `${props.subdomain}.${props.apexDomain}`;
13
+ // Always look up the root hosted zone (e.g. development.quidproquojs.com), not
14
+ // a per-service sub-zone. The FQDN may include the service name (e.g.
15
+ // ws.shell.development.quidproquojs.com) but the A record lives in the root zone.
16
+ const hostedZoneDomain = quidproquo_webserver_1.qpqWebServerUtils.resolveDomainRoot(props.rootDomain, props.qpqConfig);
10
17
  const apexHostedZone = aws_cdk_lib_1.aws_route53.HostedZone.fromLookup(this, 'hosted-zone', {
11
- domainName: props.apexDomain,
12
- });
13
- this.certificate = new aws_cdk_lib_1.aws_certificatemanager.Certificate(this, 'certificate', {
14
- domainName: this.deployDomain,
15
- certificateName: `${this.deployDomain}-cert`,
16
- validation: aws_cdk_lib_1.aws_certificatemanager.CertificateValidation.fromDns(apexHostedZone),
18
+ domainName: hostedZoneDomain,
17
19
  });
20
+ // Regional API Gateway custom domains need a cert in the deploy region.
21
+ // Look it up from SSM, written by the matching DomainCertificateStack during the domain phase.
22
+ const deployRegion = quidproquo_config_aws_1.qpqConfigAwsUtils.getApplicationModuleDeployRegion(props.qpqConfig);
23
+ this.certificate = (0, DomainCertificateLookup_1.lookupDomainCertificate)(this, deployRegion, props.rootDomain, props.subdomain);
18
24
  this.domainName = new aws_cdk_lib_1.aws_apigateway.DomainName(this, 'domain-name', {
19
25
  domainName: this.deployDomain,
20
26
  certificate: this.certificate,
@@ -11,51 +11,49 @@ class WebserverRoll extends QpqConstructBlock_1.QpqConstructBlock {
11
11
  assumedBy: new aws_cdk_lib_1.aws_iam.CompositePrincipal(new aws_cdk_lib_1.aws_iam.ServicePrincipal('lambda.amazonaws.com'), new aws_cdk_lib_1.aws_iam.ServicePrincipal('transfer.amazonaws.com'), new aws_cdk_lib_1.aws_iam.ServicePrincipal('edgelambda.amazonaws.com')),
12
12
  });
13
13
  const policies = [
14
+ // Resolve cross-stack resource names at runtime via CloudFormation exports.
14
15
  {
15
16
  sid: 'CloudFormationListExports',
16
17
  actions: ['cloudformation:ListExports'],
17
18
  resources: ['*'],
18
19
  },
20
+ // Look up API Gateway metadata (stages, deployments) from within Lambdas.
19
21
  {
20
22
  sid: 'APIGatewayGetOperations',
21
23
  actions: ['apigateway:GET'],
22
24
  resources: ['*'],
23
25
  },
26
+ // Invalidate CloudFront caches after web-entry static asset deploys.
24
27
  {
25
28
  sid: 'CloudFrontCreateInvalidation',
26
29
  actions: ['cloudfront:CreateInvalidation'],
27
30
  resources: ['*'],
28
31
  },
32
+ // Publish to event-bus SNS topics (the framework's pub/sub layer).
29
33
  {
30
34
  sid: 'SNSPublishMessages',
31
35
  actions: ['sns:Publish'],
32
36
  resources: ['*'],
33
37
  },
38
+ // Invoke QPQ service functions (`*sfunc*`) from other Lambdas.
34
39
  {
35
40
  sid: 'LambdaInvokeFunction',
36
41
  actions: ['lambda:InvokeFunction'],
37
42
  resources: ['arn:aws:lambda:*:*:function:*sfunc*'],
38
43
  },
39
- {
40
- sid: 'S3BucketOperations',
41
- actions: ['s3:GetObject', 's3:PutObject', 's3:ListBucket', 's3:DeleteObject'],
42
- resources: ['arn:aws:s3:::*'],
43
- },
44
+ // Push messages to websocket clients via API Gateway Management API.
44
45
  {
45
46
  sid: 'APIGatewayManageConnections',
46
47
  actions: ['execute-api:ManageConnections'],
47
48
  resources: ['*'],
48
49
  },
50
+ // Look up ACM certs when wiring up custom domains at runtime.
49
51
  {
50
52
  sid: 'ACMCertificateOperations',
51
53
  actions: ['acm:DescribeCertificate', 'acm:ListCertificates'],
52
54
  resources: ['*'],
53
55
  },
54
- {
55
- sid: 'DynamoDBTableOperations',
56
- actions: ['dynamodb:GetItem', 'dynamodb:Scan', 'dynamodb:Query', 'dynamodb:PutItem', 'dynamodb:UpdateItem', 'dynamodb:DeleteItem'],
57
- resources: ['arn:aws:dynamodb:*:*:table/*'],
58
- },
56
+ // Standard Lambda logging + log retrieval for the `askGetLogs` flow.
59
57
  {
60
58
  sid: 'CloudWatchLogsManagement',
61
59
  actions: [
@@ -69,6 +67,7 @@ class WebserverRoll extends QpqConstructBlock_1.QpqConstructBlock {
69
67
  ],
70
68
  resources: ['*'],
71
69
  },
70
+ // Required for VPC-attached Lambdas to manage their ENIs.
72
71
  {
73
72
  sid: 'EC2NetworkInterfacePermissions',
74
73
  actions: [
@@ -80,11 +79,6 @@ class WebserverRoll extends QpqConstructBlock_1.QpqConstructBlock {
80
79
  ],
81
80
  resources: ['*'],
82
81
  },
83
- {
84
- sid: 'TextractDocumentProcessing',
85
- actions: ['textract:*'],
86
- resources: ['*'],
87
- },
88
82
  ];
89
83
  policies.forEach((policy) => {
90
84
  role.addToPolicy(new aws_cdk_lib_1.aws_iam.PolicyStatement(policy));
@@ -1,5 +1,4 @@
1
+ export * from './DomainCertificateLookup';
1
2
  export * from './Function';
2
- export * from './InfQpqWebserverServiceDomainsConstruct';
3
3
  export * from './LambdaLayers';
4
- export * from './ServiceDomain';
5
4
  export * from './SubdomainName';
@@ -14,8 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./DomainCertificateLookup"), exports);
17
18
  __exportStar(require("./Function"), exports);
18
- __exportStar(require("./InfQpqWebserverServiceDomainsConstruct"), exports);
19
19
  __exportStar(require("./LambdaLayers"), exports);
20
- __exportStar(require("./ServiceDomain"), exports);
21
20
  __exportStar(require("./SubdomainName"), exports);
@@ -57,32 +57,28 @@ class QpqConfigAwsAlarmConstruct extends QpqConstructBlock_1.QpqConstructBlock {
57
57
  constructor(scope, id, props) {
58
58
  var _a;
59
59
  super(scope, id, props);
60
- // Check if the namespace is Lambda
61
- if (props.alarmConfig.alarmSettings.namespace === quidproquo_config_aws_1.AwsAlarmNamespace.Lambda) {
62
- const lambdaAlarmSettings = props.alarmConfig.alarmSettings;
63
- // Create CloudWatch alarm for Lambda
64
- const alarm = new aws_cdk_lib_1.aws_cloudwatch.Alarm(this, props.alarmConfig.uniqueKey, {
65
- alarmName: this.resourceName(props.alarmConfig.name),
66
- metric: new aws_cdk_lib_1.aws_cloudwatch.Metric({
67
- namespace: lambdaAlarmSettings.namespace,
68
- metricName: lambdaAlarmSettings.metricName,
69
- statistic: lambdaAlarmSettings.statistic,
70
- period: cdk.Duration.seconds(lambdaAlarmSettings.period),
71
- }),
72
- threshold: lambdaAlarmSettings.threshold,
73
- comparisonOperator: AwsAlarmOperatorToComparisonOperator(lambdaAlarmSettings.operator),
74
- datapointsToAlarm: lambdaAlarmSettings.datapointsToAlarm,
75
- evaluationPeriods: lambdaAlarmSettings.evaluationPeriodsToAlarm,
76
- });
77
- (_a = props.alarmConfig.alarmSettings.onAlarm.publishToEventBus) === null || _a === void 0 ? void 0 : _a.forEach((eventBusName) => {
78
- const eventBus = core_1.QpqCoreEventBusConstruct.fromOtherStack(scope, 'eventBus', props.qpqConfig, eventBusName);
79
- alarm.addAlarmAction(new aws_cdk_lib_1.aws_cloudwatch_actions.SnsAction(eventBus.topic));
80
- });
81
- }
82
- else {
83
- // Handle other namespaces or throw an error
84
- throw new Error(`Invalid namespace ${props.alarmConfig.alarmSettings.namespace}`);
85
- }
60
+ // The alarm is built entirely from the shared BaseAwsAlarmQPQConfigSetting
61
+ // fields, so it is namespace-agnostic — Lambda, ApiGateway, DynamoDb and Sqs
62
+ // (and any future namespace) are all supported via the config's namespace +
63
+ // metricName pair, no per-namespace branching required.
64
+ const alarmSettings = props.alarmConfig.alarmSettings;
65
+ const alarm = new aws_cdk_lib_1.aws_cloudwatch.Alarm(this, props.alarmConfig.uniqueKey, {
66
+ alarmName: this.resourceName(props.alarmConfig.name),
67
+ metric: new aws_cdk_lib_1.aws_cloudwatch.Metric({
68
+ namespace: alarmSettings.namespace,
69
+ metricName: alarmSettings.metricName,
70
+ statistic: alarmSettings.statistic,
71
+ period: cdk.Duration.seconds(alarmSettings.period),
72
+ }),
73
+ threshold: alarmSettings.threshold,
74
+ comparisonOperator: AwsAlarmOperatorToComparisonOperator(alarmSettings.operator),
75
+ datapointsToAlarm: alarmSettings.datapointsToAlarm,
76
+ evaluationPeriods: alarmSettings.evaluationPeriodsToAlarm,
77
+ });
78
+ (_a = alarmSettings.onAlarm.publishToEventBus) === null || _a === void 0 ? void 0 : _a.forEach((eventBusName) => {
79
+ const eventBus = core_1.QpqCoreEventBusConstruct.fromOtherStack(scope, 'eventBus', props.qpqConfig, eventBusName);
80
+ alarm.addAlarmAction(new aws_cdk_lib_1.aws_cloudwatch_actions.SnsAction(eventBus.topic));
81
+ });
86
82
  }
87
83
  }
88
84
  exports.QpqConfigAwsAlarmConstruct = QpqConfigAwsAlarmConstruct;
@@ -0,0 +1,9 @@
1
+ import { BootstrapCloudTrailQPQConfigSetting } from 'quidproquo-config-aws';
2
+ import { Construct } from 'constructs';
3
+ import { QpqConstructBlock, QpqConstructBlockProps } from '../../../base/QpqConstructBlock';
4
+ export interface QpqBootstrapConfigCloudTrailConstructProps extends QpqConstructBlockProps {
5
+ cloudTrailConfig: BootstrapCloudTrailQPQConfigSetting;
6
+ }
7
+ export declare class QpqBootstrapConfigCloudTrailConstruct extends QpqConstructBlock {
8
+ constructor(scope: Construct, id: string, props: QpqBootstrapConfigCloudTrailConstructProps);
9
+ }
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.QpqBootstrapConfigCloudTrailConstruct = void 0;
37
+ const quidproquo_config_aws_1 = require("quidproquo-config-aws");
38
+ const cdk = __importStar(require("aws-cdk-lib"));
39
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
40
+ const QpqConstructBlock_1 = require("../../../base/QpqConstructBlock");
41
+ const SUPPORTED_RETENTION_DAYS = [
42
+ aws_cdk_lib_1.aws_logs.RetentionDays.ONE_DAY,
43
+ aws_cdk_lib_1.aws_logs.RetentionDays.THREE_DAYS,
44
+ aws_cdk_lib_1.aws_logs.RetentionDays.FIVE_DAYS,
45
+ aws_cdk_lib_1.aws_logs.RetentionDays.ONE_WEEK,
46
+ aws_cdk_lib_1.aws_logs.RetentionDays.TWO_WEEKS,
47
+ aws_cdk_lib_1.aws_logs.RetentionDays.ONE_MONTH,
48
+ aws_cdk_lib_1.aws_logs.RetentionDays.TWO_MONTHS,
49
+ aws_cdk_lib_1.aws_logs.RetentionDays.THREE_MONTHS,
50
+ aws_cdk_lib_1.aws_logs.RetentionDays.FOUR_MONTHS,
51
+ aws_cdk_lib_1.aws_logs.RetentionDays.FIVE_MONTHS,
52
+ aws_cdk_lib_1.aws_logs.RetentionDays.SIX_MONTHS,
53
+ aws_cdk_lib_1.aws_logs.RetentionDays.ONE_YEAR,
54
+ aws_cdk_lib_1.aws_logs.RetentionDays.THIRTEEN_MONTHS,
55
+ aws_cdk_lib_1.aws_logs.RetentionDays.EIGHTEEN_MONTHS,
56
+ aws_cdk_lib_1.aws_logs.RetentionDays.TWO_YEARS,
57
+ aws_cdk_lib_1.aws_logs.RetentionDays.FIVE_YEARS,
58
+ aws_cdk_lib_1.aws_logs.RetentionDays.TEN_YEARS,
59
+ ];
60
+ const resolveLogRetention = (days) => {
61
+ var _a;
62
+ if (!days)
63
+ return aws_cdk_lib_1.aws_logs.RetentionDays.ONE_MONTH;
64
+ return (_a = SUPPORTED_RETENTION_DAYS.find((v) => v >= days)) !== null && _a !== void 0 ? _a : aws_cdk_lib_1.aws_logs.RetentionDays.TEN_YEARS;
65
+ };
66
+ class QpqBootstrapConfigCloudTrailConstruct extends QpqConstructBlock_1.QpqConstructBlock {
67
+ constructor(scope, id, props) {
68
+ super(scope, id, props);
69
+ const { name, retentionDays = 365, enableLogFileValidation = true, multiRegion = true, includeGlobalServiceEvents = true, cloudWatchLogs, } = props.cloudTrailConfig;
70
+ const accountId = quidproquo_config_aws_1.qpqConfigAwsUtils.getApplicationModuleDeployAccountId(props.qpqConfig);
71
+ const region = quidproquo_config_aws_1.qpqConfigAwsUtils.getApplicationModuleDeployRegion(props.qpqConfig);
72
+ const bucket = new aws_cdk_lib_1.aws_s3.Bucket(this, 'logs', {
73
+ bucketName: `qpq-cloudtrail-${accountId}-${region}-${name}`,
74
+ blockPublicAccess: aws_cdk_lib_1.aws_s3.BlockPublicAccess.BLOCK_ALL,
75
+ encryption: aws_cdk_lib_1.aws_s3.BucketEncryption.S3_MANAGED,
76
+ enforceSSL: true,
77
+ removalPolicy: cdk.RemovalPolicy.RETAIN,
78
+ lifecycleRules: [{ expiration: cdk.Duration.days(retentionDays) }],
79
+ });
80
+ const logGroup = cloudWatchLogs
81
+ ? new aws_cdk_lib_1.aws_logs.LogGroup(this, 'log-group', {
82
+ logGroupName: `/qpq/cloudtrail/${name}`,
83
+ retention: resolveLogRetention(cloudWatchLogs.retentionDays),
84
+ removalPolicy: cdk.RemovalPolicy.DESTROY,
85
+ })
86
+ : undefined;
87
+ new aws_cdk_lib_1.aws_cloudtrail.Trail(this, 'trail', {
88
+ trailName: `${name}-trail`,
89
+ bucket,
90
+ enableFileValidation: enableLogFileValidation,
91
+ isMultiRegionTrail: multiRegion,
92
+ includeGlobalServiceEvents,
93
+ sendToCloudWatchLogs: !!logGroup,
94
+ cloudWatchLogGroup: logGroup,
95
+ });
96
+ }
97
+ }
98
+ exports.QpqBootstrapConfigCloudTrailConstruct = QpqBootstrapConfigCloudTrailConstruct;
@@ -0,0 +1 @@
1
+ export * from './QpqBootstrapConfigCloudTrailConstruct';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./QpqBootstrapConfigCloudTrailConstruct"), exports);
@@ -1,2 +1,3 @@
1
1
  export * from './alarm';
2
+ export * from './cloudTrail';
2
3
  export * from './organization';
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./alarm"), exports);
18
+ __exportStar(require("./cloudTrail"), exports);
18
19
  __exportStar(require("./organization"), exports);
@@ -0,0 +1,5 @@
1
+ import { AiQPQConfigSetting } from 'quidproquo-core';
2
+ import { aws_iam } from 'aws-cdk-lib';
3
+ export declare class QpqCoreAiConstruct {
4
+ static authorizeActionsForRole(role: aws_iam.IRole, aiConfigs: AiQPQConfigSetting[]): void;
5
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QpqCoreAiConstruct = void 0;
4
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
5
+ class QpqCoreAiConstruct {
6
+ static authorizeActionsForRole(role, aiConfigs) {
7
+ if (aiConfigs.length === 0) {
8
+ return;
9
+ }
10
+ role.addToPrincipalPolicy(new aws_cdk_lib_1.aws_iam.PolicyStatement({
11
+ effect: aws_cdk_lib_1.aws_iam.Effect.ALLOW,
12
+ actions: ['bedrock:InvokeModel', 'bedrock:InvokeModelWithResponseStream'],
13
+ resources: ['*'],
14
+ }));
15
+ }
16
+ }
17
+ exports.QpqCoreAiConstruct = QpqCoreAiConstruct;
@@ -0,0 +1 @@
1
+ export * from './QpqCoreAiConstruct';
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./QpqWebserverDomainConstruct"), exports);
17
+ __exportStar(require("./QpqCoreAiConstruct"), exports);
@@ -9,5 +9,5 @@ export declare class QpqInfCoreUserDirectoryConstruct extends QpqConstructBlock
9
9
  userPool: aws_cognito.IUserPool;
10
10
  static fromOtherStack(scope: Construct, id: string, qpqConfig: QPQConfig, userDirectoryName: string): QpqInfCoreUserDirectoryConstruct;
11
11
  constructor(scope: Construct, id: string, props: QpqInfCoreUserDirectoryConstructProps);
12
- static authorizeActionsForRole(role: aws_iam.IRole, userDirectoryConfigs: UserDirectoryQPQConfigSetting[], userDirectoryConstructs: QpqInfCoreUserDirectoryConstruct[], qpqConfig: QPQConfig): void;
12
+ static authorizeAdminActionsForRole(role: aws_iam.IRole, userDirectoryConfigs: UserDirectoryQPQConfigSetting[], userDirectoryConstructs: QpqInfCoreUserDirectoryConstruct[], qpqConfig: QPQConfig): void;
13
13
  }