@ts-cloud/core 0.2.2 → 0.2.4

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 (226) hide show
  1. package/dist/advanced-features.test.d.ts +1 -0
  2. package/dist/aws/cloudformation.d.ts +136 -0
  3. package/dist/aws/cloudfront.d.ts +45 -0
  4. package/dist/aws/credentials.d.ts +77 -0
  5. package/dist/aws/credentials.test.d.ts +4 -0
  6. package/dist/aws/index.d.ts +10 -0
  7. package/dist/aws/s3.d.ts +256 -0
  8. package/dist/aws/s3.test.d.ts +4 -0
  9. package/dist/aws/signature.d.ts +142 -0
  10. package/dist/aws/signature.test.d.ts +4 -0
  11. package/dist/backup/disaster-recovery.d.ts +140 -0
  12. package/dist/backup/disaster-recovery.test.d.ts +1 -0
  13. package/dist/backup/index.d.ts +8 -0
  14. package/dist/backup/manager.d.ts +172 -0
  15. package/dist/backup/manager.test.d.ts +1 -0
  16. package/dist/cicd/circleci.d.ts +50 -0
  17. package/dist/cicd/github-actions.d.ts +62 -0
  18. package/dist/cicd/gitlab-ci.d.ts +50 -0
  19. package/dist/cicd/index.d.ts +7 -0
  20. package/dist/cli/history.d.ts +137 -0
  21. package/dist/cli/index.d.ts +9 -0
  22. package/dist/cli/progress.d.ts +193 -0
  23. package/dist/cli/repl.d.ts +148 -0
  24. package/dist/cli/suggestions.d.ts +74 -0
  25. package/dist/cli/table.d.ts +73 -0
  26. package/dist/cli/table.test.d.ts +1 -0
  27. package/dist/cloudformation/builder.d.ts +93 -0
  28. package/dist/cloudformation/builder.test.d.ts +4 -0
  29. package/dist/cloudformation/builders/api-gateway.d.ts +30 -0
  30. package/dist/cloudformation/builders/cache.d.ts +35 -0
  31. package/dist/cloudformation/builders/cdn.d.ts +34 -0
  32. package/dist/cloudformation/builders/compute.d.ts +68 -0
  33. package/dist/cloudformation/builders/database.d.ts +61 -0
  34. package/dist/cloudformation/builders/functions.d.ts +32 -0
  35. package/dist/cloudformation/builders/messaging.d.ts +17 -0
  36. package/dist/cloudformation/builders/monitoring.d.ts +39 -0
  37. package/dist/cloudformation/builders/network.d.ts +14 -0
  38. package/dist/cloudformation/builders/queue.d.ts +16 -0
  39. package/dist/cloudformation/builders/security.d.ts +31 -0
  40. package/dist/cloudformation/builders/storage.d.ts +36 -0
  41. package/dist/cloudformation/index.d.ts +10 -0
  42. package/dist/cloudformation/types.d.ts +200 -0
  43. package/dist/compliance/aws-config.d.ts +175 -0
  44. package/dist/compliance/cloudtrail.d.ts +132 -0
  45. package/dist/compliance/compliance.test.d.ts +1 -0
  46. package/dist/compliance/guardduty.d.ts +176 -0
  47. package/dist/compliance/index.d.ts +12 -0
  48. package/dist/compliance/security-hub.d.ts +178 -0
  49. package/dist/containers/build-optimization.d.ts +155 -0
  50. package/dist/containers/containers.test.d.ts +1 -0
  51. package/dist/containers/image-scanning.d.ts +144 -0
  52. package/dist/containers/index.d.ts +8 -0
  53. package/dist/containers/registry.d.ts +129 -0
  54. package/dist/containers/service-mesh.d.ts +254 -0
  55. package/dist/database/database.test.d.ts +1 -0
  56. package/dist/database/index.d.ts +8 -0
  57. package/dist/database/migrations.d.ts +153 -0
  58. package/dist/database/performance.d.ts +219 -0
  59. package/dist/database/replicas.d.ts +218 -0
  60. package/dist/database/users.d.ts +165 -0
  61. package/dist/dependency-graph.d.ts +37 -0
  62. package/dist/deployment/ab-testing.d.ts +165 -0
  63. package/dist/deployment/blue-green.d.ts +140 -0
  64. package/dist/deployment/canary.d.ts +165 -0
  65. package/dist/deployment/deployment.test.d.ts +1 -0
  66. package/dist/deployment/index.d.ts +12 -0
  67. package/dist/deployment/progressive.d.ts +50 -0
  68. package/dist/dns/dns.test.d.ts +1 -0
  69. package/dist/dns/dnssec.d.ts +120 -0
  70. package/dist/dns/index.d.ts +7 -0
  71. package/dist/dns/resolver.d.ts +216 -0
  72. package/dist/dns/routing.d.ts +277 -0
  73. package/dist/email/advanced/analytics.d.ts +107 -0
  74. package/dist/email/advanced/index.d.ts +10 -0
  75. package/dist/email/advanced/rules.d.ts +131 -0
  76. package/dist/email/advanced/scheduling.d.ts +81 -0
  77. package/dist/email/advanced/search.d.ts +91 -0
  78. package/dist/email/advanced/shared-mailboxes.d.ts +109 -0
  79. package/dist/email/advanced/templates.d.ts +95 -0
  80. package/dist/email/advanced/threading.d.ts +65 -0
  81. package/dist/email/analytics.d.ts +189 -0
  82. package/dist/email/bounce-handling.d.ts +171 -0
  83. package/dist/email/email.test.d.ts +1 -0
  84. package/dist/email/handlers/__tests__/inbound.test.d.ts +1 -0
  85. package/dist/email/handlers/__tests__/outbound.test.d.ts +1 -0
  86. package/dist/email/handlers/converter.d.ts +11 -0
  87. package/dist/email/handlers/feedback.d.ts +11 -0
  88. package/dist/email/handlers/inbound.d.ts +13 -0
  89. package/dist/email/handlers/outbound.d.ts +13 -0
  90. package/dist/email/index.d.ts +10 -0
  91. package/dist/email/reputation.d.ts +133 -0
  92. package/dist/email/templates.d.ts +124 -0
  93. package/dist/errors/index.d.ts +177 -0
  94. package/dist/errors/index.test.d.ts +4 -0
  95. package/dist/health-checks/index.d.ts +35 -0
  96. package/dist/index.d.ts +15 -256
  97. package/dist/index.js +228 -80
  98. package/dist/intrinsic-functions.d.ts +77 -0
  99. package/dist/lambda/concurrency.d.ts +146 -0
  100. package/dist/lambda/destinations.d.ts +141 -0
  101. package/dist/lambda/dlq.d.ts +160 -0
  102. package/dist/lambda/index.d.ts +10 -0
  103. package/dist/lambda/lambda.test.d.ts +1 -0
  104. package/dist/lambda/layers.d.ts +117 -0
  105. package/dist/lambda/versions.d.ts +145 -0
  106. package/dist/lambda/vpc.d.ts +164 -0
  107. package/dist/local/config.d.ts +44 -0
  108. package/dist/local/index.d.ts +5 -0
  109. package/dist/local/mock-aws.d.ts +69 -0
  110. package/dist/modules/ai.d.ts +108 -0
  111. package/dist/modules/api.d.ts +157 -0
  112. package/dist/modules/auth.d.ts +262 -0
  113. package/dist/modules/cache.d.ts +108 -0
  114. package/dist/modules/cdn.d.ts +305 -0
  115. package/dist/modules/communication.d.ts +117 -0
  116. package/dist/modules/compute.d.ts +1376 -0
  117. package/dist/modules/database.d.ts +144 -0
  118. package/dist/modules/deployment.d.ts +372 -0
  119. package/dist/modules/dns.d.ts +143 -0
  120. package/dist/modules/email.d.ts +314 -0
  121. package/dist/modules/filesystem.d.ts +132 -0
  122. package/dist/modules/index.d.ts +31 -0
  123. package/dist/modules/messaging.d.ts +210 -0
  124. package/dist/modules/monitoring.d.ts +574 -0
  125. package/dist/modules/network.d.ts +148 -0
  126. package/dist/modules/parameter-store.d.ts +143 -0
  127. package/dist/modules/permissions.d.ts +245 -0
  128. package/dist/modules/phone.d.ts +125 -0
  129. package/dist/modules/queue.d.ts +411 -0
  130. package/dist/modules/redirects.d.ts +140 -0
  131. package/dist/modules/registry.d.ts +189 -0
  132. package/dist/modules/search.d.ts +135 -0
  133. package/dist/modules/secrets.d.ts +149 -0
  134. package/dist/modules/security.d.ts +219 -0
  135. package/dist/modules/sms.d.ts +130 -0
  136. package/dist/modules/storage.d.ts +344 -0
  137. package/dist/modules/workflow.d.ts +288 -0
  138. package/dist/multi-account/config.d.ts +166 -0
  139. package/dist/multi-account/index.d.ts +6 -0
  140. package/dist/multi-account/manager.d.ts +181 -0
  141. package/dist/multi-region/cross-region.d.ts +204 -0
  142. package/dist/multi-region/index.d.ts +7 -0
  143. package/dist/multi-region/manager.d.ts +136 -0
  144. package/dist/multi-region/regions.d.ts +98 -0
  145. package/dist/network-security/index.d.ts +55 -0
  146. package/dist/observability/index.d.ts +8 -0
  147. package/dist/observability/logs.d.ts +213 -0
  148. package/dist/observability/metrics.d.ts +187 -0
  149. package/dist/observability/observability.test.d.ts +1 -0
  150. package/dist/observability/synthetics.d.ts +189 -0
  151. package/dist/observability/xray.d.ts +193 -0
  152. package/dist/phone/advanced/analytics.d.ts +83 -0
  153. package/dist/phone/advanced/callbacks.d.ts +67 -0
  154. package/dist/phone/advanced/index.d.ts +7 -0
  155. package/dist/phone/advanced/ivr-builder.d.ts +130 -0
  156. package/dist/phone/advanced/recording.d.ts +62 -0
  157. package/dist/phone/handlers/__tests__/incoming-call.test.d.ts +1 -0
  158. package/dist/phone/handlers/incoming-call.d.ts +10 -0
  159. package/dist/phone/handlers/missed-call.d.ts +9 -0
  160. package/dist/phone/handlers/voicemail.d.ts +10 -0
  161. package/dist/phone/index.d.ts +5 -0
  162. package/dist/presets/api-backend.d.ts +11 -0
  163. package/dist/presets/data-pipeline.d.ts +11 -0
  164. package/dist/presets/extend.d.ts +194 -0
  165. package/dist/presets/extend.test.d.ts +4 -0
  166. package/dist/presets/fullstack-app.d.ts +12 -0
  167. package/dist/presets/index.d.ts +13 -0
  168. package/dist/presets/jamstack.d.ts +12 -0
  169. package/dist/presets/microservices.d.ts +18 -0
  170. package/dist/presets/ml-api.d.ts +13 -0
  171. package/dist/presets/nodejs-server.d.ts +14 -0
  172. package/dist/presets/nodejs-serverless.d.ts +14 -0
  173. package/dist/presets/realtime-app.d.ts +11 -0
  174. package/dist/presets/static-site.d.ts +12 -0
  175. package/dist/presets/traditional-web-app.d.ts +16 -0
  176. package/dist/presets/wordpress.d.ts +12 -0
  177. package/dist/preview/github.d.ts +32 -0
  178. package/dist/preview/github.test.d.ts +1 -0
  179. package/dist/preview/index.d.ts +10 -0
  180. package/dist/preview/manager.d.ts +101 -0
  181. package/dist/preview/manager.test.d.ts +1 -0
  182. package/dist/preview/notifications.d.ts +89 -0
  183. package/dist/preview/notifications.test.d.ts +1 -0
  184. package/dist/queue/batch-processing.d.ts +138 -0
  185. package/dist/queue/dlq-monitoring.d.ts +143 -0
  186. package/dist/queue/fifo.d.ts +131 -0
  187. package/dist/queue/index.d.ts +8 -0
  188. package/dist/queue/management.d.ts +162 -0
  189. package/dist/queue/queue.test.d.ts +1 -0
  190. package/dist/resource-mgmt/index.d.ts +44 -0
  191. package/dist/resource-naming.d.ts +26 -0
  192. package/dist/s3/index.d.ts +227 -0
  193. package/dist/schema/index.d.ts +12 -0
  194. package/dist/security/certificate-manager.d.ts +184 -0
  195. package/dist/security/index.d.ts +8 -0
  196. package/dist/security/scanning.d.ts +196 -0
  197. package/dist/security/secrets-manager.d.ts +204 -0
  198. package/dist/security/secrets-rotation.d.ts +167 -0
  199. package/dist/security/security.test.d.ts +1 -0
  200. package/dist/sms/advanced/ab-testing.d.ts +74 -0
  201. package/dist/sms/advanced/analytics.d.ts +75 -0
  202. package/dist/sms/advanced/campaigns.d.ts +96 -0
  203. package/dist/sms/advanced/chatbot.d.ts +67 -0
  204. package/dist/sms/advanced/index.d.ts +9 -0
  205. package/dist/sms/advanced/link-tracking.d.ts +60 -0
  206. package/dist/sms/advanced/mms.d.ts +60 -0
  207. package/dist/sms/handlers/__tests__/send.test.d.ts +1 -0
  208. package/dist/sms/handlers/delivery-status.d.ts +10 -0
  209. package/dist/sms/handlers/receive.d.ts +10 -0
  210. package/dist/sms/handlers/send.d.ts +10 -0
  211. package/dist/sms/index.d.ts +5 -0
  212. package/dist/stack-diff.d.ts +38 -0
  213. package/dist/static-site/index.d.ts +49 -0
  214. package/dist/template-builder.d.ts +42 -0
  215. package/dist/template-validator.d.ts +28 -0
  216. package/dist/types.d.ts +2514 -0
  217. package/dist/utils/cache.d.ts +117 -0
  218. package/dist/utils/diff.d.ts +52 -0
  219. package/dist/utils/hash.d.ts +73 -0
  220. package/dist/utils/index.d.ts +7 -0
  221. package/dist/utils/parallel.d.ts +78 -0
  222. package/dist/validators/credentials.d.ts +30 -0
  223. package/dist/validators/credentials.test.d.ts +4 -0
  224. package/dist/validators/quotas.d.ts +64 -0
  225. package/dist/validators/quotas.test.d.ts +4 -0
  226. package/package.json +2 -2
