@ts-cloud/core 0.2.3 → 0.2.5

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,411 @@
1
+ import type { EventBridgeRule, SQSQueue } from '@ts-cloud/aws-types';
2
+ import type { EnvironmentType } from '../types';
3
+ export interface QueueOptions {
4
+ slug: string;
5
+ environment: EnvironmentType;
6
+ name?: string;
7
+ delaySeconds?: number;
8
+ visibilityTimeout?: number;
9
+ messageRetentionPeriod?: number;
10
+ maxMessageSize?: number;
11
+ receiveMessageWaitTime?: number;
12
+ fifo?: boolean;
13
+ contentBasedDeduplication?: boolean;
14
+ encrypted?: boolean;
15
+ kmsKeyId?: string;
16
+ }
17
+ export interface DeadLetterQueueOptions {
18
+ slug: string;
19
+ environment: EnvironmentType;
20
+ maxReceiveCount?: number;
21
+ }
22
+ export interface ScheduleOptions {
23
+ slug: string;
24
+ environment: EnvironmentType;
25
+ name?: string;
26
+ description?: string;
27
+ enabled?: boolean;
28
+ }
29
+ export interface EcsScheduleOptions extends ScheduleOptions {
30
+ taskDefinitionArn: string;
31
+ clusterArn: string;
32
+ subnets: string[];
33
+ securityGroups?: string[];
34
+ assignPublicIp?: boolean;
35
+ taskCount?: number;
36
+ containerOverrides?: Array<{
37
+ name: string;
38
+ environment?: Array<{
39
+ name: string;
40
+ value: string;
41
+ }>;
42
+ command?: string[];
43
+ }>;
44
+ }
45
+ export interface LambdaScheduleOptions extends ScheduleOptions {
46
+ functionArn: string;
47
+ input?: Record<string, unknown>;
48
+ }
49
+ export interface SqsTargetOptions extends ScheduleOptions {
50
+ queueArn: string;
51
+ messageGroupId?: string;
52
+ }
53
+ /**
54
+ * Queue & Scheduling Module - EventBridge + SQS
55
+ * Provides clean API for creating queues, cron jobs, and scheduled tasks
56
+ */
57
+ export declare class Queue {
58
+ /**
59
+ * Create an SQS queue
60
+ */
61
+ static createQueue(options: QueueOptions): {
62
+ queue: SQSQueue;
63
+ logicalId: string;
64
+ };
65
+ /**
66
+ * Create a dead letter queue and attach it to a source queue
67
+ */
68
+ static createDeadLetterQueue(sourceQueueLogicalId: string, options: DeadLetterQueueOptions): {
69
+ deadLetterQueue: SQSQueue;
70
+ updatedSourceQueue: SQSQueue;
71
+ deadLetterLogicalId: string;
72
+ };
73
+ /**
74
+ * Create an EventBridge rule with a cron schedule
75
+ */
76
+ static createSchedule(cronExpression: string, options: ScheduleOptions): {
77
+ rule: EventBridgeRule;
78
+ logicalId: string;
79
+ };
80
+ /**
81
+ * Schedule an ECS Fargate task with cron
82
+ */
83
+ static scheduleEcsTask(cronExpression: string, roleArn: string, options: EcsScheduleOptions): {
84
+ rule: EventBridgeRule;
85
+ logicalId: string;
86
+ };
87
+ /**
88
+ * Schedule a Lambda function with cron
89
+ */
90
+ static scheduleLambda(cronExpression: string, options: LambdaScheduleOptions): {
91
+ rule: EventBridgeRule;
92
+ logicalId: string;
93
+ };
94
+ /**
95
+ * Schedule an SQS message with cron
96
+ */
97
+ static scheduleSqsMessage(cronExpression: string, options: SqsTargetOptions): {
98
+ rule: EventBridgeRule;
99
+ logicalId: string;
100
+ };
101
+ /**
102
+ * Add a target to an existing EventBridge rule
103
+ */
104
+ static addTarget(rule: EventBridgeRule, target: {
105
+ id: string;
106
+ arn: string;
107
+ roleArn?: string;
108
+ input?: Record<string, unknown>;
109
+ }): EventBridgeRule;
110
+ /**
111
+ * Helper: Convert cron expression to rate expression
112
+ * EventBridge supports both cron() and rate() expressions
113
+ */
114
+ static toCronExpression(expression: string): string;
115
+ /**
116
+ * Helper: Create rate expression
117
+ */
118
+ static rateExpression(value: number, unit: 'minute' | 'minutes' | 'hour' | 'hours' | 'day' | 'days'): string;
119
+ /**
120
+ * Common cron expressions
121
+ */
122
+ static readonly CronExpressions: {
123
+ readonly EveryMinute: "cron(* * * * ? *)";
124
+ readonly Every5Minutes: "cron(*/5 * * * ? *)";
125
+ readonly Every15Minutes: "cron(*/15 * * * ? *)";
126
+ readonly Every30Minutes: "cron(*/30 * * * ? *)";
127
+ readonly Hourly: "cron(0 * * * ? *)";
128
+ readonly Daily: "cron(0 0 * * ? *)";
129
+ readonly DailyAt9AM: "cron(0 9 * * ? *)";
130
+ readonly DailyAtMidnight: "cron(0 0 * * ? *)";
131
+ readonly Weekly: "cron(0 0 ? * SUN *)";
132
+ readonly Monthly: "cron(0 0 1 * ? *)";
133
+ };
134
+ /**
135
+ * Common rate expressions
136
+ */
137
+ static readonly RateExpressions: {
138
+ readonly Every1Minute: "rate(1 minute)";
139
+ readonly Every5Minutes: "rate(5 minutes)";
140
+ readonly Every10Minutes: "rate(10 minutes)";
141
+ readonly Every15Minutes: "rate(15 minutes)";
142
+ readonly Every30Minutes: "rate(30 minutes)";
143
+ readonly Every1Hour: "rate(1 hour)";
144
+ readonly Every6Hours: "rate(6 hours)";
145
+ readonly Every12Hours: "rate(12 hours)";
146
+ readonly Every1Day: "rate(1 day)";
147
+ };
148
+ /**
149
+ * Convert a human-readable rate string to a cron/rate expression
150
+ * Supports formats like: "every 5 minutes", "every hour", "daily at 9am", etc.
151
+ */
152
+ static rateStringToExpression(rateString: string): string;
153
+ /**
154
+ * Job configuration interface
155
+ */
156
+ static readonly JobConfig: {
157
+ /**
158
+ * Create job configuration with retry settings
159
+ */
160
+ create: (options: {
161
+ name: string;
162
+ handler: string;
163
+ retries?: number;
164
+ backoff?: "linear" | "exponential" | "fixed";
165
+ backoffDelay?: number;
166
+ maxDelay?: number;
167
+ timeout?: number;
168
+ jitter?: boolean;
169
+ }) => JobConfiguration;
170
+ /**
171
+ * Calculate delay for a given retry attempt
172
+ */
173
+ calculateDelay: (attempt: number, config: Pick<JobConfiguration, "backoff" | "backoffDelay" | "maxDelay" | "jitter">) => number;
174
+ /**
175
+ * Common job configurations
176
+ */
177
+ presets: {
178
+ /**
179
+ * Fast retry for transient failures
180
+ */
181
+ fastRetry: {
182
+ retries: number;
183
+ backoff: "exponential";
184
+ backoffDelay: number;
185
+ maxDelay: number;
186
+ jitter: boolean;
187
+ };
188
+ /**
189
+ * Standard job with moderate retries
190
+ */
191
+ standard: {
192
+ retries: number;
193
+ backoff: "exponential";
194
+ backoffDelay: number;
195
+ maxDelay: number;
196
+ jitter: boolean;
197
+ };
198
+ /**
199
+ * Long-running job with extended timeouts
200
+ */
201
+ longRunning: {
202
+ retries: number;
203
+ backoff: "exponential";
204
+ backoffDelay: number;
205
+ maxDelay: number;
206
+ timeout: number;
207
+ jitter: boolean;
208
+ };
209
+ /**
210
+ * Critical job with many retries
211
+ */
212
+ critical: {
213
+ retries: number;
214
+ backoff: "exponential";
215
+ backoffDelay: number;
216
+ maxDelay: number;
217
+ jitter: boolean;
218
+ };
219
+ /**
220
+ * No retry (fire and forget)
221
+ */
222
+ noRetry: {
223
+ retries: number;
224
+ backoff: "fixed";
225
+ backoffDelay: number;
226
+ maxDelay: number;
227
+ jitter: boolean;
228
+ };
229
+ };
230
+ };
231
+ /**
232
+ * Create ECS container override for job execution
233
+ */
234
+ static createJobContainerOverride(options: {
235
+ containerName: string;
236
+ jobClass: string;
237
+ jobData?: Record<string, unknown>;
238
+ environment?: Record<string, string>;
239
+ }): {
240
+ name: string;
241
+ command: string[];
242
+ environment: Array<{
243
+ name: string;
244
+ value: string;
245
+ }>;
246
+ };
247
+ /**
248
+ * Generate scheduled job resources
249
+ */
250
+ static createScheduledJob(options: {
251
+ slug: string;
252
+ environment: EnvironmentType;
253
+ schedule: string;
254
+ jobClass: string;
255
+ jobData?: Record<string, unknown>;
256
+ taskDefinitionArn: string;
257
+ clusterArn: string;
258
+ subnets: string[];
259
+ securityGroups?: string[];
260
+ roleArn: string;
261
+ containerName?: string;
262
+ }): {
263
+ rule: EventBridgeRule;
264
+ logicalId: string;
265
+ };
266
+ /**
267
+ * Queue presets for common use cases
268
+ */
269
+ static readonly QueuePresets: {
270
+ /**
271
+ * High-throughput queue with short visibility
272
+ */
273
+ highThroughput: (slug: string, environment: EnvironmentType) => {
274
+ queue: SQSQueue;
275
+ logicalId: string;
276
+ };
277
+ /**
278
+ * Long-running job queue
279
+ */
280
+ longRunning: (slug: string, environment: EnvironmentType) => {
281
+ queue: SQSQueue;
282
+ logicalId: string;
283
+ };
284
+ /**
285
+ * FIFO queue for ordered processing
286
+ */
287
+ fifo: (slug: string, environment: EnvironmentType) => {
288
+ queue: SQSQueue;
289
+ logicalId: string;
290
+ };
291
+ /**
292
+ * Delayed queue for scheduled messages
293
+ */
294
+ delayed: (slug: string, environment: EnvironmentType, delaySeconds?: number) => {
295
+ queue: SQSQueue;
296
+ logicalId: string;
297
+ };
298
+ };
299
+ }
300
+ /**
301
+ * Job configuration type
302
+ */
303
+ export interface JobConfiguration {
304
+ name: string;
305
+ handler: string;
306
+ retries: number;
307
+ backoff: 'linear' | 'exponential' | 'fixed';
308
+ backoffDelay: number;
309
+ maxDelay: number;
310
+ timeout: number;
311
+ jitter: boolean;
312
+ }
313
+ /**
314
+ * Discovered job definition from file scanning
315
+ */
316
+ export interface DiscoveredJob {
317
+ name: string;
318
+ path: string;
319
+ schedule?: string;
320
+ handler: string;
321
+ enabled: boolean;
322
+ retries?: number;
323
+ backoff?: 'linear' | 'exponential' | 'fixed';
324
+ timeout?: number;
325
+ description?: string;
326
+ }
327
+ /**
328
+ * Discovered action definition from file scanning
329
+ */
330
+ export interface DiscoveredAction {
331
+ name: string;
332
+ path: string;
333
+ handler: string;
334
+ description?: string;
335
+ }
336
+ /**
337
+ * Dynamic job and action loader for Stacks framework integration
338
+ */
339
+ export declare class JobLoader {
340
+ /**
341
+ * Discover jobs from app/Jobs directory
342
+ * Scans *.ts files and extracts job metadata from exports
343
+ */
344
+ static discoverJobs(options: {
345
+ projectRoot: string;
346
+ jobsPath?: string;
347
+ }): Promise<DiscoveredJob[]>;
348
+ /**
349
+ * Parse job metadata from file content
350
+ * Looks for exported schedule, handle function, and config
351
+ */
352
+ static parseJobMetadata(content: string, name: string, path: string): DiscoveredJob | null;
353
+ /**
354
+ * Discover actions from app/Actions directory
355
+ * Scans *.ts files and extracts action metadata
356
+ */
357
+ static discoverActions(options: {
358
+ projectRoot: string;
359
+ actionsPath?: string;
360
+ }): Promise<DiscoveredAction[]>;
361
+ /**
362
+ * Parse action metadata from file content
363
+ */
364
+ static parseActionMetadata(content: string, name: string, path: string): DiscoveredAction | null;
365
+ /**
366
+ * Generate scheduled job resources from discovered jobs
367
+ */
368
+ static generateScheduledJobResources(options: {
369
+ slug: string;
370
+ environment: EnvironmentType;
371
+ jobs: DiscoveredJob[];
372
+ taskDefinitionArn: string;
373
+ clusterArn: string;
374
+ subnets: string[];
375
+ securityGroups?: string[];
376
+ roleArn: string;
377
+ containerName?: string;
378
+ }): {
379
+ rules: Record<string, EventBridgeRule>;
380
+ count: number;
381
+ };
382
+ /**
383
+ * Generate a job runner script for ECS tasks
384
+ */
385
+ static generateJobRunnerScript(): string;
386
+ /**
387
+ * Generate job manifest file for CI/CD deployments
388
+ */
389
+ static generateJobManifest(options: {
390
+ projectRoot: string;
391
+ jobsPath?: string;
392
+ }): Promise<{
393
+ jobs: DiscoveredJob[];
394
+ scheduledCount: number;
395
+ totalCount: number;
396
+ }>;
397
+ }
398
+ /**
399
+ * Stacks framework job/action integration helpers
400
+ */
401
+ export declare const StacksIntegration: {
402
+ loadJobs: typeof JobLoader.discoverJobs;
403
+ loadActions: typeof JobLoader.discoverActions;
404
+ generateScheduledJobs: typeof JobLoader.generateScheduledJobResources;
405
+ generateRunner: typeof JobLoader.generateJobRunnerScript;
406
+ paths: {
407
+ jobs: string;
408
+ actions: string;
409
+ runner: string;
410
+ };
411
+ };
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Redirects Module - URL Redirect Management
3
+ * Provides clean API for creating domain and path-based redirects
4
+ */
5
+ import type { CloudFrontFunction, S3Bucket, S3BucketPolicy } from '@ts-cloud/aws-types';
6
+ import type { EnvironmentType } from '../types';
7
+ export interface RedirectRule {
8
+ source: string;
9
+ target: string;
10
+ statusCode?: 301 | 302 | 307 | 308;
11
+ preserveQueryString?: boolean;
12
+ }
13
+ export interface DomainRedirectOptions {
14
+ slug: string;
15
+ environment: EnvironmentType;
16
+ sourceDomain: string;
17
+ targetDomain: string;
18
+ protocol?: 'http' | 'https';
19
+ preservePath?: boolean;
20
+ }
21
+ export interface PathRedirectOptions {
22
+ slug: string;
23
+ environment: EnvironmentType;
24
+ rules: RedirectRule[];
25
+ }
26
+ /**
27
+ * Redirects Module - Domain and Path-based Redirects
28
+ * Provides clean API for URL redirects using S3 and CloudFront Functions
29
+ */
30
+ export declare class Redirects {
31
+ /**
32
+ * Create an S3 bucket configured for domain redirect
33
+ * Redirects all requests from one domain to another
34
+ */
35
+ static createDomainRedirectBucket(options: DomainRedirectOptions): {
36
+ bucket: S3Bucket;
37
+ bucketPolicy: S3BucketPolicy;
38
+ logicalId: string;
39
+ policyLogicalId: string;
40
+ };
41
+ /**
42
+ * Create a CloudFront Function for path-based redirects
43
+ */
44
+ static createPathRedirectFunction(options: PathRedirectOptions): {
45
+ function: CloudFrontFunction;
46
+ logicalId: string;
47
+ functionCode: string;
48
+ };
49
+ /**
50
+ * Generate CloudFront Function code for path redirects
51
+ */
52
+ static generateRedirectFunctionCode(rules: RedirectRule[]): string;
53
+ /**
54
+ * Create common redirect patterns
55
+ */
56
+ static readonly CommonRedirects: {
57
+ /**
58
+ * www to non-www redirect
59
+ */
60
+ wwwToApex: (domain: string, protocol?: "http" | "https") => DomainRedirectOptions;
61
+ /**
62
+ * non-www to www redirect
63
+ */
64
+ apexToWww: (domain: string, protocol?: "http" | "https") => DomainRedirectOptions;
65
+ /**
66
+ * HTTP to HTTPS redirect (handled at CloudFront/ALB level typically)
67
+ */
68
+ httpToHttps: (path?: string) => RedirectRule;
69
+ /**
70
+ * Trailing slash normalization (add trailing slash)
71
+ */
72
+ addTrailingSlash: (paths: string[]) => RedirectRule[];
73
+ /**
74
+ * Trailing slash normalization (remove trailing slash)
75
+ */
76
+ removeTrailingSlash: (paths: string[]) => RedirectRule[];
77
+ };
78
+ /**
79
+ * Create redirect rules for common URL patterns
80
+ */
81
+ static readonly Patterns: {
82
+ /**
83
+ * Old blog URL pattern to new pattern
84
+ * /blog/2023/01/my-post -> /blog/my-post
85
+ */
86
+ flattenBlogUrls: (posts: Array<{
87
+ oldPath: string;
88
+ newPath: string;
89
+ }>) => RedirectRule[];
90
+ /**
91
+ * Category URL changes
92
+ */
93
+ categoryRename: (oldCategory: string, newCategory: string) => RedirectRule[];
94
+ /**
95
+ * Product page URL pattern
96
+ */
97
+ productSlugChange: (products: Array<{
98
+ oldSlug: string;
99
+ newSlug: string;
100
+ }>) => RedirectRule[];
101
+ /**
102
+ * Deprecated API version redirects
103
+ */
104
+ apiVersionRedirect: (oldVersion: string, newVersion: string, endpoints: string[]) => RedirectRule[];
105
+ /**
106
+ * Gone (410) redirects for deleted content
107
+ */
108
+ gonePages: (paths: string[]) => RedirectRule[];
109
+ };
110
+ /**
111
+ * Create a complete redirect setup with multiple rules
112
+ */
113
+ static createRedirectSetup(options: {
114
+ slug: string;
115
+ environment: EnvironmentType;
116
+ domainRedirects?: DomainRedirectOptions[];
117
+ pathRedirects?: RedirectRule[];
118
+ }): {
119
+ resources: Record<string, any>;
120
+ outputs: {
121
+ domainRedirectBuckets: string[];
122
+ pathRedirectFunctionLogicalId: string | null;
123
+ };
124
+ };
125
+ /**
126
+ * Generate redirect rules from a simple mapping object
127
+ */
128
+ static fromMapping(mapping: Record<string, string>, options?: {
129
+ statusCode?: 301 | 302 | 307 | 308;
130
+ preserveQueryString?: boolean;
131
+ }): RedirectRule[];
132
+ /**
133
+ * Validate redirect rules for common issues
134
+ */
135
+ static validateRules(rules: RedirectRule[]): {
136
+ valid: boolean;
137
+ errors: string[];
138
+ warnings: string[];
139
+ };
140
+ }