@monorise/sst 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.sst/platform/src/components/aws/apigatewayv2.d.ts +1 -3
- package/dist/.sst/platform/src/components/aws/apigatewayv2.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/aurora.d.ts +4 -4
- package/dist/.sst/platform/src/components/aws/aurora.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/auth.d.ts +38 -3
- package/dist/.sst/platform/src/components/aws/auth.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/bucket.d.ts +102 -1
- package/dist/.sst/platform/src/components/aws/bucket.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/cluster.d.ts +1 -3
- package/dist/.sst/platform/src/components/aws/cluster.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/cognito-user-pool-client.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/cognito-user-pool.d.ts +4 -0
- package/dist/.sst/platform/src/components/aws/cognito-user-pool.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/dynamo.d.ts +0 -1
- package/dist/.sst/platform/src/components/aws/dynamo.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/email.d.ts +1 -1
- package/dist/.sst/platform/src/components/aws/fargate.d.ts +34 -0
- package/dist/.sst/platform/src/components/aws/fargate.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/function.d.ts +1 -3
- package/dist/.sst/platform/src/components/aws/function.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/helpers/arn.d.ts +5 -0
- package/dist/.sst/platform/src/components/aws/helpers/arn.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/open-search.d.ts +4 -4
- package/dist/.sst/platform/src/components/aws/open-search.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/opencontrol.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/permission.d.ts +13 -0
- package/dist/.sst/platform/src/components/aws/permission.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/postgres.d.ts +3 -3
- package/dist/.sst/platform/src/components/aws/postgres.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/realtime.d.ts +6 -0
- package/dist/.sst/platform/src/components/aws/realtime.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/redis.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/remix.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/router.d.ts +20 -14
- package/dist/.sst/platform/src/components/aws/router.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/service.d.ts +26 -0
- package/dist/.sst/platform/src/components/aws/service.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/solid-start.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/ssr-site.d.ts +197 -6
- package/dist/.sst/platform/src/components/aws/ssr-site.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/static-site.d.ts +5 -5
- package/dist/.sst/platform/src/components/aws/static-site.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/step-functions/state.d.ts +34 -0
- package/dist/.sst/platform/src/components/aws/step-functions/state.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/step-functions.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/svelte-kit.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/tan-stack-start.d.ts +1 -1
- package/dist/.sst/platform/src/components/aws/task.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/aws/vpc.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/base/base-ssr-site.d.ts +1 -99
- package/dist/.sst/platform/src/components/base/base-ssr-site.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/base/base-static-site.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/cloudflare/binding.d.ts +1 -1
- package/dist/.sst/platform/src/components/cloudflare/binding.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/cloudflare/bucket.d.ts +4 -2
- package/dist/.sst/platform/src/components/cloudflare/bucket.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/cloudflare/cron.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/cloudflare/d1.d.ts +1 -1
- package/dist/.sst/platform/src/components/cloudflare/experimental/astro.d.ts +186 -0
- package/dist/.sst/platform/src/components/cloudflare/experimental/astro.d.ts.map +1 -0
- package/dist/.sst/platform/src/components/cloudflare/experimental/index.d.ts +4 -0
- package/dist/.sst/platform/src/components/cloudflare/experimental/index.d.ts.map +1 -0
- package/dist/.sst/platform/src/components/cloudflare/experimental/solid-start.d.ts +171 -0
- package/dist/.sst/platform/src/components/cloudflare/experimental/solid-start.d.ts.map +1 -0
- package/dist/.sst/platform/src/components/cloudflare/experimental/static-site.d.ts +222 -0
- package/dist/.sst/platform/src/components/cloudflare/experimental/static-site.d.ts.map +1 -0
- package/dist/.sst/platform/src/components/cloudflare/helpers/fetch.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/cloudflare/helpers/worker-builder.d.ts +1 -1
- package/dist/.sst/platform/src/components/cloudflare/helpers/worker-builder.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/cloudflare/index.d.ts +4 -1
- package/dist/.sst/platform/src/components/cloudflare/index.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/cloudflare/kv.d.ts +8 -2
- package/dist/.sst/platform/src/components/cloudflare/kv.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/cloudflare/providers/kv-data.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/cloudflare/providers/worker-assets.d.ts +18 -0
- package/dist/.sst/platform/src/components/cloudflare/providers/worker-assets.d.ts.map +1 -0
- package/dist/.sst/platform/src/components/cloudflare/queue.d.ts +1 -1
- package/dist/.sst/platform/src/components/cloudflare/ssr-site.d.ts +34 -42
- package/dist/.sst/platform/src/components/cloudflare/ssr-site.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/cloudflare/worker.d.ts +28 -6
- package/dist/.sst/platform/src/components/cloudflare/worker.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/component.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/duration.d.ts +2 -1
- package/dist/.sst/platform/src/components/duration.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/rpc/rpc.d.ts +1 -0
- package/dist/.sst/platform/src/components/rpc/rpc.d.ts.map +1 -1
- package/dist/.sst/platform/src/components/secret.d.ts +1 -1
- package/dist/.sst/platform/src/config.d.ts +15 -0
- package/dist/.sst/platform/src/config.d.ts.map +1 -1
- package/dist/.sst/platform/src/util/fs.d.ts +5 -0
- package/dist/.sst/platform/src/util/fs.d.ts.map +1 -0
- package/dist/components/dashboard.d.ts +2 -0
- package/dist/components/dashboard.d.ts.map +1 -0
- package/dist/components/monorise-core.d.ts.map +1 -1
- package/dist/components/q-function.d.ts +1 -1
- package/dist/components/q-function.d.ts.map +1 -1
- package/dist/components/single-table.d.ts +2 -1
- package/dist/components/single-table.d.ts.map +1 -1
- package/dist/index.js +605 -7
- package/dist/index.js.map +1 -1
- package/dist/tsup.config.d.ts +3 -0
- package/dist/tsup.config.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/.sst/platform/src/components/aws/analog.js +0 -118
- package/dist/.sst/platform/src/components/aws/analog.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigateway-websocket-route.js +0 -110
- package/dist/.sst/platform/src/components/aws/apigateway-websocket-route.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigateway-websocket.js +0 -409
- package/dist/.sst/platform/src/components/aws/apigateway-websocket.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigatewayv1-api-key.js +0 -55
- package/dist/.sst/platform/src/components/aws/apigatewayv1-api-key.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigatewayv1-authorizer.js +0 -110
- package/dist/.sst/platform/src/components/aws/apigatewayv1-authorizer.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigatewayv1-base-route.js +0 -34
- package/dist/.sst/platform/src/components/aws/apigatewayv1-base-route.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigatewayv1-integration-route.js +0 -49
- package/dist/.sst/platform/src/components/aws/apigatewayv1-integration-route.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigatewayv1-lambda-route.js +0 -85
- package/dist/.sst/platform/src/components/aws/apigatewayv1-lambda-route.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigatewayv1-usage-plan.js +0 -66
- package/dist/.sst/platform/src/components/aws/apigatewayv1-usage-plan.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigatewayv1.js +0 -749
- package/dist/.sst/platform/src/components/aws/apigatewayv1.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigatewayv2-authorizer.js +0 -98
- package/dist/.sst/platform/src/components/aws/apigatewayv2-authorizer.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigatewayv2-base-route.js +0 -28
- package/dist/.sst/platform/src/components/aws/apigatewayv2-base-route.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigatewayv2-lambda-route.js +0 -84
- package/dist/.sst/platform/src/components/aws/apigatewayv2-lambda-route.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigatewayv2-private-route.js +0 -55
- package/dist/.sst/platform/src/components/aws/apigatewayv2-private-route.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigatewayv2-url-route.js +0 -53
- package/dist/.sst/platform/src/components/aws/apigatewayv2-url-route.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/apigatewayv2.js +0 -648
- package/dist/.sst/platform/src/components/aws/apigatewayv2.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/app-sync-data-source.js +0 -208
- package/dist/.sst/platform/src/components/aws/app-sync-data-source.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/app-sync-function.js +0 -52
- package/dist/.sst/platform/src/components/aws/app-sync-function.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/app-sync-resolver.js +0 -70
- package/dist/.sst/platform/src/components/aws/app-sync-resolver.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/app-sync.js +0 -330
- package/dist/.sst/platform/src/components/aws/app-sync.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/astro.js +0 -156
- package/dist/.sst/platform/src/components/aws/astro.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/aurora.js +0 -678
- package/dist/.sst/platform/src/components/aws/aurora.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/auth-v1.js +0 -36
- package/dist/.sst/platform/src/components/aws/auth-v1.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/auth.js +0 -209
- package/dist/.sst/platform/src/components/aws/auth.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/bucket-lambda-subscriber.js +0 -99
- package/dist/.sst/platform/src/components/aws/bucket-lambda-subscriber.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/bucket-notification.js +0 -170
- package/dist/.sst/platform/src/components/aws/bucket-notification.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/bucket-queue-subscriber.js +0 -77
- package/dist/.sst/platform/src/components/aws/bucket-queue-subscriber.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/bucket-topic-subscriber.js +0 -99
- package/dist/.sst/platform/src/components/aws/bucket-topic-subscriber.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/bucket.js +0 -754
- package/dist/.sst/platform/src/components/aws/bucket.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/bus-base-subscriber.js +0 -19
- package/dist/.sst/platform/src/components/aws/bus-base-subscriber.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/bus-lambda-subscriber.js +0 -81
- package/dist/.sst/platform/src/components/aws/bus-lambda-subscriber.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/bus-queue-subscriber.js +0 -63
- package/dist/.sst/platform/src/components/aws/bus-queue-subscriber.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/bus.js +0 -350
- package/dist/.sst/platform/src/components/aws/bus.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/cdn.js +0 -234
- package/dist/.sst/platform/src/components/aws/cdn.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/cluster-v1.js +0 -245
- package/dist/.sst/platform/src/components/aws/cluster-v1.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/cluster.js +0 -321
- package/dist/.sst/platform/src/components/aws/cluster.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/cognito-identity-pool.js +0 -263
- package/dist/.sst/platform/src/components/aws/cognito-identity-pool.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/cognito-identity-provider.js +0 -67
- package/dist/.sst/platform/src/components/aws/cognito-identity-provider.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/cognito-user-pool-client.js +0 -81
- package/dist/.sst/platform/src/components/aws/cognito-user-pool-client.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/cognito-user-pool.js +0 -368
- package/dist/.sst/platform/src/components/aws/cognito-user-pool.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/cron.js +0 -200
- package/dist/.sst/platform/src/components/aws/cron.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/dns-validated-certificate.js +0 -55
- package/dist/.sst/platform/src/components/aws/dns-validated-certificate.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/dns.js +0 -121
- package/dist/.sst/platform/src/components/aws/dns.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/dynamo-lambda-subscriber.js +0 -79
- package/dist/.sst/platform/src/components/aws/dynamo-lambda-subscriber.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/dynamo.js +0 -291
- package/dist/.sst/platform/src/components/aws/dynamo.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/efs.js +0 -241
- package/dist/.sst/platform/src/components/aws/efs.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/email.js +0 -276
- package/dist/.sst/platform/src/components/aws/email.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/fargate.js +0 -434
- package/dist/.sst/platform/src/components/aws/fargate.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/function.js +0 -1041
- package/dist/.sst/platform/src/components/aws/function.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/helpers/apigateway-account.js +0 -31
- package/dist/.sst/platform/src/components/aws/helpers/apigateway-account.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/helpers/apigatewayv2-domain.js +0 -2
- package/dist/.sst/platform/src/components/aws/helpers/apigatewayv2-domain.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/helpers/arn.js +0 -86
- package/dist/.sst/platform/src/components/aws/helpers/arn.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/helpers/bootstrap.js +0 -7
- package/dist/.sst/platform/src/components/aws/helpers/bootstrap.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/helpers/container-builder.js +0 -27
- package/dist/.sst/platform/src/components/aws/helpers/container-builder.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/helpers/function-builder.js +0 -51
- package/dist/.sst/platform/src/components/aws/helpers/function-builder.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/helpers/provider.js +0 -34
- package/dist/.sst/platform/src/components/aws/helpers/provider.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/helpers/quota.js +0 -20
- package/dist/.sst/platform/src/components/aws/helpers/quota.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/helpers/site-builder.js +0 -36
- package/dist/.sst/platform/src/components/aws/helpers/site-builder.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/helpers/subscriber.js +0 -13
- package/dist/.sst/platform/src/components/aws/helpers/subscriber.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/https-redirect.js +0 -124
- package/dist/.sst/platform/src/components/aws/https-redirect.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/iam-edit.js +0 -40
- package/dist/.sst/platform/src/components/aws/iam-edit.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/index.js +0 -49
- package/dist/.sst/platform/src/components/aws/index.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/kinesis-stream-lambda-subscriber.js +0 -82
- package/dist/.sst/platform/src/components/aws/kinesis-stream-lambda-subscriber.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/kinesis-stream.js +0 -134
- package/dist/.sst/platform/src/components/aws/kinesis-stream.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/linkable.js +0 -25
- package/dist/.sst/platform/src/components/aws/linkable.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/logging.js +0 -26
- package/dist/.sst/platform/src/components/aws/logging.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/mysql.js +0 -514
- package/dist/.sst/platform/src/components/aws/mysql.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/nextjs.js +0 -444
- package/dist/.sst/platform/src/components/aws/nextjs.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/nuxt.js +0 -113
- package/dist/.sst/platform/src/components/aws/nuxt.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/open-search.js +0 -365
- package/dist/.sst/platform/src/components/aws/open-search.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/opencontrol.js +0 -164
- package/dist/.sst/platform/src/components/aws/opencontrol.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/permission.js +0 -19
- package/dist/.sst/platform/src/components/aws/permission.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/postgres-v1.js +0 -304
- package/dist/.sst/platform/src/components/aws/postgres-v1.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/postgres.js +0 -532
- package/dist/.sst/platform/src/components/aws/postgres.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/providers/bucket-files.js +0 -8
- package/dist/.sst/platform/src/components/aws/providers/bucket-files.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/providers/distribution-deployment-waiter.js +0 -8
- package/dist/.sst/platform/src/components/aws/providers/distribution-deployment-waiter.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/providers/distribution-invalidation.js +0 -8
- package/dist/.sst/platform/src/components/aws/providers/distribution-invalidation.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/providers/function-environment-update.js +0 -18
- package/dist/.sst/platform/src/components/aws/providers/function-environment-update.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/providers/hosted-zone-lookup.js +0 -8
- package/dist/.sst/platform/src/components/aws/providers/hosted-zone-lookup.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/providers/kv-keys.js +0 -8
- package/dist/.sst/platform/src/components/aws/providers/kv-keys.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/providers/kv-routes-update.js +0 -8
- package/dist/.sst/platform/src/components/aws/providers/kv-routes-update.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/providers/origin-access-control.js +0 -8
- package/dist/.sst/platform/src/components/aws/providers/origin-access-control.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/providers/rds-role-lookup.js +0 -8
- package/dist/.sst/platform/src/components/aws/providers/rds-role-lookup.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/providers/vector-table.js +0 -8
- package/dist/.sst/platform/src/components/aws/providers/vector-table.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/queue-lambda-subscriber.js +0 -81
- package/dist/.sst/platform/src/components/aws/queue-lambda-subscriber.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/queue.js +0 -322
- package/dist/.sst/platform/src/components/aws/queue.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/react.js +0 -157
- package/dist/.sst/platform/src/components/aws/react.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/realtime-lambda-subscriber.js +0 -78
- package/dist/.sst/platform/src/components/aws/realtime-lambda-subscriber.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/realtime.js +0 -221
- package/dist/.sst/platform/src/components/aws/realtime.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/redis-v1.js +0 -335
- package/dist/.sst/platform/src/components/aws/redis-v1.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/redis.js +0 -382
- package/dist/.sst/platform/src/components/aws/redis.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/remix.js +0 -212
- package/dist/.sst/platform/src/components/aws/remix.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/router-base-route.js +0 -40
- package/dist/.sst/platform/src/components/aws/router-base-route.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/router-bucket-route.js +0 -40
- package/dist/.sst/platform/src/components/aws/router-bucket-route.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/router-url-route.js +0 -51
- package/dist/.sst/platform/src/components/aws/router-url-route.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/router.js +0 -1156
- package/dist/.sst/platform/src/components/aws/router.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/service-v1.js +0 -606
- package/dist/.sst/platform/src/components/aws/service-v1.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/service.js +0 -924
- package/dist/.sst/platform/src/components/aws/service.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/sns-topic-lambda-subscriber.js +0 -75
- package/dist/.sst/platform/src/components/aws/sns-topic-lambda-subscriber.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/sns-topic-queue-subscriber.js +0 -59
- package/dist/.sst/platform/src/components/aws/sns-topic-queue-subscriber.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/sns-topic.js +0 -233
- package/dist/.sst/platform/src/components/aws/sns-topic.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/solid-start.js +0 -120
- package/dist/.sst/platform/src/components/aws/solid-start.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/ssr-site.js +0 -792
- package/dist/.sst/platform/src/components/aws/ssr-site.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/static-site.js +0 -583
- package/dist/.sst/platform/src/components/aws/static-site.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/step-functions/choice.js +0 -98
- package/dist/.sst/platform/src/components/aws/step-functions/choice.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/step-functions/fail.js +0 -25
- package/dist/.sst/platform/src/components/aws/step-functions/fail.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/step-functions/map.js +0 -108
- package/dist/.sst/platform/src/components/aws/step-functions/map.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/step-functions/parallel.js +0 -129
- package/dist/.sst/platform/src/components/aws/step-functions/parallel.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/step-functions/pass.js +0 -41
- package/dist/.sst/platform/src/components/aws/step-functions/pass.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/step-functions/state.js +0 -134
- package/dist/.sst/platform/src/components/aws/step-functions/state.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/step-functions/succeed.js +0 -25
- package/dist/.sst/platform/src/components/aws/step-functions/succeed.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/step-functions/task.js +0 -116
- package/dist/.sst/platform/src/components/aws/step-functions/task.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/step-functions/wait.js +0 -46
- package/dist/.sst/platform/src/components/aws/step-functions/wait.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/step-functions.js +0 -576
- package/dist/.sst/platform/src/components/aws/step-functions.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/svelte-kit.js +0 -144
- package/dist/.sst/platform/src/components/aws/svelte-kit.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/tan-stack-start.js +0 -143
- package/dist/.sst/platform/src/components/aws/tan-stack-start.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/task.js +0 -311
- package/dist/.sst/platform/src/components/aws/task.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/vector.js +0 -224
- package/dist/.sst/platform/src/components/aws/vector.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/vpc-v1.js +0 -355
- package/dist/.sst/platform/src/components/aws/vpc-v1.js.map +0 -1
- package/dist/.sst/platform/src/components/aws/vpc.js +0 -834
- package/dist/.sst/platform/src/components/aws/vpc.js.map +0 -1
- package/dist/.sst/platform/src/components/base/base-site.js +0 -47
- package/dist/.sst/platform/src/components/base/base-site.js.map +0 -1
- package/dist/.sst/platform/src/components/base/base-ssr-site.js +0 -72
- package/dist/.sst/platform/src/components/base/base-ssr-site.js.map +0 -1
- package/dist/.sst/platform/src/components/base/base-static-site.js +0 -87
- package/dist/.sst/platform/src/components/base/base-static-site.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/account-id.js +0 -2
- package/dist/.sst/platform/src/components/cloudflare/account-id.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/auth.js +0 -37
- package/dist/.sst/platform/src/components/cloudflare/auth.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/binding.js +0 -25
- package/dist/.sst/platform/src/components/cloudflare/binding.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/bucket.js +0 -98
- package/dist/.sst/platform/src/components/cloudflare/bucket.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/cron.js +0 -86
- package/dist/.sst/platform/src/components/cloudflare/cron.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/d1.js +0 -104
- package/dist/.sst/platform/src/components/cloudflare/d1.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/dns.js +0 -138
- package/dist/.sst/platform/src/components/cloudflare/dns.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/helpers/fetch.js +0 -39
- package/dist/.sst/platform/src/components/cloudflare/helpers/fetch.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/helpers/worker-builder.js +0 -25
- package/dist/.sst/platform/src/components/cloudflare/helpers/worker-builder.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/index.js +0 -13
- package/dist/.sst/platform/src/components/cloudflare/index.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/kv.js +0 -98
- package/dist/.sst/platform/src/components/cloudflare/kv.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/providers/dns-record.js +0 -11
- package/dist/.sst/platform/src/components/cloudflare/providers/dns-record.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/providers/kv-data.js +0 -63
- package/dist/.sst/platform/src/components/cloudflare/providers/kv-data.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/providers/worker-url.js +0 -83
- package/dist/.sst/platform/src/components/cloudflare/providers/worker-url.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/providers/zone-lookup.js +0 -54
- package/dist/.sst/platform/src/components/cloudflare/providers/zone-lookup.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/queue.js +0 -57
- package/dist/.sst/platform/src/components/cloudflare/queue.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/remix.d.ts +0 -223
- package/dist/.sst/platform/src/components/cloudflare/remix.d.ts.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/remix.js +0 -291
- package/dist/.sst/platform/src/components/cloudflare/remix.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/ssr-site.js +0 -177
- package/dist/.sst/platform/src/components/cloudflare/ssr-site.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/static-site.js +0 -315
- package/dist/.sst/platform/src/components/cloudflare/static-site.js.map +0 -1
- package/dist/.sst/platform/src/components/cloudflare/worker.js +0 -326
- package/dist/.sst/platform/src/components/cloudflare/worker.js.map +0 -1
- package/dist/.sst/platform/src/components/component.js +0 -395
- package/dist/.sst/platform/src/components/component.js.map +0 -1
- package/dist/.sst/platform/src/components/cpu.js +0 -9
- package/dist/.sst/platform/src/components/cpu.js.map +0 -1
- package/dist/.sst/platform/src/components/dns.js +0 -7
- package/dist/.sst/platform/src/components/dns.js.map +0 -1
- package/dist/.sst/platform/src/components/duration.js +0 -19
- package/dist/.sst/platform/src/components/duration.js.map +0 -1
- package/dist/.sst/platform/src/components/error.js +0 -6
- package/dist/.sst/platform/src/components/error.js.map +0 -1
- package/dist/.sst/platform/src/components/experimental/dev-command.js +0 -59
- package/dist/.sst/platform/src/components/experimental/dev-command.js.map +0 -1
- package/dist/.sst/platform/src/components/experimental/index.js +0 -2
- package/dist/.sst/platform/src/components/experimental/index.js.map +0 -1
- package/dist/.sst/platform/src/components/hint.d.ts +0 -7
- package/dist/.sst/platform/src/components/hint.d.ts.map +0 -1
- package/dist/.sst/platform/src/components/hint.js +0 -20
- package/dist/.sst/platform/src/components/hint.js.map +0 -1
- package/dist/.sst/platform/src/components/index.js +0 -16
- package/dist/.sst/platform/src/components/index.js.map +0 -1
- package/dist/.sst/platform/src/components/input.js +0 -2
- package/dist/.sst/platform/src/components/input.js.map +0 -1
- package/dist/.sst/platform/src/components/link.js +0 -138
- package/dist/.sst/platform/src/components/link.js.map +0 -1
- package/dist/.sst/platform/src/components/linkable.js +0 -244
- package/dist/.sst/platform/src/components/linkable.js.map +0 -1
- package/dist/.sst/platform/src/components/naming.js +0 -58
- package/dist/.sst/platform/src/components/naming.js.map +0 -1
- package/dist/.sst/platform/src/components/path.js +0 -5
- package/dist/.sst/platform/src/components/path.js.map +0 -1
- package/dist/.sst/platform/src/components/rpc/rpc.js +0 -120
- package/dist/.sst/platform/src/components/rpc/rpc.js.map +0 -1
- package/dist/.sst/platform/src/components/secret.js +0 -143
- package/dist/.sst/platform/src/components/secret.js.map +0 -1
- package/dist/.sst/platform/src/components/size.js +0 -29
- package/dist/.sst/platform/src/components/size.js.map +0 -1
- package/dist/.sst/platform/src/components/vercel/account-id.js +0 -2
- package/dist/.sst/platform/src/components/vercel/account-id.js.map +0 -1
- package/dist/.sst/platform/src/components/vercel/dns.js +0 -104
- package/dist/.sst/platform/src/components/vercel/dns.js.map +0 -1
- package/dist/.sst/platform/src/components/vercel/index.js +0 -3
- package/dist/.sst/platform/src/components/vercel/index.js.map +0 -1
- package/dist/.sst/platform/src/components/vercel/providers/dns-record.js +0 -8
- package/dist/.sst/platform/src/components/vercel/providers/dns-record.js.map +0 -1
- package/dist/.sst/platform/src/config.js +0 -5
- package/dist/.sst/platform/src/config.js.map +0 -1
- package/dist/.sst/platform/src/util/compare-semver.js +0 -24
- package/dist/.sst/platform/src/util/compare-semver.js.map +0 -1
- package/dist/.sst/platform/src/util/lazy.js +0 -12
- package/dist/.sst/platform/src/util/lazy.js.map +0 -1
- package/dist/.sst/platform/src/util/path-to-regex.d.ts +0 -128
- package/dist/.sst/platform/src/util/path-to-regex.d.ts.map +0 -1
- package/dist/.sst/platform/src/util/path-to-regex.js +0 -392
- package/dist/.sst/platform/src/util/path-to-regex.js.map +0 -1
- package/dist/.sst/platform/src/util/semaphore.js +0 -36
- package/dist/.sst/platform/src/util/semaphore.js.map +0 -1
- package/dist/.sst/platform/src/util/warn.js +0 -8
- package/dist/.sst/platform/src/util/warn.js.map +0 -1
- package/dist/components/monorise-core.js +0 -147
- package/dist/components/monorise-core.js.map +0 -1
- package/dist/components/q-function.js +0 -53
- package/dist/components/q-function.js.map +0 -1
- package/dist/components/single-table.js +0 -73
- package/dist/components/single-table.js.map +0 -1
- package/dist/constants/event.js +0 -74
- package/dist/constants/event.js.map +0 -1
- package/dist/constants/table.js +0 -3
- package/dist/constants/table.js.map +0 -1
- package/dist/sst.config.js +0 -24
- package/dist/sst.config.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,754 +0,0 @@
|
|
|
1
|
-
import { output, interpolate, all, } from "@pulumi/pulumi";
|
|
2
|
-
import { hashStringToPrettyString, logicalName } from "../naming";
|
|
3
|
-
import { Component, transform } from "../component";
|
|
4
|
-
import { toSeconds } from "../duration";
|
|
5
|
-
import { VisibleError } from "../error";
|
|
6
|
-
import { parseBucketArn } from "./helpers/arn";
|
|
7
|
-
import { BucketLambdaSubscriber } from "./bucket-lambda-subscriber";
|
|
8
|
-
import { iam, s3 } from "@pulumi/aws";
|
|
9
|
-
import { permission } from "./permission";
|
|
10
|
-
import { BucketQueueSubscriber } from "./bucket-queue-subscriber";
|
|
11
|
-
import { BucketTopicSubscriber } from "./bucket-topic-subscriber";
|
|
12
|
-
import { BucketNotification } from "./bucket-notification";
|
|
13
|
-
/**
|
|
14
|
-
* The `Bucket` component lets you add an [AWS S3 Bucket](https://aws.amazon.com/s3/) to
|
|
15
|
-
* your app.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
*
|
|
19
|
-
* #### Minimal example
|
|
20
|
-
*
|
|
21
|
-
* ```ts title="sst.config.ts"
|
|
22
|
-
* const bucket = new sst.aws.Bucket("MyBucket");
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* #### Public read access
|
|
26
|
-
*
|
|
27
|
-
* Enable `public` read access for all the files in the bucket. Useful for hosting public files.
|
|
28
|
-
*
|
|
29
|
-
* ```ts title="sst.config.ts"
|
|
30
|
-
* new sst.aws.Bucket("MyBucket", {
|
|
31
|
-
* access: "public"
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* #### Add a subscriber
|
|
36
|
-
*
|
|
37
|
-
* ```ts title="sst.config.ts"
|
|
38
|
-
* bucket.notify({
|
|
39
|
-
* notifications: [
|
|
40
|
-
* {
|
|
41
|
-
* name: "MySubscriber",
|
|
42
|
-
* function: "src/subscriber.handler"
|
|
43
|
-
* }
|
|
44
|
-
* ]
|
|
45
|
-
* });
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* #### Link the bucket to a resource
|
|
49
|
-
*
|
|
50
|
-
* You can link the bucket to other resources, like a function or your Next.js app.
|
|
51
|
-
*
|
|
52
|
-
* ```ts title="sst.config.ts"
|
|
53
|
-
* new sst.aws.Nextjs("MyWeb", {
|
|
54
|
-
* link: [bucket]
|
|
55
|
-
* });
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* Once linked, you can generate a pre-signed URL to upload files in your app.
|
|
59
|
-
*
|
|
60
|
-
* ```ts title="app/page.tsx" {1,7}
|
|
61
|
-
* import { Resource } from "sst";
|
|
62
|
-
* import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
|
|
63
|
-
* import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
|
|
64
|
-
*
|
|
65
|
-
* const command = new PutObjectCommand({
|
|
66
|
-
* Key: "file.txt",
|
|
67
|
-
* Bucket: Resource.MyBucket.name
|
|
68
|
-
* });
|
|
69
|
-
* await getSignedUrl(new S3Client({}), command);
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
export class Bucket extends Component {
|
|
73
|
-
constructor(name, args = {}, opts = {}) {
|
|
74
|
-
var _a;
|
|
75
|
-
super(__pulumiType, name, args, opts);
|
|
76
|
-
this.isSubscribed = false;
|
|
77
|
-
this.constructorName = name;
|
|
78
|
-
this.constructorOpts = opts;
|
|
79
|
-
if (args && "ref" in args) {
|
|
80
|
-
const ref = args;
|
|
81
|
-
this.bucket = output(ref.bucket);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const parent = this;
|
|
85
|
-
const access = normalizeAccess();
|
|
86
|
-
const enforceHttps = output((_a = args.enforceHttps) !== null && _a !== void 0 ? _a : true);
|
|
87
|
-
const policyArgs = normalizePolicy();
|
|
88
|
-
const bucket = createBucket();
|
|
89
|
-
createVersioning();
|
|
90
|
-
const publicAccessBlock = createPublicAccess();
|
|
91
|
-
const policy = createBucketPolicy();
|
|
92
|
-
createCorsRule();
|
|
93
|
-
// Ensure the policy is created when the bucket is used in another component
|
|
94
|
-
// (ie. bucket.name). Also, a bucket can only have one policy. We want to ensure
|
|
95
|
-
// the policy created here is created first. And SST will throw an error if
|
|
96
|
-
// another policy is created after this one.
|
|
97
|
-
this.bucket = policy.urn.apply(() => bucket);
|
|
98
|
-
function normalizeAccess() {
|
|
99
|
-
return all([args.public, args.access]).apply(([pub, access]) => pub === true ? "public" : access);
|
|
100
|
-
}
|
|
101
|
-
function normalizePolicy() {
|
|
102
|
-
var _a;
|
|
103
|
-
return output((_a = args.policy) !== null && _a !== void 0 ? _a : []).apply((policy) => policy.map((p) => (Object.assign(Object.assign({}, p), { effect: p.effect && p.effect.charAt(0).toUpperCase() + p.effect.slice(1), principals: p.principals === "*"
|
|
104
|
-
? [{ type: "*", identifiers: ["*"] }]
|
|
105
|
-
: p.principals.map((i) => (Object.assign(Object.assign({}, i), { type: {
|
|
106
|
-
aws: "AWS",
|
|
107
|
-
service: "Service",
|
|
108
|
-
federated: "Federated",
|
|
109
|
-
canonical: "Canonical",
|
|
110
|
-
}[i.type] }))), paths: p.paths
|
|
111
|
-
? p.paths.map((path) => path.replace(/^\//, ""))
|
|
112
|
-
: ["", "*"] }))));
|
|
113
|
-
}
|
|
114
|
-
function createBucket() {
|
|
115
|
-
var _a;
|
|
116
|
-
return new s3.BucketV2(...transform((_a = args.transform) === null || _a === void 0 ? void 0 : _a.bucket, `${name}Bucket`, {
|
|
117
|
-
forceDestroy: true,
|
|
118
|
-
}, { parent }));
|
|
119
|
-
}
|
|
120
|
-
function createVersioning() {
|
|
121
|
-
return output(args.versioning).apply((versioning) => {
|
|
122
|
-
var _a;
|
|
123
|
-
if (!versioning)
|
|
124
|
-
return;
|
|
125
|
-
return new s3.BucketVersioningV2(...transform((_a = args.transform) === null || _a === void 0 ? void 0 : _a.versioning, `${name}Versioning`, {
|
|
126
|
-
bucket: bucket.bucket,
|
|
127
|
-
versioningConfiguration: {
|
|
128
|
-
status: "Enabled",
|
|
129
|
-
},
|
|
130
|
-
}, { parent }));
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
function createPublicAccess() {
|
|
134
|
-
var _a, _b;
|
|
135
|
-
if (((_a = args.transform) === null || _a === void 0 ? void 0 : _a.publicAccessBlock) === false)
|
|
136
|
-
return;
|
|
137
|
-
return new s3.BucketPublicAccessBlock(...transform((_b = args.transform) === null || _b === void 0 ? void 0 : _b.publicAccessBlock, `${name}PublicAccessBlock`, {
|
|
138
|
-
bucket: bucket.bucket,
|
|
139
|
-
blockPublicAcls: true,
|
|
140
|
-
blockPublicPolicy: access.apply((v) => v !== "public"),
|
|
141
|
-
ignorePublicAcls: true,
|
|
142
|
-
restrictPublicBuckets: access.apply((v) => v !== "public"),
|
|
143
|
-
}, { parent }));
|
|
144
|
-
}
|
|
145
|
-
function createBucketPolicy() {
|
|
146
|
-
return all([access, enforceHttps, policyArgs]).apply(([access, enforceHttps, policyArgs]) => {
|
|
147
|
-
var _a;
|
|
148
|
-
const statements = [];
|
|
149
|
-
if (access) {
|
|
150
|
-
statements.push({
|
|
151
|
-
principals: [
|
|
152
|
-
access === "public"
|
|
153
|
-
? { type: "*", identifiers: ["*"] }
|
|
154
|
-
: {
|
|
155
|
-
type: "Service",
|
|
156
|
-
identifiers: ["cloudfront.amazonaws.com"],
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
actions: ["s3:GetObject"],
|
|
160
|
-
resources: [interpolate `${bucket.arn}/*`],
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
if (enforceHttps) {
|
|
164
|
-
statements.push({
|
|
165
|
-
effect: "Deny",
|
|
166
|
-
principals: [{ type: "*", identifiers: ["*"] }],
|
|
167
|
-
actions: ["s3:*"],
|
|
168
|
-
resources: [bucket.arn, interpolate `${bucket.arn}/*`],
|
|
169
|
-
conditions: [
|
|
170
|
-
{
|
|
171
|
-
test: "Bool",
|
|
172
|
-
variable: "aws:SecureTransport",
|
|
173
|
-
values: ["false"],
|
|
174
|
-
},
|
|
175
|
-
],
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
statements.push(...policyArgs.map((policy) => ({
|
|
179
|
-
effect: policy.effect,
|
|
180
|
-
principals: policy.principals,
|
|
181
|
-
actions: policy.actions,
|
|
182
|
-
conditions: policy.conditions,
|
|
183
|
-
resources: policy.paths.map((path) => path === "" ? bucket.arn : interpolate `${bucket.arn}/${path}`),
|
|
184
|
-
})));
|
|
185
|
-
return new s3.BucketPolicy(...transform((_a = args.transform) === null || _a === void 0 ? void 0 : _a.policy, `${name}Policy`, {
|
|
186
|
-
bucket: bucket.bucket,
|
|
187
|
-
policy: iam.getPolicyDocumentOutput({ statements }).json,
|
|
188
|
-
}, {
|
|
189
|
-
parent,
|
|
190
|
-
dependsOn: publicAccessBlock,
|
|
191
|
-
}));
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
function createCorsRule() {
|
|
195
|
-
return output(args.cors).apply((cors) => {
|
|
196
|
-
var _a, _b, _c, _d, _e;
|
|
197
|
-
if (cors === false)
|
|
198
|
-
return;
|
|
199
|
-
return new s3.BucketCorsConfigurationV2(...transform((_a = args.transform) === null || _a === void 0 ? void 0 : _a.cors, `${name}Cors`, {
|
|
200
|
-
bucket: bucket.bucket,
|
|
201
|
-
corsRules: [
|
|
202
|
-
{
|
|
203
|
-
allowedHeaders: (_b = cors === null || cors === void 0 ? void 0 : cors.allowHeaders) !== null && _b !== void 0 ? _b : ["*"],
|
|
204
|
-
allowedMethods: (_c = cors === null || cors === void 0 ? void 0 : cors.allowMethods) !== null && _c !== void 0 ? _c : [
|
|
205
|
-
"DELETE",
|
|
206
|
-
"GET",
|
|
207
|
-
"HEAD",
|
|
208
|
-
"POST",
|
|
209
|
-
"PUT",
|
|
210
|
-
],
|
|
211
|
-
allowedOrigins: (_d = cors === null || cors === void 0 ? void 0 : cors.allowOrigins) !== null && _d !== void 0 ? _d : ["*"],
|
|
212
|
-
exposeHeaders: cors === null || cors === void 0 ? void 0 : cors.exposeHeaders,
|
|
213
|
-
maxAgeSeconds: toSeconds((_e = cors === null || cors === void 0 ? void 0 : cors.maxAge) !== null && _e !== void 0 ? _e : "0 seconds"),
|
|
214
|
-
},
|
|
215
|
-
],
|
|
216
|
-
}, { parent }));
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* The generated name of the S3 Bucket.
|
|
222
|
-
*/
|
|
223
|
-
get name() {
|
|
224
|
-
return this.bucket.bucket;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* The domain name of the bucket. Has the format `${bucketName}.s3.amazonaws.com`.
|
|
228
|
-
*/
|
|
229
|
-
get domain() {
|
|
230
|
-
return this.bucket.bucketDomainName;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* The ARN of the S3 Bucket.
|
|
234
|
-
*/
|
|
235
|
-
get arn() {
|
|
236
|
-
return this.bucket.arn;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* The underlying [resources](/docs/components/#nodes) this component creates.
|
|
240
|
-
*/
|
|
241
|
-
get nodes() {
|
|
242
|
-
return {
|
|
243
|
-
/**
|
|
244
|
-
* The Amazon S3 bucket.
|
|
245
|
-
*/
|
|
246
|
-
bucket: this.bucket,
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Reference an existing bucket with the given bucket name. This is useful when you
|
|
251
|
-
* create a bucket in one stage and want to share it in another stage. It avoids having to
|
|
252
|
-
* create a new bucket in the other stage.
|
|
253
|
-
*
|
|
254
|
-
* :::tip
|
|
255
|
-
* You can use the `static get` method to share buckets across stages.
|
|
256
|
-
* :::
|
|
257
|
-
*
|
|
258
|
-
* @param name The name of the component.
|
|
259
|
-
* @param bucketName The name of the existing S3 Bucket.
|
|
260
|
-
* @param opts? Resource options.
|
|
261
|
-
*
|
|
262
|
-
* @example
|
|
263
|
-
* Imagine you create a bucket in the `dev` stage. And in your personal stage `frank`,
|
|
264
|
-
* instead of creating a new bucket, you want to share the bucket from `dev`.
|
|
265
|
-
*
|
|
266
|
-
* ```ts title="sst.config.ts"
|
|
267
|
-
* const bucket = $app.stage === "frank"
|
|
268
|
-
* ? sst.aws.Bucket.get("MyBucket", "app-dev-mybucket-12345678")
|
|
269
|
-
* : new sst.aws.Bucket("MyBucket");
|
|
270
|
-
* ```
|
|
271
|
-
*
|
|
272
|
-
* Here `app-dev-mybucket-12345678` is the auto-generated bucket name for the bucket created
|
|
273
|
-
* in the `dev` stage. You can find this by outputting the bucket name in the `dev` stage.
|
|
274
|
-
*
|
|
275
|
-
* ```ts title="sst.config.ts"
|
|
276
|
-
* return {
|
|
277
|
-
* bucket: bucket.name
|
|
278
|
-
* };
|
|
279
|
-
* ```
|
|
280
|
-
*/
|
|
281
|
-
static get(name, bucketName, opts) {
|
|
282
|
-
return new Bucket(name, {
|
|
283
|
-
ref: true,
|
|
284
|
-
bucket: s3.BucketV2.get(`${name}Bucket`, bucketName, undefined, opts),
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Subscribe to event notifications from this bucket. You can subscribe to these
|
|
289
|
-
* notifications with a function, a queue, or a topic.
|
|
290
|
-
*
|
|
291
|
-
* @param args The config for the event notifications.
|
|
292
|
-
*
|
|
293
|
-
* @example
|
|
294
|
-
*
|
|
295
|
-
* For exmaple, to notify a function:
|
|
296
|
-
*
|
|
297
|
-
* ```js title="sst.config.ts" {5}
|
|
298
|
-
* bucket.notify({
|
|
299
|
-
* notifications: [
|
|
300
|
-
* {
|
|
301
|
-
* name: "MySubscriber",
|
|
302
|
-
* function: "src/subscriber.handler"
|
|
303
|
-
* }
|
|
304
|
-
* ]
|
|
305
|
-
* });
|
|
306
|
-
* ```
|
|
307
|
-
*
|
|
308
|
-
* Or let's say you have a queue.
|
|
309
|
-
*
|
|
310
|
-
* ```js title="sst.config.ts"
|
|
311
|
-
* const myQueue = new sst.aws.Queue("MyQueue");
|
|
312
|
-
* ```
|
|
313
|
-
*
|
|
314
|
-
* You can notify it by passing in the queue.
|
|
315
|
-
*
|
|
316
|
-
* ```js title="sst.config.ts" {5}
|
|
317
|
-
* bucket.notify({
|
|
318
|
-
* notifications: [
|
|
319
|
-
* {
|
|
320
|
-
* name: "MySubscriber",
|
|
321
|
-
* queue: myQueue
|
|
322
|
-
* }
|
|
323
|
-
* ]
|
|
324
|
-
* });
|
|
325
|
-
* ```
|
|
326
|
-
*
|
|
327
|
-
* Or let's say you have a topic.
|
|
328
|
-
*
|
|
329
|
-
* ```js title="sst.config.ts"
|
|
330
|
-
* const myTopic = new sst.aws.SnsTopic("MyTopic");
|
|
331
|
-
* ```
|
|
332
|
-
*
|
|
333
|
-
* You can notify it by passing in the topic.
|
|
334
|
-
*
|
|
335
|
-
* ```js title="sst.config.ts" {5}
|
|
336
|
-
* bucket.notify({
|
|
337
|
-
* notifications: [
|
|
338
|
-
* {
|
|
339
|
-
* name: "MySubscriber",
|
|
340
|
-
* topic: myTopic
|
|
341
|
-
* }
|
|
342
|
-
* ]
|
|
343
|
-
* });
|
|
344
|
-
* ```
|
|
345
|
-
*
|
|
346
|
-
* You can also set it to only send notifications for specific S3 events.
|
|
347
|
-
*
|
|
348
|
-
* ```js {6}
|
|
349
|
-
* bucket.notify({
|
|
350
|
-
* notifications: [
|
|
351
|
-
* {
|
|
352
|
-
* name: "MySubscriber",
|
|
353
|
-
* function: "src/subscriber.handler",
|
|
354
|
-
* events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
|
|
355
|
-
* }
|
|
356
|
-
* ]
|
|
357
|
-
* });
|
|
358
|
-
* ```
|
|
359
|
-
*
|
|
360
|
-
* And you can add filters to be only notified from specific files in the bucket.
|
|
361
|
-
*
|
|
362
|
-
* ```js {6}
|
|
363
|
-
* bucket.notify({
|
|
364
|
-
* notifications: [
|
|
365
|
-
* {
|
|
366
|
-
* name: "MySubscriber",
|
|
367
|
-
* function: "src/subscriber.handler",
|
|
368
|
-
* filterPrefix: "images/"
|
|
369
|
-
* }
|
|
370
|
-
* ]
|
|
371
|
-
* });
|
|
372
|
-
* ```
|
|
373
|
-
*/
|
|
374
|
-
notify(args) {
|
|
375
|
-
if (this.isSubscribed) {
|
|
376
|
-
throw new VisibleError(`Cannot call "notify" on the "${this.constructorName}" bucket multiple times. Calling it again will override previous notifications.`);
|
|
377
|
-
}
|
|
378
|
-
this.isSubscribed = true;
|
|
379
|
-
const name = this.constructorName;
|
|
380
|
-
const opts = this.constructorOpts;
|
|
381
|
-
return new BucketNotification(`${name}Notifications`, Object.assign({ bucket: { name: this.bucket.bucket, arn: this.bucket.arn } }, args), opts);
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Subscribe to events from this bucket.
|
|
385
|
-
*
|
|
386
|
-
* @deprecated The `notify` function is now the recommended way to subscribe to events
|
|
387
|
-
* from this bucket. It allows you to configure multiple subscribers at once. To migrate,
|
|
388
|
-
* remove the current subscriber, deploy the changes, and then add the subscriber
|
|
389
|
-
* back using the new `notify` function.
|
|
390
|
-
*
|
|
391
|
-
* @param subscriber The function that'll be notified.
|
|
392
|
-
* @param args Configure the subscription.
|
|
393
|
-
*
|
|
394
|
-
* @example
|
|
395
|
-
*
|
|
396
|
-
* ```js title="sst.config.ts"
|
|
397
|
-
* bucket.subscribe("src/subscriber.handler");
|
|
398
|
-
* ```
|
|
399
|
-
*
|
|
400
|
-
* Subscribe to specific S3 events. The `link` ensures the subscriber can access the bucket.
|
|
401
|
-
*
|
|
402
|
-
* ```js title="sst.config.ts" "link: [bucket]"
|
|
403
|
-
* bucket.subscribe({
|
|
404
|
-
* handler: "src/subscriber.handler",
|
|
405
|
-
* link: [bucket]
|
|
406
|
-
* }, {
|
|
407
|
-
* events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
|
|
408
|
-
* });
|
|
409
|
-
* ```
|
|
410
|
-
*
|
|
411
|
-
* Subscribe to specific S3 events from a specific folder.
|
|
412
|
-
*
|
|
413
|
-
* ```js title="sst.config.ts" {2}
|
|
414
|
-
* bucket.subscribe("src/subscriber.handler", {
|
|
415
|
-
* filterPrefix: "images/",
|
|
416
|
-
* events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
|
|
417
|
-
* });
|
|
418
|
-
* ```
|
|
419
|
-
*
|
|
420
|
-
* Customize the subscriber function.
|
|
421
|
-
*
|
|
422
|
-
* ```js title="sst.config.ts"
|
|
423
|
-
* bucket.subscribe({
|
|
424
|
-
* handler: "src/subscriber.handler",
|
|
425
|
-
* timeout: "60 seconds",
|
|
426
|
-
* });
|
|
427
|
-
* ```
|
|
428
|
-
*
|
|
429
|
-
* Or pass in the ARN of an existing Lambda function.
|
|
430
|
-
*
|
|
431
|
-
* ```js title="sst.config.ts"
|
|
432
|
-
* bucket.subscribe("arn:aws:lambda:us-east-1:123456789012:function:my-function");
|
|
433
|
-
* ```
|
|
434
|
-
*/
|
|
435
|
-
subscribe(subscriber, args) {
|
|
436
|
-
this.ensureNotSubscribed();
|
|
437
|
-
return Bucket._subscribeFunction(this.constructorName, this.bucket.bucket, this.bucket.arn, subscriber, args, { provider: this.constructorOpts.provider });
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Subscribe to events of an S3 bucket that was not created in your app.
|
|
441
|
-
*
|
|
442
|
-
* @deprecated The `notify` function is now the recommended way to subscribe to events
|
|
443
|
-
* from this bucket. It allows you to configure multiple subscribers at once. To migrate,
|
|
444
|
-
* remove the current subscriber, deploy the changes, and then add the subscriber
|
|
445
|
-
* back using the new `notify` function.
|
|
446
|
-
*
|
|
447
|
-
* @param bucketArn The ARN of the S3 bucket to subscribe to.
|
|
448
|
-
* @param subscriber The function that'll be notified.
|
|
449
|
-
* @param args Configure the subscription.
|
|
450
|
-
*
|
|
451
|
-
* @example
|
|
452
|
-
*
|
|
453
|
-
* For example, let's say you have an existing S3 bucket with the following ARN.
|
|
454
|
-
*
|
|
455
|
-
* ```js title="sst.config.ts"
|
|
456
|
-
* const bucketArn = "arn:aws:s3:::my-bucket";
|
|
457
|
-
* ```
|
|
458
|
-
*
|
|
459
|
-
* You can subscribe to it by passing in the ARN.
|
|
460
|
-
*
|
|
461
|
-
* ```js title="sst.config.ts"
|
|
462
|
-
* sst.aws.Bucket.subscribe(bucketArn, "src/subscriber.handler");
|
|
463
|
-
* ```
|
|
464
|
-
*
|
|
465
|
-
* Subscribe to specific S3 events.
|
|
466
|
-
*
|
|
467
|
-
* ```js title="sst.config.ts"
|
|
468
|
-
* sst.aws.Bucket.subscribe(bucketArn, "src/subscriber.handler", {
|
|
469
|
-
* events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
|
|
470
|
-
* });
|
|
471
|
-
* ```
|
|
472
|
-
*
|
|
473
|
-
* Subscribe to specific S3 events from a specific folder.
|
|
474
|
-
*
|
|
475
|
-
* ```js title="sst.config.ts" {2}
|
|
476
|
-
* sst.aws.Bucket.subscribe(bucketArn, "src/subscriber.handler", {
|
|
477
|
-
* filterPrefix: "images/",
|
|
478
|
-
* events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
|
|
479
|
-
* });
|
|
480
|
-
* ```
|
|
481
|
-
*
|
|
482
|
-
* Customize the subscriber function.
|
|
483
|
-
*
|
|
484
|
-
* ```js title="sst.config.ts"
|
|
485
|
-
* sst.aws.Bucket.subscribe(bucketArn, {
|
|
486
|
-
* handler: "src/subscriber.handler",
|
|
487
|
-
* timeout: "60 seconds",
|
|
488
|
-
* });
|
|
489
|
-
* ```
|
|
490
|
-
*/
|
|
491
|
-
static subscribe(bucketArn, subscriber, args) {
|
|
492
|
-
return output(bucketArn).apply((bucketArn) => {
|
|
493
|
-
const bucketName = parseBucketArn(bucketArn).bucketName;
|
|
494
|
-
return this._subscribeFunction(bucketName, bucketName, bucketArn, subscriber, args);
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
static _subscribeFunction(name, bucketName, bucketArn, subscriber, args = {}, opts = {}) {
|
|
498
|
-
return all([bucketArn, subscriber, args]).apply(([bucketArn, subscriber, args]) => {
|
|
499
|
-
const subscriberId = this.buildSubscriberId(bucketArn, typeof subscriber === "string" ? subscriber : subscriber.handler);
|
|
500
|
-
return new BucketLambdaSubscriber(`${name}Subscriber${subscriberId}`, Object.assign({ bucket: { name: bucketName, arn: bucketArn }, subscriber,
|
|
501
|
-
subscriberId }, args), opts);
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* Subscribe to events from this bucket with an SQS Queue.
|
|
506
|
-
*
|
|
507
|
-
* @deprecated The `notify` function is now the recommended way to subscribe to events
|
|
508
|
-
* from this bucket. It allows you to configure multiple subscribers at once. To migrate,
|
|
509
|
-
* remove the current subscriber, deploy the changes, and then add the subscriber
|
|
510
|
-
* back using the new `notify` function.
|
|
511
|
-
*
|
|
512
|
-
* @param queueArn The ARN of the queue that'll be notified.
|
|
513
|
-
* @param args Configure the subscription.
|
|
514
|
-
*
|
|
515
|
-
* @example
|
|
516
|
-
*
|
|
517
|
-
* For example, let's say you have a queue.
|
|
518
|
-
*
|
|
519
|
-
* ```js title="sst.config.ts"
|
|
520
|
-
* const queue = new sst.aws.Queue("MyQueue");
|
|
521
|
-
* ```
|
|
522
|
-
*
|
|
523
|
-
* You can subscribe to this bucket with it.
|
|
524
|
-
*
|
|
525
|
-
* ```js title="sst.config.ts"
|
|
526
|
-
* bucket.subscribe(queue.arn);
|
|
527
|
-
* ```
|
|
528
|
-
*
|
|
529
|
-
* Subscribe to specific S3 events.
|
|
530
|
-
*
|
|
531
|
-
* ```js title="sst.config.ts"
|
|
532
|
-
* bucket.subscribe(queue.arn, {
|
|
533
|
-
* events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
|
|
534
|
-
* });
|
|
535
|
-
* ```
|
|
536
|
-
*
|
|
537
|
-
* Subscribe to specific S3 events from a specific folder.
|
|
538
|
-
*
|
|
539
|
-
* ```js title="sst.config.ts" {2}
|
|
540
|
-
* bucket.subscribe(queue.arn, {
|
|
541
|
-
* filterPrefix: "images/",
|
|
542
|
-
* events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
|
|
543
|
-
* });
|
|
544
|
-
* ```
|
|
545
|
-
*/
|
|
546
|
-
subscribeQueue(queueArn, args = {}) {
|
|
547
|
-
this.ensureNotSubscribed();
|
|
548
|
-
return Bucket._subscribeQueue(this.constructorName, this.bucket.bucket, this.arn, queueArn, args, { provider: this.constructorOpts.provider });
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Subscribe to events of an S3 bucket that was not created in your app with an SQS Queue.
|
|
552
|
-
*
|
|
553
|
-
* @deprecated The `notify` function is now the recommended way to subscribe to events
|
|
554
|
-
* from this bucket. It allows you to configure multiple subscribers at once. To migrate,
|
|
555
|
-
* remove the current subscriber, deploy the changes, and then add the subscriber
|
|
556
|
-
* back using the new `notify` function.
|
|
557
|
-
*
|
|
558
|
-
* @param bucketArn The ARN of the S3 bucket to subscribe to.
|
|
559
|
-
* @param queueArn The ARN of the queue that'll be notified.
|
|
560
|
-
* @param args Configure the subscription.
|
|
561
|
-
*
|
|
562
|
-
* @example
|
|
563
|
-
*
|
|
564
|
-
* For example, let's say you have an existing S3 bucket and SQS queue with the following ARNs.
|
|
565
|
-
*
|
|
566
|
-
* ```js title="sst.config.ts"
|
|
567
|
-
* const bucketArn = "arn:aws:s3:::my-bucket";
|
|
568
|
-
* const queueArn = "arn:aws:sqs:us-east-1:123456789012:MyQueue";
|
|
569
|
-
* ```
|
|
570
|
-
*
|
|
571
|
-
* You can subscribe to the bucket with the queue.
|
|
572
|
-
*
|
|
573
|
-
* ```js title="sst.config.ts"
|
|
574
|
-
* sst.aws.Bucket.subscribeQueue(bucketArn, queueArn);
|
|
575
|
-
* ```
|
|
576
|
-
*
|
|
577
|
-
* Subscribe to specific S3 events.
|
|
578
|
-
*
|
|
579
|
-
* ```js title="sst.config.ts"
|
|
580
|
-
* sst.aws.Bucket.subscribeQueue(bucketArn, queueArn, {
|
|
581
|
-
* events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
|
|
582
|
-
* });
|
|
583
|
-
* ```
|
|
584
|
-
*
|
|
585
|
-
* Subscribe to specific S3 events from a specific folder.
|
|
586
|
-
*
|
|
587
|
-
* ```js title="sst.config.ts" {2}
|
|
588
|
-
* sst.aws.Bucket.subscribeQueue(bucketArn, queueArn, {
|
|
589
|
-
* filterPrefix: "images/",
|
|
590
|
-
* events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
|
|
591
|
-
* });
|
|
592
|
-
* ```
|
|
593
|
-
*/
|
|
594
|
-
static subscribeQueue(bucketArn, queueArn, args) {
|
|
595
|
-
return output(bucketArn).apply((bucketArn) => {
|
|
596
|
-
const bucketName = parseBucketArn(bucketArn).bucketName;
|
|
597
|
-
return this._subscribeQueue(bucketName, bucketName, bucketArn, queueArn, args);
|
|
598
|
-
});
|
|
599
|
-
}
|
|
600
|
-
static _subscribeQueue(name, bucketName, bucketArn, queueArn, args = {}, opts = {}) {
|
|
601
|
-
return all([bucketArn, queueArn, args]).apply(([bucketArn, queueArn, args]) => {
|
|
602
|
-
const subscriberId = this.buildSubscriberId(bucketArn, queueArn);
|
|
603
|
-
return new BucketQueueSubscriber(`${name}Subscriber${subscriberId}`, Object.assign({ bucket: { name: bucketName, arn: bucketArn }, queue: queueArn, subscriberId }, args), opts);
|
|
604
|
-
});
|
|
605
|
-
}
|
|
606
|
-
/**
|
|
607
|
-
* Subscribe to events from this bucket with an SNS Topic.
|
|
608
|
-
*
|
|
609
|
-
* @deprecated The `notify` function is now the recommended way to subscribe to events
|
|
610
|
-
* from this bucket. It allows you to configure multiple subscribers at once. To migrate,
|
|
611
|
-
* remove the current subscriber, deploy the changes, and then add the subscriber
|
|
612
|
-
* back using the new `notify` function.
|
|
613
|
-
*
|
|
614
|
-
* @param topicArn The ARN of the topic that'll be notified.
|
|
615
|
-
* @param args Configure the subscription.
|
|
616
|
-
*
|
|
617
|
-
* @example
|
|
618
|
-
*
|
|
619
|
-
* For example, let's say you have a topic.
|
|
620
|
-
*
|
|
621
|
-
* ```js title="sst.config.ts"
|
|
622
|
-
* const topic = new sst.aws.SnsTopic("MyTopic");
|
|
623
|
-
* ```
|
|
624
|
-
*
|
|
625
|
-
* You can subscribe to this bucket with it.
|
|
626
|
-
*
|
|
627
|
-
* ```js title="sst.config.ts"
|
|
628
|
-
* bucket.subscribe(topic.arn);
|
|
629
|
-
* ```
|
|
630
|
-
*
|
|
631
|
-
* Subscribe to specific S3 events.
|
|
632
|
-
*
|
|
633
|
-
* ```js title="sst.config.ts"
|
|
634
|
-
* bucket.subscribe(topic.arn, {
|
|
635
|
-
* events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
|
|
636
|
-
* });
|
|
637
|
-
* ```
|
|
638
|
-
*
|
|
639
|
-
* Subscribe to specific S3 events from a specific folder.
|
|
640
|
-
*
|
|
641
|
-
* ```js title="sst.config.ts" {2}
|
|
642
|
-
* bucket.subscribe(topic.arn, {
|
|
643
|
-
* filterPrefix: "images/",
|
|
644
|
-
* events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
|
|
645
|
-
* });
|
|
646
|
-
* ```
|
|
647
|
-
*/
|
|
648
|
-
subscribeTopic(topicArn, args = {}) {
|
|
649
|
-
this.ensureNotSubscribed();
|
|
650
|
-
return Bucket._subscribeTopic(this.constructorName, this.bucket.bucket, this.arn, topicArn, args, { provider: this.constructorOpts.provider });
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
* Subscribe to events of an S3 bucket that was not created in your app with an SNS Topic.
|
|
654
|
-
*
|
|
655
|
-
* @deprecated The `notify` function is now the recommended way to subscribe to events
|
|
656
|
-
* from this bucket. It allows you to configure multiple subscribers at once. To migrate,
|
|
657
|
-
* remove the current subscriber, deploy the changes, and then add the subscriber
|
|
658
|
-
* back using the new `notify` function.
|
|
659
|
-
*
|
|
660
|
-
* @param bucketArn The ARN of the S3 bucket to subscribe to.
|
|
661
|
-
* @param topicArn The ARN of the topic that'll be notified.
|
|
662
|
-
* @param args Configure the subscription.
|
|
663
|
-
*
|
|
664
|
-
* @example
|
|
665
|
-
*
|
|
666
|
-
* For example, let's say you have an existing S3 bucket and SNS topic with the following ARNs.
|
|
667
|
-
*
|
|
668
|
-
* ```js title="sst.config.ts"
|
|
669
|
-
* const bucketArn = "arn:aws:s3:::my-bucket";
|
|
670
|
-
* const topicArn = "arn:aws:sns:us-east-1:123456789012:MyTopic";
|
|
671
|
-
* ```
|
|
672
|
-
*
|
|
673
|
-
* You can subscribe to the bucket with the topic.
|
|
674
|
-
*
|
|
675
|
-
* ```js title="sst.config.ts"
|
|
676
|
-
* sst.aws.Bucket.subscribe(bucketArn, topicArn);
|
|
677
|
-
* ```
|
|
678
|
-
*
|
|
679
|
-
* Subscribe to specific S3 events.
|
|
680
|
-
*
|
|
681
|
-
* ```js title="sst.config.ts"
|
|
682
|
-
* sst.aws.Bucket.subscribe(bucketArn, topicArn, {
|
|
683
|
-
* events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
|
|
684
|
-
* });
|
|
685
|
-
* ```
|
|
686
|
-
*
|
|
687
|
-
* Subscribe to specific S3 events from a specific folder.
|
|
688
|
-
*
|
|
689
|
-
* ```js title="sst.config.ts" {2}
|
|
690
|
-
* sst.aws.Bucket.subscribe(bucketArn, topicArn, {
|
|
691
|
-
* filterPrefix: "images/",
|
|
692
|
-
* events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
|
|
693
|
-
* });
|
|
694
|
-
* ```
|
|
695
|
-
*/
|
|
696
|
-
static subscribeTopic(bucketArn, topicArn, args) {
|
|
697
|
-
return output(bucketArn).apply((bucketArn) => {
|
|
698
|
-
const bucketName = parseBucketArn(bucketArn).bucketName;
|
|
699
|
-
return this._subscribeTopic(bucketName, bucketName, bucketArn, topicArn, args);
|
|
700
|
-
});
|
|
701
|
-
}
|
|
702
|
-
static _subscribeTopic(name, bucketName, bucketArn, topicArn, args = {}, opts = {}) {
|
|
703
|
-
return all([bucketArn, topicArn, args]).apply(([bucketArn, topicArn, args]) => {
|
|
704
|
-
const subscriberId = this.buildSubscriberId(bucketArn, topicArn);
|
|
705
|
-
return new BucketTopicSubscriber(`${name}Subscriber${subscriberId}`, Object.assign({ bucket: { name: bucketName, arn: bucketArn }, topic: topicArn, subscriberId }, args), opts);
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
static buildSubscriberId(bucketArn, _discriminator) {
|
|
709
|
-
return logicalName(hashStringToPrettyString([
|
|
710
|
-
bucketArn,
|
|
711
|
-
// Temporarily only allowing one subscriber per bucket because of the
|
|
712
|
-
// AWS/Terraform issue that appending/removing a notification deletes
|
|
713
|
-
// all existing notifications.
|
|
714
|
-
//
|
|
715
|
-
// A solution would be to implement a dynamic provider. On create,
|
|
716
|
-
// get existing notifications then append. And on delete, get existing
|
|
717
|
-
// notifications then remove from the list.
|
|
718
|
-
//
|
|
719
|
-
// https://github.com/hashicorp/terraform-provider-aws/issues/501
|
|
720
|
-
//
|
|
721
|
-
// Commenting out the lines below to ensure the id never changes.
|
|
722
|
-
// Because on id change, the removal of notification happens after
|
|
723
|
-
// the creation of notification. And the newly created notification
|
|
724
|
-
// gets removed.
|
|
725
|
-
//...events,
|
|
726
|
-
//args.filterPrefix ?? "",
|
|
727
|
-
//args.filterSuffix ?? "",
|
|
728
|
-
//discriminator,
|
|
729
|
-
].join(""), 6));
|
|
730
|
-
}
|
|
731
|
-
ensureNotSubscribed() {
|
|
732
|
-
if (this.isSubscribed)
|
|
733
|
-
throw new VisibleError(`Cannot subscribe to the "${this.constructorName}" bucket multiple times. An S3 bucket can only have one subscriber.`);
|
|
734
|
-
this.isSubscribed = true;
|
|
735
|
-
}
|
|
736
|
-
/** @internal */
|
|
737
|
-
getSSTLink() {
|
|
738
|
-
return {
|
|
739
|
-
properties: {
|
|
740
|
-
name: this.name,
|
|
741
|
-
},
|
|
742
|
-
include: [
|
|
743
|
-
permission({
|
|
744
|
-
actions: ["s3:*"],
|
|
745
|
-
resources: [this.arn, interpolate `${this.arn}/*`],
|
|
746
|
-
}),
|
|
747
|
-
],
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
const __pulumiType = "sst:aws:Bucket";
|
|
752
|
-
// @ts-expect-error
|
|
753
|
-
Bucket.__pulumiType = __pulumiType;
|
|
754
|
-
//# sourceMappingURL=bucket.js.map
|