@@ -0,0 +1,262 @@
1
+ import type { CognitoUserPool, CognitoUserPoolClient, CognitoUserPoolDomain, CognitoIdentityPool, CognitoIdentityPoolRoleAttachment, IAMRole } from '@ts-cloud/aws-types';
2
+ import type { EnvironmentType } from '../types';
3
+ export interface UserPoolOptions {
4
+ slug: string;
5
+ environment: EnvironmentType;
6
+ userPoolName?: string;
7
+ aliasAttributes?: ('email' | 'phone_number')[];
8
+ autoVerifiedAttributes?: ('email' | 'phone_number')[];
9
+ passwordPolicy?: PasswordPolicyOptions;
10
+ mfaConfiguration?: 'OFF' | 'ON' | 'OPTIONAL';
11
+ emailConfiguration?: EmailConfigurationOptions;
12
+ smsConfiguration?: SmsConfigurationOptions;
13
+ lambdaTriggers?: LambdaTriggersOptions;
14
+ userPoolAddOns?: {
15
+ advancedSecurityMode?: 'OFF' | 'AUDIT' | 'ENFORCED';
16
+ };
17
+ accountRecoverySetting?: {
18
+ recoveryMechanisms: Array<{
19
+ Name: 'verified_email' | 'verified_phone_number' | 'admin_only';
20
+ Priority: number;
21
+ }>;
22
+ };
23
+ }
24
+ export interface PasswordPolicyOptions {
25
+ minimumLength?: number;
26
+ requireLowercase?: boolean;
27
+ requireUppercase?: boolean;
28
+ requireNumbers?: boolean;
29
+ requireSymbols?: boolean;
30
+ temporaryPasswordValidityDays?: number;
31
+ }
32
+ export interface EmailConfigurationOptions {
33
+ emailSendingAccount?: 'COGNITO_DEFAULT' | 'DEVELOPER';
34
+ from?: string;
35
+ replyToEmailAddress?: string;
36
+ sourceArn?: string;
37
+ configurationSet?: string;
38
+ }
39
+ export interface SmsConfigurationOptions {
40
+ externalId: string;
41
+ snsCallerArn: string;
42
+ }
43
+ export interface LambdaTriggersOptions {
44
+ preSignUp?: string;
45
+ postConfirmation?: string;
46
+ preAuthentication?: string;
47
+ postAuthentication?: string;
48
+ customMessage?: string;
49
+ defineAuthChallenge?: string;
50
+ createAuthChallenge?: string;
51
+ verifyAuthChallengeResponse?: string;
52
+ preTokenGeneration?: string;
53
+ userMigration?: string;
54
+ }
55
+ export interface UserPoolClientOptions {
56
+ slug: string;
57
+ environment: EnvironmentType;
58
+ clientName?: string;
59
+ generateSecret?: boolean;
60
+ refreshTokenValidity?: number;
61
+ accessTokenValidity?: number;
62
+ idTokenValidity?: number;
63
+ tokenValidityUnits?: {
64
+ RefreshToken?: 'seconds' | 'minutes' | 'hours' | 'days';
65
+ AccessToken?: 'seconds' | 'minutes' | 'hours' | 'days';
66
+ IdToken?: 'seconds' | 'minutes' | 'hours' | 'days';
67
+ };
68
+ readAttributes?: string[];
69
+ writeAttributes?: string[];
70
+ explicitAuthFlows?: string[];
71
+ preventUserExistenceErrors?: 'ENABLED' | 'LEGACY';
72
+ enableTokenRevocation?: boolean;
73
+ callbackURLs?: string[];
74
+ logoutURLs?: string[];
75
+ allowedOAuthFlows?: ('code' | 'implicit' | 'client_credentials')[];
76
+ allowedOAuthScopes?: string[];
77
+ allowedOAuthFlowsUserPoolClient?: boolean;
78
+ supportedIdentityProviders?: string[];
79
+ }
80
+ export interface UserPoolDomainOptions {
81
+ slug: string;
82
+ environment: EnvironmentType;
83
+ domain: string;
84
+ customDomainConfig?: {
85
+ CertificateArn: string;
86
+ };
87
+ }
88
+ export interface IdentityPoolOptions {
89
+ slug: string;
90
+ environment: EnvironmentType;
91
+ identityPoolName?: string;
92
+ allowUnauthenticatedIdentities?: boolean;
93
+ cognitoIdentityProviders?: Array<{
94
+ ClientId: string;
95
+ ProviderName: string;
96
+ ServerSideTokenCheck?: boolean;
97
+ }>;
98
+ supportedLoginProviders?: Record<string, string>;
99
+ samlProviderARNs?: string[];
100
+ openIdConnectProviderARNs?: string[];
101
+ }
102
+ export interface IdentityPoolRoleAttachmentOptions {
103
+ slug: string;
104
+ environment: EnvironmentType;
105
+ authenticatedRole: string;
106
+ unauthenticatedRole?: string;
107
+ roleMappings?: Record<string, {
108
+ Type: 'Token' | 'Rules';
109
+ AmbiguousRoleResolution?: 'AuthenticatedRole' | 'Deny';
110
+ RulesConfiguration?: {
111
+ Rules: Array<{
112
+ Claim: string;
113
+ MatchType: 'Equals' | 'Contains' | 'StartsWith' | 'NotEqual';
114
+ Value: string;
115
+ RoleARN: string;
116
+ }>;
117
+ };
118
+ }>;
119
+ }
120
+ /**
121
+ * Authentication Module - Cognito
122
+ * Provides clean API for user authentication and identity management
123
+ */
124
+ export declare class Auth {
125
+ /**
126
+ * Create a Cognito User Pool
127
+ */
128
+ static createUserPool(options: UserPoolOptions): {
129
+ userPool: CognitoUserPool;
130
+ logicalId: string;
131
+ };
132
+ /**
133
+ * Create a Cognito User Pool Client
134
+ */
135
+ static createUserPoolClient(userPoolLogicalId: string, options: UserPoolClientOptions): {
136
+ client: CognitoUserPoolClient;
137
+ logicalId: string;
138
+ };
139
+ /**
140
+ * Create a Cognito User Pool Domain
141
+ */
142
+ static createUserPoolDomain(userPoolLogicalId: string, options: UserPoolDomainOptions): {
143
+ domain: CognitoUserPoolDomain;
144
+ logicalId: string;
145
+ };
146
+ /**
147
+ * Create a Cognito Identity Pool
148
+ */
149
+ static createIdentityPool(options: IdentityPoolOptions): {
150
+ identityPool: CognitoIdentityPool;
151
+ logicalId: string;
152
+ };
153
+ /**
154
+ * Create an Identity Pool Role Attachment
155
+ */
156
+ static createIdentityPoolRoleAttachment(identityPoolLogicalId: string, options: IdentityPoolRoleAttachmentOptions): {
157
+ attachment: CognitoIdentityPoolRoleAttachment;
158
+ logicalId: string;
159
+ };
160
+ /**
161
+ * Create IAM role for authenticated users
162
+ */
163
+ static createAuthenticatedRole(options: {
164
+ slug: string;
165
+ environment: EnvironmentType;
166
+ identityPoolLogicalId: string;
167
+ }): {
168
+ role: IAMRole;
169
+ logicalId: string;
170
+ };
171
+ /**
172
+ * Create IAM role for unauthenticated users
173
+ */
174
+ static createUnauthenticatedRole(options: {
175
+ slug: string;
176
+ environment: EnvironmentType;
177
+ identityPoolLogicalId: string;
178
+ }): {
179
+ role: IAMRole;
180
+ logicalId: string;
181
+ };
182
+ /**
183
+ * Common password policies
184
+ */
185
+ static readonly PasswordPolicies: {
186
+ /**
187
+ * Relaxed password policy for development
188
+ */
189
+ readonly relaxed: () => PasswordPolicyOptions;
190
+ /**
191
+ * Standard password policy
192
+ */
193
+ readonly standard: () => PasswordPolicyOptions;
194
+ /**
195
+ * Strict password policy for production
196
+ */
197
+ readonly strict: () => PasswordPolicyOptions;
198
+ };
199
+ /**
200
+ * Common authentication flows
201
+ */
202
+ static readonly AuthFlows: {
203
+ /**
204
+ * Standard auth flows (SRP, refresh token)
205
+ */
206
+ readonly standard: readonly ["ALLOW_USER_SRP_AUTH", "ALLOW_REFRESH_TOKEN_AUTH"];
207
+ /**
208
+ * Admin auth flows (for server-side authentication)
209
+ */
210
+ readonly admin: readonly ["ALLOW_ADMIN_USER_PASSWORD_AUTH", "ALLOW_REFRESH_TOKEN_AUTH"];
211
+ /**
212
+ * Custom auth flows
213
+ */
214
+ readonly custom: readonly ["ALLOW_CUSTOM_AUTH", "ALLOW_REFRESH_TOKEN_AUTH"];
215
+ /**
216
+ * All auth flows (not recommended for production)
217
+ */
218
+ readonly all: readonly ["ALLOW_USER_SRP_AUTH", "ALLOW_USER_PASSWORD_AUTH", "ALLOW_ADMIN_USER_PASSWORD_AUTH", "ALLOW_CUSTOM_AUTH", "ALLOW_REFRESH_TOKEN_AUTH"];
219
+ };
220
+ /**
221
+ * Common OAuth scopes
222
+ */
223
+ static readonly OAuthScopes: {
224
+ /**
225
+ * Basic OAuth scopes
226
+ */
227
+ readonly basic: readonly ["openid", "email", "profile"];
228
+ /**
229
+ * All standard scopes
230
+ */
231
+ readonly all: readonly ["openid", "email", "profile", "phone", "aws.cognito.signin.user.admin"];
232
+ };
233
+ /**
234
+ * Common use cases
235
+ */
236
+ static readonly UseCases: {
237
+ /**
238
+ * Create a basic user pool for web application
239
+ */
240
+ readonly webApp: (slug: string, environment: EnvironmentType, callbackUrl: string) => {
241
+ userPool: CognitoUserPool;
242
+ poolId: string;
243
+ client: CognitoUserPoolClient;
244
+ clientId: string;
245
+ };
246
+ /**
247
+ * Create a user pool with identity pool for mobile app
248
+ */
249
+ readonly mobileApp: (slug: string, environment: EnvironmentType) => {
250
+ userPool: CognitoUserPool;
251
+ poolId: string;
252
+ client: CognitoUserPoolClient;
253
+ clientId: string;
254
+ identityPool: CognitoIdentityPool;
255
+ identityPoolId: string;
256
+ authRole: IAMRole;
257
+ authRoleId: string;
258
+ attachment: CognitoIdentityPoolRoleAttachment;
259
+ attachmentId: string;
260
+ };
261
+ };
262
+ }
@@ -0,0 +1,108 @@
1
+ import type { ElastiCacheCluster, ElastiCacheParameterGroup, ElastiCacheReplicationGroup, ElastiCacheSubnetGroup } from '@ts-cloud/aws-types';
2
+ import type { EnvironmentType } from '../types';
3
+ export interface RedisOptions {
4
+ slug: string;
5
+ environment: EnvironmentType;
6
+ nodeType?: string;
7
+ engineVersion?: string;
8
+ port?: number;
9
+ subnetIds?: string[];
10
+ securityGroupIds?: string[];
11
+ numCacheClusters?: number;
12
+ automaticFailover?: boolean;
13
+ multiAz?: boolean;
14
+ clusterMode?: boolean;
15
+ numNodeGroups?: number;
16
+ replicasPerNodeGroup?: number;
17
+ atRestEncryption?: boolean;
18
+ transitEncryption?: boolean;
19
+ authToken?: string;
20
+ kmsKeyId?: string;
21
+ snapshotRetentionDays?: number;
22
+ snapshotWindow?: string;
23
+ maintenanceWindow?: string;
24
+ }
25
+ export interface MemcachedOptions {
26
+ slug: string;
27
+ environment: EnvironmentType;
28
+ nodeType?: string;
29
+ engineVersion?: string;
30
+ port?: number;
31
+ numCacheNodes?: number;
32
+ subnetIds?: string[];
33
+ securityGroupIds?: string[];
34
+ azMode?: 'single-az' | 'cross-az';
35
+ preferredAzs?: string[];
36
+ maintenanceWindow?: string;
37
+ }
38
+ /**
39
+ * Cache Module - ElastiCache (Redis + Memcached)
40
+ * Provides clean API for creating Redis and Memcached clusters
41
+ */
42
+ export declare class Cache {
43
+ /**
44
+ * Create a Redis cluster
45
+ */
46
+ static createRedis(options: RedisOptions): {
47
+ replicationGroup: ElastiCacheReplicationGroup;
48
+ subnetGroup?: ElastiCacheSubnetGroup;
49
+ logicalId: string;
50
+ subnetGroupId?: string;
51
+ };
52
+ /**
53
+ * Create a Memcached cluster
54
+ */
55
+ static createMemcached(options: MemcachedOptions): {
56
+ cluster: ElastiCacheCluster;
57
+ subnetGroup?: ElastiCacheSubnetGroup;
58
+ logicalId: string;
59
+ subnetGroupId?: string;
60
+ };
61
+ /**
62
+ * Enable cluster mode for Redis (returns new configuration)
63
+ */
64
+ static enableClusterMode(replicationGroup: ElastiCacheReplicationGroup, numNodeGroups?: number, replicasPerNodeGroup?: number): ElastiCacheReplicationGroup;
65
+ /**
66
+ * Create a parameter group for Redis
67
+ */
68
+ static createRedisParameterGroup(version: string, options: {
69
+ slug: string;
70
+ environment: EnvironmentType;
71
+ parameters?: Record<string, string>;
72
+ }): {
73
+ parameterGroup: ElastiCacheParameterGroup;
74
+ logicalId: string;
75
+ };
76
+ /**
77
+ * Create a parameter group for Memcached
78
+ */
79
+ static createMemcachedParameterGroup(version: string, options: {
80
+ slug: string;
81
+ environment: EnvironmentType;
82
+ parameters?: Record<string, string>;
83
+ }): {
84
+ parameterGroup: ElastiCacheParameterGroup;
85
+ logicalId: string;
86
+ };
87
+ /**
88
+ * Common ElastiCache node types
89
+ */
90
+ static readonly NodeTypes: {
91
+ readonly T3_Micro: "cache.t3.micro";
92
+ readonly T3_Small: "cache.t3.small";
93
+ readonly T3_Medium: "cache.t3.medium";
94
+ readonly T4g_Micro: "cache.t4g.micro";
95
+ readonly T4g_Small: "cache.t4g.small";
96
+ readonly T4g_Medium: "cache.t4g.medium";
97
+ readonly M5_Large: "cache.m5.large";
98
+ readonly M5_XLarge: "cache.m5.xlarge";
99
+ readonly M5_2XLarge: "cache.m5.2xlarge";
100
+ readonly R5_Large: "cache.r5.large";
101
+ readonly R5_XLarge: "cache.r5.xlarge";
102
+ readonly R5_2XLarge: "cache.r5.2xlarge";
103
+ readonly R5_4XLarge: "cache.r5.4xlarge";
104
+ readonly R6g_Large: "cache.r6g.large";
105
+ readonly R6g_XLarge: "cache.r6g.xlarge";
106
+ readonly R6g_2XLarge: "cache.r6g.2xlarge";
107
+ };
108
+ }
@@ -0,0 +1,305 @@
1
+ import type { CloudFrontDistribution, CloudFrontOriginAccessControl, LambdaFunction, IAMRole } from '@ts-cloud/aws-types';
2
+ import type { EnvironmentType } from '../types';
3
+ export interface DistributionOptions {
4
+ slug: string;
5
+ environment: EnvironmentType;
6
+ origin: OriginConfig;
7
+ customDomain?: string;
8
+ certificateArn?: string;
9
+ errorPages?: ErrorPageMapping[];
10
+ cachePolicy?: CachePolicyConfig;
11
+ edgeFunctions?: EdgeFunctionConfig[];
12
+ http3?: boolean;
13
+ comment?: string;
14
+ }
15
+ export interface OriginConfig {
16
+ type?: 's3' | 'alb' | 'custom';
17
+ id?: string;
18
+ originId?: string;
19
+ domainName?: string;
20
+ originPath?: string;
21
+ customHeaders?: Record<string, string>;
22
+ s3OriginAccessControl?: string;
23
+ }
24
+ export interface ErrorPageMapping {
25
+ errorCode: number;
26
+ responseCode?: number;
27
+ responsePagePath?: string;
28
+ }
29
+ export interface CachePolicyConfig {
30
+ minTTL?: number;
31
+ maxTTL?: number;
32
+ defaultTTL?: number;
33
+ }
34
+ export interface EdgeFunctionConfig {
35
+ event: 'origin-request' | 'origin-response' | 'viewer-request' | 'viewer-response';
36
+ functionArn: string;
37
+ }
38
+ /**
39
+ * CDN Module - CloudFront Distribution Management
40
+ * Provides clean API for creating and configuring CloudFront distributions
41
+ */
42
+ export declare class CDN {
43
+ /**
44
+ * Create a CloudFront distribution
45
+ */
46
+ static createDistribution(options: DistributionOptions): {
47
+ distribution: CloudFrontDistribution;
48
+ originAccessControl?: CloudFrontOriginAccessControl;
49
+ logicalId: string;
50
+ };
51
+ /**
52
+ * Set custom domain on a distribution
53
+ */
54
+ static setCustomDomain(distribution: CloudFrontDistribution, domain: string, certificateArn: string): CloudFrontDistribution;
55
+ /**
56
+ * Set error pages for SPA routing (404 → index.html)
57
+ */
58
+ static setErrorPages(distribution: CloudFrontDistribution, mappings: ErrorPageMapping[]): CloudFrontDistribution;
59
+ /**
60
+ * Enable HTTP/3 support
61
+ */
62
+ static enableHttp3(distribution: CloudFrontDistribution): CloudFrontDistribution;
63
+ /**
64
+ * Add Lambda@Edge function
65
+ */
66
+ static addEdgeFunction(distribution: CloudFrontDistribution, event: EdgeFunctionConfig['event'], functionArn: string): CloudFrontDistribution;
67
+ /**
68
+ * Set cache policy with custom TTL
69
+ */
70
+ static setCachePolicy(distribution: CloudFrontDistribution, ttl: {
71
+ min?: number;
72
+ max?: number;
73
+ default?: number;
74
+ }): CloudFrontDistribution;
75
+ /**
76
+ * Create standard SPA (Single Page Application) configuration
77
+ * Routes all 404/403 errors to index.html
78
+ */
79
+ static createSpaDistribution(options: Omit<DistributionOptions, 'errorPages'>): ReturnType<typeof CDN.createDistribution>;
80
+ /**
81
+ * Create Lambda@Edge origin request function for docs routing
82
+ * Handles:
83
+ * - Pretty URLs (e.g., /guide → /guide.html or /guide/index.html)
84
+ * - Trailing slashes normalization
85
+ * - Default document serving (index.html)
86
+ */
87
+ static createDocsOriginRequestFunction(options: {
88
+ slug: string;
89
+ environment: EnvironmentType;
90
+ }): {
91
+ lambdaFunction: LambdaFunction;
92
+ role: IAMRole;
93
+ functionLogicalId: string;
94
+ roleLogicalId: string;
95
+ versionLogicalId: string;
96
+ };
97
+ /**
98
+ * Create a docs-specific CloudFront distribution
99
+ * Includes Lambda@Edge for URL rewriting and proper cache settings
100
+ */
101
+ static createDocsDistribution(options: {
102
+ slug: string;
103
+ environment: EnvironmentType;
104
+ origin: OriginConfig;
105
+ customDomain?: string;
106
+ certificateArn?: string;
107
+ lambdaEdgeFunctionArn?: string;
108
+ }): {
109
+ distribution: CloudFrontDistribution;
110
+ originAccessControl?: CloudFrontOriginAccessControl;
111
+ logicalId: string;
112
+ };
113
+ /**
114
+ * Create an API distribution with ALB origin
115
+ * Optimized for API traffic (no caching by default, all methods allowed)
116
+ */
117
+ static createApiDistribution(options: {
118
+ slug: string;
119
+ environment: EnvironmentType;
120
+ albDomainName: string;
121
+ customDomain?: string;
122
+ certificateArn?: string;
123
+ pathPattern?: string;
124
+ forwardHeaders?: string[];
125
+ forwardCookies?: 'none' | 'all' | 'whitelist';
126
+ whitelistedCookies?: string[];
127
+ customOriginHeaders?: Record<string, string>;
128
+ }): {
129
+ distribution: CloudFrontDistribution;
130
+ logicalId: string;
131
+ };
132
+ /**
133
+ * Create a multi-origin distribution (S3 for static, ALB for API)
134
+ */
135
+ static createMultiOriginDistribution(options: {
136
+ slug: string;
137
+ environment: EnvironmentType;
138
+ s3BucketDomainName: string;
139
+ albDomainName: string;
140
+ apiPathPattern?: string;
141
+ customDomain?: string;
142
+ certificateArn?: string;
143
+ customOriginHeaders?: Record<string, string>;
144
+ }): {
145
+ distribution: CloudFrontDistribution;
146
+ originAccessControl: CloudFrontOriginAccessControl;
147
+ logicalId: string;
148
+ oacLogicalId: string;
149
+ };
150
+ /**
151
+ * Add ALB origin to an existing distribution
152
+ */
153
+ static addAlbOrigin(distribution: CloudFrontDistribution, options: {
154
+ originId: string;
155
+ domainName: string;
156
+ pathPattern: string;
157
+ customHeaders?: Record<string, string>;
158
+ forwardHeaders?: string[];
159
+ cacheTtl?: {
160
+ default: number;
161
+ max: number;
162
+ min: number;
163
+ };
164
+ }): CloudFrontDistribution;
165
+ /**
166
+ * Add a custom origin header (for origin authentication)
167
+ */
168
+ static addOriginHeader(distribution: CloudFrontDistribution, originId: string, headerName: string, headerValue: string): CloudFrontDistribution;
169
+ /**
170
+ * Lambda@Edge code templates for common use cases
171
+ */
172
+ static readonly EdgeFunctionTemplates: {
173
+ /**
174
+ * Origin request handler for docs/VitePress routing
175
+ */
176
+ docsOriginRequest: string;
177
+ /**
178
+ * Viewer response handler for security headers
179
+ */
180
+ securityHeaders: string;
181
+ /**
182
+ * Viewer request handler for basic auth (staging/preview environments)
183
+ */
184
+ basicAuth: (username: string, password: string) => string;
185
+ /**
186
+ * Origin request handler for path-based routing (e.g., /api to different origin)
187
+ */
188
+ pathBasedRouting: (pathPrefix: string, targetOriginId: string) => string;
189
+ };
190
+ /**
191
+ * CDN Configuration helpers
192
+ * Provides Stacks configuration parity for CDN options
193
+ */
194
+ static readonly Config: {
195
+ /**
196
+ * Create TTL configuration
197
+ */
198
+ ttl: (options: {
199
+ min?: number;
200
+ max?: number;
201
+ default?: number;
202
+ }) => {
203
+ MinTTL: number;
204
+ MaxTTL: number;
205
+ DefaultTTL: number;
206
+ };
207
+ /**
208
+ * Cookie behavior configuration
209
+ */
210
+ cookies: (behavior: "none" | "all" | "allowList", allowedCookies?: string[]) => {
211
+ Forward: string;
212
+ WhitelistedNames?: string[];
213
+ };
214
+ /**
215
+ * Allowed HTTP methods configuration
216
+ */
217
+ allowedMethods: (methods: "ALL" | "GET_HEAD" | "GET_HEAD_OPTIONS") => string[];
218
+ /**
219
+ * Cached methods configuration
220
+ */
221
+ cachedMethods: (methods: "GET_HEAD" | "GET_HEAD_OPTIONS") => string[];
222
+ /**
223
+ * Common TTL presets
224
+ */
225
+ ttlPresets: {
226
+ /** Static assets (1 year) */
227
+ readonly static: {
228
+ readonly min: 0;
229
+ readonly max: 31536000;
230
+ readonly default: 31536000;
231
+ };
232
+ /** Dynamic content (no cache) */
233
+ readonly dynamic: {
234
+ readonly min: 0;
235
+ readonly max: 0;
236
+ readonly default: 0;
237
+ };
238
+ /** API responses (1 hour) */
239
+ readonly api: {
240
+ readonly min: 0;
241
+ readonly max: 3600;
242
+ readonly default: 60;
243
+ };
244
+ /** SPA/HTML (1 day) */
245
+ readonly html: {
246
+ readonly min: 0;
247
+ readonly max: 86400;
248
+ readonly default: 86400;
249
+ };
250
+ /** Images (1 week) */
251
+ readonly images: {
252
+ readonly min: 0;
253
+ readonly max: 604800;
254
+ readonly default: 604800;
255
+ };
256
+ };
257
+ /**
258
+ * Create cache behavior configuration
259
+ */
260
+ cacheBehavior: (options: {
261
+ ttl?: {
262
+ min: number;
263
+ max: number;
264
+ default: number;
265
+ };
266
+ cookies?: "none" | "all" | "allowList";
267
+ allowedCookies?: string[];
268
+ allowedMethods?: "ALL" | "GET_HEAD" | "GET_HEAD_OPTIONS";
269
+ cachedMethods?: "GET_HEAD" | "GET_HEAD_OPTIONS";
270
+ compress?: boolean;
271
+ forwardQueryString?: boolean;
272
+ forwardHeaders?: string[];
273
+ }) => {
274
+ MinTTL: number;
275
+ MaxTTL: number;
276
+ DefaultTTL: number;
277
+ Compress: boolean;
278
+ AllowedMethods: string[];
279
+ CachedMethods: string[];
280
+ ForwardedValues: {
281
+ QueryString: boolean;
282
+ Headers: string[];
283
+ Cookies: {
284
+ Forward: string;
285
+ WhitelistedNames?: string[];
286
+ };
287
+ };
288
+ };
289
+ };
290
+ /**
291
+ * Apply configuration to an existing distribution
292
+ */
293
+ static applyConfig(distribution: CloudFrontDistribution, config: {
294
+ ttl?: {
295
+ min: number;
296
+ max: number;
297
+ default: number;
298
+ };
299
+ cookies?: 'none' | 'all' | 'allowList';
300
+ allowedCookies?: string[];
301
+ allowedMethods?: 'ALL' | 'GET_HEAD' | 'GET_HEAD_OPTIONS';
302
+ cachedMethods?: 'GET_HEAD' | 'GET_HEAD_OPTIONS';
303
+ compress?: boolean;
304
+ }): CloudFrontDistribution;
305
+ }