@stacksjs/ts-cloud-core 0.1.3 → 0.1.7
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.
- package/README.md +98 -13
- package/dist/advanced-features.test.d.ts +0 -0
- package/dist/aws/cloudformation.d.ts +69 -0
- package/dist/aws/cloudfront.d.ts +21 -0
- package/dist/aws/credentials.d.ts +66 -0
- package/dist/aws/credentials.test.d.ts +0 -0
- package/{src/aws/index.ts → dist/aws/index.d.ts} +37 -51
- package/dist/aws/s3.d.ts +130 -0
- package/dist/aws/s3.test.d.ts +0 -0
- package/dist/aws/signature.d.ts +101 -0
- package/dist/aws/signature.test.d.ts +0 -0
- package/dist/backup/disaster-recovery.d.ts +98 -0
- package/dist/backup/disaster-recovery.test.d.ts +0 -0
- package/{src/backup/index.ts → dist/backup/index.d.ts} +10 -20
- package/dist/backup/manager.d.ts +112 -0
- package/dist/backup/manager.test.d.ts +0 -0
- package/dist/cicd/circleci.d.ts +47 -0
- package/dist/cicd/github-actions.d.ts +55 -0
- package/dist/cicd/gitlab-ci.d.ts +46 -0
- package/dist/cicd/index.d.ts +3 -0
- package/dist/cli/history.d.ts +66 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/progress.d.ts +97 -0
- package/dist/cli/repl.d.ts +76 -0
- package/dist/cli/suggestions.d.ts +67 -0
- package/dist/cli/table.d.ts +70 -0
- package/dist/cli/table.test.d.ts +0 -0
- package/dist/cloudformation/builder.d.ts +59 -0
- package/dist/cloudformation/builder.test.d.ts +0 -0
- package/dist/cloudformation/builders/api-gateway.d.ts +30 -0
- package/dist/cloudformation/builders/cache.d.ts +35 -0
- package/dist/cloudformation/builders/cdn.d.ts +34 -0
- package/dist/cloudformation/builders/compute.d.ts +66 -0
- package/dist/cloudformation/builders/database.d.ts +61 -0
- package/dist/cloudformation/builders/functions.d.ts +32 -0
- package/dist/cloudformation/builders/messaging.d.ts +17 -0
- package/dist/cloudformation/builders/monitoring.d.ts +36 -0
- package/dist/cloudformation/builders/network.d.ts +14 -0
- package/dist/cloudformation/builders/queue.d.ts +8 -0
- package/dist/cloudformation/builders/security.d.ts +31 -0
- package/dist/cloudformation/builders/storage.d.ts +8 -0
- package/dist/cloudformation/index.d.ts +24 -0
- package/dist/cloudformation/types.d.ts +132 -0
- package/dist/compliance/aws-config.d.ts +88 -0
- package/dist/compliance/cloudtrail.d.ts +96 -0
- package/dist/compliance/compliance.test.d.ts +0 -0
- package/dist/compliance/guardduty.d.ts +110 -0
- package/{src/compliance/index.ts → dist/compliance/index.d.ts} +20 -36
- package/dist/compliance/security-hub.d.ts +110 -0
- package/dist/containers/build-optimization.d.ts +110 -0
- package/dist/containers/containers.test.d.ts +0 -0
- package/dist/containers/image-scanning.d.ts +96 -0
- package/dist/containers/index.d.ts +4 -0
- package/dist/containers/registry.d.ts +99 -0
- package/dist/containers/service-mesh.d.ts +206 -0
- package/dist/database/database.test.d.ts +0 -0
- package/dist/database/index.d.ts +4 -0
- package/dist/database/migrations.d.ts +102 -0
- package/dist/database/performance.d.ts +168 -0
- package/dist/database/replicas.d.ts +146 -0
- package/dist/database/users.d.ts +102 -0
- package/dist/dependency-graph.d.ts +19 -0
- package/dist/deployment/ab-testing.d.ts +114 -0
- package/dist/deployment/blue-green.d.ts +98 -0
- package/dist/deployment/canary.d.ts +103 -0
- package/dist/deployment/deployment.test.d.ts +0 -0
- package/{src/deployment/index.ts → dist/deployment/index.d.ts} +20 -36
- package/dist/deployment/progressive.d.ts +34 -0
- package/dist/dns/dns.test.d.ts +0 -0
- package/dist/dns/dnssec.d.ts +75 -0
- package/dist/dns/index.d.ts +3 -0
- package/dist/dns/resolver.d.ts +150 -0
- package/dist/dns/routing.d.ts +217 -0
- package/dist/email/advanced/analytics.d.ts +78 -0
- package/dist/email/advanced/index.d.ts +7 -0
- package/dist/email/advanced/rules.d.ts +60 -0
- package/dist/email/advanced/scheduling.d.ts +63 -0
- package/dist/email/advanced/search.d.ts +76 -0
- package/dist/email/advanced/shared-mailboxes.d.ts +66 -0
- package/dist/email/advanced/templates.d.ts +39 -0
- package/dist/email/advanced/threading.d.ts +53 -0
- package/dist/email/analytics.d.ts +144 -0
- package/dist/email/bounce-handling.d.ts +120 -0
- package/dist/email/email.test.d.ts +0 -0
- package/dist/email/handlers/__tests__/inbound.test.d.ts +0 -0
- package/dist/email/handlers/__tests__/outbound.test.d.ts +0 -0
- package/{src/email/handlers/converter.ts → dist/email/handlers/converter.d.ts} +3 -5
- package/{src/email/handlers/feedback.ts → dist/email/handlers/feedback.d.ts} +3 -5
- package/{src/email/handlers/inbound.ts → dist/email/handlers/inbound.d.ts} +3 -5
- package/{src/email/handlers/outbound.ts → dist/email/handlers/outbound.d.ts} +3 -5
- package/dist/email/index.d.ts +6 -0
- package/dist/email/reputation.d.ts +97 -0
- package/dist/email/templates.d.ts +82 -0
- package/dist/errors/index.d.ts +186 -0
- package/dist/errors/index.test.d.ts +0 -0
- package/dist/health-checks/index.d.ts +35 -0
- package/dist/index.d.ts +256 -0
- package/dist/index.js +63499 -0
- package/dist/intrinsic-functions.d.ts +37 -0
- package/dist/lambda/concurrency.d.ts +98 -0
- package/dist/lambda/destinations.d.ts +99 -0
- package/dist/lambda/dlq.d.ts +109 -0
- package/dist/lambda/index.d.ts +6 -0
- package/dist/lambda/lambda.test.d.ts +0 -0
- package/dist/lambda/layers.d.ts +81 -0
- package/dist/lambda/versions.d.ts +91 -0
- package/dist/lambda/vpc.d.ts +116 -0
- package/dist/local/config.d.ts +44 -0
- package/dist/local/index.d.ts +2 -0
- package/dist/local/mock-aws.d.ts +60 -0
- package/dist/modules/ai.d.ts +47 -0
- package/dist/modules/api.d.ts +98 -0
- package/dist/modules/auth.d.ts +165 -0
- package/dist/modules/cache.d.ts +73 -0
- package/dist/modules/cdn.d.ts +125 -0
- package/dist/modules/communication.d.ts +98 -0
- package/dist/modules/compute.d.ts +309 -0
- package/dist/modules/database.d.ts +105 -0
- package/dist/modules/deployment.d.ts +181 -0
- package/dist/modules/dns.d.ts +45 -0
- package/dist/modules/email.d.ts +217 -0
- package/dist/modules/filesystem.d.ts +94 -0
- package/dist/modules/index.d.ts +27 -0
- package/dist/modules/messaging.d.ts +108 -0
- package/dist/modules/monitoring.d.ts +127 -0
- package/dist/modules/network.d.ts +102 -0
- package/dist/modules/parameter-store.d.ts +33 -0
- package/dist/modules/permissions.d.ts +132 -0
- package/dist/modules/phone.d.ts +80 -0
- package/dist/modules/queue.d.ts +210 -0
- package/dist/modules/redirects.d.ts +59 -0
- package/dist/modules/registry.d.ts +73 -0
- package/dist/modules/search.d.ts +56 -0
- package/dist/modules/secrets.d.ts +80 -0
- package/dist/modules/security.d.ts +100 -0
- package/dist/modules/sms.d.ts +52 -0
- package/dist/modules/storage.d.ts +160 -0
- package/dist/modules/workflow.d.ts +205 -0
- package/dist/multi-account/config.d.ts +315 -0
- package/dist/multi-account/index.d.ts +2 -0
- package/dist/multi-account/manager.d.ts +100 -0
- package/dist/multi-region/cross-region.d.ts +114 -0
- package/dist/multi-region/index.d.ts +3 -0
- package/dist/multi-region/manager.d.ts +72 -0
- package/dist/multi-region/regions.d.ts +98 -0
- package/dist/network-security/index.d.ts +39 -0
- package/dist/observability/index.d.ts +4 -0
- package/dist/observability/logs.d.ts +129 -0
- package/dist/observability/metrics.d.ts +153 -0
- package/dist/observability/observability.test.d.ts +0 -0
- package/dist/observability/synthetics.d.ts +146 -0
- package/dist/observability/xray.d.ts +129 -0
- package/dist/phone/advanced/analytics.d.ts +66 -0
- package/dist/phone/advanced/callbacks.d.ts +50 -0
- package/dist/phone/advanced/index.d.ts +4 -0
- package/dist/phone/advanced/ivr-builder.d.ts +83 -0
- package/dist/phone/advanced/recording.d.ts +48 -0
- package/dist/phone/handlers/__tests__/incoming-call.test.d.ts +0 -0
- package/{src/phone/handlers/incoming-call.ts → dist/phone/handlers/incoming-call.d.ts} +3 -5
- package/{src/phone/handlers/missed-call.ts → dist/phone/handlers/missed-call.d.ts} +3 -5
- package/{src/phone/handlers/voicemail.ts → dist/phone/handlers/voicemail.d.ts} +3 -5
- package/dist/phone/index.d.ts +2 -0
- package/dist/presets/api-backend.d.ts +11 -0
- package/dist/presets/data-pipeline.d.ts +11 -0
- package/{src/presets/extend.ts → dist/presets/extend.d.ts} +11 -114
- package/dist/presets/extend.test.d.ts +0 -0
- package/dist/presets/fullstack-app.d.ts +12 -0
- package/dist/presets/index.d.ts +24 -0
- package/dist/presets/jamstack.d.ts +12 -0
- package/dist/presets/microservices.d.ts +18 -0
- package/dist/presets/ml-api.d.ts +13 -0
- package/dist/presets/nodejs-server.d.ts +14 -0
- package/dist/presets/nodejs-serverless.d.ts +14 -0
- package/dist/presets/realtime-app.d.ts +11 -0
- package/dist/presets/static-site.d.ts +12 -0
- package/dist/presets/traditional-web-app.d.ts +16 -0
- package/dist/presets/wordpress.d.ts +12 -0
- package/dist/preview/github.d.ts +32 -0
- package/dist/preview/github.test.d.ts +0 -0
- package/{src/preview/index.ts → dist/preview/index.d.ts} +16 -26
- package/dist/preview/manager.d.ts +58 -0
- package/dist/preview/manager.test.d.ts +0 -0
- package/dist/preview/notifications.d.ts +55 -0
- package/dist/preview/notifications.test.d.ts +0 -0
- package/dist/queue/batch-processing.d.ts +87 -0
- package/dist/queue/dlq-monitoring.d.ts +95 -0
- package/dist/queue/fifo.d.ts +90 -0
- package/dist/queue/index.d.ts +4 -0
- package/dist/queue/management.d.ts +105 -0
- package/dist/queue/queue.test.d.ts +0 -0
- package/dist/resource-mgmt/index.d.ts +29 -0
- package/dist/resource-naming.d.ts +26 -0
- package/dist/s3/index.d.ts +173 -0
- package/dist/schema/index.d.ts +9 -0
- package/dist/security/certificate-manager.d.ts +121 -0
- package/dist/security/index.d.ts +4 -0
- package/dist/security/scanning.d.ts +147 -0
- package/dist/security/secrets-manager.d.ts +144 -0
- package/dist/security/secrets-rotation.d.ts +115 -0
- package/dist/security/security.test.d.ts +0 -0
- package/dist/sms/advanced/ab-testing.d.ts +54 -0
- package/dist/sms/advanced/analytics.d.ts +56 -0
- package/dist/sms/advanced/campaigns.d.ts +82 -0
- package/dist/sms/advanced/chatbot.d.ts +48 -0
- package/dist/sms/advanced/index.d.ts +6 -0
- package/dist/sms/advanced/link-tracking.d.ts +42 -0
- package/dist/sms/advanced/mms.d.ts +35 -0
- package/dist/sms/handlers/__tests__/send.test.d.ts +0 -0
- package/{src/sms/handlers/delivery-status.ts → dist/sms/handlers/delivery-status.d.ts} +3 -5
- package/{src/sms/handlers/receive.ts → dist/sms/handlers/receive.d.ts} +3 -5
- package/{src/sms/handlers/send.ts → dist/sms/handlers/send.d.ts} +3 -5
- package/dist/sms/index.d.ts +2 -0
- package/dist/stack-diff.d.ts +34 -0
- package/dist/static-site/index.d.ts +49 -0
- package/dist/template-builder.d.ts +14 -0
- package/dist/template-validator.d.ts +24 -0
- package/dist/utils/cache.d.ts +55 -0
- package/dist/utils/diff.d.ts +48 -0
- package/dist/utils/hash.d.ts +58 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/parallel.d.ts +60 -0
- package/dist/validators/credentials.d.ts +23 -0
- package/dist/validators/credentials.test.d.ts +0 -0
- package/dist/validators/quotas.d.ts +60 -0
- package/dist/validators/quotas.test.d.ts +0 -0
- package/package.json +13 -4
- package/src/advanced-features.test.ts +0 -465
- package/src/aws/cloudformation.ts +0 -421
- package/src/aws/cloudfront.ts +0 -158
- package/src/aws/credentials.test.ts +0 -132
- package/src/aws/credentials.ts +0 -545
- package/src/aws/s3.test.ts +0 -188
- package/src/aws/s3.ts +0 -1088
- package/src/aws/signature.test.ts +0 -670
- package/src/aws/signature.ts +0 -1155
- package/src/backup/disaster-recovery.test.ts +0 -726
- package/src/backup/disaster-recovery.ts +0 -500
- package/src/backup/manager.test.ts +0 -498
- package/src/backup/manager.ts +0 -432
- package/src/cicd/circleci.ts +0 -430
- package/src/cicd/github-actions.ts +0 -424
- package/src/cicd/gitlab-ci.ts +0 -255
- package/src/cicd/index.ts +0 -8
- package/src/cli/history.ts +0 -396
- package/src/cli/index.ts +0 -10
- package/src/cli/progress.ts +0 -458
- package/src/cli/repl.ts +0 -454
- package/src/cli/suggestions.ts +0 -327
- package/src/cli/table.test.ts +0 -319
- package/src/cli/table.ts +0 -332
- package/src/cloudformation/builder.test.ts +0 -327
- package/src/cloudformation/builder.ts +0 -378
- package/src/cloudformation/builders/api-gateway.ts +0 -449
- package/src/cloudformation/builders/cache.ts +0 -334
- package/src/cloudformation/builders/cdn.ts +0 -278
- package/src/cloudformation/builders/compute.ts +0 -485
- package/src/cloudformation/builders/database.ts +0 -392
- package/src/cloudformation/builders/functions.ts +0 -343
- package/src/cloudformation/builders/messaging.ts +0 -140
- package/src/cloudformation/builders/monitoring.ts +0 -300
- package/src/cloudformation/builders/network.ts +0 -264
- package/src/cloudformation/builders/queue.ts +0 -147
- package/src/cloudformation/builders/security.ts +0 -399
- package/src/cloudformation/builders/storage.ts +0 -285
- package/src/cloudformation/index.ts +0 -30
- package/src/cloudformation/types.ts +0 -173
- package/src/compliance/aws-config.ts +0 -543
- package/src/compliance/cloudtrail.ts +0 -376
- package/src/compliance/compliance.test.ts +0 -423
- package/src/compliance/guardduty.ts +0 -446
- package/src/compliance/security-hub.ts +0 -456
- package/src/containers/build-optimization.ts +0 -416
- package/src/containers/containers.test.ts +0 -508
- package/src/containers/image-scanning.ts +0 -360
- package/src/containers/index.ts +0 -9
- package/src/containers/registry.ts +0 -293
- package/src/containers/service-mesh.ts +0 -520
- package/src/database/database.test.ts +0 -762
- package/src/database/index.ts +0 -9
- package/src/database/migrations.ts +0 -444
- package/src/database/performance.ts +0 -528
- package/src/database/replicas.ts +0 -534
- package/src/database/users.ts +0 -494
- package/src/dependency-graph.ts +0 -143
- package/src/deployment/ab-testing.ts +0 -582
- package/src/deployment/blue-green.ts +0 -452
- package/src/deployment/canary.ts +0 -500
- package/src/deployment/deployment.test.ts +0 -526
- package/src/deployment/progressive.ts +0 -62
- package/src/dns/dns.test.ts +0 -641
- package/src/dns/dnssec.ts +0 -315
- package/src/dns/index.ts +0 -8
- package/src/dns/resolver.ts +0 -496
- package/src/dns/routing.ts +0 -593
- package/src/email/advanced/analytics.ts +0 -445
- package/src/email/advanced/index.ts +0 -11
- package/src/email/advanced/rules.ts +0 -465
- package/src/email/advanced/scheduling.ts +0 -352
- package/src/email/advanced/search.ts +0 -412
- package/src/email/advanced/shared-mailboxes.ts +0 -404
- package/src/email/advanced/templates.ts +0 -455
- package/src/email/advanced/threading.ts +0 -281
- package/src/email/analytics.ts +0 -467
- package/src/email/bounce-handling.ts +0 -425
- package/src/email/email.test.ts +0 -431
- package/src/email/handlers/__tests__/inbound.test.ts +0 -38
- package/src/email/handlers/__tests__/outbound.test.ts +0 -37
- package/src/email/index.ts +0 -15
- package/src/email/reputation.ts +0 -303
- package/src/email/templates.ts +0 -352
- package/src/errors/index.test.ts +0 -434
- package/src/errors/index.ts +0 -416
- package/src/health-checks/index.ts +0 -40
- package/src/index.ts +0 -360
- package/src/intrinsic-functions.ts +0 -118
- package/src/lambda/concurrency.ts +0 -330
- package/src/lambda/destinations.ts +0 -345
- package/src/lambda/dlq.ts +0 -425
- package/src/lambda/index.ts +0 -11
- package/src/lambda/lambda.test.ts +0 -840
- package/src/lambda/layers.ts +0 -263
- package/src/lambda/versions.ts +0 -376
- package/src/lambda/vpc.ts +0 -399
- package/src/local/config.ts +0 -114
- package/src/local/index.ts +0 -6
- package/src/local/mock-aws.ts +0 -351
- package/src/modules/ai.ts +0 -340
- package/src/modules/api.ts +0 -478
- package/src/modules/auth.ts +0 -805
- package/src/modules/cache.ts +0 -417
- package/src/modules/cdn.ts +0 -1062
- package/src/modules/communication.ts +0 -1094
- package/src/modules/compute.ts +0 -3348
- package/src/modules/database.ts +0 -554
- package/src/modules/deployment.ts +0 -1079
- package/src/modules/dns.ts +0 -337
- package/src/modules/email.ts +0 -1538
- package/src/modules/filesystem.ts +0 -515
- package/src/modules/index.ts +0 -32
- package/src/modules/messaging.ts +0 -486
- package/src/modules/monitoring.ts +0 -2086
- package/src/modules/network.ts +0 -664
- package/src/modules/parameter-store.ts +0 -325
- package/src/modules/permissions.ts +0 -1081
- package/src/modules/phone.ts +0 -494
- package/src/modules/queue.ts +0 -1260
- package/src/modules/redirects.ts +0 -464
- package/src/modules/registry.ts +0 -699
- package/src/modules/search.ts +0 -401
- package/src/modules/secrets.ts +0 -416
- package/src/modules/security.ts +0 -731
- package/src/modules/sms.ts +0 -389
- package/src/modules/storage.ts +0 -1120
- package/src/modules/workflow.ts +0 -680
- package/src/multi-account/config.ts +0 -521
- package/src/multi-account/index.ts +0 -7
- package/src/multi-account/manager.ts +0 -427
- package/src/multi-region/cross-region.ts +0 -410
- package/src/multi-region/index.ts +0 -8
- package/src/multi-region/manager.ts +0 -483
- package/src/multi-region/regions.ts +0 -435
- package/src/network-security/index.ts +0 -48
- package/src/observability/index.ts +0 -9
- package/src/observability/logs.ts +0 -522
- package/src/observability/metrics.ts +0 -460
- package/src/observability/observability.test.ts +0 -782
- package/src/observability/synthetics.ts +0 -568
- package/src/observability/xray.ts +0 -358
- package/src/phone/advanced/analytics.ts +0 -349
- package/src/phone/advanced/callbacks.ts +0 -428
- package/src/phone/advanced/index.ts +0 -8
- package/src/phone/advanced/ivr-builder.ts +0 -504
- package/src/phone/advanced/recording.ts +0 -310
- package/src/phone/handlers/__tests__/incoming-call.test.ts +0 -40
- package/src/phone/index.ts +0 -9
- package/src/presets/api-backend.ts +0 -134
- package/src/presets/data-pipeline.ts +0 -204
- package/src/presets/extend.test.ts +0 -295
- package/src/presets/fullstack-app.ts +0 -144
- package/src/presets/index.ts +0 -27
- package/src/presets/jamstack.ts +0 -135
- package/src/presets/microservices.ts +0 -167
- package/src/presets/ml-api.ts +0 -208
- package/src/presets/nodejs-server.ts +0 -104
- package/src/presets/nodejs-serverless.ts +0 -114
- package/src/presets/realtime-app.ts +0 -184
- package/src/presets/static-site.ts +0 -64
- package/src/presets/traditional-web-app.ts +0 -339
- package/src/presets/wordpress.ts +0 -138
- package/src/preview/github.test.ts +0 -249
- package/src/preview/github.ts +0 -297
- package/src/preview/manager.test.ts +0 -440
- package/src/preview/manager.ts +0 -326
- package/src/preview/notifications.test.ts +0 -582
- package/src/preview/notifications.ts +0 -341
- package/src/queue/batch-processing.ts +0 -402
- package/src/queue/dlq-monitoring.ts +0 -402
- package/src/queue/fifo.ts +0 -342
- package/src/queue/index.ts +0 -9
- package/src/queue/management.ts +0 -428
- package/src/queue/queue.test.ts +0 -429
- package/src/resource-mgmt/index.ts +0 -39
- package/src/resource-naming.ts +0 -62
- package/src/s3/index.ts +0 -523
- package/src/schema/cloud-config.schema.json +0 -554
- package/src/schema/index.ts +0 -68
- package/src/security/certificate-manager.ts +0 -492
- package/src/security/index.ts +0 -9
- package/src/security/scanning.ts +0 -545
- package/src/security/secrets-manager.ts +0 -476
- package/src/security/secrets-rotation.ts +0 -456
- package/src/security/security.test.ts +0 -738
- package/src/sms/advanced/ab-testing.ts +0 -389
- package/src/sms/advanced/analytics.ts +0 -336
- package/src/sms/advanced/campaigns.ts +0 -523
- package/src/sms/advanced/chatbot.ts +0 -224
- package/src/sms/advanced/index.ts +0 -10
- package/src/sms/advanced/link-tracking.ts +0 -248
- package/src/sms/advanced/mms.ts +0 -308
- package/src/sms/handlers/__tests__/send.test.ts +0 -40
- package/src/sms/index.ts +0 -9
- package/src/stack-diff.ts +0 -389
- package/src/static-site/index.ts +0 -85
- package/src/template-builder.ts +0 -110
- package/src/template-validator.ts +0 -574
- package/src/utils/cache.ts +0 -291
- package/src/utils/diff.ts +0 -269
- package/src/utils/hash.ts +0 -227
- package/src/utils/index.ts +0 -8
- package/src/utils/parallel.ts +0 -294
- package/src/validators/credentials.test.ts +0 -274
- package/src/validators/credentials.ts +0 -233
- package/src/validators/quotas.test.ts +0 -434
- package/src/validators/quotas.ts +0 -217
- package/test/ai.test.ts +0 -327
- package/test/api.test.ts +0 -511
- package/test/auth.test.ts +0 -632
- package/test/cache.test.ts +0 -406
- package/test/cdn.test.ts +0 -247
- package/test/compute.test.ts +0 -861
- package/test/database.test.ts +0 -523
- package/test/deployment.test.ts +0 -499
- package/test/dns.test.ts +0 -270
- package/test/email.test.ts +0 -439
- package/test/filesystem.test.ts +0 -382
- package/test/integration.test.ts +0 -350
- package/test/messaging.test.ts +0 -514
- package/test/monitoring.test.ts +0 -634
- package/test/network.test.ts +0 -425
- package/test/permissions.test.ts +0 -488
- package/test/queue.test.ts +0 -484
- package/test/registry.test.ts +0 -306
- package/test/security.test.ts +0 -462
- package/test/storage.test.ts +0 -463
- package/test/template-validator.test.ts +0 -559
- package/test/workflow.test.ts +0 -592
- package/tsconfig.json +0 -16
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Call Recording with Transcription
|
|
3
|
-
*
|
|
4
|
-
* Provides call recording storage and transcription
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export interface CallRecording {
|
|
8
|
-
recordingId: string
|
|
9
|
-
contactId: string
|
|
10
|
-
startTime: string
|
|
11
|
-
endTime: string
|
|
12
|
-
duration: number
|
|
13
|
-
participants: string[]
|
|
14
|
-
recordingUrl: string
|
|
15
|
-
transcription?: CallTranscription
|
|
16
|
-
status: 'recording' | 'processing' | 'completed' | 'failed'
|
|
17
|
-
createdAt: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface CallTranscription {
|
|
21
|
-
transcriptId: string
|
|
22
|
-
text: string
|
|
23
|
-
segments: TranscriptionSegment[]
|
|
24
|
-
language: string
|
|
25
|
-
confidence: number
|
|
26
|
-
status: 'pending' | 'processing' | 'completed' | 'failed'
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface TranscriptionSegment {
|
|
30
|
-
speaker: string
|
|
31
|
-
startTime: number
|
|
32
|
-
endTime: number
|
|
33
|
-
text: string
|
|
34
|
-
confidence: number
|
|
35
|
-
sentiment?: 'positive' | 'neutral' | 'negative'
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Call Recording Module
|
|
40
|
-
*/
|
|
41
|
-
export class CallRecording {
|
|
42
|
-
/**
|
|
43
|
-
* Lambda code for processing call recordings
|
|
44
|
-
*/
|
|
45
|
-
static RecordingProcessorCode = `
|
|
46
|
-
const { S3Client, GetObjectCommand, PutObjectCommand, CopyObjectCommand } = require('@aws-sdk/client-s3');
|
|
47
|
-
const { TranscribeClient, StartTranscriptionJobCommand, GetTranscriptionJobCommand } = require('@aws-sdk/client-transcribe');
|
|
48
|
-
const { DynamoDBClient, PutItemCommand, UpdateItemCommand } = require('@aws-sdk/client-dynamodb');
|
|
49
|
-
|
|
50
|
-
const s3 = new S3Client({});
|
|
51
|
-
const transcribe = new TranscribeClient({});
|
|
52
|
-
const dynamodb = new DynamoDBClient({});
|
|
53
|
-
|
|
54
|
-
const RECORDING_BUCKET = process.env.RECORDING_BUCKET;
|
|
55
|
-
const RECORDINGS_TABLE = process.env.RECORDINGS_TABLE;
|
|
56
|
-
|
|
57
|
-
exports.handler = async (event) => {
|
|
58
|
-
console.log('Recording processor event:', JSON.stringify(event, null, 2));
|
|
59
|
-
|
|
60
|
-
for (const record of event.Records) {
|
|
61
|
-
try {
|
|
62
|
-
const bucket = record.s3?.bucket?.name || RECORDING_BUCKET;
|
|
63
|
-
const key = decodeURIComponent(record.s3?.object?.key?.replace(/\\+/g, ' ') || '');
|
|
64
|
-
|
|
65
|
-
// Only process audio files
|
|
66
|
-
if (!key.match(/\\.(wav|mp3|mp4|flac|ogg|webm)$/i)) continue;
|
|
67
|
-
|
|
68
|
-
const recordingId = key.split('/').pop().replace(/\\.[^.]+$/, '');
|
|
69
|
-
const now = new Date().toISOString();
|
|
70
|
-
|
|
71
|
-
// Save recording metadata
|
|
72
|
-
await dynamodb.send(new PutItemCommand({
|
|
73
|
-
TableName: RECORDINGS_TABLE,
|
|
74
|
-
Item: {
|
|
75
|
-
recordingId: { S: recordingId },
|
|
76
|
-
bucket: { S: bucket },
|
|
77
|
-
key: { S: key },
|
|
78
|
-
status: { S: 'processing' },
|
|
79
|
-
createdAt: { S: now },
|
|
80
|
-
ttl: { N: String(Math.floor(Date.now() / 1000) + 90 * 24 * 60 * 60) },
|
|
81
|
-
},
|
|
82
|
-
}));
|
|
83
|
-
|
|
84
|
-
// Start transcription job
|
|
85
|
-
const transcriptionJobName = \`transcribe-\${recordingId}-\${Date.now()}\`;
|
|
86
|
-
const mediaUri = \`s3://\${bucket}/\${key}\`;
|
|
87
|
-
|
|
88
|
-
await transcribe.send(new StartTranscriptionJobCommand({
|
|
89
|
-
TranscriptionJobName: transcriptionJobName,
|
|
90
|
-
LanguageCode: 'en-US',
|
|
91
|
-
MediaFormat: key.split('.').pop().toLowerCase(),
|
|
92
|
-
Media: { MediaFileUri: mediaUri },
|
|
93
|
-
OutputBucketName: bucket,
|
|
94
|
-
OutputKey: \`transcriptions/\${recordingId}.json\`,
|
|
95
|
-
Settings: {
|
|
96
|
-
ShowSpeakerLabels: true,
|
|
97
|
-
MaxSpeakerLabels: 10,
|
|
98
|
-
ChannelIdentification: false,
|
|
99
|
-
},
|
|
100
|
-
}));
|
|
101
|
-
|
|
102
|
-
// Update status
|
|
103
|
-
await dynamodb.send(new UpdateItemCommand({
|
|
104
|
-
TableName: RECORDINGS_TABLE,
|
|
105
|
-
Key: { recordingId: { S: recordingId } },
|
|
106
|
-
UpdateExpression: 'SET transcriptionJobName = :job, #status = :status',
|
|
107
|
-
ExpressionAttributeNames: { '#status': 'status' },
|
|
108
|
-
ExpressionAttributeValues: {
|
|
109
|
-
':job': { S: transcriptionJobName },
|
|
110
|
-
':status': { S: 'transcribing' },
|
|
111
|
-
},
|
|
112
|
-
}));
|
|
113
|
-
|
|
114
|
-
console.log(\`Started transcription for: \${recordingId}\`);
|
|
115
|
-
} catch (error) {
|
|
116
|
-
console.error('Error processing recording:', error);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return { statusCode: 200 };
|
|
121
|
-
};
|
|
122
|
-
`
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Lambda code for transcription completion
|
|
126
|
-
*/
|
|
127
|
-
static TranscriptionCompleteCode = `
|
|
128
|
-
const { S3Client, GetObjectCommand } = require('@aws-sdk/client-s3');
|
|
129
|
-
const { DynamoDBClient, UpdateItemCommand, QueryCommand } = require('@aws-sdk/client-dynamodb');
|
|
130
|
-
|
|
131
|
-
const s3 = new S3Client({});
|
|
132
|
-
const dynamodb = new DynamoDBClient({});
|
|
133
|
-
|
|
134
|
-
const RECORDING_BUCKET = process.env.RECORDING_BUCKET;
|
|
135
|
-
const RECORDINGS_TABLE = process.env.RECORDINGS_TABLE;
|
|
136
|
-
|
|
137
|
-
exports.handler = async (event) => {
|
|
138
|
-
console.log('Transcription complete event:', JSON.stringify(event, null, 2));
|
|
139
|
-
|
|
140
|
-
const { detail } = event;
|
|
141
|
-
const jobName = detail?.TranscriptionJobName;
|
|
142
|
-
const jobStatus = detail?.TranscriptionJobStatus;
|
|
143
|
-
|
|
144
|
-
if (!jobName) return { statusCode: 400 };
|
|
145
|
-
|
|
146
|
-
// Find recording by job name
|
|
147
|
-
const queryResult = await dynamodb.send(new QueryCommand({
|
|
148
|
-
TableName: RECORDINGS_TABLE,
|
|
149
|
-
IndexName: 'job-index',
|
|
150
|
-
KeyConditionExpression: 'transcriptionJobName = :job',
|
|
151
|
-
ExpressionAttributeValues: {
|
|
152
|
-
':job': { S: jobName },
|
|
153
|
-
},
|
|
154
|
-
}));
|
|
155
|
-
|
|
156
|
-
const recording = queryResult.Items?.[0];
|
|
157
|
-
if (!recording) {
|
|
158
|
-
console.log('Recording not found for job:', jobName);
|
|
159
|
-
return { statusCode: 404 };
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const recordingId = recording.recordingId.S;
|
|
163
|
-
|
|
164
|
-
if (jobStatus === 'COMPLETED') {
|
|
165
|
-
// Get transcription result
|
|
166
|
-
const transcriptKey = \`transcriptions/\${recordingId}.json\`;
|
|
167
|
-
const result = await s3.send(new GetObjectCommand({
|
|
168
|
-
Bucket: RECORDING_BUCKET,
|
|
169
|
-
Key: transcriptKey,
|
|
170
|
-
}));
|
|
171
|
-
|
|
172
|
-
const transcriptData = JSON.parse(await result.Body.transformToString());
|
|
173
|
-
|
|
174
|
-
// Extract segments with speaker labels
|
|
175
|
-
const segments = [];
|
|
176
|
-
const items = transcriptData.results?.items || [];
|
|
177
|
-
let currentSegment = null;
|
|
178
|
-
|
|
179
|
-
for (const item of items) {
|
|
180
|
-
if (item.type === 'pronunciation') {
|
|
181
|
-
const speaker = item.speaker_label || 'spk_0';
|
|
182
|
-
const startTime = parseFloat(item.start_time || 0);
|
|
183
|
-
const endTime = parseFloat(item.end_time || 0);
|
|
184
|
-
const content = item.alternatives?.[0]?.content || '';
|
|
185
|
-
const confidence = parseFloat(item.alternatives?.[0]?.confidence || 0);
|
|
186
|
-
|
|
187
|
-
if (!currentSegment || currentSegment.speaker !== speaker) {
|
|
188
|
-
if (currentSegment) segments.push(currentSegment);
|
|
189
|
-
currentSegment = {
|
|
190
|
-
speaker,
|
|
191
|
-
startTime,
|
|
192
|
-
endTime,
|
|
193
|
-
text: content,
|
|
194
|
-
confidence,
|
|
195
|
-
};
|
|
196
|
-
} else {
|
|
197
|
-
currentSegment.endTime = endTime;
|
|
198
|
-
currentSegment.text += ' ' + content;
|
|
199
|
-
currentSegment.confidence = (currentSegment.confidence + confidence) / 2;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
if (currentSegment) segments.push(currentSegment);
|
|
204
|
-
|
|
205
|
-
// Update recording with transcription
|
|
206
|
-
await dynamodb.send(new UpdateItemCommand({
|
|
207
|
-
TableName: RECORDINGS_TABLE,
|
|
208
|
-
Key: { recordingId: { S: recordingId } },
|
|
209
|
-
UpdateExpression: 'SET #status = :status, transcription = :transcript, completedAt = :now',
|
|
210
|
-
ExpressionAttributeNames: { '#status': 'status' },
|
|
211
|
-
ExpressionAttributeValues: {
|
|
212
|
-
':status': { S: 'completed' },
|
|
213
|
-
':transcript': { S: JSON.stringify({
|
|
214
|
-
text: transcriptData.results?.transcripts?.[0]?.transcript || '',
|
|
215
|
-
segments,
|
|
216
|
-
language: 'en-US',
|
|
217
|
-
confidence: segments.reduce((sum, s) => sum + s.confidence, 0) / segments.length || 0,
|
|
218
|
-
})},
|
|
219
|
-
':now': { S: new Date().toISOString() },
|
|
220
|
-
},
|
|
221
|
-
}));
|
|
222
|
-
|
|
223
|
-
console.log(\`Transcription completed for: \${recordingId}\`);
|
|
224
|
-
} else if (jobStatus === 'FAILED') {
|
|
225
|
-
await dynamodb.send(new UpdateItemCommand({
|
|
226
|
-
TableName: RECORDINGS_TABLE,
|
|
227
|
-
Key: { recordingId: { S: recordingId } },
|
|
228
|
-
UpdateExpression: 'SET #status = :status, error = :error',
|
|
229
|
-
ExpressionAttributeNames: { '#status': 'status' },
|
|
230
|
-
ExpressionAttributeValues: {
|
|
231
|
-
':status': { S: 'failed' },
|
|
232
|
-
':error': { S: detail?.FailureReason || 'Unknown error' },
|
|
233
|
-
},
|
|
234
|
-
}));
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
return { statusCode: 200 };
|
|
238
|
-
};
|
|
239
|
-
`
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Create recordings DynamoDB table
|
|
243
|
-
*/
|
|
244
|
-
static createRecordingsTable(config: { slug: string }): Record<string, any> {
|
|
245
|
-
return {
|
|
246
|
-
[`${config.slug}CallRecordingsTable`]: {
|
|
247
|
-
Type: 'AWS::DynamoDB::Table',
|
|
248
|
-
Properties: {
|
|
249
|
-
TableName: `${config.slug}-call-recordings`,
|
|
250
|
-
BillingMode: 'PAY_PER_REQUEST',
|
|
251
|
-
AttributeDefinitions: [
|
|
252
|
-
{ AttributeName: 'recordingId', AttributeType: 'S' },
|
|
253
|
-
{ AttributeName: 'transcriptionJobName', AttributeType: 'S' },
|
|
254
|
-
],
|
|
255
|
-
KeySchema: [
|
|
256
|
-
{ AttributeName: 'recordingId', KeyType: 'HASH' },
|
|
257
|
-
],
|
|
258
|
-
GlobalSecondaryIndexes: [
|
|
259
|
-
{
|
|
260
|
-
IndexName: 'job-index',
|
|
261
|
-
KeySchema: [
|
|
262
|
-
{ AttributeName: 'transcriptionJobName', KeyType: 'HASH' },
|
|
263
|
-
],
|
|
264
|
-
Projection: { ProjectionType: 'ALL' },
|
|
265
|
-
},
|
|
266
|
-
],
|
|
267
|
-
TimeToLiveSpecification: {
|
|
268
|
-
AttributeName: 'ttl',
|
|
269
|
-
Enabled: true,
|
|
270
|
-
},
|
|
271
|
-
},
|
|
272
|
-
},
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Create recording processor Lambda
|
|
278
|
-
*/
|
|
279
|
-
static createRecordingProcessorLambda(config: {
|
|
280
|
-
slug: string
|
|
281
|
-
roleArn: string
|
|
282
|
-
recordingBucket: string
|
|
283
|
-
recordingsTable: string
|
|
284
|
-
}): Record<string, any> {
|
|
285
|
-
return {
|
|
286
|
-
[`${config.slug}RecordingProcessorLambda`]: {
|
|
287
|
-
Type: 'AWS::Lambda::Function',
|
|
288
|
-
Properties: {
|
|
289
|
-
FunctionName: `${config.slug}-recording-processor`,
|
|
290
|
-
Runtime: 'nodejs20.x',
|
|
291
|
-
Handler: 'index.handler',
|
|
292
|
-
Role: config.roleArn,
|
|
293
|
-
Timeout: 60,
|
|
294
|
-
MemorySize: 256,
|
|
295
|
-
Code: {
|
|
296
|
-
ZipFile: CallRecording.RecordingProcessorCode,
|
|
297
|
-
},
|
|
298
|
-
Environment: {
|
|
299
|
-
Variables: {
|
|
300
|
-
RECORDING_BUCKET: config.recordingBucket,
|
|
301
|
-
RECORDINGS_TABLE: config.recordingsTable,
|
|
302
|
-
},
|
|
303
|
-
},
|
|
304
|
-
},
|
|
305
|
-
},
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export default CallRecording
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test'
|
|
2
|
-
import { handler } from '../incoming-call'
|
|
3
|
-
|
|
4
|
-
describe('Incoming Call Handler', () => {
|
|
5
|
-
it('should export handler code as string', () => {
|
|
6
|
-
expect(typeof handler).toBe('string')
|
|
7
|
-
expect(handler).toContain('exports.handler')
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
it('should contain SNS client import', () => {
|
|
11
|
-
expect(handler).toContain('SNSClient')
|
|
12
|
-
expect(handler).toContain('PublishCommand')
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it('should contain DynamoDB client import', () => {
|
|
16
|
-
expect(handler).toContain('DynamoDBClient')
|
|
17
|
-
expect(handler).toContain('PutItemCommand')
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('should extract contact data', () => {
|
|
21
|
-
expect(handler).toContain('ContactData')
|
|
22
|
-
expect(handler).toContain('CustomerEndpoint')
|
|
23
|
-
expect(handler).toContain('SystemEndpoint')
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
it('should log calls to DynamoDB', () => {
|
|
27
|
-
expect(handler).toContain('CALL_LOG_TABLE')
|
|
28
|
-
expect(handler).toContain('contactId')
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('should send notifications', () => {
|
|
32
|
-
expect(handler).toContain('NOTIFICATION_TOPIC_ARN')
|
|
33
|
-
expect(handler).toContain('incoming_call')
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
it('should support webhook notifications', () => {
|
|
37
|
-
expect(handler).toContain('WEBHOOK_URL')
|
|
38
|
-
expect(handler).toContain('fetch')
|
|
39
|
-
})
|
|
40
|
-
})
|
package/src/phone/index.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import type { CloudConfig } from '@stacksjs/ts-cloud-types'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* API-Only Backend Preset
|
|
5
|
-
* Perfect for: REST APIs, GraphQL APIs, mobile backends
|
|
6
|
-
* Includes: API Gateway + Lambda functions + DynamoDB
|
|
7
|
-
*/
|
|
8
|
-
export function createApiBackendPreset(options: {
|
|
9
|
-
name: string
|
|
10
|
-
slug: string
|
|
11
|
-
domain?: string
|
|
12
|
-
}): Partial<CloudConfig> {
|
|
13
|
-
const { name, slug, domain } = options
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
project: {
|
|
17
|
-
name,
|
|
18
|
-
slug,
|
|
19
|
-
region: 'us-east-1',
|
|
20
|
-
},
|
|
21
|
-
mode: 'serverless',
|
|
22
|
-
environments: {
|
|
23
|
-
production: {
|
|
24
|
-
type: 'production',
|
|
25
|
-
domain,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
infrastructure: {
|
|
29
|
-
apiGateway: {
|
|
30
|
-
type: 'HTTP', // HTTP API is cheaper and simpler
|
|
31
|
-
cors: {
|
|
32
|
-
allowOrigins: ['*'],
|
|
33
|
-
allowMethods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
|
|
34
|
-
allowHeaders: ['Content-Type', 'Authorization'],
|
|
35
|
-
maxAge: 3600,
|
|
36
|
-
},
|
|
37
|
-
customDomain: domain ? {
|
|
38
|
-
domain,
|
|
39
|
-
certificateArn: 'TO_BE_GENERATED',
|
|
40
|
-
} : undefined,
|
|
41
|
-
throttling: {
|
|
42
|
-
rateLimit: 10000,
|
|
43
|
-
burstLimit: 5000,
|
|
44
|
-
},
|
|
45
|
-
authorizer: {
|
|
46
|
-
type: 'JWT',
|
|
47
|
-
identitySource: '$request.header.Authorization',
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
functions: {
|
|
51
|
-
users: {
|
|
52
|
-
runtime: 'nodejs20.x',
|
|
53
|
-
handler: 'dist/api/users.handler',
|
|
54
|
-
memory: 512,
|
|
55
|
-
timeout: 30,
|
|
56
|
-
events: [{
|
|
57
|
-
type: 'http',
|
|
58
|
-
path: '/users',
|
|
59
|
-
method: 'GET',
|
|
60
|
-
}, {
|
|
61
|
-
type: 'http',
|
|
62
|
-
path: '/users',
|
|
63
|
-
method: 'POST',
|
|
64
|
-
}],
|
|
65
|
-
},
|
|
66
|
-
products: {
|
|
67
|
-
runtime: 'nodejs20.x',
|
|
68
|
-
handler: 'dist/api/products.handler',
|
|
69
|
-
memory: 512,
|
|
70
|
-
timeout: 30,
|
|
71
|
-
events: [{
|
|
72
|
-
type: 'http',
|
|
73
|
-
path: '/products',
|
|
74
|
-
method: 'GET',
|
|
75
|
-
}],
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
databases: {
|
|
79
|
-
dynamodb: {
|
|
80
|
-
tables: {
|
|
81
|
-
[`${slug}-users`]: {
|
|
82
|
-
partitionKey: { name: 'userId', type: 'S' },
|
|
83
|
-
billingMode: 'PAY_PER_REQUEST',
|
|
84
|
-
streamEnabled: true,
|
|
85
|
-
pointInTimeRecovery: true,
|
|
86
|
-
globalSecondaryIndexes: [{
|
|
87
|
-
name: 'EmailIndex',
|
|
88
|
-
partitionKey: { name: 'email', type: 'S' },
|
|
89
|
-
projection: 'ALL',
|
|
90
|
-
}],
|
|
91
|
-
},
|
|
92
|
-
[`${slug}-products`]: {
|
|
93
|
-
partitionKey: { name: 'productId', type: 'S' },
|
|
94
|
-
sortKey: { name: 'category', type: 'S' },
|
|
95
|
-
billingMode: 'PAY_PER_REQUEST',
|
|
96
|
-
streamEnabled: false,
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
cache: {
|
|
102
|
-
elasticache: {
|
|
103
|
-
nodeType: 'cache.t3.micro',
|
|
104
|
-
numCacheNodes: 1,
|
|
105
|
-
engine: 'redis',
|
|
106
|
-
engineVersion: '7.0',
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
security: {
|
|
110
|
-
certificate: domain ? {
|
|
111
|
-
domain,
|
|
112
|
-
validationMethod: 'DNS',
|
|
113
|
-
} : undefined,
|
|
114
|
-
waf: {
|
|
115
|
-
enabled: true,
|
|
116
|
-
rules: ['rateLimit', 'sqlInjection'],
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
monitoring: {
|
|
120
|
-
alarms: [{
|
|
121
|
-
metric: 'Errors',
|
|
122
|
-
threshold: 10,
|
|
123
|
-
period: 300,
|
|
124
|
-
evaluationPeriods: 1,
|
|
125
|
-
}, {
|
|
126
|
-
metric: 'Duration',
|
|
127
|
-
threshold: 3000, // 3 seconds
|
|
128
|
-
period: 300,
|
|
129
|
-
evaluationPeriods: 2,
|
|
130
|
-
}],
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
}
|
|
134
|
-
}
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import type { CloudConfig } from '@stacksjs/ts-cloud-types'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Data Pipeline Preset
|
|
5
|
-
* Perfect for: ETL pipelines, data processing, analytics workflows
|
|
6
|
-
* Includes: Kinesis + Lambda + S3 + Athena + Glue
|
|
7
|
-
*/
|
|
8
|
-
export function createDataPipelinePreset(options: {
|
|
9
|
-
name: string
|
|
10
|
-
slug: string
|
|
11
|
-
retentionDays?: number
|
|
12
|
-
}): Partial<CloudConfig> {
|
|
13
|
-
const {
|
|
14
|
-
name,
|
|
15
|
-
slug,
|
|
16
|
-
retentionDays = 7,
|
|
17
|
-
} = options
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
project: {
|
|
21
|
-
name,
|
|
22
|
-
slug,
|
|
23
|
-
region: 'us-east-1',
|
|
24
|
-
},
|
|
25
|
-
mode: 'serverless',
|
|
26
|
-
infrastructure: {
|
|
27
|
-
streaming: {
|
|
28
|
-
dataStream: {
|
|
29
|
-
name: `${slug}-stream`,
|
|
30
|
-
shardCount: 2,
|
|
31
|
-
retentionPeriod: retentionDays * 24, // Convert to hours
|
|
32
|
-
encryption: true,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
storage: {
|
|
36
|
-
raw: {
|
|
37
|
-
public: false,
|
|
38
|
-
versioning: true,
|
|
39
|
-
encryption: true,
|
|
40
|
-
intelligentTiering: true,
|
|
41
|
-
lifecycleRules: [{
|
|
42
|
-
id: 'ArchiveOldData',
|
|
43
|
-
enabled: true,
|
|
44
|
-
transitions: [{
|
|
45
|
-
days: 30,
|
|
46
|
-
storageClass: 'GLACIER',
|
|
47
|
-
}, {
|
|
48
|
-
days: 90,
|
|
49
|
-
storageClass: 'DEEP_ARCHIVE',
|
|
50
|
-
}],
|
|
51
|
-
}],
|
|
52
|
-
},
|
|
53
|
-
processed: {
|
|
54
|
-
public: false,
|
|
55
|
-
versioning: true,
|
|
56
|
-
encryption: true,
|
|
57
|
-
intelligentTiering: true,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
functions: {
|
|
61
|
-
'stream-processor': {
|
|
62
|
-
runtime: 'nodejs20.x',
|
|
63
|
-
handler: 'dist/processors/stream.handler',
|
|
64
|
-
memory: 2048,
|
|
65
|
-
timeout: 300, // 5 minutes for batch processing
|
|
66
|
-
events: [{
|
|
67
|
-
type: 'kinesis',
|
|
68
|
-
streamName: `${slug}-stream`,
|
|
69
|
-
batchSize: 1000,
|
|
70
|
-
startingPosition: 'LATEST',
|
|
71
|
-
parallelizationFactor: 10,
|
|
72
|
-
}],
|
|
73
|
-
},
|
|
74
|
-
transformer: {
|
|
75
|
-
runtime: 'nodejs20.x',
|
|
76
|
-
handler: 'dist/processors/transform.handler',
|
|
77
|
-
memory: 3008,
|
|
78
|
-
timeout: 900, // 15 minutes
|
|
79
|
-
events: [{
|
|
80
|
-
type: 's3',
|
|
81
|
-
bucket: `${slug}-raw`,
|
|
82
|
-
prefix: 'incoming/',
|
|
83
|
-
}],
|
|
84
|
-
},
|
|
85
|
-
aggregator: {
|
|
86
|
-
runtime: 'nodejs20.x',
|
|
87
|
-
handler: 'dist/processors/aggregate.handler',
|
|
88
|
-
memory: 2048,
|
|
89
|
-
timeout: 600, // 10 minutes
|
|
90
|
-
events: [{
|
|
91
|
-
type: 'schedule',
|
|
92
|
-
expression: 'cron(0 * * * ? *)', // Every hour
|
|
93
|
-
}],
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
analytics: {
|
|
97
|
-
athena: {
|
|
98
|
-
database: `${slug}_analytics`,
|
|
99
|
-
workgroup: `${slug}-workgroup`,
|
|
100
|
-
outputBucket: `${slug}-query-results`,
|
|
101
|
-
tables: [{
|
|
102
|
-
name: 'raw_events',
|
|
103
|
-
location: `s3://${slug}-raw/events/`,
|
|
104
|
-
format: 'parquet',
|
|
105
|
-
partitionKeys: ['year', 'month', 'day'],
|
|
106
|
-
}, {
|
|
107
|
-
name: 'processed_events',
|
|
108
|
-
location: `s3://${slug}-processed/events/`,
|
|
109
|
-
format: 'parquet',
|
|
110
|
-
partitionKeys: ['year', 'month', 'day'],
|
|
111
|
-
}],
|
|
112
|
-
},
|
|
113
|
-
glue: {
|
|
114
|
-
crawlers: [{
|
|
115
|
-
name: `${slug}-crawler`,
|
|
116
|
-
databaseName: `${slug}_analytics`,
|
|
117
|
-
s3Targets: [
|
|
118
|
-
`s3://${slug}-raw/`,
|
|
119
|
-
`s3://${slug}-processed/`,
|
|
120
|
-
],
|
|
121
|
-
schedule: 'cron(0 2 * * ? *)', // Daily at 2 AM
|
|
122
|
-
}],
|
|
123
|
-
jobs: [{
|
|
124
|
-
name: `${slug}-etl-job`,
|
|
125
|
-
scriptLocation: `s3://${slug}-scripts/etl.py`,
|
|
126
|
-
role: `${slug}-glue-role`,
|
|
127
|
-
maxCapacity: 10,
|
|
128
|
-
timeout: 120, // 2 hours
|
|
129
|
-
}],
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
databases: {
|
|
133
|
-
dynamodb: {
|
|
134
|
-
tables: {
|
|
135
|
-
[`${slug}-metadata`]: {
|
|
136
|
-
partitionKey: { name: 'pipelineId', type: 'S' },
|
|
137
|
-
sortKey: { name: 'timestamp', type: 'S' },
|
|
138
|
-
billingMode: 'PAY_PER_REQUEST',
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
queues: {
|
|
144
|
-
failedJobs: {
|
|
145
|
-
fifo: false,
|
|
146
|
-
visibilityTimeout: 900, // 15 minutes
|
|
147
|
-
messageRetentionPeriod: 1209600, // 14 days
|
|
148
|
-
deadLetterQueue: true,
|
|
149
|
-
maxReceiveCount: 3,
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
workflow: {
|
|
153
|
-
pipelines: [{
|
|
154
|
-
name: `${slug}-daily-pipeline`,
|
|
155
|
-
type: 'stepFunctions',
|
|
156
|
-
definition: {
|
|
157
|
-
StartAt: 'ExtractData',
|
|
158
|
-
States: {
|
|
159
|
-
ExtractData: {
|
|
160
|
-
Type: 'Task',
|
|
161
|
-
Resource: 'arn:aws:states:::lambda:invoke',
|
|
162
|
-
Next: 'TransformData',
|
|
163
|
-
},
|
|
164
|
-
TransformData: {
|
|
165
|
-
Type: 'Task',
|
|
166
|
-
Resource: 'arn:aws:states:::lambda:invoke',
|
|
167
|
-
Next: 'LoadData',
|
|
168
|
-
},
|
|
169
|
-
LoadData: {
|
|
170
|
-
Type: 'Task',
|
|
171
|
-
Resource: 'arn:aws:states:::lambda:invoke',
|
|
172
|
-
End: true,
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
schedule: 'cron(0 0 * * ? *)', // Daily at midnight
|
|
177
|
-
}],
|
|
178
|
-
},
|
|
179
|
-
monitoring: {
|
|
180
|
-
dashboard: {
|
|
181
|
-
name: `${slug}-pipeline`,
|
|
182
|
-
widgets: [{
|
|
183
|
-
type: 'metric',
|
|
184
|
-
metrics: [
|
|
185
|
-
'KinesisIncomingRecords',
|
|
186
|
-
'LambdaInvocations',
|
|
187
|
-
'S3ObjectsCreated',
|
|
188
|
-
'GlueJobsSucceeded',
|
|
189
|
-
],
|
|
190
|
-
}],
|
|
191
|
-
},
|
|
192
|
-
alarms: [{
|
|
193
|
-
metric: 'LambdaErrors',
|
|
194
|
-
threshold: 10,
|
|
195
|
-
evaluationPeriods: 1,
|
|
196
|
-
}, {
|
|
197
|
-
metric: 'KinesisIteratorAge',
|
|
198
|
-
threshold: 60000, // 1 minute
|
|
199
|
-
evaluationPeriods: 2,
|
|
200
|
-
}],
|
|
201
|
-
},
|
|
202
|
-
},
|
|
203
|
-
}
|
|
204
|
-
}
|