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
package/lib/type.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC;AAClC,eAAO,MAAM,IAAI,EAAe,KAAK,CAAC,OAAO,CAAC,CAAC"}
|
package/lib/type.js
ADDED
package/lib/type.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,IAAI,GAAG;CAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alchemy-effect",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Sam Goodwin <sam@alchemy.run>",
|
|
6
6
|
"homepage": "https://alchemy.run",
|
|
@@ -16,19 +16,128 @@
|
|
|
16
16
|
"lib",
|
|
17
17
|
"src"
|
|
18
18
|
],
|
|
19
|
+
"bin": {
|
|
20
|
+
"alchemy-effect": "bin/alchemy-effect.js"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "bun bundle && bun pm pack",
|
|
24
|
+
"bundle": "tsdown",
|
|
25
|
+
"bundle:watch": "tsdown --watch",
|
|
26
|
+
"publish:npm": "cp ../README.md . && bun publish && rm README.md"
|
|
27
|
+
},
|
|
19
28
|
"exports": {
|
|
20
29
|
".": {
|
|
21
30
|
"bun": "./src/index.ts",
|
|
22
31
|
"import": "./lib/index.js",
|
|
23
32
|
"types": "./src/index.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./aws": {
|
|
35
|
+
"bun": "./src/aws/index.ts",
|
|
36
|
+
"import": "./lib/aws/index.js",
|
|
37
|
+
"types": "./lib/aws/index.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./aws/dynamodb": {
|
|
40
|
+
"bun": "./src/aws/dynamodb/index.ts",
|
|
41
|
+
"import": "./lib/aws/dynamodb/index.js",
|
|
42
|
+
"types": "./lib/aws/dynamodb/index.d.ts"
|
|
43
|
+
},
|
|
44
|
+
"./aws/ec2": {
|
|
45
|
+
"bun": "./src/aws/ec2/index.ts",
|
|
46
|
+
"import": "./lib/aws/ec2/index.js",
|
|
47
|
+
"types": "./lib/aws/ec2/index.d.ts"
|
|
48
|
+
},
|
|
49
|
+
"./aws/lambda": {
|
|
50
|
+
"bun": "./src/aws/lambda/index.ts",
|
|
51
|
+
"import": "./lib/aws/lambda/index.js",
|
|
52
|
+
"types": "./lib/aws/lambda/index.d.ts"
|
|
53
|
+
},
|
|
54
|
+
"./aws/sqs": {
|
|
55
|
+
"bun": "./src/aws/sqs/index.ts",
|
|
56
|
+
"import": "./lib/aws/sqs/index.js",
|
|
57
|
+
"types": "./lib/sqs/aws/index.d.ts"
|
|
58
|
+
},
|
|
59
|
+
"./aws/sts": {
|
|
60
|
+
"bun": "./src/aws/sts.ts",
|
|
61
|
+
"import": "./lib/aws/sts.js",
|
|
62
|
+
"types": "./lib/sts.d.ts"
|
|
63
|
+
},
|
|
64
|
+
"./aws/iam": {
|
|
65
|
+
"bun": "./src/aws/iam.ts",
|
|
66
|
+
"import": "./lib/aws/iam.js",
|
|
67
|
+
"types": "./lib/iam.d.ts"
|
|
68
|
+
},
|
|
69
|
+
"./aws/credentials": {
|
|
70
|
+
"bun": "./src/aws/credentials.ts",
|
|
71
|
+
"import": "./lib/aws/credentials.js",
|
|
72
|
+
"types": "./lib/aws/credentials.d.ts"
|
|
73
|
+
},
|
|
74
|
+
"./cli": {
|
|
75
|
+
"bun": "./src/cli/index.ts",
|
|
76
|
+
"import": "./lib/cli/index.js",
|
|
77
|
+
"types": "./lib/cli/index.d.ts"
|
|
78
|
+
},
|
|
79
|
+
"./cloudflare": {
|
|
80
|
+
"bun": "./src/cloudflare/index.ts",
|
|
81
|
+
"import": "./lib/cloudflare/index.js",
|
|
82
|
+
"types": "./lib/cloudflare/index.d.ts"
|
|
83
|
+
},
|
|
84
|
+
"./cloudflare/live": {
|
|
85
|
+
"bun": "./src/cloudflare/live.ts",
|
|
86
|
+
"import": "./lib/cloudflare/live.js",
|
|
87
|
+
"types": "./lib/cloudflare/live.d.ts"
|
|
88
|
+
},
|
|
89
|
+
"./cloudflare/assets": {
|
|
90
|
+
"bun": "./src/cloudflare/worker/assets.fetch.ts",
|
|
91
|
+
"import": "./lib/cloudflare/worker/assets.fetch.js",
|
|
92
|
+
"types": "./lib/cloudflare/worker/assets.fetch.d.ts"
|
|
93
|
+
},
|
|
94
|
+
"./cloudflare/worker": {
|
|
95
|
+
"bun": "./src/cloudflare/worker/index.ts",
|
|
96
|
+
"import": "./lib/cloudflare/worker/index.js",
|
|
97
|
+
"types": "./lib/cloudflare/worker/index.d.ts"
|
|
98
|
+
},
|
|
99
|
+
"./cloudflare/kv": {
|
|
100
|
+
"bun": "./src/cloudflare/kv/index.ts",
|
|
101
|
+
"import": "./lib/cloudflare/kv/index.js",
|
|
102
|
+
"types": "./lib/cloudflare/kv/index.d.ts"
|
|
103
|
+
},
|
|
104
|
+
"./cloudflare/r2": {
|
|
105
|
+
"bun": "./src/cloudflare/r2/index.ts",
|
|
106
|
+
"import": "./lib/cloudflare/r2/index.js",
|
|
107
|
+
"types": "./lib/cloudflare/r2/index.d.ts"
|
|
24
108
|
}
|
|
25
109
|
},
|
|
110
|
+
"dependencies": {
|
|
111
|
+
"@aws-sdk/credential-providers": "^3.0.0",
|
|
112
|
+
"@effect/vitest": "^0.27.0",
|
|
113
|
+
"@smithy/node-config-provider": "^4.0.0",
|
|
114
|
+
"@smithy/shared-ini-file-loader": "^4.3.4",
|
|
115
|
+
"@smithy/types": "^4.8.1",
|
|
116
|
+
"@types/aws-lambda": "^8.10.152",
|
|
117
|
+
"aws4fetch": "^1.0.20",
|
|
118
|
+
"cloudflare": "^5.2.0",
|
|
119
|
+
"esbuild": "^0.25.12",
|
|
120
|
+
"fast-xml-parser": "^5.2.5",
|
|
121
|
+
"ignore": "^7.0.5",
|
|
122
|
+
"itty-aws": "^0.6.1",
|
|
123
|
+
"jszip": "^3.10.1",
|
|
124
|
+
"yaml": "^2.0.0"
|
|
125
|
+
},
|
|
26
126
|
"devDependencies": {
|
|
27
|
-
"@
|
|
127
|
+
"@clack/prompts": "^0.11.0",
|
|
128
|
+
"@cloudflare/workers-types": "^4.20250805.0",
|
|
28
129
|
"@effect/platform": "^0.92.1",
|
|
130
|
+
"@effect/platform-node": "^0.98.3",
|
|
131
|
+
"@types/aws-lambda": "^8.10.152",
|
|
29
132
|
"@types/bun": "latest",
|
|
30
133
|
"@types/node": "latest",
|
|
31
|
-
"
|
|
134
|
+
"@types/react": "^19.2.2",
|
|
135
|
+
"effect": "^3.18.4",
|
|
136
|
+
"ink": "^6.3.1",
|
|
137
|
+
"react": "^19.2.0",
|
|
138
|
+
"react-devtools-core": "^7.0.1",
|
|
139
|
+
"tsconfig-paths": "^4.2.0",
|
|
140
|
+
"tsdown": "^0.15.4"
|
|
32
141
|
},
|
|
33
142
|
"peerDependencies": {
|
|
34
143
|
"@effect/platform": "*",
|
|
@@ -41,6 +150,9 @@
|
|
|
41
150
|
},
|
|
42
151
|
"@effect/platform-node": {
|
|
43
152
|
"optional": true
|
|
153
|
+
},
|
|
154
|
+
"effect": {
|
|
155
|
+
"optional": true
|
|
44
156
|
}
|
|
45
157
|
},
|
|
46
158
|
"publishConfig": {
|
package/src/app.ts
CHANGED
|
@@ -3,13 +3,12 @@ import * as Data from "effect/Data";
|
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Layer from "effect/Layer";
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
>() {}
|
|
6
|
+
export interface AppProps {
|
|
7
|
+
name: string;
|
|
8
|
+
stage: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class App extends Context.Tag("App")<App, AppProps>() {}
|
|
13
12
|
|
|
14
13
|
export class FailedToParseArg extends Data.TaggedError("FailedToParseArg")<{
|
|
15
14
|
message: string;
|
|
@@ -41,3 +40,5 @@ export const fromArgs = Layer.effect(
|
|
|
41
40
|
|
|
42
41
|
export const app = (input: { name: string; stage: string }) =>
|
|
43
42
|
Layer.succeed(App, App.of(input));
|
|
43
|
+
|
|
44
|
+
export const make = app;
|
package/src/apply.ts
CHANGED
|
@@ -5,8 +5,17 @@ import type { Simplify } from "effect/Types";
|
|
|
5
5
|
import { PlanReviewer, type PlanRejected } from "./approve.ts";
|
|
6
6
|
import type { AnyBinding, BindingService } from "./binding.ts";
|
|
7
7
|
import type { ApplyEvent, ApplyStatus } from "./event.ts";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
plan,
|
|
10
|
+
type BindNode,
|
|
11
|
+
type Create,
|
|
12
|
+
type CRUD,
|
|
13
|
+
type Delete,
|
|
14
|
+
type Plan,
|
|
15
|
+
type Update,
|
|
16
|
+
} from "./plan.ts";
|
|
9
17
|
import type { Resource } from "./resource.ts";
|
|
18
|
+
import type { Service } from "./service.ts";
|
|
10
19
|
import { State } from "./state.ts";
|
|
11
20
|
|
|
12
21
|
export interface PlanStatusSession {
|
|
@@ -25,7 +34,34 @@ export class PlanStatusReporter extends Context.Tag("PlanStatusReporter")<
|
|
|
25
34
|
}
|
|
26
35
|
>() {}
|
|
27
36
|
|
|
28
|
-
export const apply
|
|
37
|
+
export const apply: typeof applyPlan &
|
|
38
|
+
typeof applyResources &
|
|
39
|
+
typeof applyResourcesPhase = (...args: any[]): any =>
|
|
40
|
+
Effect.isEffect(args[0])
|
|
41
|
+
? applyPlan(args[0] as any)
|
|
42
|
+
: args.length === 1 && "phase" in args[0]
|
|
43
|
+
? applyResourcesPhase(args[0])
|
|
44
|
+
: applyResources(...args);
|
|
45
|
+
|
|
46
|
+
export const applyResourcesPhase = <
|
|
47
|
+
const Phase extends "update" | "destroy",
|
|
48
|
+
const Resources extends (Service | Resource)[],
|
|
49
|
+
>(props: {
|
|
50
|
+
resources: Resources;
|
|
51
|
+
phase: Phase;
|
|
52
|
+
}) => applyPlan(plan(props));
|
|
53
|
+
|
|
54
|
+
export const applyResources = <const Resources extends (Service | Resource)[]>(
|
|
55
|
+
...resources: Resources
|
|
56
|
+
) =>
|
|
57
|
+
applyPlan(
|
|
58
|
+
plan({
|
|
59
|
+
phase: "update",
|
|
60
|
+
resources,
|
|
61
|
+
}),
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export const applyPlan = <P extends Plan, Err, Req>(
|
|
29
65
|
plan: Effect.Effect<P, Err, Req>,
|
|
30
66
|
) =>
|
|
31
67
|
plan.pipe(
|
|
@@ -49,48 +85,137 @@ export const apply = <P extends Plan, Err, Req>(
|
|
|
49
85
|
} satisfies PlanStatusSession);
|
|
50
86
|
const { emit, done } = session;
|
|
51
87
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
88
|
+
const constOrEffect = <T, Err = never, Req = never>(
|
|
89
|
+
effect: T | Effect.Effect<T>,
|
|
90
|
+
): Effect.Effect<T, Err, Req> =>
|
|
91
|
+
Effect.isEffect(effect) ? effect : Effect.succeed(effect);
|
|
92
|
+
|
|
93
|
+
const resolveBindingUpstream = Effect.fn(function* ({
|
|
94
|
+
node,
|
|
95
|
+
resource,
|
|
96
|
+
}: {
|
|
97
|
+
node: BindNode;
|
|
98
|
+
resource: Resource;
|
|
99
|
+
}) {
|
|
100
|
+
const binding = node.binding as AnyBinding & {
|
|
101
|
+
// smuggled property (because it interacts poorly with inference)
|
|
102
|
+
Tag: Context.Tag<never, BindingService>;
|
|
103
|
+
};
|
|
104
|
+
const provider = yield* binding.Tag;
|
|
105
|
+
|
|
106
|
+
const resourceId: string = node.binding.capability.resource.id;
|
|
107
|
+
const upstreamNode = plan.resources[resourceId];
|
|
108
|
+
const upstreamAttr = resource
|
|
109
|
+
? yield* apply(upstreamNode)
|
|
110
|
+
: yield* Effect.dieMessage(`Resource ${resourceId} not found`);
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
resourceId,
|
|
114
|
+
upstreamAttr,
|
|
115
|
+
upstreamNode,
|
|
116
|
+
provider,
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const attachBindings = ({
|
|
121
|
+
resource,
|
|
122
|
+
bindings,
|
|
123
|
+
target,
|
|
124
|
+
}: {
|
|
125
|
+
resource: Resource;
|
|
126
|
+
bindings: BindNode[];
|
|
55
127
|
target: {
|
|
56
128
|
id: string;
|
|
57
129
|
props: any;
|
|
58
130
|
attr: any;
|
|
59
|
-
}
|
|
60
|
-
)
|
|
61
|
-
|
|
131
|
+
};
|
|
132
|
+
}) =>
|
|
133
|
+
Effect.all(
|
|
62
134
|
bindings.map(
|
|
63
135
|
Effect.fn(function* (node) {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
Tag: Context.Tag<never, BindingService>;
|
|
67
|
-
};
|
|
68
|
-
const provider = yield* binding.Tag;
|
|
69
|
-
|
|
70
|
-
const resourceId: string = node.binding.capability.resource.id;
|
|
71
|
-
const upstreamNode = plan.resources[resourceId];
|
|
72
|
-
const upstreamAttr = resource
|
|
73
|
-
? yield* apply(upstreamNode)
|
|
74
|
-
: yield* Effect.dieMessage(
|
|
75
|
-
`Resource ${resourceId} not found`,
|
|
76
|
-
);
|
|
136
|
+
const { resourceId, upstreamAttr, upstreamNode, provider } =
|
|
137
|
+
yield* resolveBindingUpstream({ node, resource });
|
|
77
138
|
|
|
78
|
-
const
|
|
139
|
+
const input = {
|
|
79
140
|
source: {
|
|
80
141
|
id: resourceId,
|
|
81
142
|
attr: upstreamAttr,
|
|
82
143
|
props: upstreamNode.resource.props,
|
|
83
144
|
},
|
|
84
145
|
props: node.binding.props,
|
|
146
|
+
attr: node.attr,
|
|
85
147
|
target,
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
148
|
+
} as const;
|
|
149
|
+
if (node.action === "attach") {
|
|
150
|
+
return yield* constOrEffect(provider.attach(input));
|
|
151
|
+
} else if (node.action === "reattach") {
|
|
152
|
+
// reattach is optional, we fall back to attach if it's not available
|
|
153
|
+
return yield* constOrEffect(
|
|
154
|
+
(provider.reattach ? provider.reattach : provider.attach)(
|
|
155
|
+
input,
|
|
156
|
+
),
|
|
157
|
+
);
|
|
158
|
+
} else if (node.action === "detach" && provider.detach) {
|
|
159
|
+
return yield* constOrEffect(
|
|
160
|
+
provider.detach({
|
|
161
|
+
...input,
|
|
162
|
+
target,
|
|
163
|
+
}),
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
return node.attr;
|
|
167
|
+
}),
|
|
168
|
+
),
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
const postAttachBindings = ({
|
|
172
|
+
bindings,
|
|
173
|
+
bindingOutputs,
|
|
174
|
+
resource,
|
|
175
|
+
target,
|
|
176
|
+
}: {
|
|
177
|
+
bindings: BindNode[];
|
|
178
|
+
bindingOutputs: any[];
|
|
179
|
+
resource: Resource;
|
|
180
|
+
target: {
|
|
181
|
+
id: string;
|
|
182
|
+
props: any;
|
|
183
|
+
attr: any;
|
|
184
|
+
};
|
|
185
|
+
}) =>
|
|
186
|
+
Effect.all(
|
|
187
|
+
bindings.map(
|
|
188
|
+
Effect.fn(function* (node, i) {
|
|
189
|
+
const { resourceId, upstreamAttr, upstreamNode, provider } =
|
|
190
|
+
yield* resolveBindingUpstream({ node, resource });
|
|
191
|
+
|
|
192
|
+
const oldBindingOutput = bindingOutputs[i];
|
|
193
|
+
|
|
194
|
+
if (
|
|
195
|
+
provider.postattach &&
|
|
196
|
+
(node.action === "attach" || node.action === "reattach")
|
|
197
|
+
) {
|
|
198
|
+
const bindingOutput = yield* constOrEffect(
|
|
199
|
+
provider.postattach({
|
|
200
|
+
source: {
|
|
201
|
+
id: resourceId,
|
|
202
|
+
attr: upstreamAttr,
|
|
203
|
+
props: upstreamNode.resource.props,
|
|
204
|
+
},
|
|
205
|
+
props: node.binding.props,
|
|
206
|
+
attr: oldBindingOutput,
|
|
207
|
+
target,
|
|
208
|
+
} as const),
|
|
209
|
+
);
|
|
210
|
+
return {
|
|
211
|
+
...oldBindingOutput,
|
|
212
|
+
...bindingOutput,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
return oldBindingOutput;
|
|
90
216
|
}),
|
|
91
217
|
),
|
|
92
218
|
);
|
|
93
|
-
});
|
|
94
219
|
|
|
95
220
|
const apply: (node: CRUD) => Effect.Effect<any, never, never> = (
|
|
96
221
|
node,
|
|
@@ -98,21 +223,25 @@ export const apply = <P extends Plan, Err, Req>(
|
|
|
98
223
|
Effect.gen(function* () {
|
|
99
224
|
const checkpoint = <Out, Err>(
|
|
100
225
|
effect: Effect.Effect<Out, Err, never>,
|
|
101
|
-
) =>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
226
|
+
) => effect.pipe(Effect.flatMap((output) => saveState({ output })));
|
|
227
|
+
|
|
228
|
+
const saveState = <Output>({
|
|
229
|
+
output,
|
|
230
|
+
bindings = node.bindings,
|
|
231
|
+
}: {
|
|
232
|
+
output: Output;
|
|
233
|
+
bindings?: BindNode[];
|
|
234
|
+
}) =>
|
|
235
|
+
state
|
|
236
|
+
.set(node.resource.id, {
|
|
237
|
+
id: node.resource.id,
|
|
238
|
+
type: node.resource.type,
|
|
239
|
+
status: node.action === "create" ? "created" : "updated",
|
|
240
|
+
props: node.resource.props,
|
|
241
|
+
output,
|
|
242
|
+
bindings,
|
|
243
|
+
})
|
|
244
|
+
.pipe(Effect.map(() => output));
|
|
116
245
|
|
|
117
246
|
const id = node.resource.id;
|
|
118
247
|
const resource = node.resource;
|
|
@@ -137,71 +266,101 @@ export const apply = <P extends Plan, Err, Req>(
|
|
|
137
266
|
status,
|
|
138
267
|
});
|
|
139
268
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
});
|
|
151
|
-
}
|
|
269
|
+
const createOrUpdate = Effect.fn(function* ({
|
|
270
|
+
node,
|
|
271
|
+
attr,
|
|
272
|
+
phase,
|
|
273
|
+
}: {
|
|
274
|
+
node: Create<Resource> | Update<Resource>;
|
|
275
|
+
attr: any;
|
|
276
|
+
phase: "create" | "update";
|
|
277
|
+
}) {
|
|
278
|
+
yield* report(phase === "create" ? "creating" : "updating");
|
|
152
279
|
|
|
153
|
-
|
|
280
|
+
let bindingOutputs = yield* attachBindings({
|
|
154
281
|
resource,
|
|
155
|
-
node.bindings,
|
|
156
|
-
{
|
|
282
|
+
bindings: node.bindings,
|
|
283
|
+
target: {
|
|
157
284
|
id,
|
|
158
285
|
props: node.news,
|
|
159
286
|
attr,
|
|
160
287
|
},
|
|
161
|
-
);
|
|
288
|
+
});
|
|
162
289
|
|
|
163
|
-
yield*
|
|
290
|
+
const output: any = yield* (
|
|
291
|
+
phase === "create"
|
|
292
|
+
? node.provider.create
|
|
293
|
+
: node.provider.update
|
|
294
|
+
)({
|
|
295
|
+
id,
|
|
296
|
+
news: node.news,
|
|
297
|
+
bindings: bindingOutputs,
|
|
298
|
+
session: scopedSession,
|
|
299
|
+
...(node.action === "update"
|
|
300
|
+
? {
|
|
301
|
+
output: node.output,
|
|
302
|
+
olds: node.olds,
|
|
303
|
+
}
|
|
304
|
+
: {}),
|
|
305
|
+
}).pipe(
|
|
306
|
+
// TODO(sam): partial checkpoints
|
|
307
|
+
// checkpoint,
|
|
308
|
+
Effect.tap(() =>
|
|
309
|
+
report(phase === "create" ? "created" : "updated"),
|
|
310
|
+
),
|
|
311
|
+
);
|
|
164
312
|
|
|
165
|
-
|
|
166
|
-
.create({
|
|
167
|
-
id,
|
|
168
|
-
news: node.news,
|
|
169
|
-
bindings,
|
|
170
|
-
session: scopedSession,
|
|
171
|
-
})
|
|
172
|
-
.pipe(
|
|
173
|
-
checkpoint,
|
|
174
|
-
Effect.tap(() => report("created")),
|
|
175
|
-
);
|
|
176
|
-
} else if (node.action === "update") {
|
|
177
|
-
const bindings = yield* applyBindings(
|
|
313
|
+
bindingOutputs = yield* postAttachBindings({
|
|
178
314
|
resource,
|
|
179
|
-
node.bindings,
|
|
180
|
-
|
|
315
|
+
bindings: node.bindings,
|
|
316
|
+
bindingOutputs,
|
|
317
|
+
target: {
|
|
181
318
|
id,
|
|
182
319
|
props: node.news,
|
|
183
|
-
attr
|
|
320
|
+
attr,
|
|
184
321
|
},
|
|
185
|
-
);
|
|
322
|
+
});
|
|
186
323
|
|
|
187
|
-
yield*
|
|
324
|
+
yield* saveState({
|
|
325
|
+
output,
|
|
326
|
+
bindings: node.bindings.map((binding, i) => ({
|
|
327
|
+
...binding,
|
|
328
|
+
attr: bindingOutputs[i],
|
|
329
|
+
})),
|
|
330
|
+
});
|
|
188
331
|
|
|
189
|
-
|
|
332
|
+
return output;
|
|
333
|
+
});
|
|
190
334
|
|
|
191
|
-
|
|
192
|
-
|
|
335
|
+
if (node.action === "noop") {
|
|
336
|
+
return (yield* state.get(id))?.output;
|
|
337
|
+
} else if (node.action === "create") {
|
|
338
|
+
let attr: any;
|
|
339
|
+
if (node.provider.precreate) {
|
|
340
|
+
yield* Effect.logDebug("precreate", id);
|
|
341
|
+
// stub the resource prior to resolving upstream resources or bindings if a stub is available
|
|
342
|
+
attr = yield* node.provider.precreate({
|
|
193
343
|
id,
|
|
194
344
|
news: node.news,
|
|
195
|
-
olds: node.olds,
|
|
196
|
-
output: node.output,
|
|
197
|
-
bindings,
|
|
198
345
|
session: scopedSession,
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
yield* Effect.logDebug("create", id);
|
|
350
|
+
return yield* createOrUpdate({
|
|
351
|
+
node,
|
|
352
|
+
attr,
|
|
353
|
+
phase: "create",
|
|
354
|
+
});
|
|
355
|
+
} else if (node.action === "update") {
|
|
356
|
+
yield* Effect.logDebug("update", id);
|
|
357
|
+
return yield* createOrUpdate({
|
|
358
|
+
node,
|
|
359
|
+
attr: node.attributes,
|
|
360
|
+
phase: "update",
|
|
361
|
+
});
|
|
204
362
|
} else if (node.action === "delete") {
|
|
363
|
+
yield* Effect.logDebug("delete", id);
|
|
205
364
|
yield* Effect.all(
|
|
206
365
|
node.downstream.map((dep) =>
|
|
207
366
|
dep in plan.resources
|
|
@@ -246,15 +405,15 @@ export const apply = <P extends Plan, Err, Req>(
|
|
|
246
405
|
id,
|
|
247
406
|
news: node.news,
|
|
248
407
|
// TODO(sam): these need to only include attach actions
|
|
249
|
-
bindings: yield*
|
|
408
|
+
bindings: yield* attachBindings({
|
|
250
409
|
resource,
|
|
251
|
-
node.bindings,
|
|
252
|
-
{
|
|
410
|
+
bindings: node.bindings,
|
|
411
|
+
target: {
|
|
253
412
|
id,
|
|
254
413
|
props: node.news,
|
|
255
414
|
attr: node.attributes,
|
|
256
415
|
},
|
|
257
|
-
),
|
|
416
|
+
}),
|
|
258
417
|
session: scopedSession,
|
|
259
418
|
})
|
|
260
419
|
// TODO(sam): delete and create will conflict here, we need to extend the state store for replace
|
|
@@ -265,7 +424,6 @@ export const apply = <P extends Plan, Err, Req>(
|
|
|
265
424
|
);
|
|
266
425
|
});
|
|
267
426
|
if (!node.deleteFirst) {
|
|
268
|
-
const outputs = yield* create;
|
|
269
427
|
yield* destroy;
|
|
270
428
|
return outputs;
|
|
271
429
|
} else {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Data from "effect/Data";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Layer from "effect/Layer";
|
|
5
|
+
import * as STS from "./sts.ts";
|
|
6
|
+
|
|
7
|
+
export class FailedToGetAccount extends Data.TaggedError(
|
|
8
|
+
"AWS::Account::FailedToGetAccount",
|
|
9
|
+
)<{
|
|
10
|
+
message: string;
|
|
11
|
+
cause: Error;
|
|
12
|
+
}> {}
|
|
13
|
+
|
|
14
|
+
export type AccountID = string;
|
|
15
|
+
|
|
16
|
+
export class Account extends Context.Tag("AWS::AccountID")<
|
|
17
|
+
Account,
|
|
18
|
+
AccountID
|
|
19
|
+
>() {}
|
|
20
|
+
|
|
21
|
+
export const fromIdentity = () =>
|
|
22
|
+
Layer.effect(
|
|
23
|
+
Account,
|
|
24
|
+
Effect.gen(function* () {
|
|
25
|
+
const sts = yield* STS.STSClient;
|
|
26
|
+
const identity = yield* sts.getCallerIdentity({}).pipe(
|
|
27
|
+
Effect.catchAll(
|
|
28
|
+
(err) =>
|
|
29
|
+
new FailedToGetAccount({
|
|
30
|
+
message: "Failed to look up account ID",
|
|
31
|
+
cause: err,
|
|
32
|
+
}),
|
|
33
|
+
),
|
|
34
|
+
);
|
|
35
|
+
return identity.Account!;
|
|
36
|
+
}),
|
|
37
|
+
);
|
package/src/aws/arn.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Arn = string;
|