alchemy-effect 0.0.0 → 0.2.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/README.md +179 -0
- package/bin/alchemy-effect.js +15 -0
- package/bin/alchemy-effect.js.map +1 -0
- package/bin/alchemy-effect.ts +10 -0
- package/lib/app.d.ts +7 -2
- package/lib/app.d.ts.map +1 -1
- package/lib/app.js +1 -0
- package/lib/app.js.map +1 -1
- package/lib/apply.d.ts +57 -1
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +141 -55
- package/lib/apply.js.map +1 -1
- package/lib/aws/account.d.ts +18 -0
- package/lib/aws/account.d.ts.map +1 -0
- package/lib/aws/account.js +18 -0
- package/lib/aws/account.js.map +1 -0
- package/lib/aws/arn.d.ts +2 -0
- package/lib/aws/arn.d.ts.map +1 -0
- package/lib/aws/arn.js +1 -0
- package/lib/aws/arn.js.map +1 -0
- package/lib/aws/assets.d.ts +8 -0
- package/lib/aws/assets.d.ts.map +1 -0
- package/lib/aws/assets.js +4 -0
- package/lib/aws/assets.js.map +1 -0
- package/lib/aws/bundle.d.ts +4 -0
- package/lib/aws/bundle.d.ts.map +1 -0
- package/lib/aws/bundle.js +4 -0
- package/lib/aws/bundle.js.map +1 -0
- package/lib/aws/client.d.ts +8 -0
- package/lib/aws/client.d.ts.map +1 -0
- package/lib/aws/client.js +28 -0
- package/lib/aws/client.js.map +1 -0
- package/lib/aws/credentials.d.ts +146 -0
- package/lib/aws/credentials.d.ts.map +1 -0
- package/lib/aws/credentials.js +170 -0
- package/lib/aws/credentials.js.map +1 -0
- package/lib/aws/dynamodb/attribute-value.d.ts +20 -0
- package/lib/aws/dynamodb/attribute-value.d.ts.map +1 -0
- package/lib/aws/dynamodb/attribute-value.js +217 -0
- package/lib/aws/dynamodb/attribute-value.js.map +1 -0
- package/lib/aws/dynamodb/client.d.ts +12 -0
- package/lib/aws/dynamodb/client.d.ts.map +1 -0
- package/lib/aws/dynamodb/client.js +11 -0
- package/lib/aws/dynamodb/client.js.map +1 -0
- package/lib/aws/dynamodb/expr.d.ts +41 -0
- package/lib/aws/dynamodb/expr.d.ts.map +1 -0
- package/lib/aws/dynamodb/expr.js +1 -0
- package/lib/aws/dynamodb/expr.js.map +1 -0
- package/lib/aws/dynamodb/index.d.ts +9 -0
- package/lib/aws/dynamodb/index.d.ts.map +1 -0
- package/lib/aws/dynamodb/index.js +10 -0
- package/lib/aws/dynamodb/index.js.map +1 -0
- package/lib/aws/dynamodb/projection.d.ts +25 -0
- package/lib/aws/dynamodb/projection.d.ts.map +1 -0
- package/lib/aws/dynamodb/projection.js +1 -0
- package/lib/aws/dynamodb/projection.js.map +1 -0
- package/lib/aws/dynamodb/secondary-index.d.ts +25 -0
- package/lib/aws/dynamodb/secondary-index.d.ts.map +1 -0
- package/lib/aws/dynamodb/secondary-index.js +4 -0
- package/lib/aws/dynamodb/secondary-index.js.map +1 -0
- package/lib/aws/dynamodb/table.d.ts +56 -0
- package/lib/aws/dynamodb/table.d.ts.map +1 -0
- package/lib/aws/dynamodb/table.get-item.d.ts +55 -0
- package/lib/aws/dynamodb/table.get-item.d.ts.map +1 -0
- package/lib/aws/dynamodb/table.get-item.js +75 -0
- package/lib/aws/dynamodb/table.get-item.js.map +1 -0
- package/lib/aws/dynamodb/table.js +4 -0
- package/lib/aws/dynamodb/table.js.map +1 -0
- package/lib/aws/dynamodb/table.provider.d.ts +8 -0
- package/lib/aws/dynamodb/table.provider.d.ts.map +1 -0
- package/lib/aws/dynamodb/table.provider.js +199 -0
- package/lib/aws/dynamodb/table.provider.js.map +1 -0
- package/lib/aws/ec2/client.d.ts +12 -0
- package/lib/aws/ec2/client.d.ts.map +1 -0
- package/lib/aws/ec2/client.js +11 -0
- package/lib/aws/ec2/client.js.map +1 -0
- package/lib/aws/ec2/index.d.ts +4 -0
- package/lib/aws/ec2/index.d.ts.map +1 -0
- package/lib/aws/ec2/index.js +4 -0
- package/lib/aws/ec2/index.js.map +1 -0
- package/lib/aws/ec2/vpc.d.ts +131 -0
- package/lib/aws/ec2/vpc.d.ts.map +1 -0
- package/lib/aws/ec2/vpc.js +3 -0
- package/lib/aws/ec2/vpc.js.map +1 -0
- package/lib/aws/ec2/vpc.provider.d.ts +7 -0
- package/lib/aws/ec2/vpc.provider.d.ts.map +1 -0
- package/lib/aws/ec2/vpc.provider.js +198 -0
- package/lib/aws/ec2/vpc.provider.js.map +1 -0
- package/lib/aws/iam.d.ts +23 -0
- package/lib/aws/iam.d.ts.map +1 -0
- package/lib/aws/iam.js +7 -0
- package/lib/aws/iam.js.map +1 -0
- package/lib/aws/index.d.ts +32 -0
- package/lib/aws/index.d.ts.map +1 -0
- package/lib/aws/index.js +23 -0
- package/lib/aws/index.js.map +1 -0
- package/lib/aws/lambda/client.d.ts +8 -0
- package/lib/aws/lambda/client.d.ts.map +1 -0
- package/lib/aws/lambda/client.js +7 -0
- package/lib/aws/lambda/client.js.map +1 -0
- package/lib/aws/lambda/consume.d.ts +17 -0
- package/lib/aws/lambda/consume.d.ts.map +1 -0
- package/lib/aws/lambda/consume.js +30 -0
- package/lib/aws/lambda/consume.js.map +1 -0
- package/lib/aws/lambda/function.d.ts +41 -0
- package/lib/aws/lambda/function.d.ts.map +1 -0
- package/lib/aws/lambda/function.handler.d.ts +7 -0
- package/lib/aws/lambda/function.handler.d.ts.map +1 -0
- package/lib/aws/lambda/function.handler.js +8 -0
- package/lib/aws/lambda/function.handler.js.map +1 -0
- package/lib/aws/lambda/function.invoke.d.ts +10 -0
- package/lib/aws/lambda/function.invoke.d.ts.map +1 -0
- package/lib/aws/lambda/function.invoke.js +31 -0
- package/lib/aws/lambda/function.invoke.js.map +1 -0
- package/lib/aws/lambda/function.js +3 -0
- package/lib/aws/lambda/function.js.map +1 -0
- package/lib/aws/lambda/function.provider.d.ts +9 -0
- package/lib/aws/lambda/function.provider.d.ts.map +1 -0
- package/lib/aws/lambda/function.provider.js +465 -0
- package/lib/aws/lambda/function.provider.js.map +1 -0
- package/lib/aws/lambda/index.d.ts +8 -0
- package/lib/aws/lambda/index.d.ts.map +1 -0
- package/lib/aws/lambda/index.js +9 -0
- package/lib/aws/lambda/index.js.map +1 -0
- package/lib/aws/lambda/serve.d.ts +14 -0
- package/lib/aws/lambda/serve.d.ts.map +1 -0
- package/lib/aws/lambda/serve.js +7 -0
- package/lib/aws/lambda/serve.js.map +1 -0
- package/lib/aws/parse-ini.d.ts +4 -0
- package/lib/aws/parse-ini.d.ts.map +1 -0
- package/lib/aws/parse-ini.js +67 -0
- package/lib/aws/parse-ini.js.map +1 -0
- package/lib/aws/profile.d.ts +6 -0
- package/lib/aws/profile.d.ts.map +1 -0
- package/lib/aws/profile.js +4 -0
- package/lib/aws/profile.js.map +1 -0
- package/lib/aws/region.d.ts +19 -0
- package/lib/aws/region.d.ts.map +1 -0
- package/lib/aws/region.js +21 -0
- package/lib/aws/region.js.map +1 -0
- package/lib/aws/s3.d.ts +8 -0
- package/lib/aws/s3.d.ts.map +1 -0
- package/lib/aws/s3.js +7 -0
- package/lib/aws/s3.js.map +1 -0
- package/lib/aws/sqs/client.d.ts +12 -0
- package/lib/aws/sqs/client.d.ts.map +1 -0
- package/lib/aws/sqs/client.js +11 -0
- package/lib/aws/sqs/client.js.map +1 -0
- package/lib/aws/sqs/index.d.ts +7 -0
- package/lib/aws/sqs/index.d.ts.map +1 -0
- package/lib/aws/sqs/index.js +7 -0
- package/lib/aws/sqs/index.js.map +1 -0
- package/lib/aws/sqs/queue.consume.d.ts +12 -0
- package/lib/aws/sqs/queue.consume.d.ts.map +1 -0
- package/lib/aws/sqs/queue.consume.js +3 -0
- package/lib/aws/sqs/queue.consume.js.map +1 -0
- package/lib/aws/sqs/queue.d.ts +79 -0
- package/lib/aws/sqs/queue.d.ts.map +1 -0
- package/lib/aws/sqs/queue.event-source.d.ts +20 -0
- package/lib/aws/sqs/queue.event-source.d.ts.map +1 -0
- package/lib/aws/sqs/queue.event-source.js +148 -0
- package/lib/aws/sqs/queue.event-source.js.map +1 -0
- package/lib/aws/sqs/queue.js +3 -0
- package/lib/aws/sqs/queue.js.map +1 -0
- package/lib/aws/sqs/queue.provider.d.ts +7 -0
- package/lib/aws/sqs/queue.provider.d.ts.map +1 -0
- package/lib/aws/sqs/queue.provider.js +79 -0
- package/lib/aws/sqs/queue.provider.js.map +1 -0
- package/lib/aws/sqs/queue.send-message.d.ts +11 -0
- package/lib/aws/sqs/queue.send-message.d.ts.map +1 -0
- package/lib/aws/sqs/queue.send-message.js +32 -0
- package/lib/aws/sqs/queue.send-message.js.map +1 -0
- package/lib/aws/sts.d.ts +8 -0
- package/lib/aws/sts.d.ts.map +1 -0
- package/lib/aws/sts.js +7 -0
- package/lib/aws/sts.js.map +1 -0
- package/lib/aws/zip.d.ts +3 -0
- package/lib/aws/zip.d.ts.map +1 -0
- package/lib/aws/zip.js +12 -0
- package/lib/aws/zip.js.map +1 -0
- package/lib/binding.d.ts +70 -22
- package/lib/binding.d.ts.map +1 -1
- package/lib/binding.js.map +1 -1
- package/lib/capability.d.ts +38 -0
- package/lib/capability.d.ts.map +1 -1
- package/lib/cli/approve.d.ts +4 -0
- package/lib/cli/approve.d.ts.map +1 -0
- package/lib/cli/approve.js +18 -0
- package/lib/cli/approve.js.map +1 -0
- package/lib/cli/clack.d.ts +14 -0
- package/lib/cli/clack.d.ts.map +1 -0
- package/lib/cli/clack.js +12 -0
- package/lib/cli/clack.js.map +1 -0
- package/lib/cli/components/ApprovePlan.d.ts +8 -0
- package/lib/cli/components/ApprovePlan.d.ts.map +1 -0
- package/lib/cli/components/ApprovePlan.js +30 -0
- package/lib/cli/components/ApprovePlan.js.map +1 -0
- package/lib/cli/components/Plan.d.ts +7 -0
- package/lib/cli/components/Plan.d.ts.map +1 -0
- package/lib/cli/components/Plan.js +100 -0
- package/lib/cli/components/Plan.js.map +1 -0
- package/lib/cli/components/PlanProgress.d.ts +9 -0
- package/lib/cli/components/PlanProgress.d.ts.map +1 -0
- package/lib/cli/components/PlanProgress.js +166 -0
- package/lib/cli/components/PlanProgress.js.map +1 -0
- package/lib/cli/index.d.ts +449 -0
- package/lib/cli/index.d.ts.map +1 -0
- package/lib/cli/index.js +39912 -0
- package/lib/cli/index.js.map +1 -0
- package/lib/cli/main.d.ts +2 -0
- package/lib/cli/main.d.ts.map +1 -0
- package/lib/cli/main.js +1 -0
- package/lib/cli/main.js.map +1 -0
- package/lib/cli/plan.d.ts +13 -0
- package/lib/cli/plan.d.ts.map +1 -0
- package/lib/cli/plan.js +1 -0
- package/lib/cli/plan.js.map +1 -0
- package/lib/cli/progress.d.ts +7 -0
- package/lib/cli/progress.d.ts.map +1 -0
- package/lib/cli/progress.js +30 -0
- package/lib/cli/progress.js.map +1 -0
- package/lib/cli/spinner.d.ts +2 -0
- package/lib/cli/spinner.d.ts.map +1 -0
- package/lib/cli/spinner.js +13 -0
- package/lib/cli/spinner.js.map +1 -0
- package/lib/cloudflare/api.d.ts +36 -0
- package/lib/cloudflare/api.d.ts.map +1 -0
- package/lib/cloudflare/api.js +99 -0
- package/lib/cloudflare/api.js.map +1 -0
- package/lib/cloudflare/context.d.ts +27 -0
- package/lib/cloudflare/context.d.ts.map +1 -0
- package/lib/cloudflare/context.js +24 -0
- package/lib/cloudflare/context.js.map +1 -0
- package/lib/cloudflare/index.d.ts +6 -0
- package/lib/cloudflare/index.d.ts.map +1 -0
- package/lib/cloudflare/index.js +5 -0
- package/lib/cloudflare/index.js.map +1 -0
- package/lib/cloudflare/kv/index.d.ts +4 -0
- package/lib/cloudflare/kv/index.d.ts.map +1 -0
- package/lib/cloudflare/kv/index.js +4 -0
- package/lib/cloudflare/kv/index.js.map +1 -0
- package/lib/cloudflare/kv/namespace.binding.d.ts +8 -0
- package/lib/cloudflare/kv/namespace.binding.d.ts.map +1 -0
- package/lib/cloudflare/kv/namespace.binding.js +15 -0
- package/lib/cloudflare/kv/namespace.binding.js.map +1 -0
- package/lib/cloudflare/kv/namespace.client.d.ts +11 -0
- package/lib/cloudflare/kv/namespace.client.d.ts.map +1 -0
- package/lib/cloudflare/kv/namespace.client.js +31 -0
- package/lib/cloudflare/kv/namespace.client.js.map +1 -0
- package/lib/cloudflare/kv/namespace.d.ts +23 -0
- package/lib/cloudflare/kv/namespace.d.ts.map +1 -0
- package/lib/cloudflare/kv/namespace.js +3 -0
- package/lib/cloudflare/kv/namespace.js.map +1 -0
- package/lib/cloudflare/kv/namespace.provider.d.ts +5 -0
- package/lib/cloudflare/kv/namespace.provider.d.ts.map +1 -0
- package/lib/cloudflare/kv/namespace.provider.js +80 -0
- package/lib/cloudflare/kv/namespace.provider.js.map +1 -0
- package/lib/cloudflare/live.d.ts +11 -0
- package/lib/cloudflare/live.d.ts.map +1 -0
- package/lib/cloudflare/live.js +18 -0
- package/lib/cloudflare/live.js.map +1 -0
- package/lib/cloudflare/r2/bucket.binding.d.ts +8 -0
- package/lib/cloudflare/r2/bucket.binding.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.binding.js +18 -0
- package/lib/cloudflare/r2/bucket.binding.js.map +1 -0
- package/lib/cloudflare/r2/bucket.client.d.ts +8 -0
- package/lib/cloudflare/r2/bucket.client.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.client.js +9 -0
- package/lib/cloudflare/r2/bucket.client.js.map +1 -0
- package/lib/cloudflare/r2/bucket.d.ts +32 -0
- package/lib/cloudflare/r2/bucket.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.del.d.ts +4 -0
- package/lib/cloudflare/r2/bucket.del.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.del.js +7 -0
- package/lib/cloudflare/r2/bucket.del.js.map +1 -0
- package/lib/cloudflare/r2/bucket.get.d.ts +5 -0
- package/lib/cloudflare/r2/bucket.get.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.get.js +7 -0
- package/lib/cloudflare/r2/bucket.get.js.map +1 -0
- package/lib/cloudflare/r2/bucket.head.d.ts +4 -0
- package/lib/cloudflare/r2/bucket.head.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.head.js +7 -0
- package/lib/cloudflare/r2/bucket.head.js.map +1 -0
- package/lib/cloudflare/r2/bucket.js +3 -0
- package/lib/cloudflare/r2/bucket.js.map +1 -0
- package/lib/cloudflare/r2/bucket.list.d.ts +5 -0
- package/lib/cloudflare/r2/bucket.list.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.list.js +7 -0
- package/lib/cloudflare/r2/bucket.list.js.map +1 -0
- package/lib/cloudflare/r2/bucket.multipart.d.ts +19 -0
- package/lib/cloudflare/r2/bucket.multipart.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.multipart.js +25 -0
- package/lib/cloudflare/r2/bucket.multipart.js.map +1 -0
- package/lib/cloudflare/r2/bucket.provider.d.ts +5 -0
- package/lib/cloudflare/r2/bucket.provider.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.provider.js +66 -0
- package/lib/cloudflare/r2/bucket.provider.js.map +1 -0
- package/lib/cloudflare/r2/bucket.put.d.ts +6 -0
- package/lib/cloudflare/r2/bucket.put.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.put.js +8 -0
- package/lib/cloudflare/r2/bucket.put.js.map +1 -0
- package/lib/cloudflare/r2/index.d.ts +10 -0
- package/lib/cloudflare/r2/index.d.ts.map +1 -0
- package/lib/cloudflare/r2/index.js +10 -0
- package/lib/cloudflare/r2/index.js.map +1 -0
- package/lib/cloudflare/stream.d.ts +10 -0
- package/lib/cloudflare/stream.d.ts.map +1 -0
- package/lib/cloudflare/stream.js +16 -0
- package/lib/cloudflare/stream.js.map +1 -0
- package/lib/cloudflare/worker/assets.fetch.d.ts +8 -0
- package/lib/cloudflare/worker/assets.fetch.d.ts.map +1 -0
- package/lib/cloudflare/worker/assets.fetch.js +11 -0
- package/lib/cloudflare/worker/assets.fetch.js.map +1 -0
- package/lib/cloudflare/worker/assets.provider.d.ts +66 -0
- package/lib/cloudflare/worker/assets.provider.d.ts.map +1 -0
- package/lib/cloudflare/worker/assets.provider.js +145 -0
- package/lib/cloudflare/worker/assets.provider.js.map +1 -0
- package/lib/cloudflare/worker/index.d.ts +6 -0
- package/lib/cloudflare/worker/index.d.ts.map +1 -0
- package/lib/cloudflare/worker/index.js +5 -0
- package/lib/cloudflare/worker/index.js.map +1 -0
- package/lib/cloudflare/worker/worker.d.ts +67 -0
- package/lib/cloudflare/worker/worker.d.ts.map +1 -0
- package/lib/cloudflare/worker/worker.handler.d.ts +11 -0
- package/lib/cloudflare/worker/worker.handler.d.ts.map +1 -0
- package/lib/cloudflare/worker/worker.handler.js +15 -0
- package/lib/cloudflare/worker/worker.handler.js.map +1 -0
- package/lib/cloudflare/worker/worker.js +4 -0
- package/lib/cloudflare/worker/worker.js.map +1 -0
- package/lib/cloudflare/worker/worker.provider.d.ts +10 -0
- package/lib/cloudflare/worker/worker.provider.d.ts.map +1 -0
- package/lib/cloudflare/worker/worker.provider.js +193 -0
- package/lib/cloudflare/worker/worker.provider.js.map +1 -0
- package/lib/cloudflare/worker/worker.serve.d.ts +39 -0
- package/lib/cloudflare/worker/worker.serve.d.ts.map +1 -0
- package/lib/cloudflare/worker/worker.serve.js +4 -0
- package/lib/cloudflare/worker/worker.serve.js.map +1 -0
- package/lib/destroy.d.ts +1 -3
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js +5 -0
- package/lib/destroy.js.map +1 -1
- package/lib/dot-alchemy.d.ts +3 -2
- package/lib/dot-alchemy.d.ts.map +1 -1
- package/lib/dot-alchemy.js +3 -2
- package/lib/dot-alchemy.js.map +1 -1
- package/lib/esbuild.d.ts +28 -0
- package/lib/esbuild.d.ts.map +1 -0
- package/lib/esbuild.js +63 -0
- package/lib/esbuild.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/plan.d.ts +19 -8
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +144 -72
- package/lib/plan.js.map +1 -1
- package/lib/policy.d.ts +19 -1
- package/lib/policy.d.ts.map +1 -1
- package/lib/policy.js +10 -1
- package/lib/policy.js.map +1 -1
- package/lib/provider.d.ts +2 -2
- package/lib/provider.d.ts.map +1 -1
- package/lib/resource.d.ts +2 -10
- package/lib/resource.d.ts.map +1 -1
- package/lib/resource.js +1 -0
- package/lib/resource.js.map +1 -1
- package/lib/runtime.d.ts +1 -1
- package/lib/runtime.d.ts.map +1 -1
- package/lib/schema.d.ts +37 -0
- package/lib/schema.d.ts.map +1 -0
- package/lib/schema.js +61 -0
- package/lib/schema.js.map +1 -0
- package/lib/sha256.d.ts +5 -0
- package/lib/sha256.d.ts.map +1 -0
- package/lib/sha256.js +16 -0
- package/lib/sha256.js.map +1 -0
- package/lib/state.d.ts +3 -2
- package/lib/state.d.ts.map +1 -1
- package/lib/state.js +3 -2
- package/lib/state.js.map +1 -1
- package/lib/tags.d.ts +17 -0
- package/lib/tags.d.ts.map +1 -0
- package/lib/tags.js +22 -0
- package/lib/tags.js.map +1 -0
- package/lib/test.d.ts +14 -0
- package/lib/test.d.ts.map +1 -0
- package/lib/test.js +28 -0
- package/lib/test.js.map +1 -0
- package/lib/tsconfig.test.tsbuildinfo +1 -0
- package/lib/type.d.ts +3 -0
- package/lib/type.d.ts.map +1 -0
- package/lib/type.js +3 -0
- package/lib/type.js.map +1 -0
- package/package.json +115 -3
- package/src/app.ts +8 -7
- package/src/apply.ts +251 -93
- package/src/aws/account.ts +37 -0
- package/src/aws/arn.ts +1 -0
- package/src/aws/assets.ts +8 -0
- package/src/aws/bundle.ts +5 -0
- package/src/aws/client.ts +47 -0
- package/src/aws/credentials.ts +409 -0
- package/src/aws/dynamodb/attribute-value.ts +240 -0
- package/src/aws/dynamodb/client.ts +20 -0
- package/src/aws/dynamodb/expr.ts +90 -0
- package/src/aws/dynamodb/index.ts +12 -0
- package/src/aws/dynamodb/projection.ts +159 -0
- package/src/aws/dynamodb/secondary-index.ts +45 -0
- package/src/aws/dynamodb/table.get-item.ts +177 -0
- package/src/aws/dynamodb/table.provider.ts +280 -0
- package/src/aws/dynamodb/table.ts +156 -0
- package/src/aws/ec2/client.ts +20 -0
- package/src/aws/ec2/index.ts +3 -0
- package/src/aws/ec2/vpc.provider.ts +285 -0
- package/src/aws/ec2/vpc.ts +152 -0
- package/src/aws/iam.ts +30 -0
- package/src/aws/index.ts +54 -0
- package/src/aws/lambda/client.ts +14 -0
- package/src/aws/lambda/consume.ts +63 -0
- package/src/aws/lambda/function.handler.ts +30 -0
- package/src/aws/lambda/function.invoke.ts +40 -0
- package/src/aws/lambda/function.provider.ts +655 -0
- package/src/aws/lambda/function.ts +45 -0
- package/src/aws/lambda/index.ts +9 -0
- package/src/aws/lambda/serve.ts +29 -0
- package/src/aws/parse-ini.ts +80 -0
- package/src/aws/profile.ts +6 -0
- package/src/aws/region.ts +37 -0
- package/src/aws/s3.ts +10 -0
- package/src/aws/sqs/client.ts +20 -0
- package/src/aws/sqs/index.ts +6 -0
- package/src/aws/sqs/queue.consume.ts +13 -0
- package/src/aws/sqs/queue.event-source.ts +253 -0
- package/src/aws/sqs/queue.provider.ts +94 -0
- package/src/aws/sqs/queue.send-message.ts +51 -0
- package/src/aws/sqs/queue.ts +86 -0
- package/src/aws/sts.ts +13 -0
- package/src/aws/zip.ts +17 -0
- package/src/binding.ts +121 -25
- package/src/capability.ts +44 -0
- package/src/cli/approve.tsx +30 -0
- package/src/cli/clack.ts +22 -0
- package/src/cli/components/ApprovePlan.tsx +44 -0
- package/src/cli/components/Plan.tsx +154 -0
- package/src/cli/components/PlanProgress.tsx +206 -0
- package/src/cli/index.ts +6 -0
- package/src/cli/main.ts +0 -0
- package/src/cli/plan.ts +16 -0
- package/src/cli/progress.tsx +46 -0
- package/src/cli/spinner.ts +14 -0
- package/src/cloudflare/api.ts +152 -0
- package/src/cloudflare/context.ts +49 -0
- package/src/cloudflare/index.ts +6 -0
- package/src/cloudflare/kv/index.ts +3 -0
- package/src/cloudflare/kv/namespace.binding.ts +25 -0
- package/src/cloudflare/kv/namespace.client.ts +70 -0
- package/src/cloudflare/kv/namespace.provider.ts +99 -0
- package/src/cloudflare/kv/namespace.ts +29 -0
- package/src/cloudflare/live.ts +38 -0
- package/src/cloudflare/r2/bucket.binding.ts +27 -0
- package/src/cloudflare/r2/bucket.client.ts +22 -0
- package/src/cloudflare/r2/bucket.del.ts +11 -0
- package/src/cloudflare/r2/bucket.get.ts +13 -0
- package/src/cloudflare/r2/bucket.head.ts +11 -0
- package/src/cloudflare/r2/bucket.list.ts +12 -0
- package/src/cloudflare/r2/bucket.multipart.ts +55 -0
- package/src/cloudflare/r2/bucket.provider.ts +83 -0
- package/src/cloudflare/r2/bucket.put.ts +17 -0
- package/src/cloudflare/r2/bucket.ts +38 -0
- package/src/cloudflare/r2/index.ts +9 -0
- package/src/cloudflare/stream.ts +21 -0
- package/src/cloudflare/worker/assets.fetch.ts +27 -0
- package/src/cloudflare/worker/assets.provider.ts +249 -0
- package/src/cloudflare/worker/index.ts +6 -0
- package/src/cloudflare/worker/worker.handler.ts +39 -0
- package/src/cloudflare/worker/worker.provider.ts +246 -0
- package/src/cloudflare/worker/worker.serve.ts +19 -0
- package/src/cloudflare/worker/worker.ts +76 -0
- package/src/destroy.ts +6 -3
- package/src/dot-alchemy.ts +3 -2
- package/src/esbuild.ts +98 -0
- package/src/index.ts +5 -0
- package/src/plan.ts +233 -120
- package/src/policy.ts +55 -2
- package/src/provider.ts +2 -2
- package/src/resource.ts +3 -2
- package/src/runtime.ts +1 -1
- package/src/schema.ts +102 -0
- package/src/sha256.ts +23 -0
- package/src/state.ts +3 -2
- package/src/tags.ts +38 -0
- package/src/test.ts +71 -0
- package/src/type.ts +2 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import * as Data from "effect/Data";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Schedule from "effect/Schedule";
|
|
5
|
+
|
|
6
|
+
import { App, type Provider, type ProviderService } from "alchemy-effect";
|
|
7
|
+
import type { TimeToLiveSpecification } from "itty-aws/dynamodb";
|
|
8
|
+
import { createTagger, hasTags } from "../../tags.ts";
|
|
9
|
+
import { Account } from "../account.ts";
|
|
10
|
+
import { Region } from "../region.ts";
|
|
11
|
+
import { isScalarAttributeType, toAttributeType } from "./attribute-value.ts";
|
|
12
|
+
import { DynamoDBClient } from "./client.ts";
|
|
13
|
+
import {
|
|
14
|
+
Table,
|
|
15
|
+
type AnyTable,
|
|
16
|
+
type TableAttrs,
|
|
17
|
+
type TableProps,
|
|
18
|
+
} from "./table.ts";
|
|
19
|
+
|
|
20
|
+
// we add an explict type to simplify the Layer type errors because the Table interface has a lot of type args
|
|
21
|
+
export const tableProvider = (): Layer.Layer<
|
|
22
|
+
Provider<AnyTable>,
|
|
23
|
+
any,
|
|
24
|
+
App | DynamoDBClient | Region | Account
|
|
25
|
+
> =>
|
|
26
|
+
Table.provider.effect(
|
|
27
|
+
// @ts-expect-error
|
|
28
|
+
Effect.gen(function* () {
|
|
29
|
+
const dynamodb = yield* DynamoDBClient;
|
|
30
|
+
const app = yield* App;
|
|
31
|
+
const region = yield* Region;
|
|
32
|
+
const accountId = yield* Account;
|
|
33
|
+
|
|
34
|
+
const createTableName = (id: string, props: TableProps) =>
|
|
35
|
+
props.tableName ?? `${app.name}-${id}-${app.stage}`;
|
|
36
|
+
|
|
37
|
+
const tagged = yield* createTagger();
|
|
38
|
+
|
|
39
|
+
const toKeySchema = (props: TableProps) => [
|
|
40
|
+
{
|
|
41
|
+
AttributeName: props.partitionKey as string,
|
|
42
|
+
KeyType: "HASH" as const,
|
|
43
|
+
},
|
|
44
|
+
...(props.sortKey
|
|
45
|
+
? [
|
|
46
|
+
{
|
|
47
|
+
AttributeName: props.sortKey as string,
|
|
48
|
+
KeyType: "RANGE" as const,
|
|
49
|
+
},
|
|
50
|
+
]
|
|
51
|
+
: []),
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
const toAttributeDefinitions = (props: TableProps) =>
|
|
55
|
+
Object.entries(props.attributes)
|
|
56
|
+
.flatMap(([name, schema]) => {
|
|
57
|
+
const type = toAttributeType(schema);
|
|
58
|
+
if (isScalarAttributeType(type)) {
|
|
59
|
+
// only scalars can be included in the attribute definitions
|
|
60
|
+
return [
|
|
61
|
+
{
|
|
62
|
+
AttributeName: name,
|
|
63
|
+
AttributeType: type,
|
|
64
|
+
} as const,
|
|
65
|
+
];
|
|
66
|
+
} else {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
.sort((a, b) => a.AttributeName.localeCompare(b.AttributeName));
|
|
71
|
+
|
|
72
|
+
const toAttributeDefinitionsMap = (props: TableProps) =>
|
|
73
|
+
Object.fromEntries(
|
|
74
|
+
toAttributeDefinitions(props).map(
|
|
75
|
+
(def) => [def.AttributeName, def.AttributeType] as const,
|
|
76
|
+
),
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const resolveTableIfOwned = (id: string, tableName: string) =>
|
|
80
|
+
// if it already exists, let's see if it contains tags indicating we (this app+stage) owns it
|
|
81
|
+
// that would indicate we are in a partial state and can safely take control
|
|
82
|
+
dynamodb.describeTable({ TableName: tableName }).pipe(
|
|
83
|
+
Effect.flatMap((r) =>
|
|
84
|
+
dynamodb
|
|
85
|
+
.listTagsOfResource({
|
|
86
|
+
ResourceArn: r.Table?.TableArn!,
|
|
87
|
+
})
|
|
88
|
+
.pipe(
|
|
89
|
+
Effect.map((tags) => [r, tags.Tags] as const),
|
|
90
|
+
Effect.flatMap(([r, tags]) => {
|
|
91
|
+
if (hasTags(tagged(id), tags)) {
|
|
92
|
+
return Effect.succeed(r.Table!);
|
|
93
|
+
}
|
|
94
|
+
return Effect.fail(
|
|
95
|
+
new Error("Table tags do not match expected values"),
|
|
96
|
+
);
|
|
97
|
+
}),
|
|
98
|
+
),
|
|
99
|
+
),
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const updateTimeToLive = (
|
|
103
|
+
tableName: string,
|
|
104
|
+
timeToLiveSpecification: TimeToLiveSpecification,
|
|
105
|
+
) =>
|
|
106
|
+
dynamodb
|
|
107
|
+
.updateTimeToLive({
|
|
108
|
+
TableName: tableName,
|
|
109
|
+
TimeToLiveSpecification: timeToLiveSpecification!,
|
|
110
|
+
})
|
|
111
|
+
.pipe(
|
|
112
|
+
Effect.retry({
|
|
113
|
+
while: (e) => e.name === "ResourceInUseException",
|
|
114
|
+
schedule: Schedule.exponential(100),
|
|
115
|
+
}),
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
diff: Effect.fn(function* ({ id, news, olds }) {
|
|
120
|
+
const oldTableName = createTableName(id, olds);
|
|
121
|
+
const newTableName = createTableName(id, news);
|
|
122
|
+
if (oldTableName !== newTableName) {
|
|
123
|
+
// TODO(sam): if the name is hard-coded, REPLACE is impossible - we need a suffix
|
|
124
|
+
return { action: "replace" } as const;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (
|
|
128
|
+
olds.partitionKey !== news.partitionKey ||
|
|
129
|
+
olds.sortKey !== news.sortKey
|
|
130
|
+
) {
|
|
131
|
+
return { action: "replace" } as const;
|
|
132
|
+
}
|
|
133
|
+
const oldAttributeDefinitions = toAttributeDefinitionsMap(olds);
|
|
134
|
+
const newAttributeDefinitions = toAttributeDefinitionsMap(news);
|
|
135
|
+
for (const [name, type] of Object.entries(oldAttributeDefinitions)) {
|
|
136
|
+
// CloudFormation requires that editing an existing AttributeDefinition is a replace
|
|
137
|
+
if (newAttributeDefinitions[name] !== type) {
|
|
138
|
+
return { action: "replace" } as const;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// TODO(sam):
|
|
143
|
+
// Replacements:
|
|
144
|
+
// 1. if you change ImportSourceSpecification
|
|
145
|
+
|
|
146
|
+
return { action: "noop" } as const;
|
|
147
|
+
}),
|
|
148
|
+
|
|
149
|
+
create: Effect.fn(function* ({ id, news, session }) {
|
|
150
|
+
const tableName = createTableName(id, news);
|
|
151
|
+
|
|
152
|
+
const response = yield* dynamodb
|
|
153
|
+
.createTable({
|
|
154
|
+
TableName: tableName,
|
|
155
|
+
TableClass: news.tableClass,
|
|
156
|
+
KeySchema: toKeySchema(news),
|
|
157
|
+
AttributeDefinitions: toAttributeDefinitions(news),
|
|
158
|
+
BillingMode: news.billingMode ?? "PAY_PER_REQUEST",
|
|
159
|
+
SSESpecification: news.sseSpecification,
|
|
160
|
+
WarmThroughput: news.warmThroughput,
|
|
161
|
+
DeletionProtectionEnabled: news.deletionProtectionEnabled,
|
|
162
|
+
OnDemandThroughput: news.onDemandThroughput,
|
|
163
|
+
ProvisionedThroughput: news.provisionedThroughput,
|
|
164
|
+
// ResourcePolicy: (this should be determined by bindings maybe?)
|
|
165
|
+
|
|
166
|
+
// TODO(sam): this should come from Lambda.consume ?
|
|
167
|
+
// TODO(sam): that would require Lambda.consume mutates the Table declaration?
|
|
168
|
+
// StreamSpecification: news.streamSpecification,
|
|
169
|
+
Tags: [
|
|
170
|
+
{ Key: "alchemy::app", Value: app.name },
|
|
171
|
+
{ Key: "alchemy::stage", Value: app.stage },
|
|
172
|
+
{ Key: "alchemy::id", Value: id },
|
|
173
|
+
],
|
|
174
|
+
})
|
|
175
|
+
.pipe(
|
|
176
|
+
Effect.map((r) => r.TableDescription!),
|
|
177
|
+
Effect.retry({
|
|
178
|
+
while: (e) =>
|
|
179
|
+
e.name === "LimitExceededException" ||
|
|
180
|
+
e.name === "InternalServerError",
|
|
181
|
+
schedule: Schedule.exponential(100),
|
|
182
|
+
}),
|
|
183
|
+
Effect.catchTag("ResourceInUseException", () =>
|
|
184
|
+
resolveTableIfOwned(id, tableName),
|
|
185
|
+
),
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
if (news.timeToLiveSpecification) {
|
|
189
|
+
yield* updateTimeToLive(tableName, news.timeToLiveSpecification);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
yield* session.note(response.TableArn!);
|
|
193
|
+
|
|
194
|
+
return {
|
|
195
|
+
tableName,
|
|
196
|
+
tableId: response.TableId!,
|
|
197
|
+
tableArn: response.TableArn! as TableAttrs<TableProps>["tableArn"],
|
|
198
|
+
partitionKey: news.partitionKey,
|
|
199
|
+
sortKey: news.sortKey,
|
|
200
|
+
} satisfies TableAttrs<TableProps> as TableAttrs<any>;
|
|
201
|
+
}),
|
|
202
|
+
|
|
203
|
+
update: Effect.fn(function* ({ output, news, olds }) {
|
|
204
|
+
yield* dynamodb.updateTable({
|
|
205
|
+
TableName: output.tableName,
|
|
206
|
+
TableClass: news.tableClass,
|
|
207
|
+
AttributeDefinitions: toAttributeDefinitions(news),
|
|
208
|
+
BillingMode: news.billingMode ?? "PAY_PER_REQUEST",
|
|
209
|
+
SSESpecification: news.sseSpecification,
|
|
210
|
+
WarmThroughput: news.warmThroughput,
|
|
211
|
+
DeletionProtectionEnabled: news.deletionProtectionEnabled,
|
|
212
|
+
OnDemandThroughput: news.onDemandThroughput,
|
|
213
|
+
ProvisionedThroughput: news.provisionedThroughput,
|
|
214
|
+
|
|
215
|
+
//
|
|
216
|
+
// StreamSpecification: news.streamSpecification,
|
|
217
|
+
// TimeToLiveSpecification: news.timeToLiveSpecification,
|
|
218
|
+
|
|
219
|
+
// TODO(sam): GSIs
|
|
220
|
+
// GlobalSecondaryIndexUpdates
|
|
221
|
+
|
|
222
|
+
// TODO(sam): Global Tables
|
|
223
|
+
// MultiRegionConsistency: news.multiRegionConsistency,
|
|
224
|
+
// ReplicaUpdates: [{}]
|
|
225
|
+
// GlobalTableWitnessUpdates: [{Create}]
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
if (
|
|
229
|
+
news.timeToLiveSpecification &&
|
|
230
|
+
(news.timeToLiveSpecification.AttributeName !==
|
|
231
|
+
olds.timeToLiveSpecification?.AttributeName ||
|
|
232
|
+
news.timeToLiveSpecification?.Enabled !==
|
|
233
|
+
olds.timeToLiveSpecification?.Enabled)
|
|
234
|
+
) {
|
|
235
|
+
// TODO(sam): can this run in parallel?
|
|
236
|
+
yield* updateTimeToLive(
|
|
237
|
+
output.tableName,
|
|
238
|
+
news.timeToLiveSpecification,
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return output;
|
|
243
|
+
}),
|
|
244
|
+
|
|
245
|
+
delete: Effect.fn(function* ({ output }) {
|
|
246
|
+
yield* dynamodb
|
|
247
|
+
.deleteTable({
|
|
248
|
+
TableName: output.tableName,
|
|
249
|
+
})
|
|
250
|
+
.pipe(
|
|
251
|
+
Effect.timeout(1000),
|
|
252
|
+
Effect.catchTag("ResourceNotFoundException", () => Effect.void),
|
|
253
|
+
Effect.retry({
|
|
254
|
+
while: (e) =>
|
|
255
|
+
e._tag === "ResourceInUseException" ||
|
|
256
|
+
e._tag === "InternalServerError" ||
|
|
257
|
+
e._tag === "TimeoutException",
|
|
258
|
+
schedule: Schedule.fixed(100),
|
|
259
|
+
}),
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
class TableStillExists extends Data.TaggedError("TableStillExists") {}
|
|
263
|
+
|
|
264
|
+
while (true) {
|
|
265
|
+
const table = yield* dynamodb
|
|
266
|
+
.describeTable({
|
|
267
|
+
TableName: output.tableName,
|
|
268
|
+
})
|
|
269
|
+
.pipe(
|
|
270
|
+
Effect.catchTag("ResourceNotFoundException", () => Effect.void),
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
if (table === undefined) {
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}),
|
|
278
|
+
} satisfies ProviderService<Table<string, TableProps>>;
|
|
279
|
+
}),
|
|
280
|
+
);
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import * as S from "effect/Schema";
|
|
2
|
+
import { Resource } from "../../resource.ts";
|
|
3
|
+
import type { type } from "../../type.ts";
|
|
4
|
+
import type { AccountID } from "../account.ts";
|
|
5
|
+
import type { RegionID } from "../region.ts";
|
|
6
|
+
|
|
7
|
+
import type * as DynamoDB from "itty-aws/dynamodb";
|
|
8
|
+
|
|
9
|
+
export interface TableProps<
|
|
10
|
+
Items = any,
|
|
11
|
+
Attributes extends AttributesSchema<
|
|
12
|
+
Items,
|
|
13
|
+
PartitionKey,
|
|
14
|
+
SortKey
|
|
15
|
+
> = AttributesSchema<Items, keyof Items, keyof Items | undefined>,
|
|
16
|
+
PartitionKey extends keyof Items = keyof Items,
|
|
17
|
+
SortKey extends keyof Items | undefined = keyof Items | undefined,
|
|
18
|
+
BillingMode extends DynamoDB.BillingMode = DynamoDB.BillingMode,
|
|
19
|
+
SSESpecification extends DynamoDB.SSESpecification | undefined =
|
|
20
|
+
| DynamoDB.SSESpecification
|
|
21
|
+
| undefined,
|
|
22
|
+
TimeToLiveSpecification extends
|
|
23
|
+
| DynamoDB.TimeToLiveSpecification
|
|
24
|
+
| undefined = DynamoDB.TimeToLiveSpecification | undefined,
|
|
25
|
+
WarmThroughput extends DynamoDB.WarmThroughput | undefined =
|
|
26
|
+
| DynamoDB.WarmThroughput
|
|
27
|
+
| undefined,
|
|
28
|
+
OnDemandThroughput extends DynamoDB.OnDemandThroughput | undefined =
|
|
29
|
+
| DynamoDB.OnDemandThroughput
|
|
30
|
+
| undefined,
|
|
31
|
+
ProvisionedThroughput extends DynamoDB.ProvisionedThroughput | undefined =
|
|
32
|
+
| DynamoDB.ProvisionedThroughput
|
|
33
|
+
| undefined,
|
|
34
|
+
TableClass extends DynamoDB.TableClass | undefined =
|
|
35
|
+
| DynamoDB.TableClass
|
|
36
|
+
| undefined,
|
|
37
|
+
> {
|
|
38
|
+
items: type<Items>;
|
|
39
|
+
tableName?: string;
|
|
40
|
+
attributes: Attributes;
|
|
41
|
+
partitionKey: PartitionKey;
|
|
42
|
+
sortKey?: SortKey;
|
|
43
|
+
billingMode?: BillingMode;
|
|
44
|
+
deletionProtectionEnabled?: boolean;
|
|
45
|
+
onDemandThroughput?: OnDemandThroughput;
|
|
46
|
+
provisionedThroughput?: ProvisionedThroughput;
|
|
47
|
+
sseSpecification?: SSESpecification;
|
|
48
|
+
timeToLiveSpecification?: TimeToLiveSpecification;
|
|
49
|
+
warmThroughput?: WarmThroughput;
|
|
50
|
+
tableClass?: TableClass;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface TableAttrs<Props extends TableProps> {
|
|
54
|
+
tableName: Props["tableName"] extends string ? Props["tableName"] : string;
|
|
55
|
+
tableId: string;
|
|
56
|
+
tableArn: `arn:aws:dynamodb:${RegionID}:${AccountID}:table/${this["tableName"]}`;
|
|
57
|
+
partitionKey: Props["partitionKey"];
|
|
58
|
+
sortKey: Props["sortKey"];
|
|
59
|
+
// etc...
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type AttributesSchema<
|
|
63
|
+
Items,
|
|
64
|
+
PartitionKey extends keyof Items,
|
|
65
|
+
SortKey extends keyof Items | undefined,
|
|
66
|
+
> = {
|
|
67
|
+
[k in PartitionKey | (SortKey extends undefined ? never : SortKey)]: S.Schema<
|
|
68
|
+
ToAttribute<Items[k]>
|
|
69
|
+
>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export type ToAttribute<S> = S extends string
|
|
73
|
+
? string
|
|
74
|
+
: S extends number
|
|
75
|
+
? number
|
|
76
|
+
: S extends Uint8Array | Buffer | File | Blob
|
|
77
|
+
? Uint8Array
|
|
78
|
+
: S;
|
|
79
|
+
|
|
80
|
+
export const Table = Resource<{
|
|
81
|
+
<
|
|
82
|
+
const ID extends string,
|
|
83
|
+
const Items,
|
|
84
|
+
const Attributes extends NoInfer<
|
|
85
|
+
AttributesSchema<Items, PartitionKey, SortKey>
|
|
86
|
+
>,
|
|
87
|
+
const PartitionKey extends keyof Items,
|
|
88
|
+
const SortKey extends keyof Items | undefined = undefined,
|
|
89
|
+
const BillingMode extends DynamoDB.BillingMode = "PAY_PER_REQUEST",
|
|
90
|
+
const SSESpecification extends
|
|
91
|
+
| DynamoDB.SSESpecification
|
|
92
|
+
| undefined = undefined,
|
|
93
|
+
const TimeToLiveSpecification extends
|
|
94
|
+
| DynamoDB.TimeToLiveSpecification
|
|
95
|
+
| undefined = undefined,
|
|
96
|
+
const WarmThroughput extends
|
|
97
|
+
| DynamoDB.WarmThroughput
|
|
98
|
+
| undefined = undefined,
|
|
99
|
+
const OnDemandThroughput extends
|
|
100
|
+
| DynamoDB.OnDemandThroughput
|
|
101
|
+
| undefined = undefined,
|
|
102
|
+
const ProvisionedThroughput extends
|
|
103
|
+
| DynamoDB.ProvisionedThroughput
|
|
104
|
+
| undefined = undefined,
|
|
105
|
+
const TableClass extends DynamoDB.TableClass | undefined = undefined,
|
|
106
|
+
>(
|
|
107
|
+
id: ID,
|
|
108
|
+
props: TableProps<
|
|
109
|
+
Items,
|
|
110
|
+
Attributes,
|
|
111
|
+
PartitionKey,
|
|
112
|
+
SortKey,
|
|
113
|
+
BillingMode,
|
|
114
|
+
SSESpecification,
|
|
115
|
+
TimeToLiveSpecification,
|
|
116
|
+
WarmThroughput,
|
|
117
|
+
OnDemandThroughput,
|
|
118
|
+
ProvisionedThroughput,
|
|
119
|
+
TableClass
|
|
120
|
+
>,
|
|
121
|
+
): Table<
|
|
122
|
+
ID,
|
|
123
|
+
TableProps<
|
|
124
|
+
Items,
|
|
125
|
+
Attributes,
|
|
126
|
+
PartitionKey,
|
|
127
|
+
SortKey,
|
|
128
|
+
BillingMode,
|
|
129
|
+
SSESpecification,
|
|
130
|
+
TimeToLiveSpecification,
|
|
131
|
+
WarmThroughput,
|
|
132
|
+
OnDemandThroughput,
|
|
133
|
+
ProvisionedThroughput,
|
|
134
|
+
TableClass
|
|
135
|
+
>
|
|
136
|
+
>;
|
|
137
|
+
}>("AWS.DynamoDB.Table");
|
|
138
|
+
|
|
139
|
+
export interface AnyTable extends Table<string, any> {}
|
|
140
|
+
|
|
141
|
+
export interface Table<
|
|
142
|
+
ID extends string = string,
|
|
143
|
+
Props extends TableProps = TableProps,
|
|
144
|
+
> extends Resource<"AWS.DynamoDB.Table", ID, Props, TableAttrs<Props>> {}
|
|
145
|
+
|
|
146
|
+
export declare namespace Table {
|
|
147
|
+
export type PartitionKey<T extends Table> = T["props"]["partitionKey"];
|
|
148
|
+
export type SortKey<T extends Table> = T["props"]["sortKey"];
|
|
149
|
+
export type Key<T extends Table> = {
|
|
150
|
+
[K in PartitionKey<T>]: T["props"]["attributes"][K];
|
|
151
|
+
} & SortKey<T> extends infer S extends string
|
|
152
|
+
? {
|
|
153
|
+
[K in S]: T["props"]["attributes"][K];
|
|
154
|
+
}
|
|
155
|
+
: {};
|
|
156
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
|
|
4
|
+
import { EC2 } from "itty-aws/ec2";
|
|
5
|
+
import { createAWSServiceClientLayer } from "../client.ts";
|
|
6
|
+
import * as Credentials from "../credentials.ts";
|
|
7
|
+
import * as Region from "../region.ts";
|
|
8
|
+
|
|
9
|
+
export class EC2Client extends Context.Tag("AWS.EC2.Client")<
|
|
10
|
+
EC2Client,
|
|
11
|
+
EC2
|
|
12
|
+
>() {}
|
|
13
|
+
|
|
14
|
+
export const client = createAWSServiceClientLayer<typeof EC2Client, EC2>(
|
|
15
|
+
EC2Client,
|
|
16
|
+
EC2,
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export const clientFromEnv = () =>
|
|
20
|
+
Layer.provide(client(), Layer.merge(Credentials.fromEnv(), Region.fromEnv()));
|