@stacksjs/ts-cloud 0.7.55 → 0.7.57
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/dist/alerts/alerts.test.d.ts +1 -0
- package/dist/alerts/delivery.d.ts +45 -0
- package/dist/alerts/evaluator.d.ts +12 -0
- package/dist/alerts/health.d.ts +34 -0
- package/dist/alerts/index.d.ts +6 -0
- package/dist/alerts/model.d.ts +170 -0
- package/dist/alerts/store.d.ts +90 -0
- package/dist/alerts/telemetry.d.ts +3 -0
- package/dist/api/client.d.ts +197 -0
- package/dist/api/handler.d.ts +18 -0
- package/dist/api/handler.test.d.ts +1 -0
- package/dist/api/index.d.ts +6 -0
- package/dist/api/openapi.d.ts +2 -0
- package/dist/api/service.d.ts +28 -0
- package/dist/api/types.d.ts +119 -0
- package/dist/auth/encryption.d.ts +3 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/mailer.d.ts +9 -0
- package/dist/auth/oidc.d.ts +36 -0
- package/dist/auth/oidc.test.d.ts +1 -0
- package/dist/auth/store.d.ts +121 -0
- package/dist/auth/store.test.d.ts +1 -0
- package/dist/auth/totp.d.ts +11 -0
- package/dist/auth/totp.test.d.ts +1 -0
- package/dist/auth/types.d.ts +138 -0
- package/dist/automation/index.d.ts +2 -0
- package/dist/automation/store.d.ts +46 -0
- package/dist/automation/store.test.d.ts +1 -0
- package/dist/automation/types.d.ts +66 -0
- package/dist/aws/acm.d.ts +0 -4
- package/dist/aws/application-autoscaling.d.ts +0 -5
- package/dist/aws/backup.d.ts +42 -0
- package/dist/aws/bedrock.d.ts +0 -5
- package/dist/aws/client.d.ts +3 -6
- package/dist/aws/cloudformation.d.ts +0 -4
- package/dist/aws/cloudfront-media.test.d.ts +1 -0
- package/dist/aws/cloudfront-origin.test.d.ts +1 -0
- package/dist/aws/cloudfront.d.ts +87 -3
- package/dist/aws/cloudwatch-logs.d.ts +2 -4
- package/dist/aws/cloudwatch.d.ts +1 -1
- package/dist/aws/comprehend.d.ts +0 -5
- package/dist/aws/connect.d.ts +0 -4
- package/dist/aws/cost-explorer-cache.d.ts +1 -15
- package/dist/aws/cost-explorer.d.ts +18 -9
- package/dist/aws/cost-explorer.test.d.ts +1 -0
- package/dist/aws/dynamodb.d.ts +0 -4
- package/dist/aws/ec2.d.ts +0 -4
- package/dist/aws/ecr.d.ts +0 -4
- package/dist/aws/ecs.d.ts +17 -7
- package/dist/aws/efs.d.ts +0 -4
- package/dist/aws/elasticache.d.ts +0 -4
- package/dist/aws/elbv2.d.ts +0 -7
- package/dist/aws/email.d.ts +0 -10
- package/dist/aws/eventbridge.d.ts +0 -4
- package/dist/aws/iam.d.ts +1 -5
- package/dist/aws/imap-server.d.ts +0 -7
- package/dist/aws/index.d.ts +4 -3
- package/dist/aws/index.js +31 -31
- package/dist/aws/kendra.d.ts +0 -5
- package/dist/aws/lambda.d.ts +3 -5
- package/dist/aws/opensearch.d.ts +0 -4
- package/dist/aws/personalize.d.ts +0 -5
- package/dist/aws/polly.d.ts +0 -5
- package/dist/aws/rds.d.ts +59 -4
- package/dist/aws/rekognition.d.ts +0 -5
- package/dist/aws/route53-domains.d.ts +0 -4
- package/dist/aws/route53.d.ts +0 -4
- package/dist/aws/s3.d.ts +10 -6
- package/dist/aws/scheduler.d.ts +0 -4
- package/dist/aws/secrets-manager.d.ts +0 -4
- package/dist/aws/setup-sms.d.ts +0 -14
- package/dist/aws/sms.d.ts +0 -10
- package/dist/aws/smtp-server.d.ts +0 -11
- package/dist/aws/sns.d.ts +0 -4
- package/dist/aws/sqs.d.ts +0 -4
- package/dist/aws/ssm.d.ts +0 -4
- package/dist/aws/sts.d.ts +0 -4
- package/dist/aws/support.d.ts +0 -4
- package/dist/aws/textract.d.ts +0 -5
- package/dist/aws/transcribe.d.ts +0 -4
- package/dist/aws/translate.d.ts +0 -5
- package/dist/aws/voice.d.ts +0 -11
- package/dist/aws/xray.d.ts +1 -0
- package/dist/backups/aws-database-source.d.ts +19 -0
- package/dist/backups/aws-database-source.test.d.ts +1 -0
- package/dist/backups/aws-infrastructure-source.d.ts +43 -0
- package/dist/backups/aws-infrastructure-source.test.d.ts +1 -0
- package/dist/backups/control-plane-source.d.ts +16 -0
- package/dist/backups/control-plane-source.test.d.ts +1 -0
- package/dist/backups/docker-volume-source.d.ts +31 -0
- package/dist/backups/docker-volume-source.test.d.ts +1 -0
- package/dist/backups/filesystem-source.d.ts +34 -0
- package/dist/backups/filesystem-source.test.d.ts +1 -0
- package/dist/backups/index.d.ts +10 -0
- package/dist/backups/logical-database-source.d.ts +16 -0
- package/dist/backups/logical-database-source.test.d.ts +1 -0
- package/dist/backups/model.d.ts +121 -0
- package/dist/backups/s3-destination.d.ts +85 -0
- package/dist/backups/s3-destination.test.d.ts +1 -0
- package/dist/backups/service.d.ts +80 -0
- package/dist/backups/service.test.d.ts +1 -0
- package/dist/backups/store.d.ts +30 -0
- package/dist/backups/store.test.d.ts +1 -0
- package/dist/bin/cli.js +3360 -1802
- package/dist/{chunk-tjjgajbh.js → chunk-01d86gt1.js} +301 -9
- package/dist/{chunk-73vcqg6z.js → chunk-0z43x8re.js} +7 -7
- package/dist/{chunk-tnztxpcb.js → chunk-32e7ya18.js} +61 -49
- package/dist/{chunk-qpj3edwz.js → chunk-4cjrg98a.js} +3 -7
- package/dist/{chunk-hsk6fe6x.js → chunk-50jpda9q.js} +2 -2
- package/dist/{chunk-93hjhs78.js → chunk-703nkybg.js} +1 -1
- package/dist/{chunk-d5vqwj8s.js → chunk-9m6b4m74.js} +755 -720
- package/dist/chunk-e05phx5f.js +10 -0
- package/dist/{chunk-f29w04w5.js → chunk-exbcsab2.js} +10 -4
- package/dist/{chunk-eq08r166.js → chunk-f55nkpvb.js} +2 -2
- package/dist/{chunk-3bfv1z4v.js → chunk-fv1bj3yt.js} +63 -56
- package/dist/chunk-fw3q88wk.js +48641 -0
- package/dist/{chunk-3knnr7wh.js → chunk-he9a874b.js} +170 -2
- package/dist/{chunk-zn0nxxa8.js → chunk-hpv68b4a.js} +1070 -1070
- package/dist/chunk-k114qwg9.js +12 -0
- package/dist/{chunk-r16e02bc.js → chunk-vdk53yyq.js} +3900 -4101
- package/dist/{chunk-jp2a8yad.js → chunk-vvkd46k1.js} +15 -13
- package/dist/{chunk-vd87cpvn.js → chunk-wj3s95p9.js} +62 -46
- package/dist/{chunk-mj1tmhte.js → chunk-x9s0cqfx.js} +1 -1
- package/dist/{chunk-3rsfns7x.js → chunk-ybcz6sxc.js} +2048 -387
- package/dist/{chunk-arsh1g5h.js → chunk-zqtpg06c.js} +14 -11
- package/dist/compose/index.d.ts +6 -0
- package/dist/compose/parser.d.ts +13 -0
- package/dist/compose/parser.test.d.ts +1 -0
- package/dist/compose/runtime.d.ts +10 -0
- package/dist/compose/service.d.ts +18 -0
- package/dist/compose/store.d.ts +59 -0
- package/dist/compose/store.test.d.ts +1 -0
- package/dist/compose/templates.d.ts +17 -0
- package/dist/compose/types.d.ts +164 -0
- package/dist/configuration/backends.d.ts +66 -0
- package/dist/configuration/backends.test.d.ts +1 -0
- package/dist/configuration/dotenv.d.ts +14 -0
- package/dist/configuration/dotenv.test.d.ts +1 -0
- package/dist/configuration/index.d.ts +6 -0
- package/dist/configuration/migrate.d.ts +10 -0
- package/dist/configuration/migrate.test.d.ts +1 -0
- package/dist/configuration/model.d.ts +50 -0
- package/dist/configuration/service.d.ts +144 -0
- package/dist/configuration/service.test.d.ts +1 -0
- package/dist/configuration/store.d.ts +33 -0
- package/dist/configuration/store.test.d.ts +1 -0
- package/dist/control-plane/authorization.d.ts +24 -0
- package/dist/control-plane/authorization.test.d.ts +1 -0
- package/dist/control-plane/index.d.ts +8 -0
- package/dist/control-plane/migrations.d.ts +7 -0
- package/dist/control-plane/search.d.ts +25 -0
- package/dist/control-plane/store.d.ts +117 -0
- package/dist/control-plane/store.test.d.ts +1 -0
- package/dist/control-plane/types.d.ts +381 -0
- package/dist/cost/reporting.d.ts +24 -0
- package/dist/cost/reporting.test.d.ts +1 -0
- package/dist/cost/resource-inventory.d.ts +32 -0
- package/dist/cost/resource-inventory.test.d.ts +1 -0
- package/dist/cost/resource-optimization.d.ts +59 -0
- package/dist/cost/resource-optimization.test.d.ts +1 -0
- package/dist/data-services/adapters.d.ts +39 -0
- package/dist/data-services/aws-transports.d.ts +29 -0
- package/dist/data-services/aws-transports.test.d.ts +1 -0
- package/dist/data-services/capabilities.d.ts +2 -0
- package/dist/data-services/data-services.test.d.ts +1 -0
- package/dist/data-services/docker-transport.d.ts +55 -0
- package/dist/data-services/docker-transport.test.d.ts +1 -0
- package/dist/data-services/index.d.ts +8 -0
- package/dist/data-services/model.d.ts +79 -0
- package/dist/data-services/secrets.d.ts +13 -0
- package/dist/data-services/secrets.test.d.ts +1 -0
- package/dist/data-services/service.d.ts +51 -0
- package/dist/data-services/store.d.ts +17 -0
- package/dist/deploy/container-image.d.ts +28 -0
- package/dist/deploy/container-image.test.d.ts +1 -0
- package/dist/deploy/dashboard-audit.test.d.ts +1 -0
- package/dist/deploy/dashboard-auth.d.ts +4 -23
- package/dist/deploy/dashboard-backups.integration.test.d.ts +1 -0
- package/dist/deploy/dashboard-configuration.integration.test.d.ts +1 -0
- package/dist/deploy/dashboard-control-plane.d.ts +37 -0
- package/dist/deploy/dashboard-control-plane.test.d.ts +1 -0
- package/dist/deploy/dashboard-data-services.integration.test.d.ts +1 -0
- package/dist/deploy/dashboard-environment-scope.test.d.ts +1 -0
- package/dist/deploy/dashboard-guard.d.ts +12 -0
- package/dist/deploy/dashboard-guard.test.d.ts +1 -0
- package/dist/deploy/dashboard-identities.d.ts +15 -0
- package/dist/deploy/dashboard-identities.test.d.ts +1 -0
- package/dist/deploy/dashboard-jobs.integration.test.d.ts +1 -0
- package/dist/deploy/dashboard-login-page.d.ts +5 -5
- package/dist/deploy/dashboard-login-page.test.d.ts +1 -0
- package/dist/deploy/dashboard-oidc.integration.test.d.ts +1 -0
- package/dist/deploy/dashboard-onboarding.integration.test.d.ts +1 -0
- package/dist/deploy/dashboard-policy.d.ts +4 -2
- package/dist/deploy/dashboard-queue-worker.integration.test.d.ts +1 -0
- package/dist/deploy/dashboard-release.integration.test.d.ts +1 -0
- package/dist/deploy/dashboard-route-manifest.d.ts +14 -0
- package/dist/deploy/dashboard-route-manifest.test.d.ts +1 -0
- package/dist/deploy/dashboard-security.integration.test.d.ts +1 -0
- package/dist/deploy/dashboard-session.d.ts +3 -14
- package/dist/deploy/dashboard-source.integration.test.d.ts +1 -0
- package/dist/deploy/dashboard-users.d.ts +3 -0
- package/dist/deploy/fullstack-container.d.ts +87 -0
- package/dist/deploy/fullstack-container.test.d.ts +1 -0
- package/dist/deploy/index.d.ts +7 -2
- package/dist/deploy/index.js +65 -25
- package/dist/deploy/local-dashboard-server.d.ts +30 -0
- package/dist/deploy/quick-deploy.d.ts +1 -1
- package/dist/deploy/serverless-operations.d.ts +1 -0
- package/dist/deploy/site-target.d.ts +16 -0
- package/dist/deploy/static-api-origin.d.ts +107 -0
- package/dist/deploy/static-api-origin.test.d.ts +1 -0
- package/dist/deploy/static-site-helper.d.ts +0 -16
- package/dist/deploy/telemetry-access.d.ts +5 -0
- package/dist/deploy/telemetry-access.test.d.ts +1 -0
- package/dist/deploy/telemetry-collection.d.ts +44 -0
- package/dist/deploy/telemetry-collection.test.d.ts +1 -0
- package/dist/dns/index.js +3 -3
- package/dist/dns/route53-adapter.d.ts +1 -1
- package/dist/drivers/hetzner/cloud-init.d.ts +1 -1
- package/dist/drivers/index.d.ts +2 -2
- package/dist/drivers/index.js +6 -6
- package/dist/drivers/shared/notifications.d.ts +1 -1
- package/dist/drivers/shared/rpx-gateway.d.ts +1 -0
- package/dist/fleet/fleet.test.d.ts +1 -0
- package/dist/fleet/index.d.ts +144 -0
- package/dist/fleet/queue.d.ts +3 -0
- package/dist/fleet/ssh-driver.d.ts +34 -0
- package/dist/index.d.ts +28 -4
- package/dist/index.js +1132 -424
- package/dist/jobs/adapters.d.ts +23 -0
- package/dist/jobs/index.d.ts +7 -0
- package/dist/jobs/jobs.test.d.ts +1 -0
- package/dist/jobs/model.d.ts +100 -0
- package/dist/jobs/provider-adapters.d.ts +49 -0
- package/dist/jobs/reconcile.d.ts +19 -0
- package/dist/jobs/schedule.d.ts +9 -0
- package/dist/jobs/service.d.ts +30 -0
- package/dist/jobs/store.d.ts +48 -0
- package/dist/maintenance/drivers.d.ts +117 -0
- package/dist/maintenance/index.d.ts +6 -0
- package/dist/maintenance/maintenance.test.d.ts +1 -0
- package/dist/maintenance/manifest.d.ts +15 -0
- package/dist/maintenance/queue.d.ts +9 -0
- package/dist/maintenance/service.d.ts +31 -0
- package/dist/maintenance/store.d.ts +84 -0
- package/dist/maintenance/types.d.ts +192 -0
- package/dist/media.d.ts +62 -0
- package/dist/media.test.d.ts +1 -0
- package/dist/object-storage/index.d.ts +0 -24
- package/dist/onboarding/archive.d.ts +12 -0
- package/dist/onboarding/artifact-store.d.ts +22 -0
- package/dist/onboarding/detection.d.ts +8 -0
- package/dist/onboarding/index.d.ts +9 -0
- package/dist/onboarding/migrations.d.ts +3 -0
- package/dist/onboarding/onboarding.test.d.ts +1 -0
- package/dist/onboarding/plan.d.ts +3 -0
- package/dist/onboarding/registry.d.ts +41 -0
- package/dist/onboarding/service.d.ts +16 -0
- package/dist/onboarding/store.d.ts +30 -0
- package/dist/onboarding/types.d.ts +204 -0
- package/dist/placement/builds.d.ts +20 -0
- package/dist/placement/drivers.d.ts +54 -0
- package/dist/placement/index.d.ts +6 -0
- package/dist/placement/placement.test.d.ts +1 -0
- package/dist/placement/queue.d.ts +4 -0
- package/dist/placement/service.d.ts +34 -0
- package/dist/placement/store.d.ts +49 -0
- package/dist/placement/types.d.ts +109 -0
- package/dist/preview/index.d.ts +3 -0
- package/dist/preview/service.d.ts +45 -0
- package/dist/preview/service.test.d.ts +1 -0
- package/dist/preview/store.d.ts +47 -0
- package/dist/preview/store.test.d.ts +1 -0
- package/dist/preview/types.d.ts +99 -0
- package/dist/push/apns.d.ts +0 -26
- package/dist/push/fcm.d.ts +0 -23
- package/dist/push/index.d.ts +2 -2
- package/dist/push/index.js +1 -1
- package/dist/queue/deployment-handlers.d.ts +27 -0
- package/dist/queue/deployment-handlers.test.d.ts +1 -0
- package/dist/queue/index.d.ts +4 -0
- package/dist/queue/queue.d.ts +57 -0
- package/dist/queue/queue.test.d.ts +1 -0
- package/dist/queue/types.d.ts +93 -0
- package/dist/queue/worker.d.ts +32 -0
- package/dist/queue/worker.test.d.ts +1 -0
- package/dist/regions/drivers.d.ts +139 -0
- package/dist/regions/index.d.ts +5 -0
- package/dist/regions/queue.d.ts +4 -0
- package/dist/regions/regions.test.d.ts +1 -0
- package/dist/regions/service.d.ts +23 -0
- package/dist/regions/store.d.ts +41 -0
- package/dist/regions/types.d.ts +132 -0
- package/dist/release/index.d.ts +6 -0
- package/dist/release/queue.d.ts +15 -0
- package/dist/release/queue.test.d.ts +1 -0
- package/dist/release/runtime.d.ts +35 -0
- package/dist/release/runtime.test.d.ts +1 -0
- package/dist/release/service.d.ts +28 -0
- package/dist/release/store.d.ts +88 -0
- package/dist/release/store.test.d.ts +1 -0
- package/dist/release/strategy.d.ts +8 -0
- package/dist/release/types.d.ts +103 -0
- package/dist/runtime/adapters/aws.d.ts +5 -0
- package/dist/runtime/adapters/docker.d.ts +53 -0
- package/dist/runtime/adapters/systemd.d.ts +26 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/inventory.d.ts +6 -0
- package/dist/runtime/model.d.ts +130 -0
- package/dist/runtime/normalize.d.ts +5 -0
- package/dist/runtime/operations.d.ts +113 -0
- package/dist/runtime/service.d.ts +32 -0
- package/dist/runtime/streams.d.ts +49 -0
- package/dist/security/artifacts.d.ts +105 -0
- package/dist/security/artifacts.test.d.ts +1 -0
- package/dist/security/container-release.d.ts +35 -0
- package/dist/security/container-release.test.d.ts +1 -0
- package/dist/security/index.d.ts +8 -0
- package/dist/security/integration.d.ts +41 -0
- package/dist/security/integration.test.d.ts +1 -0
- package/dist/security/posture-store.d.ts +80 -0
- package/dist/security/posture-store.test.d.ts +1 -0
- package/dist/security/pre-deploy-scanner.d.ts +0 -4
- package/dist/security/scanners.d.ts +81 -0
- package/dist/security/scanners.test.d.ts +1 -0
- package/dist/security/types.d.ts +150 -0
- package/dist/source/git-workspace.d.ts +26 -0
- package/dist/source/git-workspace.test.d.ts +1 -0
- package/dist/source/index.d.ts +6 -0
- package/dist/source/providers.d.ts +199 -0
- package/dist/source/providers.test.d.ts +1 -0
- package/dist/source/service.d.ts +18 -0
- package/dist/source/store.d.ts +149 -0
- package/dist/source/store.test.d.ts +1 -0
- package/dist/source/types.d.ts +191 -0
- package/dist/source/webhooks.d.ts +33 -0
- package/dist/source/webhooks.test.d.ts +1 -0
- package/dist/ssl/acme-client.d.ts +0 -6
- package/dist/storage/compose.d.ts +4 -0
- package/dist/storage/compose.test.d.ts +1 -0
- package/dist/storage/drivers.d.ts +107 -0
- package/dist/storage/drivers.test.d.ts +1 -0
- package/dist/storage/index.d.ts +5 -0
- package/dist/storage/model.d.ts +112 -0
- package/dist/storage/service.d.ts +95 -0
- package/dist/storage/storage.test.d.ts +1 -0
- package/dist/storage/store.d.ts +40 -0
- package/dist/telemetry/correlation.test.d.ts +1 -0
- package/dist/telemetry/index.d.ts +4 -0
- package/dist/telemetry/model.d.ts +145 -0
- package/dist/telemetry/policy.d.ts +8 -0
- package/dist/telemetry/policy.test.d.ts +1 -0
- package/dist/telemetry/redaction.d.ts +9 -0
- package/dist/telemetry/store.d.ts +34 -0
- package/dist/telemetry/store.test.d.ts +1 -0
- package/dist/ui/404.html +1506 -17
- package/dist/ui/accept-invitation.html +1163 -0
- package/dist/ui/{server/backups.html → access-denied.html} +344 -55
- package/dist/ui/account/automation.html +1669 -0
- package/dist/ui/account/security.html +1646 -0
- package/dist/ui/applications/compose.html +1590 -0
- package/dist/ui/applications/new.html +1868 -0
- package/dist/ui/data/backups.html +1757 -0
- package/dist/ui/data/services.html +1723 -0
- package/dist/ui/data/volumes.html +1639 -0
- package/dist/ui/index.html +392 -29
- package/dist/ui/integrations.html +1865 -0
- package/dist/ui/operations/alerts.html +1610 -0
- package/dist/ui/operations/configuration.html +1746 -0
- package/dist/ui/operations/jobs.html +1709 -0
- package/dist/ui/operations/maintenance.html +1540 -0
- package/dist/ui/operations/observability.html +1742 -0
- package/dist/ui/{serverless/scheduler.html → operations/previews.html} +447 -46
- package/dist/ui/operations/queue.html +1615 -0
- package/dist/ui/{server/workers.html → operations/regions.html} +413 -49
- package/dist/ui/operations/releases.html +1596 -0
- package/dist/ui/operations/workloads.html +1775 -0
- package/dist/ui/security.html +1767 -0
- package/dist/ui/server/actions.html +446 -57
- package/dist/ui/server/activity.html +346 -1
- package/dist/ui/server/capacity.html +1542 -0
- package/dist/ui/server/database.html +443 -36
- package/dist/ui/server/deployments.html +439 -53
- package/dist/ui/server/diagnostics.html +346 -1
- package/dist/ui/server/firewall.html +476 -50
- package/dist/ui/server/fleet.html +1577 -0
- package/dist/ui/server/logs.html +389 -25
- package/dist/ui/server/metrics.html +346 -1
- package/dist/ui/server/security.html +346 -1
- package/dist/ui/server/services.html +421 -46
- package/dist/ui/server/sites.html +476 -95
- package/dist/ui/server/ssh-keys.html +476 -46
- package/dist/ui/server/team.html +700 -77
- package/dist/ui/server/terminal.html +444 -54
- package/dist/ui/serverless/alarms.html +430 -42
- package/dist/ui/serverless/assets.html +421 -46
- package/dist/ui/serverless/cost.html +346 -1
- package/dist/ui/serverless/data.html +422 -47
- package/dist/ui/serverless/deployments.html +421 -46
- package/dist/ui/serverless/firewall.html +346 -1
- package/dist/ui/serverless/functions.html +423 -48
- package/dist/ui/serverless/logs.html +389 -25
- package/dist/ui/serverless/metrics.html +346 -1
- package/dist/ui/serverless/queues.html +448 -62
- package/dist/ui/serverless/secrets.html +448 -42
- package/dist/ui/serverless/traces.html +350 -5
- package/dist/ui/serverless.html +434 -58
- package/dist/ui-src/pages/404.stx +18 -0
- package/dist/ui-src/pages/accept-invitation.stx +50 -0
- package/dist/ui-src/pages/access-denied.stx +18 -0
- package/dist/ui-src/pages/account/automation.stx +187 -0
- package/dist/ui-src/pages/account/security.stx +249 -0
- package/dist/ui-src/pages/applications/compose.stx +38 -0
- package/dist/ui-src/pages/applications/new.stx +76 -0
- package/dist/ui-src/pages/data/backups.stx +214 -0
- package/dist/ui-src/pages/data/services.stx +257 -0
- package/dist/ui-src/pages/data/volumes.stx +40 -0
- package/dist/ui-src/pages/index.stx +24 -10
- package/dist/ui-src/pages/integrations.stx +186 -0
- package/dist/ui-src/pages/operations/alerts.stx +40 -0
- package/dist/ui-src/pages/operations/configuration.stx +164 -0
- package/dist/ui-src/pages/operations/jobs.stx +238 -0
- package/dist/ui-src/pages/operations/maintenance.stx +15 -0
- package/dist/ui-src/pages/operations/observability.stx +76 -0
- package/dist/ui-src/pages/operations/previews.stx +62 -0
- package/dist/ui-src/pages/operations/queue.stx +158 -0
- package/dist/ui-src/pages/operations/regions.stx +12 -0
- package/dist/ui-src/pages/operations/releases.stx +39 -0
- package/dist/ui-src/pages/operations/workloads.stx +151 -0
- package/dist/ui-src/pages/partials/head.stx +148 -15
- package/dist/ui-src/pages/partials/nav.stx +491 -74
- package/dist/ui-src/pages/partials/op-confirm.stx +6 -6
- package/dist/ui-src/pages/security.stx +264 -0
- package/dist/ui-src/pages/server/actions.stx +17 -26
- package/dist/ui-src/pages/server/capacity.stx +16 -0
- package/dist/ui-src/pages/server/database.stx +31 -16
- package/dist/ui-src/pages/server/deployments.stx +28 -30
- package/dist/ui-src/pages/server/firewall.stx +25 -30
- package/dist/ui-src/pages/server/fleet.stx +10 -0
- package/dist/ui-src/pages/server/logs.stx +11 -9
- package/dist/ui-src/pages/server/metrics.stx +8 -16
- package/dist/ui-src/pages/server/services.stx +19 -28
- package/dist/ui-src/pages/server/sites.stx +75 -72
- package/dist/ui-src/pages/server/ssh-keys.stx +24 -30
- package/dist/ui-src/pages/server/team.stx +286 -149
- package/dist/ui-src/pages/server/terminal.stx +6 -28
- package/dist/ui-src/pages/serverless/alarms.stx +17 -31
- package/dist/ui-src/pages/serverless/assets.stx +13 -22
- package/dist/ui-src/pages/serverless/cost.stx +15 -3
- package/dist/ui-src/pages/serverless/data.stx +12 -25
- package/dist/ui-src/pages/serverless/deployments.stx +14 -23
- package/dist/ui-src/pages/serverless/firewall.stx +5 -1
- package/dist/ui-src/pages/serverless/functions.stx +20 -26
- package/dist/ui-src/pages/serverless/logs.stx +11 -10
- package/dist/ui-src/pages/serverless/metrics.stx +18 -17
- package/dist/ui-src/pages/serverless/queues.stx +34 -42
- package/dist/ui-src/pages/serverless/secrets.stx +31 -34
- package/dist/ui-src/pages/serverless/traces.stx +2 -6
- package/dist/ui-src/pages/serverless.stx +40 -74
- package/package.json +11 -11
- package/dist/chunk-b17vf1g1.js +0 -13787
- package/dist/chunk-b82pbxyp.js +0 -1572
- package/dist/chunk-pqfzdg68.js +0 -12
- package/dist/chunk-z58fqnjm.js +0 -10
- package/dist/ui-src/pages/server/backups.stx +0 -91
- package/dist/ui-src/pages/server/workers.stx +0 -99
- package/dist/ui-src/pages/serverless/scheduler.stx +0 -89
|
@@ -1,15 +1,53 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SESClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-hpv68b4a.js";
|
|
4
4
|
import {
|
|
5
|
-
S3Client
|
|
6
|
-
|
|
5
|
+
S3Client,
|
|
6
|
+
resolveCredentials
|
|
7
|
+
} from "./chunk-wj3s95p9.js";
|
|
7
8
|
import {
|
|
8
9
|
AWSClient
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-zqtpg06c.js";
|
|
10
11
|
import {
|
|
11
12
|
__require
|
|
12
13
|
} from "./chunk-v0bahtg2.js";
|
|
14
|
+
// src/aws/backup.ts
|
|
15
|
+
class AwsBackupClient {
|
|
16
|
+
region;
|
|
17
|
+
client;
|
|
18
|
+
constructor(region = "us-east-1", client = new AWSClient) {
|
|
19
|
+
this.region = region;
|
|
20
|
+
this.client = client;
|
|
21
|
+
}
|
|
22
|
+
request(action, input) {
|
|
23
|
+
return this.client.request({
|
|
24
|
+
service: "backup",
|
|
25
|
+
region: this.region,
|
|
26
|
+
method: "POST",
|
|
27
|
+
path: "/",
|
|
28
|
+
headers: {
|
|
29
|
+
"Content-Type": "application/x-amz-json-1.1",
|
|
30
|
+
"X-Amz-Target": `CryoControllerFrontendService.${action}`
|
|
31
|
+
},
|
|
32
|
+
body: JSON.stringify(input)
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
startBackupJob(input) {
|
|
36
|
+
return this.request("StartBackupJob", input);
|
|
37
|
+
}
|
|
38
|
+
describeBackupJob(BackupJobId) {
|
|
39
|
+
return this.request("DescribeBackupJob", { BackupJobId });
|
|
40
|
+
}
|
|
41
|
+
startRestoreJob(input) {
|
|
42
|
+
return this.request("StartRestoreJob", input);
|
|
43
|
+
}
|
|
44
|
+
describeRestoreJob(RestoreJobId) {
|
|
45
|
+
return this.request("DescribeRestoreJob", { RestoreJobId });
|
|
46
|
+
}
|
|
47
|
+
deleteRecoveryPoint(BackupVaultName, RecoveryPointArn) {
|
|
48
|
+
return this.request("DeleteRecoveryPoint", { BackupVaultName, RecoveryPointArn });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
13
51
|
// src/object-storage/migrate.ts
|
|
14
52
|
function stripPrefix(key, prefix) {
|
|
15
53
|
if (!prefix)
|
|
@@ -107,7 +145,14 @@ async function migrateObjectStorage(options) {
|
|
|
107
145
|
const head = await toClient.headObject(options.to.bucket, destKey);
|
|
108
146
|
if (head && head.ContentLength === source.Size) {
|
|
109
147
|
result.skipped++;
|
|
110
|
-
options.onProgress?.({
|
|
148
|
+
options.onProgress?.({
|
|
149
|
+
key: source.Key,
|
|
150
|
+
destKey,
|
|
151
|
+
size: source.Size,
|
|
152
|
+
action: "skipped",
|
|
153
|
+
index: myIndex,
|
|
154
|
+
total
|
|
155
|
+
});
|
|
111
156
|
return;
|
|
112
157
|
}
|
|
113
158
|
}
|
|
@@ -192,7 +237,7 @@ function env(...names) {
|
|
|
192
237
|
}
|
|
193
238
|
return;
|
|
194
239
|
}
|
|
195
|
-
function
|
|
240
|
+
function resolveCredentials2(provider, explicit) {
|
|
196
241
|
if (explicit?.accessKeyId && explicit.secretAccessKey)
|
|
197
242
|
return explicit;
|
|
198
243
|
let accessKeyId;
|
|
@@ -217,7 +262,7 @@ function resolveObjectStorage(config = {}) {
|
|
|
217
262
|
const region = config.region || (provider === "backblaze" ? env("B2_REGION") : undefined) || (provider === "hetzner" ? env("HETZNER_S3_REGION", "HETZNER_REGION") : undefined) || env("S3_REGION", "AWS_REGION", "AWS_DEFAULT_REGION") || DEFAULT_REGION[provider];
|
|
218
263
|
const endpoint = config.endpoint || env("S3_ENDPOINT") || providerEndpoint(provider, region);
|
|
219
264
|
const forcePathStyle = config.forcePathStyle ?? env("S3_FORCE_PATH_STYLE") === "true";
|
|
220
|
-
const credentials =
|
|
265
|
+
const credentials = resolveCredentials2(provider, config.credentials);
|
|
221
266
|
const publicBaseUrl = (bucket) => {
|
|
222
267
|
const base = endpoint || `s3.${region}.amazonaws.com`;
|
|
223
268
|
return forcePathStyle ? `https://${base}/${bucket}` : `https://${bucket}.${base}`;
|
|
@@ -241,6 +286,163 @@ function createObjectStorageClient(config = {}) {
|
|
|
241
286
|
};
|
|
242
287
|
return new S3Client(resolved.region, resolved.profile, options);
|
|
243
288
|
}
|
|
289
|
+
// src/aws/cost-explorer-cache.ts
|
|
290
|
+
import { createHash } from "node:crypto";
|
|
291
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
292
|
+
import { homedir } from "node:os";
|
|
293
|
+
import { join } from "node:path";
|
|
294
|
+
var CACHE_SCHEMA_VERSION = 1;
|
|
295
|
+
var HOUR_MS = 60 * 60 * 1000;
|
|
296
|
+
var DAY_MS = 24 * HOUR_MS;
|
|
297
|
+
var OPEN_PERIOD_TTL_MS = HOUR_MS;
|
|
298
|
+
var CLOSED_PERIOD_TTL_MS = 30 * DAY_MS;
|
|
299
|
+
function cacheRoot() {
|
|
300
|
+
const xdg = process.env.XDG_CACHE_HOME;
|
|
301
|
+
return join(xdg && xdg.trim() ? xdg : join(homedir(), ".cache"), "ts-cloud", "cost-explorer");
|
|
302
|
+
}
|
|
303
|
+
function profileDir(profile) {
|
|
304
|
+
return join(cacheRoot(), profile ?? "__default__");
|
|
305
|
+
}
|
|
306
|
+
function hashKey(key) {
|
|
307
|
+
const canonical = {
|
|
308
|
+
s: key.start,
|
|
309
|
+
e: key.end,
|
|
310
|
+
g: key.granularity,
|
|
311
|
+
m: [...key.metrics].sort(),
|
|
312
|
+
gb: [...key.groupBy].map((g) => `${g.Type}:${g.Key}`).sort(),
|
|
313
|
+
f: key.filter ?? null
|
|
314
|
+
};
|
|
315
|
+
return createHash("sha256").update(JSON.stringify(canonical)).digest("hex").slice(0, 24);
|
|
316
|
+
}
|
|
317
|
+
function isClosedPeriod(start, end) {
|
|
318
|
+
const endTs = Date.parse(`${end}T00:00:00Z`);
|
|
319
|
+
if (Number.isNaN(endTs))
|
|
320
|
+
return false;
|
|
321
|
+
const now = new Date;
|
|
322
|
+
const firstOfThisMonth = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1);
|
|
323
|
+
return endTs <= firstOfThisMonth;
|
|
324
|
+
}
|
|
325
|
+
function ttlForPeriod(key) {
|
|
326
|
+
return isClosedPeriod(key.start, key.end) ? CLOSED_PERIOD_TTL_MS : OPEN_PERIOD_TTL_MS;
|
|
327
|
+
}
|
|
328
|
+
function loadCache(profile, key) {
|
|
329
|
+
const file = join(profileDir(profile), `${hashKey(key)}.json`);
|
|
330
|
+
if (!existsSync(file))
|
|
331
|
+
return null;
|
|
332
|
+
let entry;
|
|
333
|
+
try {
|
|
334
|
+
entry = JSON.parse(readFileSync(file, "utf-8"));
|
|
335
|
+
} catch {
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
if (entry.schema !== CACHE_SCHEMA_VERSION)
|
|
339
|
+
return null;
|
|
340
|
+
const ageMs = Date.now() - entry.savedAt;
|
|
341
|
+
if (ageMs < 0 || ageMs > ttlForPeriod(key))
|
|
342
|
+
return null;
|
|
343
|
+
return { response: entry.response, ageSeconds: Math.floor(ageMs / 1000) };
|
|
344
|
+
}
|
|
345
|
+
function saveCache(profile, key, response) {
|
|
346
|
+
const dir = profileDir(profile);
|
|
347
|
+
mkdirSync(dir, { recursive: true });
|
|
348
|
+
const entry = {
|
|
349
|
+
schema: CACHE_SCHEMA_VERSION,
|
|
350
|
+
savedAt: Date.now(),
|
|
351
|
+
key,
|
|
352
|
+
response
|
|
353
|
+
};
|
|
354
|
+
writeFileSync(join(dir, `${hashKey(key)}.json`), JSON.stringify(entry));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// src/aws/cost-explorer.ts
|
|
358
|
+
class CostExplorerClient {
|
|
359
|
+
client;
|
|
360
|
+
profile;
|
|
361
|
+
useCache;
|
|
362
|
+
lastCacheAgeSeconds = null;
|
|
363
|
+
constructor(profile, options) {
|
|
364
|
+
this.profile = profile;
|
|
365
|
+
this.useCache = options?.useCache ?? true;
|
|
366
|
+
this.client = new AWSClient(resolveCredentials(profile));
|
|
367
|
+
}
|
|
368
|
+
async getCostByService(params) {
|
|
369
|
+
const costs = await this.getCostByDimension({ ...params, dimension: "SERVICE" });
|
|
370
|
+
return costs.map((cost) => ({ service: cost.key, amount: cost.amount, unit: cost.unit }));
|
|
371
|
+
}
|
|
372
|
+
async getCostByDimension(params) {
|
|
373
|
+
const { start, end, dimension, granularity = "MONTHLY", filter } = params;
|
|
374
|
+
const metrics = ["UnblendedCost"];
|
|
375
|
+
const groupBy = [{ Type: "DIMENSION", Key: dimension }];
|
|
376
|
+
const cacheKey = { start, end, granularity, metrics, groupBy, filter };
|
|
377
|
+
if (this.useCache) {
|
|
378
|
+
const hit = loadCache(this.profile, cacheKey);
|
|
379
|
+
if (hit) {
|
|
380
|
+
this.lastCacheAgeSeconds = hit.ageSeconds;
|
|
381
|
+
return hit.response;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
this.lastCacheAgeSeconds = null;
|
|
385
|
+
const totals = new Map;
|
|
386
|
+
let nextPageToken;
|
|
387
|
+
do {
|
|
388
|
+
const body = {
|
|
389
|
+
TimePeriod: { Start: start, End: end },
|
|
390
|
+
Granularity: granularity,
|
|
391
|
+
Metrics: metrics,
|
|
392
|
+
GroupBy: groupBy
|
|
393
|
+
};
|
|
394
|
+
if (filter)
|
|
395
|
+
body.Filter = filter;
|
|
396
|
+
if (nextPageToken)
|
|
397
|
+
body.NextPageToken = nextPageToken;
|
|
398
|
+
const result = await this.client.request({
|
|
399
|
+
service: "ce",
|
|
400
|
+
region: "us-east-1",
|
|
401
|
+
method: "POST",
|
|
402
|
+
path: "/",
|
|
403
|
+
headers: {
|
|
404
|
+
"content-type": "application/x-amz-json-1.1",
|
|
405
|
+
"x-amz-target": "AWSInsightsIndexService.GetCostAndUsage"
|
|
406
|
+
},
|
|
407
|
+
body: JSON.stringify(body)
|
|
408
|
+
});
|
|
409
|
+
for (const period of result?.ResultsByTime ?? []) {
|
|
410
|
+
for (const group of period?.Groups ?? []) {
|
|
411
|
+
const key = group.Keys?.[0] ?? "Unknown";
|
|
412
|
+
const amount = Number.parseFloat(group.Metrics?.UnblendedCost?.Amount ?? "0");
|
|
413
|
+
const unit = group.Metrics?.UnblendedCost?.Unit ?? "USD";
|
|
414
|
+
const current = totals.get(key);
|
|
415
|
+
totals.set(key, { key, amount: (current?.amount ?? 0) + amount, unit });
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
nextPageToken = result?.NextPageToken || undefined;
|
|
419
|
+
} while (nextPageToken);
|
|
420
|
+
const costs = [...totals.values()].filter((cost) => cost.amount > 0).sort((a, b) => b.amount - a.amount);
|
|
421
|
+
if (this.useCache) {
|
|
422
|
+
saveCache(this.profile, cacheKey, costs);
|
|
423
|
+
}
|
|
424
|
+
return costs;
|
|
425
|
+
}
|
|
426
|
+
async getDailyTotals(params) {
|
|
427
|
+
const result = await this.client.request({
|
|
428
|
+
service: "ce",
|
|
429
|
+
region: "us-east-1",
|
|
430
|
+
method: "POST",
|
|
431
|
+
path: "/",
|
|
432
|
+
headers: {
|
|
433
|
+
"content-type": "application/x-amz-json-1.1",
|
|
434
|
+
"x-amz-target": "AWSInsightsIndexService.GetCostAndUsage"
|
|
435
|
+
},
|
|
436
|
+
body: JSON.stringify({
|
|
437
|
+
TimePeriod: { Start: params.start, End: params.end },
|
|
438
|
+
Granularity: "DAILY",
|
|
439
|
+
Metrics: ["UnblendedCost"]
|
|
440
|
+
})
|
|
441
|
+
});
|
|
442
|
+
const byTime = result?.ResultsByTime ?? [];
|
|
443
|
+
return byTime.map((t) => Number.parseFloat(t.Total?.UnblendedCost?.Amount ?? "0"));
|
|
444
|
+
}
|
|
445
|
+
}
|
|
244
446
|
// src/aws/route53-domains.ts
|
|
245
447
|
class Route53DomainsClient {
|
|
246
448
|
client;
|
|
@@ -450,7 +652,7 @@ class ECSClient {
|
|
|
450
652
|
region;
|
|
451
653
|
constructor(region = "us-east-1", profile) {
|
|
452
654
|
this.region = region;
|
|
453
|
-
this.client = new AWSClient;
|
|
655
|
+
this.client = new AWSClient(undefined, { profile });
|
|
454
656
|
}
|
|
455
657
|
async describeServices(options) {
|
|
456
658
|
const params = {
|
|
@@ -470,9 +672,10 @@ class ECSClient {
|
|
|
470
672
|
});
|
|
471
673
|
return result;
|
|
472
674
|
}
|
|
473
|
-
async listServices(cluster) {
|
|
675
|
+
async listServices(cluster, options = {}) {
|
|
474
676
|
const params = {
|
|
475
|
-
cluster
|
|
677
|
+
cluster,
|
|
678
|
+
...options
|
|
476
679
|
};
|
|
477
680
|
const result = await this.client.request({
|
|
478
681
|
service: "ecs",
|
|
@@ -487,9 +690,10 @@ class ECSClient {
|
|
|
487
690
|
});
|
|
488
691
|
return result;
|
|
489
692
|
}
|
|
490
|
-
async listTasks(cluster, serviceName) {
|
|
693
|
+
async listTasks(cluster, serviceName, options = {}) {
|
|
491
694
|
const params = {
|
|
492
|
-
cluster
|
|
695
|
+
cluster,
|
|
696
|
+
...options
|
|
493
697
|
};
|
|
494
698
|
if (serviceName) {
|
|
495
699
|
params.serviceName = serviceName;
|
|
@@ -608,7 +812,7 @@ class ECSClient {
|
|
|
608
812
|
});
|
|
609
813
|
return result;
|
|
610
814
|
}
|
|
611
|
-
async listClusters() {
|
|
815
|
+
async listClusters(options = {}) {
|
|
612
816
|
const result = await this.client.request({
|
|
613
817
|
service: "ecs",
|
|
614
818
|
region: this.region,
|
|
@@ -618,7 +822,7 @@ class ECSClient {
|
|
|
618
822
|
"X-Amz-Target": "AmazonEC2ContainerServiceV20141113.ListClusters",
|
|
619
823
|
"Content-Type": "application/x-amz-json-1.1"
|
|
620
824
|
},
|
|
621
|
-
body: JSON.stringify(
|
|
825
|
+
body: JSON.stringify(options)
|
|
622
826
|
});
|
|
623
827
|
return result;
|
|
624
828
|
}
|
|
@@ -792,7 +996,7 @@ class STSClient {
|
|
|
792
996
|
region;
|
|
793
997
|
constructor(region = "us-east-1", profile) {
|
|
794
998
|
this.region = region;
|
|
795
|
-
this.client = new AWSClient;
|
|
999
|
+
this.client = new AWSClient(undefined, { profile });
|
|
796
1000
|
}
|
|
797
1001
|
async getCallerIdentity() {
|
|
798
1002
|
const result = await this.client.request({
|
|
@@ -837,330 +1041,522 @@ class STSClient {
|
|
|
837
1041
|
};
|
|
838
1042
|
}
|
|
839
1043
|
}
|
|
840
|
-
// src/aws/
|
|
841
|
-
class
|
|
1044
|
+
// src/aws/secrets-manager.ts
|
|
1045
|
+
class SecretsManagerClient {
|
|
842
1046
|
client;
|
|
843
1047
|
region;
|
|
844
|
-
constructor(region = "us-east-1") {
|
|
1048
|
+
constructor(region = "us-east-1", profile) {
|
|
845
1049
|
this.region = region;
|
|
846
1050
|
this.client = new AWSClient;
|
|
847
1051
|
}
|
|
848
|
-
|
|
849
|
-
const
|
|
850
|
-
|
|
851
|
-
}
|
|
852
|
-
async createTopic(params) {
|
|
853
|
-
const formParams = {
|
|
854
|
-
Action: "CreateTopic",
|
|
855
|
-
Version: "2010-03-31",
|
|
856
|
-
Name: params.Name
|
|
1052
|
+
async createSecret(options) {
|
|
1053
|
+
const params = {
|
|
1054
|
+
Name: options.Name
|
|
857
1055
|
};
|
|
858
|
-
if (
|
|
859
|
-
|
|
860
|
-
formParams["Attributes.entry.1.value"] = params.DisplayName;
|
|
1056
|
+
if (options.Description) {
|
|
1057
|
+
params.Description = options.Description;
|
|
861
1058
|
}
|
|
862
|
-
if (
|
|
863
|
-
params.
|
|
864
|
-
formParams[`Tags.member.${index + 1}.Key`] = tag.Key;
|
|
865
|
-
formParams[`Tags.member.${index + 1}.Value`] = tag.Value;
|
|
866
|
-
});
|
|
1059
|
+
if (options.KmsKeyId) {
|
|
1060
|
+
params.KmsKeyId = options.KmsKeyId;
|
|
867
1061
|
}
|
|
868
|
-
if (
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
1062
|
+
if (options.SecretBinary) {
|
|
1063
|
+
params.SecretBinary = options.SecretBinary;
|
|
1064
|
+
}
|
|
1065
|
+
if (options.SecretString) {
|
|
1066
|
+
params.SecretString = options.SecretString;
|
|
1067
|
+
}
|
|
1068
|
+
if (options.Tags && options.Tags.length > 0) {
|
|
1069
|
+
params.Tags = options.Tags;
|
|
875
1070
|
}
|
|
1071
|
+
if (options.AddReplicaRegions && options.AddReplicaRegions.length > 0) {
|
|
1072
|
+
params.AddReplicaRegions = options.AddReplicaRegions;
|
|
1073
|
+
}
|
|
1074
|
+
if (options.ForceOverwriteReplicaSecret !== undefined) {
|
|
1075
|
+
params.ForceOverwriteReplicaSecret = options.ForceOverwriteReplicaSecret;
|
|
1076
|
+
}
|
|
1077
|
+
params.ClientRequestToken = options.ClientRequestToken || crypto.randomUUID();
|
|
876
1078
|
const result = await this.client.request({
|
|
877
|
-
service: "
|
|
1079
|
+
service: "secretsmanager",
|
|
878
1080
|
region: this.region,
|
|
879
1081
|
method: "POST",
|
|
880
1082
|
path: "/",
|
|
881
1083
|
headers: {
|
|
882
|
-
"
|
|
1084
|
+
"X-Amz-Target": "secretsmanager.CreateSecret",
|
|
1085
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
883
1086
|
},
|
|
884
|
-
body:
|
|
1087
|
+
body: JSON.stringify(params)
|
|
885
1088
|
});
|
|
886
1089
|
return {
|
|
887
|
-
|
|
1090
|
+
ARN: result.ARN,
|
|
1091
|
+
Name: result.Name,
|
|
1092
|
+
VersionId: result.VersionId,
|
|
1093
|
+
ReplicationStatus: result.ReplicationStatus
|
|
888
1094
|
};
|
|
889
1095
|
}
|
|
890
|
-
async
|
|
891
|
-
|
|
892
|
-
|
|
1096
|
+
async updateSecret(options) {
|
|
1097
|
+
const params = {
|
|
1098
|
+
SecretId: options.SecretId
|
|
1099
|
+
};
|
|
1100
|
+
if (options.Description) {
|
|
1101
|
+
params.Description = options.Description;
|
|
1102
|
+
}
|
|
1103
|
+
if (options.KmsKeyId) {
|
|
1104
|
+
params.KmsKeyId = options.KmsKeyId;
|
|
1105
|
+
}
|
|
1106
|
+
if (options.SecretBinary) {
|
|
1107
|
+
params.SecretBinary = options.SecretBinary;
|
|
1108
|
+
}
|
|
1109
|
+
if (options.SecretString) {
|
|
1110
|
+
params.SecretString = options.SecretString;
|
|
1111
|
+
}
|
|
1112
|
+
const result = await this.client.request({
|
|
1113
|
+
service: "secretsmanager",
|
|
893
1114
|
region: this.region,
|
|
894
1115
|
method: "POST",
|
|
895
1116
|
path: "/",
|
|
896
1117
|
headers: {
|
|
897
|
-
"
|
|
1118
|
+
"X-Amz-Target": "secretsmanager.UpdateSecret",
|
|
1119
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
898
1120
|
},
|
|
899
|
-
body:
|
|
900
|
-
Action: "DeleteTopic",
|
|
901
|
-
Version: "2010-03-31",
|
|
902
|
-
TopicArn: topicArn
|
|
903
|
-
})
|
|
1121
|
+
body: JSON.stringify(params)
|
|
904
1122
|
});
|
|
1123
|
+
return {
|
|
1124
|
+
ARN: result.ARN,
|
|
1125
|
+
Name: result.Name,
|
|
1126
|
+
VersionId: result.VersionId
|
|
1127
|
+
};
|
|
905
1128
|
}
|
|
906
|
-
async
|
|
907
|
-
const
|
|
908
|
-
|
|
909
|
-
Version: "2010-03-31"
|
|
1129
|
+
async putSecretValue(options) {
|
|
1130
|
+
const params = {
|
|
1131
|
+
SecretId: options.SecretId
|
|
910
1132
|
};
|
|
911
|
-
if (
|
|
912
|
-
|
|
1133
|
+
if (options.SecretBinary) {
|
|
1134
|
+
params.SecretBinary = options.SecretBinary;
|
|
1135
|
+
}
|
|
1136
|
+
if (options.SecretString) {
|
|
1137
|
+
params.SecretString = options.SecretString;
|
|
1138
|
+
}
|
|
1139
|
+
if (options.VersionStages && options.VersionStages.length > 0) {
|
|
1140
|
+
params.VersionStages = options.VersionStages;
|
|
1141
|
+
}
|
|
1142
|
+
if (options.ClientRequestToken) {
|
|
1143
|
+
params.ClientRequestToken = options.ClientRequestToken;
|
|
913
1144
|
}
|
|
914
1145
|
const result = await this.client.request({
|
|
915
|
-
service: "
|
|
1146
|
+
service: "secretsmanager",
|
|
916
1147
|
region: this.region,
|
|
917
1148
|
method: "POST",
|
|
918
1149
|
path: "/",
|
|
919
1150
|
headers: {
|
|
920
|
-
"
|
|
1151
|
+
"X-Amz-Target": "secretsmanager.PutSecretValue",
|
|
1152
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
921
1153
|
},
|
|
922
|
-
body:
|
|
1154
|
+
body: JSON.stringify(params)
|
|
923
1155
|
});
|
|
924
|
-
const listResult = result?.ListTopicsResponse?.ListTopicsResult || result?.ListTopicsResult;
|
|
925
|
-
const topics = listResult?.Topics?.member;
|
|
926
1156
|
return {
|
|
927
|
-
|
|
928
|
-
|
|
1157
|
+
ARN: result.ARN,
|
|
1158
|
+
Name: result.Name,
|
|
1159
|
+
VersionId: result.VersionId,
|
|
1160
|
+
VersionStages: result.VersionStages
|
|
929
1161
|
};
|
|
930
1162
|
}
|
|
931
|
-
async
|
|
1163
|
+
async getSecretValue(options) {
|
|
1164
|
+
const params = {
|
|
1165
|
+
SecretId: options.SecretId
|
|
1166
|
+
};
|
|
1167
|
+
if (options.VersionId) {
|
|
1168
|
+
params.VersionId = options.VersionId;
|
|
1169
|
+
}
|
|
1170
|
+
if (options.VersionStage) {
|
|
1171
|
+
params.VersionStage = options.VersionStage;
|
|
1172
|
+
}
|
|
932
1173
|
const result = await this.client.request({
|
|
933
|
-
service: "
|
|
1174
|
+
service: "secretsmanager",
|
|
934
1175
|
region: this.region,
|
|
935
1176
|
method: "POST",
|
|
936
1177
|
path: "/",
|
|
937
1178
|
headers: {
|
|
938
|
-
"
|
|
1179
|
+
"X-Amz-Target": "secretsmanager.GetSecretValue",
|
|
1180
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
939
1181
|
},
|
|
940
|
-
body:
|
|
941
|
-
Action: "GetTopicAttributes",
|
|
942
|
-
Version: "2010-03-31",
|
|
943
|
-
TopicArn: topicArn
|
|
944
|
-
})
|
|
1182
|
+
body: JSON.stringify(params)
|
|
945
1183
|
});
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1184
|
+
return {
|
|
1185
|
+
ARN: result.ARN,
|
|
1186
|
+
Name: result.Name,
|
|
1187
|
+
VersionId: result.VersionId,
|
|
1188
|
+
SecretBinary: result.SecretBinary,
|
|
1189
|
+
SecretString: result.SecretString,
|
|
1190
|
+
VersionStages: result.VersionStages,
|
|
1191
|
+
CreatedDate: result.CreatedDate
|
|
1192
|
+
};
|
|
954
1193
|
}
|
|
955
|
-
async
|
|
956
|
-
|
|
957
|
-
|
|
1194
|
+
async describeSecret(secretId) {
|
|
1195
|
+
const params = {
|
|
1196
|
+
SecretId: secretId
|
|
1197
|
+
};
|
|
1198
|
+
const result = await this.client.request({
|
|
1199
|
+
service: "secretsmanager",
|
|
958
1200
|
region: this.region,
|
|
959
1201
|
method: "POST",
|
|
960
1202
|
path: "/",
|
|
961
1203
|
headers: {
|
|
962
|
-
"
|
|
1204
|
+
"X-Amz-Target": "secretsmanager.DescribeSecret",
|
|
1205
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
963
1206
|
},
|
|
964
|
-
body:
|
|
965
|
-
Action: "SetTopicAttributes",
|
|
966
|
-
Version: "2010-03-31",
|
|
967
|
-
TopicArn: params.TopicArn,
|
|
968
|
-
AttributeName: params.AttributeName,
|
|
969
|
-
AttributeValue: params.AttributeValue
|
|
970
|
-
})
|
|
1207
|
+
body: JSON.stringify(params)
|
|
971
1208
|
});
|
|
1209
|
+
return this.parseSecret(result);
|
|
972
1210
|
}
|
|
973
|
-
async
|
|
974
|
-
const
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
TopicArn: params.TopicArn,
|
|
978
|
-
Protocol: params.Protocol,
|
|
979
|
-
Endpoint: params.Endpoint
|
|
980
|
-
};
|
|
981
|
-
if (params.ReturnSubscriptionArn) {
|
|
982
|
-
formParams.ReturnSubscriptionArn = "true";
|
|
1211
|
+
async listSecrets(options) {
|
|
1212
|
+
const params = {};
|
|
1213
|
+
if (options?.MaxResults) {
|
|
1214
|
+
params.MaxResults = options.MaxResults;
|
|
983
1215
|
}
|
|
984
|
-
if (
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1216
|
+
if (options?.NextToken) {
|
|
1217
|
+
params.NextToken = options.NextToken;
|
|
1218
|
+
}
|
|
1219
|
+
if (options?.Filters && options.Filters.length > 0) {
|
|
1220
|
+
params.Filters = options.Filters;
|
|
1221
|
+
}
|
|
1222
|
+
if (options?.SortOrder) {
|
|
1223
|
+
params.SortOrder = options.SortOrder;
|
|
991
1224
|
}
|
|
992
1225
|
const result = await this.client.request({
|
|
993
|
-
service: "
|
|
1226
|
+
service: "secretsmanager",
|
|
994
1227
|
region: this.region,
|
|
995
1228
|
method: "POST",
|
|
996
1229
|
path: "/",
|
|
997
1230
|
headers: {
|
|
998
|
-
"
|
|
1231
|
+
"X-Amz-Target": "secretsmanager.ListSecrets",
|
|
1232
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
999
1233
|
},
|
|
1000
|
-
body:
|
|
1234
|
+
body: JSON.stringify(params)
|
|
1001
1235
|
});
|
|
1002
1236
|
return {
|
|
1003
|
-
|
|
1237
|
+
SecretList: result.SecretList?.map((s) => this.parseSecret(s)),
|
|
1238
|
+
NextToken: result.NextToken
|
|
1004
1239
|
};
|
|
1005
1240
|
}
|
|
1006
|
-
async
|
|
1007
|
-
|
|
1008
|
-
|
|
1241
|
+
async deleteSecret(options) {
|
|
1242
|
+
const params = {
|
|
1243
|
+
SecretId: options.SecretId
|
|
1244
|
+
};
|
|
1245
|
+
if (options.RecoveryWindowInDays !== undefined) {
|
|
1246
|
+
params.RecoveryWindowInDays = options.RecoveryWindowInDays;
|
|
1247
|
+
}
|
|
1248
|
+
if (options.ForceDeleteWithoutRecovery !== undefined) {
|
|
1249
|
+
params.ForceDeleteWithoutRecovery = options.ForceDeleteWithoutRecovery;
|
|
1250
|
+
}
|
|
1251
|
+
const result = await this.client.request({
|
|
1252
|
+
service: "secretsmanager",
|
|
1009
1253
|
region: this.region,
|
|
1010
1254
|
method: "POST",
|
|
1011
1255
|
path: "/",
|
|
1012
1256
|
headers: {
|
|
1013
|
-
"
|
|
1257
|
+
"X-Amz-Target": "secretsmanager.DeleteSecret",
|
|
1258
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1014
1259
|
},
|
|
1015
|
-
body:
|
|
1016
|
-
Action: "Unsubscribe",
|
|
1017
|
-
Version: "2010-03-31",
|
|
1018
|
-
SubscriptionArn: subscriptionArn
|
|
1019
|
-
})
|
|
1260
|
+
body: JSON.stringify(params)
|
|
1020
1261
|
});
|
|
1262
|
+
return {
|
|
1263
|
+
ARN: result.ARN,
|
|
1264
|
+
Name: result.Name,
|
|
1265
|
+
DeletionDate: result.DeletionDate
|
|
1266
|
+
};
|
|
1021
1267
|
}
|
|
1022
|
-
async
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1025
|
-
Version: "2010-03-31",
|
|
1026
|
-
TopicArn: topicArn
|
|
1268
|
+
async restoreSecret(secretId) {
|
|
1269
|
+
const params = {
|
|
1270
|
+
SecretId: secretId
|
|
1027
1271
|
};
|
|
1028
|
-
if (nextToken) {
|
|
1029
|
-
formParams.NextToken = nextToken;
|
|
1030
|
-
}
|
|
1031
1272
|
const result = await this.client.request({
|
|
1032
|
-
service: "
|
|
1273
|
+
service: "secretsmanager",
|
|
1033
1274
|
region: this.region,
|
|
1034
1275
|
method: "POST",
|
|
1035
1276
|
path: "/",
|
|
1036
1277
|
headers: {
|
|
1037
|
-
"
|
|
1278
|
+
"X-Amz-Target": "secretsmanager.RestoreSecret",
|
|
1279
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1038
1280
|
},
|
|
1039
|
-
body:
|
|
1281
|
+
body: JSON.stringify(params)
|
|
1040
1282
|
});
|
|
1041
|
-
const subs = result?.ListSubscriptionsByTopicResponse?.ListSubscriptionsByTopicResult?.Subscriptions?.member;
|
|
1042
1283
|
return {
|
|
1043
|
-
|
|
1044
|
-
|
|
1284
|
+
ARN: result.ARN,
|
|
1285
|
+
Name: result.Name
|
|
1045
1286
|
};
|
|
1046
1287
|
}
|
|
1047
|
-
async
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1050
|
-
Version: "2010-03-31",
|
|
1051
|
-
Message: params.Message
|
|
1288
|
+
async rotateSecret(options) {
|
|
1289
|
+
const params = {
|
|
1290
|
+
SecretId: options.SecretId
|
|
1052
1291
|
};
|
|
1053
|
-
if (
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
if (
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
let attrIndex = 1;
|
|
1065
|
-
Object.entries(params.MessageAttributes).forEach(([name, attr]) => {
|
|
1066
|
-
formParams[`MessageAttributes.entry.${attrIndex}.Name`] = name;
|
|
1067
|
-
formParams[`MessageAttributes.entry.${attrIndex}.Value.DataType`] = attr.DataType;
|
|
1068
|
-
if (attr.StringValue) {
|
|
1069
|
-
formParams[`MessageAttributes.entry.${attrIndex}.Value.StringValue`] = attr.StringValue;
|
|
1070
|
-
}
|
|
1071
|
-
if (attr.BinaryValue) {
|
|
1072
|
-
formParams[`MessageAttributes.entry.${attrIndex}.Value.BinaryValue`] = attr.BinaryValue;
|
|
1073
|
-
}
|
|
1074
|
-
attrIndex++;
|
|
1075
|
-
});
|
|
1292
|
+
if (options.ClientRequestToken) {
|
|
1293
|
+
params.ClientRequestToken = options.ClientRequestToken;
|
|
1294
|
+
}
|
|
1295
|
+
if (options.RotationLambdaARN) {
|
|
1296
|
+
params.RotationLambdaARN = options.RotationLambdaARN;
|
|
1297
|
+
}
|
|
1298
|
+
if (options.RotationRules) {
|
|
1299
|
+
params.RotationRules = options.RotationRules;
|
|
1300
|
+
}
|
|
1301
|
+
if (options.RotateImmediately !== undefined) {
|
|
1302
|
+
params.RotateImmediately = options.RotateImmediately;
|
|
1076
1303
|
}
|
|
1077
1304
|
const result = await this.client.request({
|
|
1078
|
-
service: "
|
|
1305
|
+
service: "secretsmanager",
|
|
1079
1306
|
region: this.region,
|
|
1080
1307
|
method: "POST",
|
|
1081
1308
|
path: "/",
|
|
1082
1309
|
headers: {
|
|
1083
|
-
"
|
|
1310
|
+
"X-Amz-Target": "secretsmanager.RotateSecret",
|
|
1311
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1084
1312
|
},
|
|
1085
|
-
body:
|
|
1313
|
+
body: JSON.stringify(params)
|
|
1086
1314
|
});
|
|
1087
1315
|
return {
|
|
1088
|
-
|
|
1316
|
+
ARN: result.ARN,
|
|
1317
|
+
Name: result.Name,
|
|
1318
|
+
VersionId: result.VersionId
|
|
1089
1319
|
};
|
|
1090
1320
|
}
|
|
1091
|
-
async
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1321
|
+
async cancelRotateSecret(secretId) {
|
|
1322
|
+
const params = {
|
|
1323
|
+
SecretId: secretId
|
|
1324
|
+
};
|
|
1325
|
+
const result = await this.client.request({
|
|
1326
|
+
service: "secretsmanager",
|
|
1327
|
+
region: this.region,
|
|
1328
|
+
method: "POST",
|
|
1329
|
+
path: "/",
|
|
1330
|
+
headers: {
|
|
1331
|
+
"X-Amz-Target": "secretsmanager.CancelRotateSecret",
|
|
1332
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1333
|
+
},
|
|
1334
|
+
body: JSON.stringify(params)
|
|
1103
1335
|
});
|
|
1336
|
+
return {
|
|
1337
|
+
ARN: result.ARN,
|
|
1338
|
+
Name: result.Name
|
|
1339
|
+
};
|
|
1104
1340
|
}
|
|
1105
|
-
async
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1341
|
+
async getResourcePolicy(secretId) {
|
|
1342
|
+
const params = {
|
|
1343
|
+
SecretId: secretId
|
|
1344
|
+
};
|
|
1345
|
+
const result = await this.client.request({
|
|
1346
|
+
service: "secretsmanager",
|
|
1347
|
+
region: this.region,
|
|
1348
|
+
method: "POST",
|
|
1349
|
+
path: "/",
|
|
1350
|
+
headers: {
|
|
1351
|
+
"X-Amz-Target": "secretsmanager.GetResourcePolicy",
|
|
1352
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1353
|
+
},
|
|
1354
|
+
body: JSON.stringify(params)
|
|
1110
1355
|
});
|
|
1356
|
+
return {
|
|
1357
|
+
ARN: result.ARN,
|
|
1358
|
+
Name: result.Name,
|
|
1359
|
+
ResourcePolicy: result.ResourcePolicy
|
|
1360
|
+
};
|
|
1111
1361
|
}
|
|
1112
|
-
async
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1362
|
+
async putResourcePolicy(options) {
|
|
1363
|
+
const params = {
|
|
1364
|
+
SecretId: options.SecretId,
|
|
1365
|
+
ResourcePolicy: options.ResourcePolicy
|
|
1366
|
+
};
|
|
1367
|
+
if (options.BlockPublicPolicy !== undefined) {
|
|
1368
|
+
params.BlockPublicPolicy = options.BlockPublicPolicy;
|
|
1369
|
+
}
|
|
1370
|
+
const result = await this.client.request({
|
|
1371
|
+
service: "secretsmanager",
|
|
1372
|
+
region: this.region,
|
|
1373
|
+
method: "POST",
|
|
1374
|
+
path: "/",
|
|
1375
|
+
headers: {
|
|
1376
|
+
"X-Amz-Target": "secretsmanager.PutResourcePolicy",
|
|
1377
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1378
|
+
},
|
|
1379
|
+
body: JSON.stringify(params)
|
|
1117
1380
|
});
|
|
1381
|
+
return {
|
|
1382
|
+
ARN: result.ARN,
|
|
1383
|
+
Name: result.Name
|
|
1384
|
+
};
|
|
1118
1385
|
}
|
|
1119
|
-
async
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1386
|
+
async deleteResourcePolicy(secretId) {
|
|
1387
|
+
const params = {
|
|
1388
|
+
SecretId: secretId
|
|
1389
|
+
};
|
|
1390
|
+
const result = await this.client.request({
|
|
1391
|
+
service: "secretsmanager",
|
|
1392
|
+
region: this.region,
|
|
1393
|
+
method: "POST",
|
|
1394
|
+
path: "/",
|
|
1395
|
+
headers: {
|
|
1396
|
+
"X-Amz-Target": "secretsmanager.DeleteResourcePolicy",
|
|
1397
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1398
|
+
},
|
|
1399
|
+
body: JSON.stringify(params)
|
|
1129
1400
|
});
|
|
1401
|
+
return {
|
|
1402
|
+
ARN: result.ARN,
|
|
1403
|
+
Name: result.Name
|
|
1404
|
+
};
|
|
1130
1405
|
}
|
|
1131
|
-
async
|
|
1132
|
-
const
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1406
|
+
async tagResource(options) {
|
|
1407
|
+
const params = {
|
|
1408
|
+
SecretId: options.SecretId,
|
|
1409
|
+
Tags: options.Tags
|
|
1410
|
+
};
|
|
1411
|
+
await this.client.request({
|
|
1412
|
+
service: "secretsmanager",
|
|
1413
|
+
region: this.region,
|
|
1414
|
+
method: "POST",
|
|
1415
|
+
path: "/",
|
|
1416
|
+
headers: {
|
|
1417
|
+
"X-Amz-Target": "secretsmanager.TagResource",
|
|
1418
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1419
|
+
},
|
|
1420
|
+
body: JSON.stringify(params)
|
|
1142
1421
|
});
|
|
1143
1422
|
}
|
|
1144
|
-
async
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1423
|
+
async untagResource(options) {
|
|
1424
|
+
const params = {
|
|
1425
|
+
SecretId: options.SecretId,
|
|
1426
|
+
TagKeys: options.TagKeys
|
|
1427
|
+
};
|
|
1428
|
+
await this.client.request({
|
|
1429
|
+
service: "secretsmanager",
|
|
1430
|
+
region: this.region,
|
|
1431
|
+
method: "POST",
|
|
1432
|
+
path: "/",
|
|
1433
|
+
headers: {
|
|
1434
|
+
"X-Amz-Target": "secretsmanager.UntagResource",
|
|
1435
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1436
|
+
},
|
|
1437
|
+
body: JSON.stringify(params)
|
|
1149
1438
|
});
|
|
1150
1439
|
}
|
|
1151
|
-
async
|
|
1440
|
+
async setString(name, value, options) {
|
|
1152
1441
|
try {
|
|
1153
|
-
await this.
|
|
1154
|
-
|
|
1442
|
+
const result = await this.putSecretValue({
|
|
1443
|
+
SecretId: name,
|
|
1444
|
+
SecretString: value
|
|
1445
|
+
});
|
|
1446
|
+
return { ARN: result.ARN, VersionId: result.VersionId };
|
|
1155
1447
|
} catch (error) {
|
|
1156
|
-
if (error.code === "
|
|
1157
|
-
|
|
1448
|
+
if (error.code === "ResourceNotFoundException") {
|
|
1449
|
+
const result = await this.createSecret({
|
|
1450
|
+
Name: name,
|
|
1451
|
+
SecretString: value,
|
|
1452
|
+
Description: options?.description,
|
|
1453
|
+
KmsKeyId: options?.kmsKeyId,
|
|
1454
|
+
Tags: options?.tags
|
|
1455
|
+
});
|
|
1456
|
+
return { ARN: result.ARN, VersionId: result.VersionId };
|
|
1158
1457
|
}
|
|
1159
1458
|
throw error;
|
|
1160
1459
|
}
|
|
1161
1460
|
}
|
|
1162
|
-
async
|
|
1461
|
+
async setJson(name, value, options) {
|
|
1462
|
+
return this.setString(name, JSON.stringify(value), options);
|
|
1463
|
+
}
|
|
1464
|
+
async getString(secretId) {
|
|
1465
|
+
const result = await this.getSecretValue({ SecretId: secretId });
|
|
1466
|
+
return result.SecretString;
|
|
1467
|
+
}
|
|
1468
|
+
async getJson(secretId) {
|
|
1469
|
+
const str = await this.getString(secretId);
|
|
1470
|
+
if (str) {
|
|
1471
|
+
return JSON.parse(str);
|
|
1472
|
+
}
|
|
1473
|
+
return;
|
|
1474
|
+
}
|
|
1475
|
+
async listAll() {
|
|
1476
|
+
const allSecrets = [];
|
|
1477
|
+
let nextToken;
|
|
1478
|
+
do {
|
|
1479
|
+
const result = await this.listSecrets({ NextToken: nextToken });
|
|
1480
|
+
if (result.SecretList) {
|
|
1481
|
+
allSecrets.push(...result.SecretList);
|
|
1482
|
+
}
|
|
1483
|
+
nextToken = result.NextToken;
|
|
1484
|
+
} while (nextToken);
|
|
1485
|
+
return allSecrets;
|
|
1486
|
+
}
|
|
1487
|
+
parseSecret(s) {
|
|
1488
|
+
return {
|
|
1489
|
+
ARN: s.ARN,
|
|
1490
|
+
Name: s.Name,
|
|
1491
|
+
Description: s.Description,
|
|
1492
|
+
KmsKeyId: s.KmsKeyId,
|
|
1493
|
+
RotationEnabled: s.RotationEnabled,
|
|
1494
|
+
RotationLambdaARN: s.RotationLambdaARN,
|
|
1495
|
+
RotationRules: s.RotationRules,
|
|
1496
|
+
LastRotatedDate: s.LastRotatedDate,
|
|
1497
|
+
LastChangedDate: s.LastChangedDate,
|
|
1498
|
+
LastAccessedDate: s.LastAccessedDate,
|
|
1499
|
+
DeletedDate: s.DeletedDate,
|
|
1500
|
+
NextRotationDate: s.NextRotationDate,
|
|
1501
|
+
Tags: s.Tags,
|
|
1502
|
+
SecretVersionsToStages: s.SecretVersionsToStages,
|
|
1503
|
+
CreatedDate: s.CreatedDate,
|
|
1504
|
+
PrimaryRegion: s.PrimaryRegion
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
// src/aws/sns.ts
|
|
1509
|
+
class SNSClient {
|
|
1510
|
+
client;
|
|
1511
|
+
region;
|
|
1512
|
+
constructor(region = "us-east-1") {
|
|
1513
|
+
this.region = region;
|
|
1514
|
+
this.client = new AWSClient;
|
|
1515
|
+
}
|
|
1516
|
+
buildFormBody(params) {
|
|
1517
|
+
const entries = Object.entries(params).filter(([, value]) => value !== undefined).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
|
|
1518
|
+
return entries.join("&");
|
|
1519
|
+
}
|
|
1520
|
+
async createTopic(params) {
|
|
1521
|
+
const formParams = {
|
|
1522
|
+
Action: "CreateTopic",
|
|
1523
|
+
Version: "2010-03-31",
|
|
1524
|
+
Name: params.Name
|
|
1525
|
+
};
|
|
1526
|
+
if (params.DisplayName) {
|
|
1527
|
+
formParams["Attributes.entry.1.key"] = "DisplayName";
|
|
1528
|
+
formParams["Attributes.entry.1.value"] = params.DisplayName;
|
|
1529
|
+
}
|
|
1530
|
+
if (params.Tags) {
|
|
1531
|
+
params.Tags.forEach((tag, index) => {
|
|
1532
|
+
formParams[`Tags.member.${index + 1}.Key`] = tag.Key;
|
|
1533
|
+
formParams[`Tags.member.${index + 1}.Value`] = tag.Value;
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
if (params.Attributes) {
|
|
1537
|
+
let attrIndex = params.DisplayName ? 2 : 1;
|
|
1538
|
+
Object.entries(params.Attributes).forEach(([key, value]) => {
|
|
1539
|
+
formParams[`Attributes.entry.${attrIndex}.key`] = key;
|
|
1540
|
+
formParams[`Attributes.entry.${attrIndex}.value`] = value;
|
|
1541
|
+
attrIndex++;
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1163
1544
|
const result = await this.client.request({
|
|
1545
|
+
service: "sns",
|
|
1546
|
+
region: this.region,
|
|
1547
|
+
method: "POST",
|
|
1548
|
+
path: "/",
|
|
1549
|
+
headers: {
|
|
1550
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1551
|
+
},
|
|
1552
|
+
body: this.buildFormBody(formParams)
|
|
1553
|
+
});
|
|
1554
|
+
return {
|
|
1555
|
+
TopicArn: result?.CreateTopicResponse?.CreateTopicResult?.TopicArn || result?.TopicArn
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
async deleteTopic(topicArn) {
|
|
1559
|
+
await this.client.request({
|
|
1164
1560
|
service: "sns",
|
|
1165
1561
|
region: this.region,
|
|
1166
1562
|
method: "POST",
|
|
@@ -1169,191 +1565,1353 @@ class SNSClient {
|
|
|
1169
1565
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
1170
1566
|
},
|
|
1171
1567
|
body: this.buildFormBody({
|
|
1172
|
-
Action: "
|
|
1173
|
-
Version: "2010-03-31"
|
|
1568
|
+
Action: "DeleteTopic",
|
|
1569
|
+
Version: "2010-03-31",
|
|
1570
|
+
TopicArn: topicArn
|
|
1174
1571
|
})
|
|
1175
1572
|
});
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1573
|
+
}
|
|
1574
|
+
async listTopics(nextToken) {
|
|
1575
|
+
const formParams = {
|
|
1576
|
+
Action: "ListTopics",
|
|
1577
|
+
Version: "2010-03-31"
|
|
1578
|
+
};
|
|
1579
|
+
if (nextToken) {
|
|
1580
|
+
formParams.NextToken = nextToken;
|
|
1184
1581
|
}
|
|
1185
|
-
|
|
1582
|
+
const result = await this.client.request({
|
|
1583
|
+
service: "sns",
|
|
1584
|
+
region: this.region,
|
|
1585
|
+
method: "POST",
|
|
1586
|
+
path: "/",
|
|
1587
|
+
headers: {
|
|
1588
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1589
|
+
},
|
|
1590
|
+
body: this.buildFormBody(formParams)
|
|
1591
|
+
});
|
|
1592
|
+
const listResult = result?.ListTopicsResponse?.ListTopicsResult || result?.ListTopicsResult;
|
|
1593
|
+
const topics = listResult?.Topics?.member;
|
|
1594
|
+
return {
|
|
1595
|
+
Topics: Array.isArray(topics) ? topics : topics ? [topics] : [],
|
|
1596
|
+
NextToken: listResult?.NextToken
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
async getTopicAttributes(topicArn) {
|
|
1600
|
+
const result = await this.client.request({
|
|
1601
|
+
service: "sns",
|
|
1602
|
+
region: this.region,
|
|
1603
|
+
method: "POST",
|
|
1604
|
+
path: "/",
|
|
1605
|
+
headers: {
|
|
1606
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1607
|
+
},
|
|
1608
|
+
body: this.buildFormBody({
|
|
1609
|
+
Action: "GetTopicAttributes",
|
|
1610
|
+
Version: "2010-03-31",
|
|
1611
|
+
TopicArn: topicArn
|
|
1612
|
+
})
|
|
1613
|
+
});
|
|
1614
|
+
const attributes = result?.GetTopicAttributesResponse?.GetTopicAttributesResult?.Attributes?.entry;
|
|
1615
|
+
const attrs = { TopicArn: topicArn };
|
|
1616
|
+
if (Array.isArray(attributes)) {
|
|
1617
|
+
attributes.forEach((entry) => {
|
|
1618
|
+
attrs[entry.key] = entry.value;
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
return attrs;
|
|
1622
|
+
}
|
|
1623
|
+
async setTopicAttributes(params) {
|
|
1624
|
+
await this.client.request({
|
|
1625
|
+
service: "sns",
|
|
1626
|
+
region: this.region,
|
|
1627
|
+
method: "POST",
|
|
1628
|
+
path: "/",
|
|
1629
|
+
headers: {
|
|
1630
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1631
|
+
},
|
|
1632
|
+
body: this.buildFormBody({
|
|
1633
|
+
Action: "SetTopicAttributes",
|
|
1634
|
+
Version: "2010-03-31",
|
|
1635
|
+
TopicArn: params.TopicArn,
|
|
1636
|
+
AttributeName: params.AttributeName,
|
|
1637
|
+
AttributeValue: params.AttributeValue
|
|
1638
|
+
})
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
async subscribe(params) {
|
|
1642
|
+
const formParams = {
|
|
1643
|
+
Action: "Subscribe",
|
|
1644
|
+
Version: "2010-03-31",
|
|
1645
|
+
TopicArn: params.TopicArn,
|
|
1646
|
+
Protocol: params.Protocol,
|
|
1647
|
+
Endpoint: params.Endpoint
|
|
1648
|
+
};
|
|
1649
|
+
if (params.ReturnSubscriptionArn) {
|
|
1650
|
+
formParams.ReturnSubscriptionArn = "true";
|
|
1651
|
+
}
|
|
1652
|
+
if (params.Attributes) {
|
|
1653
|
+
let attrIndex = 1;
|
|
1654
|
+
Object.entries(params.Attributes).forEach(([key, value]) => {
|
|
1655
|
+
formParams[`Attributes.entry.${attrIndex}.key`] = key;
|
|
1656
|
+
formParams[`Attributes.entry.${attrIndex}.value`] = value;
|
|
1657
|
+
attrIndex++;
|
|
1658
|
+
});
|
|
1659
|
+
}
|
|
1660
|
+
const result = await this.client.request({
|
|
1661
|
+
service: "sns",
|
|
1662
|
+
region: this.region,
|
|
1663
|
+
method: "POST",
|
|
1664
|
+
path: "/",
|
|
1665
|
+
headers: {
|
|
1666
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1667
|
+
},
|
|
1668
|
+
body: this.buildFormBody(formParams)
|
|
1669
|
+
});
|
|
1670
|
+
return {
|
|
1671
|
+
SubscriptionArn: result?.SubscribeResponse?.SubscribeResult?.SubscriptionArn || result?.SubscriptionArn
|
|
1672
|
+
};
|
|
1673
|
+
}
|
|
1674
|
+
async unsubscribe(subscriptionArn) {
|
|
1675
|
+
await this.client.request({
|
|
1676
|
+
service: "sns",
|
|
1677
|
+
region: this.region,
|
|
1678
|
+
method: "POST",
|
|
1679
|
+
path: "/",
|
|
1680
|
+
headers: {
|
|
1681
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1682
|
+
},
|
|
1683
|
+
body: this.buildFormBody({
|
|
1684
|
+
Action: "Unsubscribe",
|
|
1685
|
+
Version: "2010-03-31",
|
|
1686
|
+
SubscriptionArn: subscriptionArn
|
|
1687
|
+
})
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
async listSubscriptionsByTopic(topicArn, nextToken) {
|
|
1691
|
+
const formParams = {
|
|
1692
|
+
Action: "ListSubscriptionsByTopic",
|
|
1693
|
+
Version: "2010-03-31",
|
|
1694
|
+
TopicArn: topicArn
|
|
1695
|
+
};
|
|
1696
|
+
if (nextToken) {
|
|
1697
|
+
formParams.NextToken = nextToken;
|
|
1698
|
+
}
|
|
1699
|
+
const result = await this.client.request({
|
|
1700
|
+
service: "sns",
|
|
1701
|
+
region: this.region,
|
|
1702
|
+
method: "POST",
|
|
1703
|
+
path: "/",
|
|
1704
|
+
headers: {
|
|
1705
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1706
|
+
},
|
|
1707
|
+
body: this.buildFormBody(formParams)
|
|
1708
|
+
});
|
|
1709
|
+
const subs = result?.ListSubscriptionsByTopicResponse?.ListSubscriptionsByTopicResult?.Subscriptions?.member;
|
|
1710
|
+
return {
|
|
1711
|
+
Subscriptions: Array.isArray(subs) ? subs : subs ? [subs] : [],
|
|
1712
|
+
NextToken: result?.ListSubscriptionsByTopicResponse?.ListSubscriptionsByTopicResult?.NextToken
|
|
1713
|
+
};
|
|
1714
|
+
}
|
|
1715
|
+
async publish(params) {
|
|
1716
|
+
const formParams = {
|
|
1717
|
+
Action: "Publish",
|
|
1718
|
+
Version: "2010-03-31",
|
|
1719
|
+
Message: params.Message
|
|
1720
|
+
};
|
|
1721
|
+
if (params.TopicArn)
|
|
1722
|
+
formParams.TopicArn = params.TopicArn;
|
|
1723
|
+
if (params.TargetArn)
|
|
1724
|
+
formParams.TargetArn = params.TargetArn;
|
|
1725
|
+
if (params.PhoneNumber)
|
|
1726
|
+
formParams.PhoneNumber = params.PhoneNumber;
|
|
1727
|
+
if (params.Subject)
|
|
1728
|
+
formParams.Subject = params.Subject;
|
|
1729
|
+
if (params.MessageStructure)
|
|
1730
|
+
formParams.MessageStructure = params.MessageStructure;
|
|
1731
|
+
if (params.MessageAttributes) {
|
|
1732
|
+
let attrIndex = 1;
|
|
1733
|
+
Object.entries(params.MessageAttributes).forEach(([name, attr]) => {
|
|
1734
|
+
formParams[`MessageAttributes.entry.${attrIndex}.Name`] = name;
|
|
1735
|
+
formParams[`MessageAttributes.entry.${attrIndex}.Value.DataType`] = attr.DataType;
|
|
1736
|
+
if (attr.StringValue) {
|
|
1737
|
+
formParams[`MessageAttributes.entry.${attrIndex}.Value.StringValue`] = attr.StringValue;
|
|
1738
|
+
}
|
|
1739
|
+
if (attr.BinaryValue) {
|
|
1740
|
+
formParams[`MessageAttributes.entry.${attrIndex}.Value.BinaryValue`] = attr.BinaryValue;
|
|
1741
|
+
}
|
|
1742
|
+
attrIndex++;
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
const result = await this.client.request({
|
|
1746
|
+
service: "sns",
|
|
1747
|
+
region: this.region,
|
|
1748
|
+
method: "POST",
|
|
1749
|
+
path: "/",
|
|
1750
|
+
headers: {
|
|
1751
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1752
|
+
},
|
|
1753
|
+
body: this.buildFormBody(formParams)
|
|
1754
|
+
});
|
|
1755
|
+
return {
|
|
1756
|
+
MessageId: result?.PublishResponse?.PublishResult?.MessageId || result?.MessageId
|
|
1757
|
+
};
|
|
1758
|
+
}
|
|
1759
|
+
async publishSMS(phoneNumber, message, senderId) {
|
|
1760
|
+
const messageAttributes = {};
|
|
1761
|
+
if (senderId) {
|
|
1762
|
+
messageAttributes["AWS.SNS.SMS.SenderID"] = {
|
|
1763
|
+
DataType: "String",
|
|
1764
|
+
StringValue: senderId
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
return this.publish({
|
|
1768
|
+
PhoneNumber: phoneNumber,
|
|
1769
|
+
Message: message,
|
|
1770
|
+
MessageAttributes: Object.keys(messageAttributes).length > 0 ? messageAttributes : undefined
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1773
|
+
async subscribeEmail(topicArn, email) {
|
|
1774
|
+
return this.subscribe({
|
|
1775
|
+
TopicArn: topicArn,
|
|
1776
|
+
Protocol: "email",
|
|
1777
|
+
Endpoint: email
|
|
1778
|
+
});
|
|
1779
|
+
}
|
|
1780
|
+
async subscribeLambda(topicArn, lambdaArn) {
|
|
1781
|
+
return this.subscribe({
|
|
1782
|
+
TopicArn: topicArn,
|
|
1783
|
+
Protocol: "lambda",
|
|
1784
|
+
Endpoint: lambdaArn
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
async subscribeSqs(topicArn, queueArn, rawMessageDelivery) {
|
|
1788
|
+
const attributes = {};
|
|
1789
|
+
if (rawMessageDelivery) {
|
|
1790
|
+
attributes.RawMessageDelivery = "true";
|
|
1791
|
+
}
|
|
1792
|
+
return this.subscribe({
|
|
1793
|
+
TopicArn: topicArn,
|
|
1794
|
+
Protocol: "sqs",
|
|
1795
|
+
Endpoint: queueArn,
|
|
1796
|
+
Attributes: Object.keys(attributes).length > 0 ? attributes : undefined
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
async subscribeHttp(topicArn, url, rawMessageDelivery) {
|
|
1800
|
+
const protocol = url.startsWith("https") ? "https" : "http";
|
|
1801
|
+
const attributes = {};
|
|
1802
|
+
if (rawMessageDelivery) {
|
|
1803
|
+
attributes.RawMessageDelivery = "true";
|
|
1804
|
+
}
|
|
1805
|
+
return this.subscribe({
|
|
1806
|
+
TopicArn: topicArn,
|
|
1807
|
+
Protocol: protocol,
|
|
1808
|
+
Endpoint: url,
|
|
1809
|
+
Attributes: Object.keys(attributes).length > 0 ? attributes : undefined
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
async subscribeSms(topicArn, phoneNumber) {
|
|
1813
|
+
return this.subscribe({
|
|
1814
|
+
TopicArn: topicArn,
|
|
1815
|
+
Protocol: "sms",
|
|
1816
|
+
Endpoint: phoneNumber
|
|
1817
|
+
});
|
|
1818
|
+
}
|
|
1819
|
+
async topicExists(topicArn) {
|
|
1820
|
+
try {
|
|
1821
|
+
await this.getTopicAttributes(topicArn);
|
|
1822
|
+
return true;
|
|
1823
|
+
} catch (error) {
|
|
1824
|
+
if (error.code === "NotFound" || error.statusCode === 404) {
|
|
1825
|
+
return false;
|
|
1826
|
+
}
|
|
1827
|
+
throw error;
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
async getSMSAttributes() {
|
|
1831
|
+
const result = await this.client.request({
|
|
1832
|
+
service: "sns",
|
|
1833
|
+
region: this.region,
|
|
1834
|
+
method: "POST",
|
|
1835
|
+
path: "/",
|
|
1836
|
+
headers: {
|
|
1837
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1838
|
+
},
|
|
1839
|
+
body: this.buildFormBody({
|
|
1840
|
+
Action: "GetSMSAttributes",
|
|
1841
|
+
Version: "2010-03-31"
|
|
1842
|
+
})
|
|
1843
|
+
});
|
|
1844
|
+
const attrs = result?.GetSMSAttributesResponse?.GetSMSAttributesResult?.attributes?.entry;
|
|
1845
|
+
const attributes = {};
|
|
1846
|
+
if (Array.isArray(attrs)) {
|
|
1847
|
+
attrs.forEach((entry) => {
|
|
1848
|
+
attributes[entry.key] = entry.value;
|
|
1849
|
+
});
|
|
1850
|
+
} else if (attrs) {
|
|
1851
|
+
attributes[attrs.key] = attrs.value;
|
|
1852
|
+
}
|
|
1853
|
+
return attributes;
|
|
1854
|
+
}
|
|
1855
|
+
async setSMSAttributes(attributes) {
|
|
1856
|
+
const formParams = {
|
|
1857
|
+
Action: "SetSMSAttributes",
|
|
1858
|
+
Version: "2010-03-31"
|
|
1859
|
+
};
|
|
1860
|
+
let attrIndex = 1;
|
|
1861
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
|
1862
|
+
if (value !== undefined) {
|
|
1863
|
+
formParams[`attributes.entry.${attrIndex}.key`] = key;
|
|
1864
|
+
formParams[`attributes.entry.${attrIndex}.value`] = value;
|
|
1865
|
+
attrIndex++;
|
|
1866
|
+
}
|
|
1867
|
+
});
|
|
1868
|
+
await this.client.request({
|
|
1869
|
+
service: "sns",
|
|
1870
|
+
region: this.region,
|
|
1871
|
+
method: "POST",
|
|
1872
|
+
path: "/",
|
|
1873
|
+
headers: {
|
|
1874
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1875
|
+
},
|
|
1876
|
+
body: this.buildFormBody(formParams)
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
async checkIfPhoneNumberIsOptedOut(phoneNumber) {
|
|
1880
|
+
const result = await this.client.request({
|
|
1881
|
+
service: "sns",
|
|
1882
|
+
region: this.region,
|
|
1883
|
+
method: "POST",
|
|
1884
|
+
path: "/",
|
|
1885
|
+
headers: {
|
|
1886
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1887
|
+
},
|
|
1888
|
+
body: this.buildFormBody({
|
|
1889
|
+
Action: "CheckIfPhoneNumberIsOptedOut",
|
|
1890
|
+
Version: "2010-03-31",
|
|
1891
|
+
phoneNumber
|
|
1892
|
+
})
|
|
1893
|
+
});
|
|
1894
|
+
return result?.CheckIfPhoneNumberIsOptedOutResponse?.CheckIfPhoneNumberIsOptedOutResult?.isOptedOut === "true";
|
|
1895
|
+
}
|
|
1896
|
+
async listPhoneNumbersOptedOut(nextToken) {
|
|
1897
|
+
const formParams = {
|
|
1898
|
+
Action: "ListPhoneNumbersOptedOut",
|
|
1899
|
+
Version: "2010-03-31"
|
|
1900
|
+
};
|
|
1901
|
+
if (nextToken)
|
|
1902
|
+
formParams.nextToken = nextToken;
|
|
1903
|
+
const result = await this.client.request({
|
|
1904
|
+
service: "sns",
|
|
1905
|
+
region: this.region,
|
|
1906
|
+
method: "POST",
|
|
1907
|
+
path: "/",
|
|
1908
|
+
headers: {
|
|
1909
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1910
|
+
},
|
|
1911
|
+
body: this.buildFormBody(formParams)
|
|
1912
|
+
});
|
|
1913
|
+
const phones = result?.ListPhoneNumbersOptedOutResponse?.ListPhoneNumbersOptedOutResult?.phoneNumbers?.member;
|
|
1914
|
+
return {
|
|
1915
|
+
phoneNumbers: Array.isArray(phones) ? phones : phones ? [phones] : [],
|
|
1916
|
+
nextToken: result?.ListPhoneNumbersOptedOutResponse?.ListPhoneNumbersOptedOutResult?.nextToken
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1919
|
+
async optInPhoneNumber(phoneNumber) {
|
|
1920
|
+
await this.client.request({
|
|
1921
|
+
service: "sns",
|
|
1922
|
+
region: this.region,
|
|
1923
|
+
method: "POST",
|
|
1924
|
+
path: "/",
|
|
1925
|
+
headers: {
|
|
1926
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1927
|
+
},
|
|
1928
|
+
body: this.buildFormBody({
|
|
1929
|
+
Action: "OptInPhoneNumber",
|
|
1930
|
+
Version: "2010-03-31",
|
|
1931
|
+
phoneNumber
|
|
1932
|
+
})
|
|
1933
|
+
});
|
|
1934
|
+
}
|
|
1935
|
+
async listSMSSandboxPhoneNumbers(nextToken) {
|
|
1936
|
+
const formParams = {
|
|
1937
|
+
Action: "ListSMSSandboxPhoneNumbers",
|
|
1938
|
+
Version: "2010-03-31"
|
|
1939
|
+
};
|
|
1940
|
+
if (nextToken)
|
|
1941
|
+
formParams.NextToken = nextToken;
|
|
1942
|
+
const result = await this.client.request({
|
|
1943
|
+
service: "sns",
|
|
1944
|
+
region: this.region,
|
|
1945
|
+
method: "POST",
|
|
1946
|
+
path: "/",
|
|
1947
|
+
headers: {
|
|
1948
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1949
|
+
},
|
|
1950
|
+
body: this.buildFormBody(formParams)
|
|
1951
|
+
});
|
|
1952
|
+
const phones = result?.ListSMSSandboxPhoneNumbersResponse?.ListSMSSandboxPhoneNumbersResult?.PhoneNumbers?.member;
|
|
1953
|
+
return {
|
|
1954
|
+
PhoneNumbers: Array.isArray(phones) ? phones : phones ? [phones] : [],
|
|
1955
|
+
NextToken: result?.ListSMSSandboxPhoneNumbersResponse?.ListSMSSandboxPhoneNumbersResult?.NextToken
|
|
1956
|
+
};
|
|
1957
|
+
}
|
|
1958
|
+
async createSMSSandboxPhoneNumber(phoneNumber, languageCode) {
|
|
1959
|
+
await this.client.request({
|
|
1960
|
+
service: "sns",
|
|
1961
|
+
region: this.region,
|
|
1962
|
+
method: "POST",
|
|
1963
|
+
path: "/",
|
|
1964
|
+
headers: {
|
|
1965
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1966
|
+
},
|
|
1967
|
+
body: this.buildFormBody({
|
|
1968
|
+
Action: "CreateSMSSandboxPhoneNumber",
|
|
1969
|
+
Version: "2010-03-31",
|
|
1970
|
+
PhoneNumber: phoneNumber,
|
|
1971
|
+
LanguageCode: languageCode || "en-US"
|
|
1972
|
+
})
|
|
1973
|
+
});
|
|
1974
|
+
}
|
|
1975
|
+
async verifySMSSandboxPhoneNumber(phoneNumber, oneTimePassword) {
|
|
1976
|
+
await this.client.request({
|
|
1977
|
+
service: "sns",
|
|
1978
|
+
region: this.region,
|
|
1979
|
+
method: "POST",
|
|
1980
|
+
path: "/",
|
|
1981
|
+
headers: {
|
|
1982
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1983
|
+
},
|
|
1984
|
+
body: this.buildFormBody({
|
|
1985
|
+
Action: "VerifySMSSandboxPhoneNumber",
|
|
1986
|
+
Version: "2010-03-31",
|
|
1987
|
+
PhoneNumber: phoneNumber,
|
|
1988
|
+
OneTimePassword: oneTimePassword
|
|
1989
|
+
})
|
|
1990
|
+
});
|
|
1991
|
+
}
|
|
1992
|
+
async deleteSMSSandboxPhoneNumber(phoneNumber) {
|
|
1993
|
+
await this.client.request({
|
|
1994
|
+
service: "sns",
|
|
1995
|
+
region: this.region,
|
|
1996
|
+
method: "POST",
|
|
1997
|
+
path: "/",
|
|
1998
|
+
headers: {
|
|
1999
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
2000
|
+
},
|
|
2001
|
+
body: this.buildFormBody({
|
|
2002
|
+
Action: "DeleteSMSSandboxPhoneNumber",
|
|
2003
|
+
Version: "2010-03-31",
|
|
2004
|
+
PhoneNumber: phoneNumber
|
|
2005
|
+
})
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
async getSMSSandboxAccountStatus() {
|
|
2009
|
+
const result = await this.client.request({
|
|
2010
|
+
service: "sns",
|
|
2011
|
+
region: this.region,
|
|
2012
|
+
method: "POST",
|
|
2013
|
+
path: "/",
|
|
2014
|
+
headers: {
|
|
2015
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
2016
|
+
},
|
|
2017
|
+
body: this.buildFormBody({
|
|
2018
|
+
Action: "GetSMSSandboxAccountStatus",
|
|
2019
|
+
Version: "2010-03-31"
|
|
2020
|
+
})
|
|
2021
|
+
});
|
|
2022
|
+
return {
|
|
2023
|
+
IsInSandbox: result?.GetSMSSandboxAccountStatusResponse?.GetSMSSandboxAccountStatusResult?.IsInSandbox === "true"
|
|
2024
|
+
};
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
// src/aws/sqs.ts
|
|
2028
|
+
class SQSClient {
|
|
2029
|
+
client;
|
|
2030
|
+
region;
|
|
2031
|
+
constructor(region = "us-east-1", profile) {
|
|
2032
|
+
this.region = region;
|
|
2033
|
+
this.client = new AWSClient;
|
|
2034
|
+
}
|
|
2035
|
+
async createQueue(options) {
|
|
2036
|
+
const queueName = options.fifo && !options.queueName.endsWith(".fifo") ? `${options.queueName}.fifo` : options.queueName;
|
|
2037
|
+
const params = {
|
|
2038
|
+
Action: "CreateQueue",
|
|
2039
|
+
QueueName: queueName,
|
|
2040
|
+
Version: "2012-11-05"
|
|
2041
|
+
};
|
|
2042
|
+
let attrIndex = 1;
|
|
2043
|
+
if (options.visibilityTimeout !== undefined) {
|
|
2044
|
+
params[`Attribute.${attrIndex}.Name`] = "VisibilityTimeout";
|
|
2045
|
+
params[`Attribute.${attrIndex}.Value`] = options.visibilityTimeout.toString();
|
|
2046
|
+
attrIndex++;
|
|
2047
|
+
}
|
|
2048
|
+
if (options.messageRetentionPeriod !== undefined) {
|
|
2049
|
+
params[`Attribute.${attrIndex}.Name`] = "MessageRetentionPeriod";
|
|
2050
|
+
params[`Attribute.${attrIndex}.Value`] = options.messageRetentionPeriod.toString();
|
|
2051
|
+
attrIndex++;
|
|
2052
|
+
}
|
|
2053
|
+
if (options.delaySeconds !== undefined) {
|
|
2054
|
+
params[`Attribute.${attrIndex}.Name`] = "DelaySeconds";
|
|
2055
|
+
params[`Attribute.${attrIndex}.Value`] = options.delaySeconds.toString();
|
|
2056
|
+
attrIndex++;
|
|
2057
|
+
}
|
|
2058
|
+
if (options.maxMessageSize !== undefined) {
|
|
2059
|
+
params[`Attribute.${attrIndex}.Name`] = "MaximumMessageSize";
|
|
2060
|
+
params[`Attribute.${attrIndex}.Value`] = options.maxMessageSize.toString();
|
|
2061
|
+
attrIndex++;
|
|
2062
|
+
}
|
|
2063
|
+
if (options.receiveMessageWaitTime !== undefined) {
|
|
2064
|
+
params[`Attribute.${attrIndex}.Name`] = "ReceiveMessageWaitTimeSeconds";
|
|
2065
|
+
params[`Attribute.${attrIndex}.Value`] = options.receiveMessageWaitTime.toString();
|
|
2066
|
+
attrIndex++;
|
|
2067
|
+
}
|
|
2068
|
+
if (options.fifo) {
|
|
2069
|
+
params[`Attribute.${attrIndex}.Name`] = "FifoQueue";
|
|
2070
|
+
params[`Attribute.${attrIndex}.Value`] = "true";
|
|
2071
|
+
attrIndex++;
|
|
2072
|
+
if (options.contentBasedDeduplication) {
|
|
2073
|
+
params[`Attribute.${attrIndex}.Name`] = "ContentBasedDeduplication";
|
|
2074
|
+
params[`Attribute.${attrIndex}.Value`] = "true";
|
|
2075
|
+
attrIndex++;
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
if (options.deadLetterTargetArn && options.maxReceiveCount) {
|
|
2079
|
+
params[`Attribute.${attrIndex}.Name`] = "RedrivePolicy";
|
|
2080
|
+
params[`Attribute.${attrIndex}.Value`] = JSON.stringify({
|
|
2081
|
+
deadLetterTargetArn: options.deadLetterTargetArn,
|
|
2082
|
+
maxReceiveCount: options.maxReceiveCount
|
|
2083
|
+
});
|
|
2084
|
+
attrIndex++;
|
|
2085
|
+
}
|
|
2086
|
+
if (options.tags && Object.keys(options.tags).length > 0) {
|
|
2087
|
+
let tagIndex = 1;
|
|
2088
|
+
for (const [key, value] of Object.entries(options.tags)) {
|
|
2089
|
+
params[`Tag.${tagIndex}.Key`] = key;
|
|
2090
|
+
params[`Tag.${tagIndex}.Value`] = value;
|
|
2091
|
+
tagIndex++;
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
const result = await this.client.request({
|
|
2095
|
+
service: "sqs",
|
|
2096
|
+
region: this.region,
|
|
2097
|
+
method: "POST",
|
|
2098
|
+
path: "/",
|
|
2099
|
+
body: new URLSearchParams(params).toString()
|
|
2100
|
+
});
|
|
2101
|
+
return { QueueUrl: result.QueueUrl || result.CreateQueueResult?.QueueUrl };
|
|
2102
|
+
}
|
|
2103
|
+
async listQueues(prefix) {
|
|
2104
|
+
const params = {
|
|
2105
|
+
Action: "ListQueues",
|
|
2106
|
+
Version: "2012-11-05"
|
|
2107
|
+
};
|
|
2108
|
+
if (prefix) {
|
|
2109
|
+
params.QueueNamePrefix = prefix;
|
|
2110
|
+
}
|
|
2111
|
+
const result = await this.client.request({
|
|
2112
|
+
service: "sqs",
|
|
2113
|
+
region: this.region,
|
|
2114
|
+
method: "POST",
|
|
2115
|
+
path: "/",
|
|
2116
|
+
body: new URLSearchParams(params).toString()
|
|
2117
|
+
});
|
|
2118
|
+
const queueUrls = [];
|
|
2119
|
+
if (result.QueueUrl) {
|
|
2120
|
+
queueUrls.push(result.QueueUrl);
|
|
2121
|
+
} else if (result.ListQueuesResult?.QueueUrl) {
|
|
2122
|
+
if (Array.isArray(result.ListQueuesResult.QueueUrl)) {
|
|
2123
|
+
queueUrls.push(...result.ListQueuesResult.QueueUrl);
|
|
2124
|
+
} else {
|
|
2125
|
+
queueUrls.push(result.ListQueuesResult.QueueUrl);
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
return { QueueUrls: queueUrls };
|
|
2129
|
+
}
|
|
2130
|
+
async getQueueAttributes(queueUrl) {
|
|
2131
|
+
const params = {
|
|
2132
|
+
Action: "GetQueueAttributes",
|
|
2133
|
+
QueueUrl: queueUrl,
|
|
2134
|
+
Version: "2012-11-05",
|
|
2135
|
+
"AttributeName.1": "All"
|
|
2136
|
+
};
|
|
2137
|
+
const result = await this.client.request({
|
|
2138
|
+
service: "sqs",
|
|
2139
|
+
region: this.region,
|
|
2140
|
+
method: "POST",
|
|
2141
|
+
path: "/",
|
|
2142
|
+
body: new URLSearchParams(params).toString()
|
|
2143
|
+
});
|
|
2144
|
+
return { Attributes: result.Attributes || result.GetQueueAttributesResult?.Attributes || {} };
|
|
2145
|
+
}
|
|
2146
|
+
async getQueueUrl(queueName) {
|
|
2147
|
+
const params = {
|
|
2148
|
+
Action: "GetQueueUrl",
|
|
2149
|
+
QueueName: queueName,
|
|
2150
|
+
Version: "2012-11-05"
|
|
2151
|
+
};
|
|
2152
|
+
const result = await this.client.request({
|
|
2153
|
+
service: "sqs",
|
|
2154
|
+
region: this.region,
|
|
2155
|
+
method: "POST",
|
|
2156
|
+
path: "/",
|
|
2157
|
+
body: new URLSearchParams(params).toString()
|
|
2158
|
+
});
|
|
2159
|
+
return { QueueUrl: result.QueueUrl || result.GetQueueUrlResult?.QueueUrl };
|
|
2160
|
+
}
|
|
2161
|
+
async deleteQueue(queueUrl) {
|
|
2162
|
+
const params = {
|
|
2163
|
+
Action: "DeleteQueue",
|
|
2164
|
+
QueueUrl: queueUrl,
|
|
2165
|
+
Version: "2012-11-05"
|
|
2166
|
+
};
|
|
2167
|
+
await this.client.request({
|
|
2168
|
+
service: "sqs",
|
|
2169
|
+
region: this.region,
|
|
2170
|
+
method: "POST",
|
|
2171
|
+
path: "/",
|
|
2172
|
+
body: new URLSearchParams(params).toString()
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
async purgeQueue(queueUrl) {
|
|
2176
|
+
const params = {
|
|
2177
|
+
Action: "PurgeQueue",
|
|
2178
|
+
QueueUrl: queueUrl,
|
|
2179
|
+
Version: "2012-11-05"
|
|
2180
|
+
};
|
|
2181
|
+
await this.client.request({
|
|
2182
|
+
service: "sqs",
|
|
2183
|
+
region: this.region,
|
|
2184
|
+
method: "POST",
|
|
2185
|
+
path: "/",
|
|
2186
|
+
body: new URLSearchParams(params).toString()
|
|
2187
|
+
});
|
|
2188
|
+
}
|
|
2189
|
+
async sendMessage(options) {
|
|
2190
|
+
const params = {
|
|
2191
|
+
Action: "SendMessage",
|
|
2192
|
+
QueueUrl: options.queueUrl,
|
|
2193
|
+
MessageBody: options.messageBody,
|
|
2194
|
+
Version: "2012-11-05"
|
|
2195
|
+
};
|
|
2196
|
+
if (options.delaySeconds !== undefined) {
|
|
2197
|
+
params.DelaySeconds = options.delaySeconds;
|
|
2198
|
+
}
|
|
2199
|
+
if (options.messageGroupId) {
|
|
2200
|
+
params.MessageGroupId = options.messageGroupId;
|
|
2201
|
+
}
|
|
2202
|
+
if (options.messageDeduplicationId) {
|
|
2203
|
+
params.MessageDeduplicationId = options.messageDeduplicationId;
|
|
2204
|
+
}
|
|
2205
|
+
const result = await this.client.request({
|
|
2206
|
+
service: "sqs",
|
|
2207
|
+
region: this.region,
|
|
2208
|
+
method: "POST",
|
|
2209
|
+
path: "/",
|
|
2210
|
+
body: new URLSearchParams(params).toString()
|
|
2211
|
+
});
|
|
2212
|
+
return { MessageId: result.MessageId || result.SendMessageResult?.MessageId };
|
|
2213
|
+
}
|
|
2214
|
+
async receiveMessages(options) {
|
|
2215
|
+
const params = {
|
|
2216
|
+
Action: "ReceiveMessage",
|
|
2217
|
+
QueueUrl: options.queueUrl,
|
|
2218
|
+
Version: "2012-11-05"
|
|
2219
|
+
};
|
|
2220
|
+
if (options.maxMessages !== undefined) {
|
|
2221
|
+
params.MaxNumberOfMessages = options.maxMessages;
|
|
2222
|
+
}
|
|
2223
|
+
if (options.visibilityTimeout !== undefined) {
|
|
2224
|
+
params.VisibilityTimeout = options.visibilityTimeout;
|
|
2225
|
+
}
|
|
2226
|
+
if (options.waitTimeSeconds !== undefined) {
|
|
2227
|
+
params.WaitTimeSeconds = options.waitTimeSeconds;
|
|
2228
|
+
}
|
|
2229
|
+
const result = await this.client.request({
|
|
2230
|
+
service: "sqs",
|
|
2231
|
+
region: this.region,
|
|
2232
|
+
method: "POST",
|
|
2233
|
+
path: "/",
|
|
2234
|
+
body: new URLSearchParams(params).toString()
|
|
2235
|
+
});
|
|
2236
|
+
const messages = [];
|
|
2237
|
+
const msgData = result.Message || result.ReceiveMessageResult?.Message;
|
|
2238
|
+
if (msgData) {
|
|
2239
|
+
if (Array.isArray(msgData)) {
|
|
2240
|
+
messages.push(...msgData.map((m) => ({
|
|
2241
|
+
MessageId: m.MessageId,
|
|
2242
|
+
ReceiptHandle: m.ReceiptHandle,
|
|
2243
|
+
Body: m.Body
|
|
2244
|
+
})));
|
|
2245
|
+
} else {
|
|
2246
|
+
messages.push({
|
|
2247
|
+
MessageId: msgData.MessageId,
|
|
2248
|
+
ReceiptHandle: msgData.ReceiptHandle,
|
|
2249
|
+
Body: msgData.Body
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
return { Messages: messages };
|
|
2254
|
+
}
|
|
2255
|
+
async deleteMessage(queueUrl, receiptHandle) {
|
|
2256
|
+
const params = {
|
|
2257
|
+
Action: "DeleteMessage",
|
|
2258
|
+
QueueUrl: queueUrl,
|
|
2259
|
+
ReceiptHandle: receiptHandle,
|
|
2260
|
+
Version: "2012-11-05"
|
|
2261
|
+
};
|
|
2262
|
+
await this.client.request({
|
|
2263
|
+
service: "sqs",
|
|
2264
|
+
region: this.region,
|
|
2265
|
+
method: "POST",
|
|
2266
|
+
path: "/",
|
|
2267
|
+
body: new URLSearchParams(params).toString()
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
// src/aws/lambda.ts
|
|
2272
|
+
import { deflateRawSync } from "zlib";
|
|
2273
|
+
function createZipFile(filename, content) {
|
|
2274
|
+
const data = typeof content === "string" ? Buffer.from(content, "utf-8") : content;
|
|
2275
|
+
const compressedData = deflateRawSync(data);
|
|
2276
|
+
const crc32 = calculateCrc32(data);
|
|
2277
|
+
const now = new Date;
|
|
2278
|
+
const dosTime = (now.getHours() << 11 | now.getMinutes() << 5 | now.getSeconds() >> 1) & 65535;
|
|
2279
|
+
const dosDate = (now.getFullYear() - 1980 << 9 | now.getMonth() + 1 << 5 | now.getDate()) & 65535;
|
|
2280
|
+
const filenameBuffer = Buffer.from(filename, "utf-8");
|
|
2281
|
+
const localHeader = Buffer.alloc(30 + filenameBuffer.length);
|
|
2282
|
+
localHeader.writeUInt32LE(67324752, 0);
|
|
2283
|
+
localHeader.writeUInt16LE(20, 4);
|
|
2284
|
+
localHeader.writeUInt16LE(0, 6);
|
|
2285
|
+
localHeader.writeUInt16LE(8, 8);
|
|
2286
|
+
localHeader.writeUInt16LE(dosTime, 10);
|
|
2287
|
+
localHeader.writeUInt16LE(dosDate, 12);
|
|
2288
|
+
localHeader.writeUInt32LE(crc32, 14);
|
|
2289
|
+
localHeader.writeUInt32LE(compressedData.length, 18);
|
|
2290
|
+
localHeader.writeUInt32LE(data.length, 22);
|
|
2291
|
+
localHeader.writeUInt16LE(filenameBuffer.length, 26);
|
|
2292
|
+
localHeader.writeUInt16LE(0, 28);
|
|
2293
|
+
filenameBuffer.copy(localHeader, 30);
|
|
2294
|
+
const centralHeader = Buffer.alloc(46 + filenameBuffer.length);
|
|
2295
|
+
centralHeader.writeUInt32LE(33639248, 0);
|
|
2296
|
+
centralHeader.writeUInt16LE(20, 4);
|
|
2297
|
+
centralHeader.writeUInt16LE(20, 6);
|
|
2298
|
+
centralHeader.writeUInt16LE(0, 8);
|
|
2299
|
+
centralHeader.writeUInt16LE(8, 10);
|
|
2300
|
+
centralHeader.writeUInt16LE(dosTime, 12);
|
|
2301
|
+
centralHeader.writeUInt16LE(dosDate, 14);
|
|
2302
|
+
centralHeader.writeUInt32LE(crc32, 16);
|
|
2303
|
+
centralHeader.writeUInt32LE(compressedData.length, 20);
|
|
2304
|
+
centralHeader.writeUInt32LE(data.length, 24);
|
|
2305
|
+
centralHeader.writeUInt16LE(filenameBuffer.length, 28);
|
|
2306
|
+
centralHeader.writeUInt16LE(0, 30);
|
|
2307
|
+
centralHeader.writeUInt16LE(0, 32);
|
|
2308
|
+
centralHeader.writeUInt16LE(0, 34);
|
|
2309
|
+
centralHeader.writeUInt16LE(0, 36);
|
|
2310
|
+
centralHeader.writeUInt32LE(0, 38);
|
|
2311
|
+
centralHeader.writeUInt32LE(0, 42);
|
|
2312
|
+
filenameBuffer.copy(centralHeader, 46);
|
|
2313
|
+
const centralDirOffset = localHeader.length + compressedData.length;
|
|
2314
|
+
const centralDirSize = centralHeader.length;
|
|
2315
|
+
const endRecord = Buffer.alloc(22);
|
|
2316
|
+
endRecord.writeUInt32LE(101010256, 0);
|
|
2317
|
+
endRecord.writeUInt16LE(0, 4);
|
|
2318
|
+
endRecord.writeUInt16LE(0, 6);
|
|
2319
|
+
endRecord.writeUInt16LE(1, 8);
|
|
2320
|
+
endRecord.writeUInt16LE(1, 10);
|
|
2321
|
+
endRecord.writeUInt32LE(centralDirSize, 12);
|
|
2322
|
+
endRecord.writeUInt32LE(centralDirOffset, 16);
|
|
2323
|
+
endRecord.writeUInt16LE(0, 20);
|
|
2324
|
+
return Buffer.concat([localHeader, compressedData, centralHeader, endRecord]);
|
|
2325
|
+
}
|
|
2326
|
+
function calculateCrc32(data) {
|
|
2327
|
+
const table = [];
|
|
2328
|
+
for (let i = 0;i < 256; i++) {
|
|
2329
|
+
let c = i;
|
|
2330
|
+
for (let j = 0;j < 8; j++) {
|
|
2331
|
+
c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
2332
|
+
}
|
|
2333
|
+
table[i] = c;
|
|
2334
|
+
}
|
|
2335
|
+
let crc = 4294967295;
|
|
2336
|
+
for (let i = 0;i < data.length; i++) {
|
|
2337
|
+
crc = table[(crc ^ data[i]) & 255] ^ crc >>> 8;
|
|
2338
|
+
}
|
|
2339
|
+
return (crc ^ 4294967295) >>> 0;
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
class LambdaClient {
|
|
2343
|
+
client;
|
|
2344
|
+
region;
|
|
2345
|
+
constructor(region = "us-east-1", profile) {
|
|
2346
|
+
this.region = region;
|
|
2347
|
+
this.client = new AWSClient(undefined, { profile });
|
|
2348
|
+
}
|
|
2349
|
+
async createFunction(params) {
|
|
2350
|
+
const result = await this.client.request({
|
|
2351
|
+
service: "lambda",
|
|
2352
|
+
region: this.region,
|
|
2353
|
+
method: "POST",
|
|
2354
|
+
path: "/2015-03-31/functions",
|
|
2355
|
+
headers: {
|
|
2356
|
+
"Content-Type": "application/json"
|
|
2357
|
+
},
|
|
2358
|
+
body: JSON.stringify(params)
|
|
2359
|
+
});
|
|
2360
|
+
return result;
|
|
2361
|
+
}
|
|
2362
|
+
async getFunction(functionName) {
|
|
2363
|
+
const result = await this.client.request({
|
|
2364
|
+
service: "lambda",
|
|
2365
|
+
region: this.region,
|
|
2366
|
+
method: "GET",
|
|
2367
|
+
path: `/2015-03-31/functions/${encodeURIComponent(functionName)}`,
|
|
2368
|
+
headers: {
|
|
2369
|
+
"Content-Type": "application/json"
|
|
2370
|
+
}
|
|
2371
|
+
});
|
|
2372
|
+
return result;
|
|
2373
|
+
}
|
|
2374
|
+
async updateFunctionCode(params) {
|
|
2375
|
+
const { FunctionName, ...rest } = params;
|
|
2376
|
+
const result = await this.client.request({
|
|
2377
|
+
service: "lambda",
|
|
2378
|
+
region: this.region,
|
|
2379
|
+
method: "PUT",
|
|
2380
|
+
path: `/2015-03-31/functions/${encodeURIComponent(FunctionName)}/code`,
|
|
2381
|
+
headers: {
|
|
2382
|
+
"Content-Type": "application/json"
|
|
2383
|
+
},
|
|
2384
|
+
body: JSON.stringify(rest)
|
|
2385
|
+
});
|
|
2386
|
+
return result;
|
|
2387
|
+
}
|
|
2388
|
+
async updateFunctionCodeInline(functionName, code, filename = "index.js") {
|
|
2389
|
+
const zipBuffer = createZipFile(filename, code);
|
|
2390
|
+
return this.updateFunctionCode({
|
|
2391
|
+
FunctionName: functionName,
|
|
2392
|
+
ZipFile: zipBuffer.toString("base64")
|
|
2393
|
+
});
|
|
2394
|
+
}
|
|
2395
|
+
async updateFunctionConfiguration(params) {
|
|
2396
|
+
const { FunctionName, ...rest } = params;
|
|
2397
|
+
const result = await this.client.request({
|
|
2398
|
+
service: "lambda",
|
|
2399
|
+
region: this.region,
|
|
2400
|
+
method: "PUT",
|
|
2401
|
+
path: `/2015-03-31/functions/${encodeURIComponent(FunctionName)}/configuration`,
|
|
2402
|
+
headers: {
|
|
2403
|
+
"Content-Type": "application/json"
|
|
2404
|
+
},
|
|
2405
|
+
body: JSON.stringify(rest)
|
|
2406
|
+
});
|
|
2407
|
+
return result;
|
|
2408
|
+
}
|
|
2409
|
+
async deleteFunction(functionName) {
|
|
2410
|
+
await this.client.request({
|
|
2411
|
+
service: "lambda",
|
|
2412
|
+
region: this.region,
|
|
2413
|
+
method: "DELETE",
|
|
2414
|
+
path: `/2015-03-31/functions/${encodeURIComponent(functionName)}`,
|
|
2415
|
+
headers: {
|
|
2416
|
+
"Content-Type": "application/json"
|
|
2417
|
+
}
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2420
|
+
async invoke(params) {
|
|
2421
|
+
const { FunctionName, InvocationType = "RequestResponse", Payload, LogType } = params;
|
|
2422
|
+
const headers = {
|
|
2423
|
+
"Content-Type": "application/json",
|
|
2424
|
+
"X-Amz-Invocation-Type": InvocationType
|
|
2425
|
+
};
|
|
2426
|
+
if (LogType) {
|
|
2427
|
+
headers["X-Amz-Log-Type"] = LogType;
|
|
2428
|
+
}
|
|
2429
|
+
const body = Payload ? typeof Payload === "string" ? Payload : JSON.stringify(Payload) : undefined;
|
|
2430
|
+
const result = await this.client.request({
|
|
2431
|
+
service: "lambda",
|
|
2432
|
+
region: this.region,
|
|
2433
|
+
method: "POST",
|
|
2434
|
+
path: `/2015-03-31/functions/${encodeURIComponent(FunctionName)}/invocations`,
|
|
2435
|
+
headers,
|
|
2436
|
+
body,
|
|
2437
|
+
returnHeaders: true
|
|
2438
|
+
});
|
|
2439
|
+
return {
|
|
2440
|
+
StatusCode: result.statusCode || 200,
|
|
2441
|
+
FunctionError: result.headers?.["x-amz-function-error"],
|
|
2442
|
+
LogResult: result.headers?.["x-amz-log-result"],
|
|
2443
|
+
Payload: typeof result.body === "string" ? result.body : JSON.stringify(result.body),
|
|
2444
|
+
ExecutedVersion: result.headers?.["x-amz-executed-version"]
|
|
2445
|
+
};
|
|
2446
|
+
}
|
|
2447
|
+
async listFunctions(params) {
|
|
2448
|
+
const queryParams = {};
|
|
2449
|
+
if (params?.MaxItems)
|
|
2450
|
+
queryParams.MaxItems = String(params.MaxItems);
|
|
2451
|
+
if (params?.Marker)
|
|
2452
|
+
queryParams.Marker = params.Marker;
|
|
2453
|
+
if (params?.FunctionVersion)
|
|
2454
|
+
queryParams.FunctionVersion = params.FunctionVersion;
|
|
2455
|
+
const result = await this.client.request({
|
|
2456
|
+
service: "lambda",
|
|
2457
|
+
region: this.region,
|
|
2458
|
+
method: "GET",
|
|
2459
|
+
path: "/2015-03-31/functions",
|
|
2460
|
+
queryParams: Object.keys(queryParams).length > 0 ? queryParams : undefined,
|
|
2461
|
+
headers: {
|
|
2462
|
+
"Content-Type": "application/json"
|
|
2463
|
+
}
|
|
2464
|
+
});
|
|
2465
|
+
return result;
|
|
2466
|
+
}
|
|
2467
|
+
async addPermission(params) {
|
|
2468
|
+
const { FunctionName, ...rest } = params;
|
|
2469
|
+
const result = await this.client.request({
|
|
2470
|
+
service: "lambda",
|
|
2471
|
+
region: this.region,
|
|
2472
|
+
method: "POST",
|
|
2473
|
+
path: `/2015-03-31/functions/${encodeURIComponent(FunctionName)}/policy`,
|
|
2474
|
+
headers: {
|
|
2475
|
+
"Content-Type": "application/json"
|
|
2476
|
+
},
|
|
2477
|
+
body: JSON.stringify(rest)
|
|
2478
|
+
});
|
|
2479
|
+
return result;
|
|
2480
|
+
}
|
|
2481
|
+
async removePermission(functionName, statementId) {
|
|
2482
|
+
await this.client.request({
|
|
2483
|
+
service: "lambda",
|
|
2484
|
+
region: this.region,
|
|
2485
|
+
method: "DELETE",
|
|
2486
|
+
path: `/2015-03-31/functions/${encodeURIComponent(functionName)}/policy/${encodeURIComponent(statementId)}`,
|
|
2487
|
+
headers: {
|
|
2488
|
+
"Content-Type": "application/json"
|
|
2489
|
+
}
|
|
2490
|
+
});
|
|
2491
|
+
}
|
|
2492
|
+
async publishVersion(params) {
|
|
2493
|
+
const { FunctionName, ...rest } = params;
|
|
2494
|
+
const result = await this.client.request({
|
|
2495
|
+
service: "lambda",
|
|
2496
|
+
region: this.region,
|
|
2497
|
+
method: "POST",
|
|
2498
|
+
path: `/2015-03-31/functions/${encodeURIComponent(FunctionName)}/versions`,
|
|
2499
|
+
headers: {
|
|
2500
|
+
"Content-Type": "application/json"
|
|
2501
|
+
},
|
|
2502
|
+
body: JSON.stringify(rest)
|
|
2503
|
+
});
|
|
2504
|
+
return result;
|
|
2505
|
+
}
|
|
2506
|
+
async createAlias(params) {
|
|
2507
|
+
const { FunctionName, ...rest } = params;
|
|
2508
|
+
const result = await this.client.request({
|
|
2509
|
+
service: "lambda",
|
|
2510
|
+
region: this.region,
|
|
2511
|
+
method: "POST",
|
|
2512
|
+
path: `/2015-03-31/functions/${encodeURIComponent(FunctionName)}/aliases`,
|
|
2513
|
+
headers: {
|
|
2514
|
+
"Content-Type": "application/json"
|
|
2515
|
+
},
|
|
2516
|
+
body: JSON.stringify(rest)
|
|
2517
|
+
});
|
|
2518
|
+
return result;
|
|
2519
|
+
}
|
|
2520
|
+
async updateAlias(params) {
|
|
2521
|
+
const { FunctionName, Name, ...rest } = params;
|
|
2522
|
+
return this.client.request({
|
|
2523
|
+
service: "lambda",
|
|
2524
|
+
region: this.region,
|
|
2525
|
+
method: "PUT",
|
|
2526
|
+
path: `/2015-03-31/functions/${encodeURIComponent(FunctionName)}/aliases/${encodeURIComponent(Name)}`,
|
|
2527
|
+
headers: { "Content-Type": "application/json" },
|
|
2528
|
+
body: JSON.stringify(rest)
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
async getAlias(functionName, name) {
|
|
2532
|
+
try {
|
|
2533
|
+
return await this.client.request({
|
|
2534
|
+
service: "lambda",
|
|
2535
|
+
region: this.region,
|
|
2536
|
+
method: "GET",
|
|
2537
|
+
path: `/2015-03-31/functions/${encodeURIComponent(functionName)}/aliases/${encodeURIComponent(name)}`
|
|
2538
|
+
});
|
|
2539
|
+
} catch (err) {
|
|
2540
|
+
if (/ResourceNotFound/i.test(String(err?.message)))
|
|
2541
|
+
return null;
|
|
2542
|
+
throw err;
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
async getProvisionedConcurrencyConfig(functionName, qualifier) {
|
|
2546
|
+
try {
|
|
2547
|
+
return await this.client.request({
|
|
2548
|
+
service: "lambda",
|
|
2549
|
+
region: this.region,
|
|
2550
|
+
method: "GET",
|
|
2551
|
+
path: `/2019-09-30/functions/${encodeURIComponent(functionName)}/provisioned-concurrency`,
|
|
2552
|
+
queryParams: { Qualifier: qualifier }
|
|
2553
|
+
});
|
|
2554
|
+
} catch (err) {
|
|
2555
|
+
if (/ProvisionedConcurrencyConfigNotFound|ResourceNotFound/i.test(String(err?.message)))
|
|
2556
|
+
return null;
|
|
2557
|
+
throw err;
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
async putProvisionedConcurrencyConfig(params) {
|
|
2561
|
+
const { FunctionName, Qualifier, ProvisionedConcurrentExecutions } = params;
|
|
2562
|
+
return this.client.request({
|
|
2563
|
+
service: "lambda",
|
|
2564
|
+
region: this.region,
|
|
2565
|
+
method: "PUT",
|
|
2566
|
+
path: `/2019-09-30/functions/${encodeURIComponent(FunctionName)}/provisioned-concurrency`,
|
|
2567
|
+
queryParams: { Qualifier },
|
|
2568
|
+
headers: { "Content-Type": "application/json" },
|
|
2569
|
+
body: JSON.stringify({ ProvisionedConcurrentExecutions })
|
|
2570
|
+
});
|
|
2571
|
+
}
|
|
2572
|
+
async deleteProvisionedConcurrencyConfig(functionName, qualifier) {
|
|
2573
|
+
await this.client.request({
|
|
2574
|
+
service: "lambda",
|
|
2575
|
+
region: this.region,
|
|
2576
|
+
method: "DELETE",
|
|
2577
|
+
path: `/2019-09-30/functions/${encodeURIComponent(functionName)}/provisioned-concurrency`,
|
|
2578
|
+
queryParams: { Qualifier: qualifier }
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
async waitForFunctionActive(functionName, maxWaitSeconds = 60) {
|
|
2582
|
+
const startTime = Date.now();
|
|
2583
|
+
const maxWaitMs = maxWaitSeconds * 1000;
|
|
2584
|
+
while (Date.now() - startTime < maxWaitMs) {
|
|
2585
|
+
try {
|
|
2586
|
+
const response = await this.getFunction(functionName);
|
|
2587
|
+
const state = response.Configuration?.State;
|
|
2588
|
+
if (state === "Active") {
|
|
2589
|
+
return response.Configuration;
|
|
2590
|
+
}
|
|
2591
|
+
if (state === "Failed") {
|
|
2592
|
+
throw new Error(`Function ${functionName} failed: ${response.Configuration?.StateReason}`);
|
|
2593
|
+
}
|
|
2594
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
2595
|
+
} catch (error) {
|
|
2596
|
+
if (error.code === "ResourceNotFoundException") {
|
|
2597
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
2598
|
+
continue;
|
|
2599
|
+
}
|
|
2600
|
+
throw error;
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
throw new Error(`Timeout waiting for function ${functionName} to become active`);
|
|
2604
|
+
}
|
|
2605
|
+
async functionExists(functionName) {
|
|
2606
|
+
try {
|
|
2607
|
+
await this.getFunction(functionName);
|
|
2608
|
+
return true;
|
|
2609
|
+
} catch (error) {
|
|
2610
|
+
if (error.code === "ResourceNotFoundException" || error.statusCode === 404) {
|
|
2611
|
+
return false;
|
|
2612
|
+
}
|
|
2613
|
+
throw error;
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
async createFunctionUrl(params) {
|
|
2617
|
+
const { FunctionName, ...rest } = params;
|
|
2618
|
+
const result = await this.client.request({
|
|
2619
|
+
service: "lambda",
|
|
2620
|
+
region: this.region,
|
|
2621
|
+
method: "POST",
|
|
2622
|
+
path: `/2021-10-31/functions/${encodeURIComponent(FunctionName)}/url`,
|
|
2623
|
+
headers: {
|
|
2624
|
+
"Content-Type": "application/json"
|
|
2625
|
+
},
|
|
2626
|
+
body: JSON.stringify(rest)
|
|
2627
|
+
});
|
|
2628
|
+
return result;
|
|
2629
|
+
}
|
|
2630
|
+
async getFunctionUrl(functionName) {
|
|
2631
|
+
try {
|
|
2632
|
+
const result = await this.client.request({
|
|
2633
|
+
service: "lambda",
|
|
2634
|
+
region: this.region,
|
|
2635
|
+
method: "GET",
|
|
2636
|
+
path: `/2021-10-31/functions/${encodeURIComponent(functionName)}/url`,
|
|
2637
|
+
headers: {
|
|
2638
|
+
"Content-Type": "application/json"
|
|
2639
|
+
}
|
|
2640
|
+
});
|
|
2641
|
+
return result;
|
|
2642
|
+
} catch (error) {
|
|
2643
|
+
if (error.statusCode === 404) {
|
|
2644
|
+
return null;
|
|
2645
|
+
}
|
|
2646
|
+
throw error;
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
async deleteFunctionUrl(functionName) {
|
|
2650
|
+
await this.client.request({
|
|
2651
|
+
service: "lambda",
|
|
2652
|
+
region: this.region,
|
|
2653
|
+
method: "DELETE",
|
|
2654
|
+
path: `/2021-10-31/functions/${encodeURIComponent(functionName)}/url`,
|
|
2655
|
+
headers: {
|
|
2656
|
+
"Content-Type": "application/json"
|
|
2657
|
+
}
|
|
2658
|
+
});
|
|
1186
2659
|
}
|
|
1187
|
-
async
|
|
1188
|
-
const
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
if (value !== undefined) {
|
|
1195
|
-
formParams[`attributes.entry.${attrIndex}.key`] = key;
|
|
1196
|
-
formParams[`attributes.entry.${attrIndex}.value`] = value;
|
|
1197
|
-
attrIndex++;
|
|
2660
|
+
async createFunctionWithCode(params) {
|
|
2661
|
+
const { Code, Filename = "index.js", ...rest } = params;
|
|
2662
|
+
const zipBuffer = createZipFile(Filename, Code);
|
|
2663
|
+
return this.createFunction({
|
|
2664
|
+
...rest,
|
|
2665
|
+
Code: {
|
|
2666
|
+
ZipFile: zipBuffer.toString("base64")
|
|
1198
2667
|
}
|
|
1199
2668
|
});
|
|
1200
|
-
|
|
1201
|
-
|
|
2669
|
+
}
|
|
2670
|
+
async addFunctionUrlPermission(functionName) {
|
|
2671
|
+
return this.addPermission({
|
|
2672
|
+
FunctionName: functionName,
|
|
2673
|
+
StatementId: "FunctionURLAllowPublicAccess",
|
|
2674
|
+
Action: "lambda:InvokeFunctionUrl",
|
|
2675
|
+
Principal: "*",
|
|
2676
|
+
FunctionUrlAuthType: "NONE"
|
|
2677
|
+
});
|
|
2678
|
+
}
|
|
2679
|
+
async publishLayerVersion(params) {
|
|
2680
|
+
const { LayerName, ...rest } = params;
|
|
2681
|
+
const result = await this.client.request({
|
|
2682
|
+
service: "lambda",
|
|
1202
2683
|
region: this.region,
|
|
1203
2684
|
method: "POST",
|
|
1204
|
-
path:
|
|
2685
|
+
path: `/2018-10-31/layers/${encodeURIComponent(LayerName)}/versions`,
|
|
1205
2686
|
headers: {
|
|
1206
|
-
"Content-Type": "application/
|
|
2687
|
+
"Content-Type": "application/json"
|
|
1207
2688
|
},
|
|
1208
|
-
body:
|
|
2689
|
+
body: JSON.stringify(rest)
|
|
1209
2690
|
});
|
|
2691
|
+
return result;
|
|
1210
2692
|
}
|
|
1211
|
-
async
|
|
2693
|
+
async listLayerVersions(layerName, params) {
|
|
2694
|
+
const queryParams = {};
|
|
2695
|
+
if (params?.CompatibleRuntime)
|
|
2696
|
+
queryParams.CompatibleRuntime = params.CompatibleRuntime;
|
|
2697
|
+
if (params?.CompatibleArchitecture)
|
|
2698
|
+
queryParams.CompatibleArchitecture = params.CompatibleArchitecture;
|
|
2699
|
+
if (params?.MaxItems)
|
|
2700
|
+
queryParams.MaxItems = String(params.MaxItems);
|
|
2701
|
+
if (params?.Marker)
|
|
2702
|
+
queryParams.Marker = params.Marker;
|
|
1212
2703
|
const result = await this.client.request({
|
|
1213
|
-
service: "
|
|
2704
|
+
service: "lambda",
|
|
1214
2705
|
region: this.region,
|
|
1215
|
-
method: "
|
|
1216
|
-
path:
|
|
2706
|
+
method: "GET",
|
|
2707
|
+
path: `/2018-10-31/layers/${encodeURIComponent(layerName)}/versions`,
|
|
2708
|
+
queryParams: Object.keys(queryParams).length > 0 ? queryParams : undefined,
|
|
1217
2709
|
headers: {
|
|
1218
|
-
"Content-Type": "application/
|
|
1219
|
-
}
|
|
1220
|
-
body: this.buildFormBody({
|
|
1221
|
-
Action: "CheckIfPhoneNumberIsOptedOut",
|
|
1222
|
-
Version: "2010-03-31",
|
|
1223
|
-
phoneNumber
|
|
1224
|
-
})
|
|
2710
|
+
"Content-Type": "application/json"
|
|
2711
|
+
}
|
|
1225
2712
|
});
|
|
1226
|
-
return result
|
|
2713
|
+
return result;
|
|
1227
2714
|
}
|
|
1228
|
-
async
|
|
1229
|
-
const formParams = {
|
|
1230
|
-
Action: "ListPhoneNumbersOptedOut",
|
|
1231
|
-
Version: "2010-03-31"
|
|
1232
|
-
};
|
|
1233
|
-
if (nextToken)
|
|
1234
|
-
formParams.nextToken = nextToken;
|
|
2715
|
+
async getLayerVersion(layerName, versionNumber) {
|
|
1235
2716
|
const result = await this.client.request({
|
|
1236
|
-
service: "
|
|
2717
|
+
service: "lambda",
|
|
2718
|
+
region: this.region,
|
|
2719
|
+
method: "GET",
|
|
2720
|
+
path: `/2018-10-31/layers/${encodeURIComponent(layerName)}/versions/${versionNumber}`,
|
|
2721
|
+
headers: {
|
|
2722
|
+
"Content-Type": "application/json"
|
|
2723
|
+
}
|
|
2724
|
+
});
|
|
2725
|
+
return result;
|
|
2726
|
+
}
|
|
2727
|
+
async addLayerVersionPermission(params) {
|
|
2728
|
+
const { LayerName, VersionNumber, ...rest } = params;
|
|
2729
|
+
const result = await this.client.request({
|
|
2730
|
+
service: "lambda",
|
|
1237
2731
|
region: this.region,
|
|
1238
2732
|
method: "POST",
|
|
1239
|
-
path:
|
|
2733
|
+
path: `/2018-10-31/layers/${encodeURIComponent(LayerName)}/versions/${VersionNumber}/policy`,
|
|
1240
2734
|
headers: {
|
|
1241
|
-
"Content-Type": "application/
|
|
2735
|
+
"Content-Type": "application/json"
|
|
1242
2736
|
},
|
|
1243
|
-
body:
|
|
2737
|
+
body: JSON.stringify(rest)
|
|
1244
2738
|
});
|
|
1245
|
-
|
|
1246
|
-
return {
|
|
1247
|
-
phoneNumbers: Array.isArray(phones) ? phones : phones ? [phones] : [],
|
|
1248
|
-
nextToken: result?.ListPhoneNumbersOptedOutResponse?.ListPhoneNumbersOptedOutResult?.nextToken
|
|
1249
|
-
};
|
|
2739
|
+
return result;
|
|
1250
2740
|
}
|
|
1251
|
-
async
|
|
2741
|
+
async deleteLayerVersion(layerName, versionNumber) {
|
|
1252
2742
|
await this.client.request({
|
|
1253
|
-
service: "
|
|
2743
|
+
service: "lambda",
|
|
2744
|
+
region: this.region,
|
|
2745
|
+
method: "DELETE",
|
|
2746
|
+
path: `/2018-10-31/layers/${encodeURIComponent(layerName)}/versions/${versionNumber}`,
|
|
2747
|
+
headers: {
|
|
2748
|
+
"Content-Type": "application/json"
|
|
2749
|
+
}
|
|
2750
|
+
});
|
|
2751
|
+
}
|
|
2752
|
+
}
|
|
2753
|
+
// src/aws/cloudwatch-logs.ts
|
|
2754
|
+
class CloudWatchLogsClient {
|
|
2755
|
+
client;
|
|
2756
|
+
region;
|
|
2757
|
+
constructor(region = "us-east-1", profile) {
|
|
2758
|
+
this.region = region;
|
|
2759
|
+
this.client = new AWSClient(undefined, { profile });
|
|
2760
|
+
}
|
|
2761
|
+
async createLogGroup(logGroupName, tags) {
|
|
2762
|
+
await this.client.request({
|
|
2763
|
+
service: "logs",
|
|
1254
2764
|
region: this.region,
|
|
1255
2765
|
method: "POST",
|
|
1256
2766
|
path: "/",
|
|
1257
|
-
headers: {
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
2767
|
+
headers: { "X-Amz-Target": "Logs_20140328.CreateLogGroup", "Content-Type": "application/x-amz-json-1.1" },
|
|
2768
|
+
body: JSON.stringify({ logGroupName, ...tags ? { tags } : {} })
|
|
2769
|
+
});
|
|
2770
|
+
}
|
|
2771
|
+
async putRetentionPolicy(logGroupName, retentionInDays) {
|
|
2772
|
+
if (![
|
|
2773
|
+
1,
|
|
2774
|
+
3,
|
|
2775
|
+
5,
|
|
2776
|
+
7,
|
|
2777
|
+
14,
|
|
2778
|
+
30,
|
|
2779
|
+
60,
|
|
2780
|
+
90,
|
|
2781
|
+
120,
|
|
2782
|
+
150,
|
|
2783
|
+
180,
|
|
2784
|
+
365,
|
|
2785
|
+
400,
|
|
2786
|
+
545,
|
|
2787
|
+
731,
|
|
2788
|
+
1096,
|
|
2789
|
+
1827,
|
|
2790
|
+
2192,
|
|
2791
|
+
2557,
|
|
2792
|
+
2922,
|
|
2793
|
+
3288,
|
|
2794
|
+
3653
|
|
2795
|
+
].includes(retentionInDays))
|
|
2796
|
+
throw new Error("Unsupported CloudWatch Logs retention period");
|
|
2797
|
+
await this.client.request({
|
|
2798
|
+
service: "logs",
|
|
2799
|
+
region: this.region,
|
|
2800
|
+
method: "POST",
|
|
2801
|
+
path: "/",
|
|
2802
|
+
headers: { "X-Amz-Target": "Logs_20140328.PutRetentionPolicy", "Content-Type": "application/x-amz-json-1.1" },
|
|
2803
|
+
body: JSON.stringify({ logGroupName, retentionInDays })
|
|
1265
2804
|
});
|
|
1266
2805
|
}
|
|
1267
|
-
async
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1270
|
-
Version: "2010-03-31"
|
|
2806
|
+
async describeLogStreams(options) {
|
|
2807
|
+
const params = {
|
|
2808
|
+
logGroupName: options.logGroupName
|
|
1271
2809
|
};
|
|
1272
|
-
if (
|
|
1273
|
-
|
|
2810
|
+
if (options.logStreamNamePrefix)
|
|
2811
|
+
params.logStreamNamePrefix = options.logStreamNamePrefix;
|
|
2812
|
+
if (options.orderBy)
|
|
2813
|
+
params.orderBy = options.orderBy;
|
|
2814
|
+
if (options.descending !== undefined)
|
|
2815
|
+
params.descending = options.descending;
|
|
2816
|
+
if (options.limit)
|
|
2817
|
+
params.limit = options.limit;
|
|
1274
2818
|
const result = await this.client.request({
|
|
1275
|
-
service: "
|
|
2819
|
+
service: "logs",
|
|
1276
2820
|
region: this.region,
|
|
1277
2821
|
method: "POST",
|
|
1278
2822
|
path: "/",
|
|
1279
2823
|
headers: {
|
|
1280
|
-
"
|
|
2824
|
+
"X-Amz-Target": "Logs_20140328.DescribeLogStreams",
|
|
2825
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1281
2826
|
},
|
|
1282
|
-
body:
|
|
2827
|
+
body: JSON.stringify(params)
|
|
1283
2828
|
});
|
|
1284
|
-
|
|
1285
|
-
return {
|
|
1286
|
-
PhoneNumbers: Array.isArray(phones) ? phones : phones ? [phones] : [],
|
|
1287
|
-
NextToken: result?.ListSMSSandboxPhoneNumbersResponse?.ListSMSSandboxPhoneNumbersResult?.NextToken
|
|
1288
|
-
};
|
|
2829
|
+
return result;
|
|
1289
2830
|
}
|
|
1290
|
-
async
|
|
1291
|
-
|
|
1292
|
-
|
|
2831
|
+
async getLogEvents(options) {
|
|
2832
|
+
const params = {
|
|
2833
|
+
logGroupName: options.logGroupName,
|
|
2834
|
+
logStreamName: options.logStreamName
|
|
2835
|
+
};
|
|
2836
|
+
if (options.startTime)
|
|
2837
|
+
params.startTime = options.startTime;
|
|
2838
|
+
if (options.endTime)
|
|
2839
|
+
params.endTime = options.endTime;
|
|
2840
|
+
if (options.limit)
|
|
2841
|
+
params.limit = options.limit;
|
|
2842
|
+
if (options.startFromHead !== undefined)
|
|
2843
|
+
params.startFromHead = options.startFromHead;
|
|
2844
|
+
const result = await this.client.request({
|
|
2845
|
+
service: "logs",
|
|
1293
2846
|
region: this.region,
|
|
1294
2847
|
method: "POST",
|
|
1295
2848
|
path: "/",
|
|
1296
2849
|
headers: {
|
|
1297
|
-
"
|
|
2850
|
+
"X-Amz-Target": "Logs_20140328.GetLogEvents",
|
|
2851
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1298
2852
|
},
|
|
1299
|
-
body:
|
|
1300
|
-
Action: "CreateSMSSandboxPhoneNumber",
|
|
1301
|
-
Version: "2010-03-31",
|
|
1302
|
-
PhoneNumber: phoneNumber,
|
|
1303
|
-
LanguageCode: languageCode || "en-US"
|
|
1304
|
-
})
|
|
2853
|
+
body: JSON.stringify(params)
|
|
1305
2854
|
});
|
|
2855
|
+
return result;
|
|
1306
2856
|
}
|
|
1307
|
-
async
|
|
1308
|
-
|
|
1309
|
-
|
|
2857
|
+
async describeLogGroups(options) {
|
|
2858
|
+
const params = {};
|
|
2859
|
+
if (options?.logGroupNamePrefix)
|
|
2860
|
+
params.logGroupNamePrefix = options.logGroupNamePrefix;
|
|
2861
|
+
if (options?.limit)
|
|
2862
|
+
params.limit = options.limit;
|
|
2863
|
+
const result = await this.client.request({
|
|
2864
|
+
service: "logs",
|
|
1310
2865
|
region: this.region,
|
|
1311
2866
|
method: "POST",
|
|
1312
2867
|
path: "/",
|
|
1313
2868
|
headers: {
|
|
1314
|
-
"
|
|
2869
|
+
"X-Amz-Target": "Logs_20140328.DescribeLogGroups",
|
|
2870
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1315
2871
|
},
|
|
1316
|
-
body:
|
|
1317
|
-
Action: "VerifySMSSandboxPhoneNumber",
|
|
1318
|
-
Version: "2010-03-31",
|
|
1319
|
-
PhoneNumber: phoneNumber,
|
|
1320
|
-
OneTimePassword: oneTimePassword
|
|
1321
|
-
})
|
|
2872
|
+
body: JSON.stringify(params)
|
|
1322
2873
|
});
|
|
2874
|
+
return result;
|
|
1323
2875
|
}
|
|
1324
|
-
async
|
|
2876
|
+
async deleteLogGroup(logGroupName) {
|
|
1325
2877
|
await this.client.request({
|
|
1326
|
-
service: "
|
|
2878
|
+
service: "logs",
|
|
1327
2879
|
region: this.region,
|
|
1328
2880
|
method: "POST",
|
|
1329
2881
|
path: "/",
|
|
1330
2882
|
headers: {
|
|
1331
|
-
"
|
|
2883
|
+
"X-Amz-Target": "Logs_20140328.DeleteLogGroup",
|
|
2884
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1332
2885
|
},
|
|
1333
|
-
body:
|
|
1334
|
-
Action: "DeleteSMSSandboxPhoneNumber",
|
|
1335
|
-
Version: "2010-03-31",
|
|
1336
|
-
PhoneNumber: phoneNumber
|
|
1337
|
-
})
|
|
2886
|
+
body: JSON.stringify({ logGroupName })
|
|
1338
2887
|
});
|
|
1339
2888
|
}
|
|
1340
|
-
async
|
|
2889
|
+
async filterLogEvents(options) {
|
|
2890
|
+
const params = {
|
|
2891
|
+
logGroupName: options.logGroupName
|
|
2892
|
+
};
|
|
2893
|
+
if (options.logStreamNames)
|
|
2894
|
+
params.logStreamNames = options.logStreamNames;
|
|
2895
|
+
if (options.startTime)
|
|
2896
|
+
params.startTime = options.startTime;
|
|
2897
|
+
if (options.endTime)
|
|
2898
|
+
params.endTime = options.endTime;
|
|
2899
|
+
if (options.filterPattern)
|
|
2900
|
+
params.filterPattern = options.filterPattern;
|
|
2901
|
+
if (options.limit)
|
|
2902
|
+
params.limit = options.limit;
|
|
1341
2903
|
const result = await this.client.request({
|
|
1342
|
-
service: "
|
|
2904
|
+
service: "logs",
|
|
1343
2905
|
region: this.region,
|
|
1344
2906
|
method: "POST",
|
|
1345
2907
|
path: "/",
|
|
1346
2908
|
headers: {
|
|
1347
|
-
"
|
|
2909
|
+
"X-Amz-Target": "Logs_20140328.FilterLogEvents",
|
|
2910
|
+
"Content-Type": "application/x-amz-json-1.1"
|
|
1348
2911
|
},
|
|
1349
|
-
body:
|
|
1350
|
-
Action: "GetSMSSandboxAccountStatus",
|
|
1351
|
-
Version: "2010-03-31"
|
|
1352
|
-
})
|
|
2912
|
+
body: JSON.stringify(params)
|
|
1353
2913
|
});
|
|
1354
|
-
return
|
|
1355
|
-
IsInSandbox: result?.GetSMSSandboxAccountStatusResponse?.GetSMSSandboxAccountStatusResult?.IsInSandbox === "true"
|
|
1356
|
-
};
|
|
2914
|
+
return result;
|
|
1357
2915
|
}
|
|
1358
2916
|
}
|
|
1359
2917
|
// src/aws/connect.ts
|
|
@@ -1865,9 +3423,7 @@ class ConnectClient {
|
|
|
1865
3423
|
},
|
|
1866
3424
|
Transitions: {
|
|
1867
3425
|
NextAction: "disconnect",
|
|
1868
|
-
Errors: [
|
|
1869
|
-
{ NextAction: "disconnect", ErrorType: "NoMatchingError" }
|
|
1870
|
-
]
|
|
3426
|
+
Errors: [{ NextAction: "disconnect", ErrorType: "NoMatchingError" }]
|
|
1871
3427
|
}
|
|
1872
3428
|
},
|
|
1873
3429
|
disconnect: {
|
|
@@ -2850,7 +4406,7 @@ class BedrockRuntimeClient {
|
|
|
2850
4406
|
return { accessKeyId, secretAccessKey, sessionToken };
|
|
2851
4407
|
}
|
|
2852
4408
|
signStreamRequest(method, path, headers, body, credentials) {
|
|
2853
|
-
const
|
|
4409
|
+
const crypto2 = __require("node:crypto");
|
|
2854
4410
|
const service = "bedrock-runtime";
|
|
2855
4411
|
const region = this.region;
|
|
2856
4412
|
const host = `${service}.${region}.amazonaws.com`;
|
|
@@ -2865,21 +4421,14 @@ class BedrockRuntimeClient {
|
|
|
2865
4421
|
if (credentials.sessionToken) {
|
|
2866
4422
|
allHeaders["x-amz-security-token"] = credentials.sessionToken;
|
|
2867
4423
|
}
|
|
2868
|
-
const payloadHash =
|
|
4424
|
+
const payloadHash = crypto2.createHash("sha256").update(body, "utf8").digest("hex");
|
|
2869
4425
|
allHeaders["x-amz-content-sha256"] = payloadHash;
|
|
2870
4426
|
allHeaders["content-length"] = Buffer.byteLength(body).toString();
|
|
2871
4427
|
const sortedHeaderKeys = Object.keys(allHeaders).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
|
2872
4428
|
const canonicalHeaders = sortedHeaderKeys.map((key) => `${key.toLowerCase()}:${allHeaders[key].trim()}
|
|
2873
4429
|
`).join("");
|
|
2874
4430
|
const signedHeaders = sortedHeaderKeys.map((key) => key.toLowerCase()).join(";");
|
|
2875
|
-
const canonicalRequest = [
|
|
2876
|
-
method,
|
|
2877
|
-
path,
|
|
2878
|
-
"",
|
|
2879
|
-
canonicalHeaders,
|
|
2880
|
-
signedHeaders,
|
|
2881
|
-
payloadHash
|
|
2882
|
-
].join(`
|
|
4431
|
+
const canonicalRequest = [method, path, "", canonicalHeaders, signedHeaders, payloadHash].join(`
|
|
2883
4432
|
`);
|
|
2884
4433
|
const algorithm = "AWS4-HMAC-SHA256";
|
|
2885
4434
|
const credentialScope = `${dateStamp}/${region}/${service}/aws4_request`;
|
|
@@ -2887,14 +4436,14 @@ class BedrockRuntimeClient {
|
|
|
2887
4436
|
algorithm,
|
|
2888
4437
|
amzDate,
|
|
2889
4438
|
credentialScope,
|
|
2890
|
-
|
|
4439
|
+
crypto2.createHash("sha256").update(canonicalRequest).digest("hex")
|
|
2891
4440
|
].join(`
|
|
2892
4441
|
`);
|
|
2893
|
-
const kDate =
|
|
2894
|
-
const kRegion =
|
|
2895
|
-
const kService =
|
|
2896
|
-
const kSigning =
|
|
2897
|
-
const signature =
|
|
4442
|
+
const kDate = crypto2.createHmac("sha256", `AWS4${credentials.secretAccessKey}`).update(dateStamp).digest();
|
|
4443
|
+
const kRegion = crypto2.createHmac("sha256", kDate).update(region).digest();
|
|
4444
|
+
const kService = crypto2.createHmac("sha256", kRegion).update(service).digest();
|
|
4445
|
+
const kSigning = crypto2.createHmac("sha256", kService).update("aws4_request").digest();
|
|
4446
|
+
const signature = crypto2.createHmac("sha256", kSigning).update(stringToSign).digest("hex");
|
|
2898
4447
|
const authorizationHeader = `${algorithm} Credential=${credentials.accessKeyId}/${credentialScope}, SignedHeaders=${signedHeaders}, Signature=${signature}`;
|
|
2899
4448
|
return {
|
|
2900
4449
|
...allHeaders,
|
|
@@ -5322,6 +6871,71 @@ async function retrieveForRag(indexId, query, options) {
|
|
|
5322
6871
|
score: r.ScoreAttributes?.ScoreConfidence || "NOT_AVAILABLE"
|
|
5323
6872
|
}));
|
|
5324
6873
|
}
|
|
6874
|
+
// src/aws/eventbridge.ts
|
|
6875
|
+
class EventBridgeClient {
|
|
6876
|
+
client;
|
|
6877
|
+
region;
|
|
6878
|
+
constructor(region = "us-east-1") {
|
|
6879
|
+
this.region = region;
|
|
6880
|
+
this.client = new AWSClient;
|
|
6881
|
+
}
|
|
6882
|
+
async request(action, params) {
|
|
6883
|
+
return this.client.request({
|
|
6884
|
+
service: "events",
|
|
6885
|
+
region: this.region,
|
|
6886
|
+
method: "POST",
|
|
6887
|
+
path: "/",
|
|
6888
|
+
headers: {
|
|
6889
|
+
"Content-Type": "application/x-amz-json-1.1",
|
|
6890
|
+
"X-Amz-Target": `AWSEvents.${action}`
|
|
6891
|
+
},
|
|
6892
|
+
body: JSON.stringify(params)
|
|
6893
|
+
});
|
|
6894
|
+
}
|
|
6895
|
+
async putRule(params) {
|
|
6896
|
+
return this.request("PutRule", params);
|
|
6897
|
+
}
|
|
6898
|
+
async deleteRule(params) {
|
|
6899
|
+
return this.request("DeleteRule", params);
|
|
6900
|
+
}
|
|
6901
|
+
async describeRule(params) {
|
|
6902
|
+
return this.request("DescribeRule", params);
|
|
6903
|
+
}
|
|
6904
|
+
async listRules(params) {
|
|
6905
|
+
return this.request("ListRules", params || {});
|
|
6906
|
+
}
|
|
6907
|
+
async listEventBuses(params) {
|
|
6908
|
+
return this.request("ListEventBuses", params || {});
|
|
6909
|
+
}
|
|
6910
|
+
async enableRule(params) {
|
|
6911
|
+
return this.request("EnableRule", params);
|
|
6912
|
+
}
|
|
6913
|
+
async disableRule(params) {
|
|
6914
|
+
return this.request("DisableRule", params);
|
|
6915
|
+
}
|
|
6916
|
+
async putTargets(params) {
|
|
6917
|
+
return this.request("PutTargets", params);
|
|
6918
|
+
}
|
|
6919
|
+
async removeTargets(params) {
|
|
6920
|
+
return this.request("RemoveTargets", params);
|
|
6921
|
+
}
|
|
6922
|
+
async listTargetsByRule(params) {
|
|
6923
|
+
return this.request("ListTargetsByRule", params);
|
|
6924
|
+
}
|
|
6925
|
+
async putEvents(params) {
|
|
6926
|
+
return this.request("PutEvents", params);
|
|
6927
|
+
}
|
|
6928
|
+
async createSchedule(params) {
|
|
6929
|
+
return this.client.request({
|
|
6930
|
+
service: "scheduler",
|
|
6931
|
+
region: this.region,
|
|
6932
|
+
method: "POST",
|
|
6933
|
+
path: `/schedules/${params.Name}`,
|
|
6934
|
+
headers: { "Content-Type": "application/json" },
|
|
6935
|
+
body: JSON.stringify(params)
|
|
6936
|
+
});
|
|
6937
|
+
}
|
|
6938
|
+
}
|
|
5325
6939
|
// src/aws/elasticache.ts
|
|
5326
6940
|
class ElastiCacheClient {
|
|
5327
6941
|
client;
|
|
@@ -5471,15 +7085,17 @@ class ElastiCacheClient {
|
|
|
5471
7085
|
}
|
|
5472
7086
|
parseCacheClusters(result) {
|
|
5473
7087
|
if (result.CacheClusterId) {
|
|
5474
|
-
return [
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
7088
|
+
return [
|
|
7089
|
+
{
|
|
7090
|
+
CacheClusterId: result.CacheClusterId,
|
|
7091
|
+
CacheClusterStatus: result.CacheClusterStatus || "available",
|
|
7092
|
+
Engine: result.Engine || "redis",
|
|
7093
|
+
EngineVersion: result.EngineVersion || "7.0",
|
|
7094
|
+
CacheNodeType: result.CacheNodeType || "cache.t3.micro",
|
|
7095
|
+
NumCacheNodes: Number.parseInt(result.NumCacheNodes || "1"),
|
|
7096
|
+
CacheClusterCreateTime: result.CacheClusterCreateTime || new Date().toISOString()
|
|
7097
|
+
}
|
|
7098
|
+
];
|
|
5483
7099
|
}
|
|
5484
7100
|
return [];
|
|
5485
7101
|
}
|
|
@@ -6271,10 +7887,10 @@ class ApplicationAutoScalingClient {
|
|
|
6271
7887
|
}
|
|
6272
7888
|
}
|
|
6273
7889
|
// src/aws/imap-server.ts
|
|
7890
|
+
import * as crypto2 from "node:crypto";
|
|
6274
7891
|
import * as net from "node:net";
|
|
6275
7892
|
import * as tls from "node:tls";
|
|
6276
|
-
import { readFileSync } from "node:fs";
|
|
6277
|
-
import * as crypto from "node:crypto";
|
|
7893
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
6278
7894
|
class ImapServer {
|
|
6279
7895
|
config;
|
|
6280
7896
|
s3;
|
|
@@ -6307,8 +7923,8 @@ class ImapServer {
|
|
|
6307
7923
|
});
|
|
6308
7924
|
if (this.config.tls?.key && this.config.tls?.cert) {
|
|
6309
7925
|
const tlsOptions = {
|
|
6310
|
-
key:
|
|
6311
|
-
cert:
|
|
7926
|
+
key: readFileSync2(this.config.tls.key),
|
|
7927
|
+
cert: readFileSync2(this.config.tls.cert)
|
|
6312
7928
|
};
|
|
6313
7929
|
this.tlsServer = tls.createServer(tlsOptions, (socket) => {
|
|
6314
7930
|
this.handleConnection(socket);
|
|
@@ -6331,7 +7947,7 @@ class ImapServer {
|
|
|
6331
7947
|
this.sessions.clear();
|
|
6332
7948
|
}
|
|
6333
7949
|
handleConnection(socket) {
|
|
6334
|
-
const sessionId =
|
|
7950
|
+
const sessionId = crypto2.randomUUID();
|
|
6335
7951
|
const session = {
|
|
6336
7952
|
id: sessionId,
|
|
6337
7953
|
socket,
|
|
@@ -7112,8 +8728,8 @@ class ImapServer {
|
|
|
7112
8728
|
}
|
|
7113
8729
|
this.send(session, `${tag} OK Begin TLS negotiation`);
|
|
7114
8730
|
const tlsOptions = {
|
|
7115
|
-
key:
|
|
7116
|
-
cert:
|
|
8731
|
+
key: readFileSync2(this.config.tls.key),
|
|
8732
|
+
cert: readFileSync2(this.config.tls.cert),
|
|
7117
8733
|
isServer: true
|
|
7118
8734
|
};
|
|
7119
8735
|
const tlsSocket = new tls.TLSSocket(session.socket, tlsOptions);
|
|
@@ -7707,10 +9323,10 @@ async function startImapServer(config) {
|
|
|
7707
9323
|
return server;
|
|
7708
9324
|
}
|
|
7709
9325
|
// src/aws/smtp-server.ts
|
|
9326
|
+
import * as crypto3 from "node:crypto";
|
|
7710
9327
|
import * as net2 from "node:net";
|
|
7711
9328
|
import * as tls2 from "node:tls";
|
|
7712
|
-
import { readFileSync as
|
|
7713
|
-
import * as crypto2 from "node:crypto";
|
|
9329
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
7714
9330
|
class SmtpServer {
|
|
7715
9331
|
config;
|
|
7716
9332
|
ses;
|
|
@@ -7739,8 +9355,8 @@ class SmtpServer {
|
|
|
7739
9355
|
});
|
|
7740
9356
|
if (this.config.tls?.key && this.config.tls?.cert) {
|
|
7741
9357
|
const tlsOptions = {
|
|
7742
|
-
key:
|
|
7743
|
-
cert:
|
|
9358
|
+
key: readFileSync3(this.config.tls.key),
|
|
9359
|
+
cert: readFileSync3(this.config.tls.cert)
|
|
7744
9360
|
};
|
|
7745
9361
|
this.tlsServer = tls2.createServer(tlsOptions, (socket) => {
|
|
7746
9362
|
this.handleConnection(socket, true);
|
|
@@ -7763,7 +9379,7 @@ class SmtpServer {
|
|
|
7763
9379
|
this.sessions.clear();
|
|
7764
9380
|
}
|
|
7765
9381
|
handleConnection(socket, secure) {
|
|
7766
|
-
const sessionId =
|
|
9382
|
+
const sessionId = crypto3.randomUUID();
|
|
7767
9383
|
const session = {
|
|
7768
9384
|
id: sessionId,
|
|
7769
9385
|
socket,
|
|
@@ -7874,8 +9490,8 @@ class SmtpServer {
|
|
|
7874
9490
|
}
|
|
7875
9491
|
this.send(session, "220 Ready to start TLS");
|
|
7876
9492
|
const tlsOptions = {
|
|
7877
|
-
key:
|
|
7878
|
-
cert:
|
|
9493
|
+
key: readFileSync3(this.config.tls.key),
|
|
9494
|
+
cert: readFileSync3(this.config.tls.cert),
|
|
7879
9495
|
isServer: true
|
|
7880
9496
|
};
|
|
7881
9497
|
const tlsSocket = new tls2.TLSSocket(session.socket, tlsOptions);
|
|
@@ -8920,8 +10536,8 @@ async function forwardToWebhook(url, receipt, secret) {
|
|
|
8920
10536
|
"Content-Type": "application/json"
|
|
8921
10537
|
};
|
|
8922
10538
|
if (secret) {
|
|
8923
|
-
const
|
|
8924
|
-
const signature =
|
|
10539
|
+
const crypto4 = await import("node:crypto");
|
|
10540
|
+
const signature = crypto4.createHmac("sha256", secret).update(body).digest("hex");
|
|
8925
10541
|
headers["X-SMS-Signature"] = signature;
|
|
8926
10542
|
headers["X-SMS-Timestamp"] = Date.now().toString();
|
|
8927
10543
|
}
|
|
@@ -10424,4 +12040,49 @@ async function createSmsInfrastructure(smsConfig) {
|
|
|
10424
12040
|
};
|
|
10425
12041
|
return setupSmsInfrastructure(setupConfig);
|
|
10426
12042
|
}
|
|
10427
|
-
|
|
12043
|
+
// src/aws/efs.ts
|
|
12044
|
+
class EFSClient {
|
|
12045
|
+
client;
|
|
12046
|
+
region;
|
|
12047
|
+
constructor(region = "us-east-1") {
|
|
12048
|
+
this.region = region;
|
|
12049
|
+
this.client = new AWSClient;
|
|
12050
|
+
}
|
|
12051
|
+
async describeFileSystems(options) {
|
|
12052
|
+
const queryParams = [];
|
|
12053
|
+
if (options?.FileSystemId) {
|
|
12054
|
+
queryParams.push(`FileSystemId=${encodeURIComponent(options.FileSystemId)}`);
|
|
12055
|
+
}
|
|
12056
|
+
if (options?.CreationToken) {
|
|
12057
|
+
queryParams.push(`CreationToken=${encodeURIComponent(options.CreationToken)}`);
|
|
12058
|
+
}
|
|
12059
|
+
const path = `/2015-02-01/file-systems${queryParams.length > 0 ? `?${queryParams.join("&")}` : ""}`;
|
|
12060
|
+
const result = await this.client.request({
|
|
12061
|
+
service: "elasticfilesystem",
|
|
12062
|
+
region: this.region,
|
|
12063
|
+
method: "GET",
|
|
12064
|
+
path,
|
|
12065
|
+
headers: {
|
|
12066
|
+
"Content-Type": "application/json"
|
|
12067
|
+
}
|
|
12068
|
+
});
|
|
12069
|
+
return {
|
|
12070
|
+
FileSystems: (result.FileSystems || []).map((fs) => ({
|
|
12071
|
+
FileSystemId: fs.FileSystemId,
|
|
12072
|
+
Name: fs.Name,
|
|
12073
|
+
CreationTime: fs.CreationTime,
|
|
12074
|
+
LifeCycleState: fs.LifeCycleState,
|
|
12075
|
+
NumberOfMountTargets: fs.NumberOfMountTargets,
|
|
12076
|
+
SizeInBytes: fs.SizeInBytes ? {
|
|
12077
|
+
Value: fs.SizeInBytes.Value,
|
|
12078
|
+
Timestamp: fs.SizeInBytes.Timestamp
|
|
12079
|
+
} : undefined,
|
|
12080
|
+
PerformanceMode: fs.PerformanceMode,
|
|
12081
|
+
Encrypted: fs.Encrypted,
|
|
12082
|
+
ThroughputMode: fs.ThroughputMode,
|
|
12083
|
+
Tags: fs.Tags
|
|
12084
|
+
}))
|
|
12085
|
+
};
|
|
12086
|
+
}
|
|
12087
|
+
}
|
|
12088
|
+
export { STSClient, AwsBackupClient, remapKey, keyMatchesFilters, migrateObjectStorage, providerEndpoint, resolveObjectStorage, createObjectStorageClient, CostExplorerClient, Route53DomainsClient, ECSClient, SecretsManagerClient, SNSClient, SQSClient, LambdaClient, CloudWatchLogsClient, ConnectClient, ELBv2Client, DynamoDBClient, OpenSearchClient, TranscribeClient, BedrockRuntimeClient, BedrockClient, BedrockAgentRuntimeClient, BedrockAgentClient, requestModelAccess, listClaudeModels, completeWithClaude, generateEmbeddings, ComprehendClient, analyzeSentiment, extractEntities, detectLanguage, containsPii, RekognitionClient, detectLabelsFromS3, countFacesInS3Image, isContentSafe, TextractClient, extractTextFromS3, extractFormsFromS3, extractTablesFromS3, PollyClient, textToSpeech, listVoices, createSSML, TranslateClient, translate, translateToMultiple, listLanguages, PersonalizeClient, PersonalizeRuntimeClient, PersonalizeEventsClient, getRecommendations, getSimilarItems, trackEvent, KendraClient, search, retrieveForRag, EventBridgeClient, ElastiCacheClient, SchedulerClient, ApplicationAutoScalingClient, ImapServer, startImapServer, SmtpServer, startSmtpServer, SmsClient, createSmsInboxHandler, createScheduledSmsHandler, createSmsClient, createDeliveryReceiptHandler, normalizePhoneNumber, formatPhoneNumber, isValidPhoneNumber, getCountryCode, isSamePhoneNumber, VoiceClient, createVoicemailHandler, createRecordingHandler, createVoiceClient, SupportClient, SupportTemplates, setupSmsInfrastructure, getSmsInfrastructureStatus, createSmsInfrastructure, EFSClient };
|