alchemy-effect 0.1.0 → 0.3.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/bin/alchemy-effect.js +55038 -8
- package/bin/alchemy-effect.js.map +1 -1
- package/bin/alchemy-effect.ts +266 -10
- package/lib/$.d.ts +5 -0
- package/lib/$.d.ts.map +1 -0
- package/lib/$.js +9 -0
- package/lib/$.js.map +1 -0
- package/lib/app.d.ts +7 -15
- package/lib/app.d.ts.map +1 -1
- package/lib/app.js +1 -20
- package/lib/app.js.map +1 -1
- package/lib/apply.d.ts +15 -19
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +173 -82
- package/lib/apply.js.map +1 -1
- package/lib/assert-never.d.ts +12 -0
- package/lib/assert-never.d.ts.map +1 -0
- package/lib/assert-never.js +11 -0
- package/lib/assert-never.js.map +1 -0
- package/lib/aws/account.d.ts +13 -3
- package/lib/aws/account.d.ts.map +1 -1
- package/lib/aws/account.js +19 -4
- package/lib/aws/account.js.map +1 -1
- package/lib/aws/arn.d.ts +1 -5
- package/lib/aws/arn.d.ts.map +1 -1
- package/lib/aws/client.d.ts.map +1 -1
- package/lib/aws/client.js +8 -1
- package/lib/aws/client.js.map +1 -1
- package/lib/aws/config.d.ts +15 -0
- package/lib/aws/config.d.ts.map +1 -0
- package/lib/aws/config.js +1 -0
- package/lib/aws/config.js.map +1 -0
- package/lib/aws/credentials.d.ts +11 -1
- package/lib/aws/credentials.d.ts.map +1 -1
- package/lib/aws/credentials.js +73 -47
- package/lib/aws/credentials.js.map +1 -1
- 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/{sqs/queue.client.js → dynamodb/client.js} +6 -6
- 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 +10 -0
- package/lib/aws/dynamodb/index.d.ts.map +1 -0
- package/lib/aws/dynamodb/index.js +9 -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 +26 -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 +59 -0
- package/lib/aws/dynamodb/table.d.ts.map +1 -0
- package/lib/aws/dynamodb/table.get-item.d.ts +57 -0
- package/lib/aws/dynamodb/table.get-item.d.ts.map +1 -0
- package/lib/aws/dynamodb/table.get-item.js +77 -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 +7 -0
- package/lib/aws/dynamodb/table.provider.d.ts.map +1 -0
- package/lib/aws/dynamodb/table.provider.js +187 -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 +7 -0
- package/lib/aws/ec2/index.d.ts.map +1 -0
- package/lib/aws/ec2/index.js +7 -0
- package/lib/aws/ec2/index.js.map +1 -0
- package/lib/aws/ec2/subnet.d.ts +175 -0
- package/lib/aws/ec2/subnet.d.ts.map +1 -0
- package/lib/aws/ec2/subnet.js +4 -0
- package/lib/aws/ec2/subnet.js.map +1 -0
- package/lib/aws/ec2/subnet.provider.d.ts +4 -0
- package/lib/aws/ec2/subnet.provider.d.ts.map +1 -0
- package/lib/aws/ec2/subnet.provider.js +250 -0
- package/lib/aws/ec2/subnet.provider.js.map +1 -0
- package/lib/aws/ec2/vpc.d.ts +135 -0
- package/lib/aws/ec2/vpc.d.ts.map +1 -0
- package/lib/aws/ec2/vpc.js +4 -0
- package/lib/aws/ec2/vpc.js.map +1 -0
- package/lib/aws/ec2/vpc.provider.d.ts +6 -0
- package/lib/aws/ec2/vpc.provider.d.ts.map +1 -0
- package/lib/aws/ec2/vpc.provider.js +183 -0
- package/lib/aws/ec2/vpc.provider.js.map +1 -0
- package/lib/aws/index.d.ts +23 -16
- package/lib/aws/index.d.ts.map +1 -1
- package/lib/aws/index.js +10 -18
- package/lib/aws/index.js.map +1 -1
- 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 +10 -11
- package/lib/aws/lambda/consume.d.ts.map +1 -1
- package/lib/aws/lambda/consume.js +3 -3
- package/lib/aws/lambda/consume.js.map +1 -1
- package/lib/aws/lambda/function.d.ts +18 -15
- package/lib/aws/lambda/function.d.ts.map +1 -1
- package/lib/aws/lambda/function.handler.d.ts +1 -1
- package/lib/aws/lambda/function.handler.d.ts.map +1 -1
- package/lib/aws/lambda/function.handler.js.map +1 -1
- package/lib/aws/lambda/function.invoke.d.ts +7 -5
- package/lib/aws/lambda/function.invoke.d.ts.map +1 -1
- package/lib/aws/lambda/function.invoke.js +5 -3
- package/lib/aws/lambda/function.invoke.js.map +1 -1
- package/lib/aws/lambda/function.js +1 -1
- package/lib/aws/lambda/function.js.map +1 -1
- package/lib/aws/lambda/function.provider.d.ts +6 -5
- package/lib/aws/lambda/function.provider.d.ts.map +1 -1
- package/lib/aws/lambda/function.provider.js +150 -58
- package/lib/aws/lambda/function.provider.js.map +1 -1
- package/lib/aws/lambda/index.d.ts +2 -2
- package/lib/aws/lambda/index.d.ts.map +1 -1
- package/lib/aws/lambda/index.js +2 -1
- package/lib/aws/lambda/index.js.map +1 -1
- package/lib/aws/lambda/serve.d.ts +2 -4
- package/lib/aws/lambda/serve.d.ts.map +1 -1
- package/lib/aws/lambda/serve.js.map +1 -1
- package/lib/aws/profile.d.ts +2 -2
- package/lib/aws/profile.d.ts.map +1 -1
- package/lib/aws/profile.js +1 -1
- package/lib/aws/profile.js.map +1 -1
- package/lib/aws/region.d.ts +14 -1
- package/lib/aws/region.d.ts.map +1 -1
- package/lib/aws/region.js +26 -1
- package/lib/aws/region.js.map +1 -1
- 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 +3 -1
- package/lib/aws/sqs/index.d.ts.map +1 -1
- package/lib/aws/sqs/index.js +3 -1
- package/lib/aws/sqs/index.js.map +1 -1
- package/lib/aws/sqs/queue.consume.d.ts +1 -10
- package/lib/aws/sqs/queue.consume.d.ts.map +1 -1
- package/lib/aws/sqs/queue.consume.js +0 -19
- package/lib/aws/sqs/queue.consume.js.map +1 -1
- package/lib/aws/sqs/queue.d.ts +6 -12
- package/lib/aws/sqs/queue.d.ts.map +1 -1
- package/lib/aws/sqs/queue.event-source.d.ts +22 -0
- package/lib/aws/sqs/queue.event-source.d.ts.map +1 -0
- package/lib/aws/sqs/queue.event-source.js +130 -0
- package/lib/aws/sqs/queue.event-source.js.map +1 -0
- package/lib/aws/sqs/queue.js +1 -1
- package/lib/aws/sqs/queue.js.map +1 -1
- package/lib/aws/sqs/queue.provider.d.ts +5 -4
- package/lib/aws/sqs/queue.provider.d.ts.map +1 -1
- package/lib/aws/sqs/queue.provider.js +6 -6
- package/lib/aws/sqs/queue.provider.js.map +1 -1
- package/lib/aws/sqs/queue.send-message.d.ts +8 -6
- package/lib/aws/sqs/queue.send-message.d.ts.map +1 -1
- package/lib/aws/sqs/queue.send-message.js +6 -4
- package/lib/aws/sqs/queue.send-message.js.map +1 -1
- package/lib/binding.d.ts +74 -26
- 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/components/ApprovePlan.d.ts +2 -2
- package/lib/cli/components/ApprovePlan.d.ts.map +1 -1
- package/lib/cli/components/ApprovePlan.js.map +1 -1
- package/lib/cli/components/Plan.d.ts +2 -2
- package/lib/cli/components/Plan.d.ts.map +1 -1
- package/lib/cli/components/Plan.js +3 -1
- package/lib/cli/components/Plan.js.map +1 -1
- package/lib/cli/components/PlanProgress.d.ts +8 -4
- package/lib/cli/components/PlanProgress.d.ts.map +1 -1
- package/lib/cli/components/PlanProgress.js +11 -1
- package/lib/cli/components/PlanProgress.js.map +1 -1
- package/lib/cli/index.d.ts +342 -213
- package/lib/cli/index.d.ts.map +1 -1
- package/lib/cli/index.js +26047 -11403
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/ink-service.d.ts +4 -0
- package/lib/cli/ink-service.d.ts.map +1 -0
- package/lib/cli/ink-service.js +43 -0
- package/lib/cli/ink-service.js.map +1 -0
- package/lib/cli/service.d.ts +21 -0
- package/lib/cli/service.d.ts.map +1 -0
- package/lib/cli/service.js +5 -0
- package/lib/cli/service.js.map +1 -0
- package/lib/cloudflare/account.d.ts +10 -0
- package/lib/cloudflare/account.d.ts.map +1 -0
- package/lib/cloudflare/account.js +24 -0
- package/lib/cloudflare/account.js.map +1 -0
- package/lib/cloudflare/api.d.ts +31 -19
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +95 -29
- package/lib/cloudflare/api.js.map +1 -1
- package/lib/cloudflare/config.d.ts +9 -0
- package/lib/cloudflare/config.d.ts.map +1 -0
- package/lib/cloudflare/config.js +1 -0
- package/lib/cloudflare/config.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 +7 -4
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +7 -4
- package/lib/cloudflare/index.js.map +1 -1
- 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 +10 -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 +24 -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 +6 -0
- package/lib/cloudflare/kv/namespace.provider.d.ts.map +1 -0
- package/lib/cloudflare/kv/namespace.provider.js +81 -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 +15 -0
- package/lib/cloudflare/live.js.map +1 -0
- package/lib/cloudflare/r2/bucket.binding.d.ts +10 -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 +33 -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 +6 -0
- package/lib/cloudflare/r2/bucket.provider.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.provider.js +67 -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 +9 -0
- package/lib/cloudflare/worker/assets.fetch.d.ts.map +1 -0
- package/lib/cloudflare/worker/assets.fetch.js +12 -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 +5 -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 +66 -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 +11 -0
- package/lib/cloudflare/worker/worker.provider.d.ts.map +1 -0
- package/lib/cloudflare/worker/worker.provider.js +194 -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/data.d.ts +3 -0
- package/lib/data.d.ts.map +1 -0
- package/lib/data.js +8 -0
- package/lib/data.js.map +1 -0
- package/lib/destroy.d.ts +1 -3
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js +2 -0
- package/lib/destroy.js.map +1 -1
- package/lib/diff.d.ts +16 -0
- package/lib/diff.d.ts.map +1 -0
- package/lib/diff.js +9 -0
- package/lib/diff.js.map +1 -0
- 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/env.d.ts +5 -0
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +15 -29
- package/lib/env.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/exports.d.ts +9 -0
- package/lib/exports.d.ts.map +1 -0
- package/lib/exports.js +13 -0
- package/lib/exports.js.map +1 -0
- package/lib/index.d.ts +11 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +11 -5
- package/lib/index.js.map +1 -1
- package/lib/input.d.ts +32 -0
- package/lib/input.d.ts.map +1 -0
- package/lib/input.js +1 -0
- package/lib/input.js.map +1 -0
- package/lib/output.d.ts +143 -0
- package/lib/output.d.ts.map +1 -0
- package/lib/output.js +269 -0
- package/lib/output.js.map +1 -0
- package/lib/plan.d.ts +59 -29
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +347 -169
- package/lib/plan.js.map +1 -1
- package/lib/policy.d.ts +22 -5
- package/lib/policy.d.ts.map +1 -1
- package/lib/policy.js +10 -2
- package/lib/policy.js.map +1 -1
- package/lib/provider.d.ts +16 -18
- package/lib/provider.d.ts.map +1 -1
- package/lib/ref.d.ts +14 -0
- package/lib/ref.d.ts.map +1 -0
- package/lib/ref.js +21 -0
- package/lib/ref.js.map +1 -0
- package/lib/resource.d.ts +13 -16
- 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 +8 -7
- package/lib/runtime.d.ts.map +1 -1
- package/lib/runtime.js.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/service.d.ts +9 -6
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js.map +1 -1
- 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/stack.d.ts +60 -0
- package/lib/stack.d.ts.map +1 -0
- package/lib/stack.js +11 -0
- package/lib/stack.js.map +1 -0
- package/lib/stage.d.ts +39 -0
- package/lib/stage.d.ts.map +1 -0
- package/lib/stage.js +32 -0
- package/lib/stage.js.map +1 -0
- package/lib/state.d.ts +53 -11
- package/lib/state.d.ts.map +1 -1
- package/lib/state.js +33 -31
- 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 +35 -0
- package/lib/test.d.ts.map +1 -0
- package/lib/test.js +68 -0
- package/lib/test.js.map +1 -0
- package/lib/tsconfig.test.tsbuildinfo +1 -0
- package/lib/type.d.ts +6 -0
- package/lib/type.d.ts.map +1 -0
- package/lib/type.js +3 -0
- package/lib/type.js.map +1 -0
- package/lib/unknown.d.ts +4 -0
- package/lib/unknown.d.ts.map +1 -0
- package/lib/unknown.js +4 -0
- package/lib/unknown.js.map +1 -0
- package/lib/user.d.ts +3 -0
- package/lib/user.d.ts.map +1 -0
- package/lib/user.js +3 -0
- package/lib/user.js.map +1 -0
- package/lib/util.d.ts +6 -0
- package/lib/util.d.ts.map +1 -0
- package/lib/util.js +9 -0
- package/lib/util.js.map +1 -0
- package/package.json +58 -7
- package/src/$.ts +17 -0
- package/src/app.ts +9 -37
- package/src/apply.ts +435 -289
- package/src/assert-never.ts +18 -0
- package/src/aws/account.ts +29 -7
- package/src/aws/arn.ts +1 -7
- package/src/aws/client.ts +14 -1
- package/src/aws/config.ts +16 -0
- package/src/aws/credentials.ts +213 -177
- package/src/aws/dynamodb/attribute-value.ts +240 -0
- package/src/aws/{sqs/queue.client.ts → dynamodb/client.ts} +9 -9
- 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 +173 -0
- package/src/aws/dynamodb/table.provider.ts +276 -0
- package/src/aws/dynamodb/table.ts +101 -0
- package/src/aws/ec2/client.ts +20 -0
- package/src/aws/ec2/index.ts +7 -0
- package/src/aws/ec2/subnet.provider.ts +358 -0
- package/src/aws/ec2/subnet.ts +213 -0
- package/src/aws/ec2/vpc.provider.ts +269 -0
- package/src/aws/ec2/vpc.ts +163 -0
- package/src/aws/index.ts +50 -45
- package/src/aws/lambda/client.ts +14 -0
- package/src/aws/lambda/consume.ts +8 -8
- package/src/aws/lambda/function.handler.ts +1 -1
- package/src/aws/lambda/function.invoke.ts +8 -4
- package/src/aws/lambda/function.provider.ts +208 -109
- package/src/aws/lambda/function.ts +21 -12
- package/src/aws/lambda/index.ts +3 -4
- package/src/aws/lambda/serve.ts +1 -1
- package/src/aws/profile.ts +1 -4
- package/src/aws/region.ts +43 -2
- package/src/aws/sqs/client.ts +20 -0
- package/src/aws/sqs/index.ts +4 -1
- package/src/aws/sqs/queue.consume.ts +1 -34
- package/src/aws/sqs/queue.event-source.ts +227 -0
- package/src/aws/sqs/queue.provider.ts +14 -7
- package/src/aws/sqs/queue.send-message.ts +7 -10
- package/src/aws/sqs/queue.ts +9 -4
- package/src/binding.ts +130 -34
- package/src/capability.ts +44 -0
- package/src/cli/components/ApprovePlan.tsx +2 -2
- package/src/cli/components/Plan.tsx +6 -3
- package/src/cli/components/PlanProgress.tsx +32 -14
- package/src/cli/index.ts +2 -6
- package/src/cli/ink-service.tsx +61 -0
- package/src/cli/service.ts +23 -0
- package/src/cloudflare/account.ts +37 -0
- package/src/cloudflare/api.ts +147 -63
- package/src/cloudflare/config.ts +7 -0
- package/src/cloudflare/context.ts +49 -0
- package/src/cloudflare/index.ts +8 -4
- package/src/cloudflare/kv/index.ts +3 -0
- package/src/cloudflare/kv/namespace.binding.ts +27 -0
- package/src/cloudflare/kv/namespace.client.ts +70 -0
- package/src/cloudflare/kv/namespace.provider.ts +100 -0
- package/src/cloudflare/kv/namespace.ts +30 -0
- package/src/cloudflare/live.ts +32 -0
- package/src/cloudflare/r2/bucket.binding.ts +29 -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 +84 -0
- package/src/cloudflare/r2/bucket.put.ts +17 -0
- package/src/cloudflare/r2/bucket.ts +44 -0
- package/src/cloudflare/r2/index.ts +9 -0
- package/src/cloudflare/stream.ts +21 -0
- package/src/cloudflare/worker/assets.fetch.ts +29 -0
- package/src/cloudflare/worker/assets.provider.ts +249 -0
- package/src/cloudflare/worker/index.ts +4 -0
- package/src/cloudflare/worker/worker.handler.ts +39 -0
- package/src/cloudflare/worker/worker.provider.ts +249 -0
- package/src/cloudflare/worker/worker.serve.ts +22 -0
- package/src/cloudflare/worker/worker.ts +77 -0
- package/src/data.ts +18 -0
- package/src/destroy.ts +2 -3
- package/src/diff.ts +30 -0
- package/src/dot-alchemy.ts +3 -2
- package/src/env.ts +20 -32
- package/src/esbuild.ts +98 -0
- package/src/exports.ts +21 -0
- package/src/index.ts +12 -6
- package/src/input.ts +81 -0
- package/src/output.ts +518 -0
- package/src/plan.ts +544 -243
- package/src/policy.ts +58 -7
- package/src/provider.ts +27 -25
- package/src/ref.ts +48 -0
- package/src/resource.ts +23 -8
- package/src/runtime.ts +16 -9
- package/src/schema.ts +102 -0
- package/src/service.ts +11 -7
- package/src/sha256.ts +23 -0
- package/src/stack.ts +116 -0
- package/src/stage.ts +85 -0
- package/src/state.ts +141 -62
- package/src/tags.ts +38 -0
- package/src/test.ts +172 -0
- package/src/type.ts +6 -0
- package/src/unknown.ts +6 -0
- package/src/user.ts +4 -0
- package/src/util.ts +21 -0
- package/lib/approve.d.ts +0 -15
- package/lib/approve.d.ts.map +0 -1
- package/lib/approve.js +0 -7
- package/lib/approve.js.map +0 -1
- package/lib/aws/lambda/function.client.d.ts +0 -8
- package/lib/aws/lambda/function.client.d.ts.map +0 -1
- package/lib/aws/lambda/function.client.js +0 -7
- package/lib/aws/lambda/function.client.js.map +0 -1
- package/lib/aws/sqs/queue.client.d.ts +0 -12
- package/lib/aws/sqs/queue.client.d.ts.map +0 -1
- package/lib/aws/sqs/queue.client.js.map +0 -1
- package/lib/cli/approve.d.ts +0 -4
- package/lib/cli/approve.d.ts.map +0 -1
- package/lib/cli/approve.js +0 -18
- package/lib/cli/approve.js.map +0 -1
- package/lib/cli/clack.d.ts +0 -14
- package/lib/cli/clack.d.ts.map +0 -1
- package/lib/cli/clack.js +0 -12
- package/lib/cli/clack.js.map +0 -1
- package/lib/cli/main.d.ts +0 -2
- package/lib/cli/main.d.ts.map +0 -1
- package/lib/cli/main.js +0 -1
- package/lib/cli/main.js.map +0 -1
- package/lib/cli/plan.d.ts +0 -13
- package/lib/cli/plan.d.ts.map +0 -1
- package/lib/cli/plan.js +0 -1
- package/lib/cli/plan.js.map +0 -1
- package/lib/cli/progress.d.ts +0 -7
- package/lib/cli/progress.d.ts.map +0 -1
- package/lib/cli/progress.js +0 -29
- package/lib/cli/progress.js.map +0 -1
- package/lib/cli/spinner.d.ts +0 -2
- package/lib/cli/spinner.d.ts.map +0 -1
- package/lib/cli/spinner.js +0 -13
- package/lib/cli/spinner.js.map +0 -1
- package/lib/cloudflare/kv.d.ts +0 -29
- package/lib/cloudflare/kv.d.ts.map +0 -1
- package/lib/cloudflare/kv.js +0 -3
- package/lib/cloudflare/kv.js.map +0 -1
- package/lib/cloudflare/kv.provider.d.ts +0 -4
- package/lib/cloudflare/kv.provider.d.ts.map +0 -1
- package/lib/cloudflare/kv.provider.js +0 -39
- package/lib/cloudflare/kv.provider.js.map +0 -1
- package/lib/cloudflare/worker.d.ts +0 -33
- package/lib/cloudflare/worker.d.ts.map +0 -1
- package/lib/cloudflare/worker.js +0 -4
- package/lib/cloudflare/worker.js.map +0 -1
- package/src/approve.ts +0 -13
- package/src/aws/lambda/function.client.ts +0 -14
- package/src/cli/approve.tsx +0 -30
- package/src/cli/clack.ts +0 -22
- package/src/cli/main.ts +0 -0
- package/src/cli/plan.ts +0 -16
- package/src/cli/progress.tsx +0 -45
- package/src/cli/spinner.ts +0 -14
- package/src/cloudflare/kv.provider.ts +0 -51
- package/src/cloudflare/kv.ts +0 -20
- package/src/cloudflare/worker.ts +0 -34
package/src/policy.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as Context from "effect/Context";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as S from "effect/Schema";
|
|
3
4
|
import { type AnyBinding, type Bind } from "./binding.ts";
|
|
4
5
|
import type { Capability } from "./capability.ts";
|
|
5
|
-
import type { Runtime } from "./runtime.ts";
|
|
6
|
+
import type { IRuntime, Runtime } from "./runtime.ts";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* A Policy binds a set of Capbilities (e.g SQS.SendMessage, SQS.Consume, etc.) to a
|
|
@@ -14,10 +15,11 @@ import type { Runtime } from "./runtime.ts";
|
|
|
14
15
|
* A Policy is invariant over the set of Capabilities to ensure least-privilege.
|
|
15
16
|
*/
|
|
16
17
|
export interface Policy<
|
|
17
|
-
F extends
|
|
18
|
+
F extends IRuntime,
|
|
18
19
|
in out Capabilities,
|
|
19
20
|
Tags = unknown,
|
|
20
21
|
> {
|
|
22
|
+
readonly kind: "alchemy/Policy";
|
|
21
23
|
readonly runtime: F;
|
|
22
24
|
readonly tags: Tags[];
|
|
23
25
|
readonly capabilities: Capabilities[];
|
|
@@ -26,12 +28,13 @@ export interface Policy<
|
|
|
26
28
|
/** Add more Capabilities to a Policy */
|
|
27
29
|
and<B extends AnyBinding[]>(
|
|
28
30
|
...bindings: B
|
|
29
|
-
): Policy<
|
|
31
|
+
): Policy<
|
|
32
|
+
F,
|
|
33
|
+
B[number]["capability"] | Capabilities,
|
|
34
|
+
BindingTags<B[number]> | Exclude<Tags, unknown>
|
|
35
|
+
>;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
|
-
export type $<T> = Instance<T>;
|
|
33
|
-
export const $ = Policy;
|
|
34
|
-
|
|
35
38
|
type BindingTags<B extends AnyBinding> = B extends any
|
|
36
39
|
? Bind<B["runtime"], B["capability"], Extract<B["tag"], string>>
|
|
37
40
|
: never;
|
|
@@ -46,7 +49,7 @@ export function Policy<B extends AnyBinding[]>(
|
|
|
46
49
|
>;
|
|
47
50
|
export function Policy(...bindings: AnyBinding[]): any {
|
|
48
51
|
return {
|
|
49
|
-
runtime: bindings[0]["runtime"],
|
|
52
|
+
runtime: bindings[0]?.["runtime"],
|
|
50
53
|
capabilities: bindings.map((b) => b.capability),
|
|
51
54
|
tags: bindings.map((b) => Context.Tag(b.tag as any)()),
|
|
52
55
|
bindings,
|
|
@@ -57,6 +60,54 @@ export function Policy(...bindings: AnyBinding[]): any {
|
|
|
57
60
|
};
|
|
58
61
|
}
|
|
59
62
|
|
|
63
|
+
export namespace Policy {
|
|
64
|
+
export interface AnyOf<in out T> {
|
|
65
|
+
readonly anyOf: T[];
|
|
66
|
+
}
|
|
67
|
+
type Generalize<T> = T extends S.Schema<infer U> ? U : T;
|
|
68
|
+
|
|
69
|
+
export const anyOf = <const T>(...anyOf: T[]): AnyOf<Generalize<T>> => ({
|
|
70
|
+
anyOf: anyOf as Generalize<T>[],
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export const join = <
|
|
74
|
+
const Strings extends readonly string[],
|
|
75
|
+
const Delimiter extends string,
|
|
76
|
+
>(
|
|
77
|
+
strings: Strings,
|
|
78
|
+
delimiter: Delimiter,
|
|
79
|
+
) => strings.join(delimiter) as Join<Strings, Delimiter>;
|
|
80
|
+
|
|
81
|
+
type ___ = Join<string[], ",">;
|
|
82
|
+
type Join<
|
|
83
|
+
T extends readonly string[],
|
|
84
|
+
Delimiter extends string,
|
|
85
|
+
> = T extends readonly [infer First extends string]
|
|
86
|
+
? First
|
|
87
|
+
: T extends readonly [
|
|
88
|
+
infer First extends string,
|
|
89
|
+
...infer Rest extends readonly string[],
|
|
90
|
+
]
|
|
91
|
+
? `${First}${Delimiter}${Join<Rest, Delimiter>}`
|
|
92
|
+
: T extends string[]
|
|
93
|
+
? string
|
|
94
|
+
: "";
|
|
95
|
+
|
|
96
|
+
export type Constraint<T> = Pick<
|
|
97
|
+
T,
|
|
98
|
+
{
|
|
99
|
+
[k in keyof T]: T[k] extends never
|
|
100
|
+
? never
|
|
101
|
+
: T[k] extends AnyOf<never>
|
|
102
|
+
? never
|
|
103
|
+
: k;
|
|
104
|
+
}[keyof T]
|
|
105
|
+
>;
|
|
106
|
+
|
|
107
|
+
// TODO(sam): one day we might infer policies using a compiler plugin, this is a placeholder
|
|
108
|
+
export const infer = <T>(): T => undefined!;
|
|
109
|
+
}
|
|
110
|
+
|
|
60
111
|
/** declare a Policy requiring Capabilities in some context */
|
|
61
112
|
export const declare = <S extends Capability>() =>
|
|
62
113
|
Effect.gen(function* () {}) as Effect.Effect<void, never, S>;
|
package/src/provider.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import * as Context from "effect/Context";
|
|
2
2
|
import type * as Effect from "effect/Effect";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Diff } from "./diff.ts";
|
|
4
|
+
import type { Input } from "./input.ts";
|
|
4
5
|
import type { Resource } from "./resource.ts";
|
|
5
6
|
import type { Runtime } from "./runtime.ts";
|
|
7
|
+
import type { Service } from "./service.ts";
|
|
8
|
+
import type { ScopedPlanStatusSession } from "./cli/service.ts";
|
|
6
9
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
export interface Provider<R extends Resource | Service>
|
|
11
|
+
extends Context.TagClass<
|
|
12
|
+
Provider<R>,
|
|
13
|
+
R["type"],
|
|
14
|
+
ProviderService<any>
|
|
15
|
+
// TODO(sam): we are using any here because the R["type"] is enough and gaining access to the sub type (e.g. SQS.Queue)
|
|
16
|
+
// is currently not possible in the current approach
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
deleteFirst?: undefined;
|
|
17
|
-
}
|
|
18
|
-
| {
|
|
19
|
-
action: "replace";
|
|
20
|
-
deleteFirst?: boolean;
|
|
21
|
-
};
|
|
18
|
+
// preferred:
|
|
19
|
+
// ProviderService<R>
|
|
20
|
+
> {}
|
|
22
21
|
|
|
23
22
|
type BindingData<Res extends Resource> = [Res] extends [Runtime]
|
|
24
23
|
? Res["binding"][]
|
|
25
24
|
: any[];
|
|
26
25
|
|
|
26
|
+
type Props<Res extends Resource> = Input.ResolveOpaque<Res["props"]>;
|
|
27
|
+
|
|
27
28
|
export interface ProviderService<Res extends Resource = Resource> {
|
|
28
29
|
// tail();
|
|
29
30
|
// watch();
|
|
30
31
|
// replace(): Effect.Effect<void, never, never>;
|
|
31
|
-
|
|
32
32
|
// different interface that is persistent, watching, reloads
|
|
33
33
|
// run?() {}
|
|
34
34
|
read?(input: {
|
|
35
35
|
id: string;
|
|
36
|
-
olds: Res
|
|
36
|
+
olds: Props<Res> | undefined;
|
|
37
37
|
// what is the ARN?
|
|
38
38
|
output: Res["attr"] | undefined; // current state -> synced state
|
|
39
39
|
session: ScopedPlanStatusSession;
|
|
@@ -41,32 +41,34 @@ export interface ProviderService<Res extends Resource = Resource> {
|
|
|
41
41
|
}): Effect.Effect<Res["attr"] | undefined, any, never>;
|
|
42
42
|
diff?(input: {
|
|
43
43
|
id: string;
|
|
44
|
-
olds: Res
|
|
44
|
+
olds: Props<Res>;
|
|
45
|
+
// Note: we do not resolve (Props<Res>) here because diff runs during plan
|
|
46
|
+
// -> we need a way for the diff handlers to work with Outputs
|
|
45
47
|
news: Res["props"];
|
|
46
48
|
output: Res["attr"];
|
|
47
|
-
}): Effect.Effect<Diff, never, never>;
|
|
48
|
-
|
|
49
|
+
}): Effect.Effect<Diff | void, never, never>;
|
|
50
|
+
precreate?(input: {
|
|
49
51
|
id: string;
|
|
50
|
-
news: Res
|
|
52
|
+
news: Props<Res>;
|
|
51
53
|
session: ScopedPlanStatusSession;
|
|
52
54
|
}): Effect.Effect<Res["attr"], any, never>;
|
|
53
55
|
create(input: {
|
|
54
56
|
id: string;
|
|
55
|
-
news: Res
|
|
57
|
+
news: Props<Res>;
|
|
56
58
|
session: ScopedPlanStatusSession;
|
|
57
59
|
bindings: BindingData<Res>;
|
|
58
60
|
}): Effect.Effect<Res["attr"], any, never>;
|
|
59
61
|
update(input: {
|
|
60
62
|
id: string;
|
|
61
|
-
news: Res
|
|
62
|
-
olds: Res
|
|
63
|
+
news: Props<Res>;
|
|
64
|
+
olds: Props<Res>;
|
|
63
65
|
output: Res["attr"];
|
|
64
66
|
session: ScopedPlanStatusSession;
|
|
65
67
|
bindings: BindingData<Res>;
|
|
66
68
|
}): Effect.Effect<Res["attr"], any, never>;
|
|
67
69
|
delete(input: {
|
|
68
70
|
id: string;
|
|
69
|
-
olds: Res
|
|
71
|
+
olds: Props<Res>;
|
|
70
72
|
output: Res["attr"];
|
|
71
73
|
session: ScopedPlanStatusSession;
|
|
72
74
|
bindings: BindingData<Res>;
|
package/src/ref.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Resource, AnyResource } from "./resource.ts";
|
|
2
|
+
import * as Output from "./output.ts";
|
|
3
|
+
|
|
4
|
+
// special runtime-only symbol for probing the Ref proxy for its metadata
|
|
5
|
+
const RefMetadata = Symbol.for("alchemy/RefMetadata");
|
|
6
|
+
|
|
7
|
+
export const isRef = (s: any): s is Ref<any> =>
|
|
8
|
+
s && s[RefMetadata] !== undefined;
|
|
9
|
+
|
|
10
|
+
export const getRefMetadata = <R extends Resource<string, string, any, any>>(
|
|
11
|
+
ref: Ref<R>,
|
|
12
|
+
): RefMetadata<R> => (ref as any)[RefMetadata];
|
|
13
|
+
|
|
14
|
+
export interface Ref<
|
|
15
|
+
R extends Resource<string, string, any, any> = AnyResource,
|
|
16
|
+
> {
|
|
17
|
+
/** @internal phantom */
|
|
18
|
+
Ref: R;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface RefMetadata<R extends Resource<string, string, any, any>> {
|
|
22
|
+
stack?: string;
|
|
23
|
+
stage?: string;
|
|
24
|
+
resourceId: R["id"];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const ref = <R extends Resource<string, string, any, any>>({
|
|
28
|
+
stack,
|
|
29
|
+
resourceId,
|
|
30
|
+
stage,
|
|
31
|
+
}: RefMetadata<R>): Ref<R> => {
|
|
32
|
+
const ref = new Proxy(
|
|
33
|
+
{},
|
|
34
|
+
{
|
|
35
|
+
get: (_, prop) => {
|
|
36
|
+
if (prop === RefMetadata) {
|
|
37
|
+
return {
|
|
38
|
+
stack,
|
|
39
|
+
stage,
|
|
40
|
+
resourceId,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return (Output.of(ref) as any)[prop];
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
) as Ref<R>;
|
|
47
|
+
return ref;
|
|
48
|
+
};
|
package/src/resource.ts
CHANGED
|
@@ -9,24 +9,37 @@ export const isResource = (r: any): r is Resource => {
|
|
|
9
9
|
);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export type AnyResource = Resource<string, string, any, any>;
|
|
13
|
+
|
|
14
|
+
export interface IResource<
|
|
13
15
|
Type extends string = string,
|
|
14
16
|
ID extends string = string,
|
|
15
17
|
Props = unknown,
|
|
16
18
|
Attrs = unknown,
|
|
19
|
+
Base = unknown,
|
|
17
20
|
> {
|
|
18
21
|
id: ID;
|
|
19
22
|
type: Type;
|
|
23
|
+
Props: unknown;
|
|
20
24
|
props: Props;
|
|
25
|
+
base: Base;
|
|
26
|
+
/** @internal phantom */
|
|
21
27
|
attr: Attrs;
|
|
22
|
-
parent: unknown;
|
|
23
|
-
// oxlint-disable-next-line no-misused-new
|
|
24
|
-
new (): Resource<Type, ID, Props, Attrs>;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
|
-
export interface
|
|
30
|
+
export interface Resource<
|
|
31
|
+
Type extends string = string,
|
|
32
|
+
ID extends string = string,
|
|
33
|
+
Props = unknown,
|
|
34
|
+
Attrs = unknown,
|
|
35
|
+
Base = unknown,
|
|
36
|
+
> extends IResource<Type, ID, Props, Attrs, Base> {
|
|
37
|
+
new (): Resource<Type, ID, Props, Attrs, Base>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ResourceTags<R extends Resource<string, string, any, any>> {
|
|
28
41
|
of<S extends ProviderService<R>>(service: S): S;
|
|
29
|
-
tag:
|
|
42
|
+
tag: Provider<R>;
|
|
30
43
|
effect<Err, Req>(
|
|
31
44
|
eff: Effect<ProviderService<R>, Err, Req>,
|
|
32
45
|
): Layer.Layer<Provider<R>, Err, Req>;
|
|
@@ -37,13 +50,14 @@ export const Resource = <Ctor extends (id: string, props: any) => Resource>(
|
|
|
37
50
|
type: ReturnType<Ctor>["type"],
|
|
38
51
|
) => {
|
|
39
52
|
const Tag = Context.Tag(type)();
|
|
40
|
-
const provider = {
|
|
41
|
-
tag: Tag,
|
|
53
|
+
const provider: ResourceTags<ReturnType<Ctor>> = {
|
|
54
|
+
tag: Tag as any,
|
|
42
55
|
effect: <Err, Req>(
|
|
43
56
|
eff: Effect<ProviderService<ReturnType<Ctor>>, Err, Req>,
|
|
44
57
|
) => Layer.effect(Tag, eff),
|
|
45
58
|
succeed: (service: ProviderService<ReturnType<Ctor>>) =>
|
|
46
59
|
Layer.succeed(Tag, service),
|
|
60
|
+
of: (service) => service,
|
|
47
61
|
};
|
|
48
62
|
return Object.assign(
|
|
49
63
|
function (id: string, props: any) {
|
|
@@ -55,6 +69,7 @@ export const Resource = <Ctor extends (id: string, props: any) => Resource>(
|
|
|
55
69
|
};
|
|
56
70
|
} as unknown as Ctor & {
|
|
57
71
|
type: ReturnType<Ctor>["type"];
|
|
72
|
+
parent: ReturnType<Ctor>;
|
|
58
73
|
new (): ReturnType<Ctor> & {
|
|
59
74
|
parent: ReturnType<Ctor>;
|
|
60
75
|
};
|
package/src/runtime.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as Layer from "effect/Layer";
|
|
|
5
5
|
import type { Capability } from "./capability.ts";
|
|
6
6
|
import type { Policy } from "./policy.ts";
|
|
7
7
|
import type { ProviderService } from "./provider.ts";
|
|
8
|
-
import type { Resource, ResourceTags } from "./resource.ts";
|
|
8
|
+
import type { IResource, Resource, ResourceTags } from "./resource.ts";
|
|
9
9
|
import type { IService, Service } from "./service.ts";
|
|
10
10
|
|
|
11
11
|
export type RuntimeHandler<
|
|
@@ -37,21 +37,30 @@ export declare namespace Runtime {
|
|
|
37
37
|
|
|
38
38
|
export type AnyRuntime = Runtime<string>;
|
|
39
39
|
|
|
40
|
-
export interface RuntimeProps<Run extends
|
|
41
|
-
bindings: Policy<Run, Extract<Req, Capability
|
|
40
|
+
export interface RuntimeProps<Run extends IRuntime, Req> {
|
|
41
|
+
bindings: Policy<Run, Extract<Req, Capability>, unknown>;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export interface
|
|
44
|
+
export interface IRuntime<
|
|
45
45
|
Type extends string = string,
|
|
46
46
|
Handler = unknown,
|
|
47
47
|
Props = unknown,
|
|
48
|
-
> extends
|
|
48
|
+
> extends IResource<Type, string, Props> {
|
|
49
49
|
type: Type;
|
|
50
50
|
props: Props;
|
|
51
51
|
handler: Handler;
|
|
52
52
|
binding: unknown;
|
|
53
53
|
/** @internal phantom */
|
|
54
54
|
capability: unknown;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface Runtime<
|
|
58
|
+
Type extends string = string,
|
|
59
|
+
Handler = unknown,
|
|
60
|
+
Props = unknown,
|
|
61
|
+
> extends IRuntime<Type, Handler, Props>,
|
|
62
|
+
Resource<Type, string, Props> {
|
|
63
|
+
provider: ResourceTags<this>;
|
|
55
64
|
<
|
|
56
65
|
const ID extends string,
|
|
57
66
|
Inputs extends any[],
|
|
@@ -75,9 +84,7 @@ export interface Runtime<
|
|
|
75
84
|
|
|
76
85
|
export const Runtime =
|
|
77
86
|
<const Type extends string>(type: Type) =>
|
|
78
|
-
<Self extends Runtime>(): Self
|
|
79
|
-
provider: ResourceTags<Self>;
|
|
80
|
-
} => {
|
|
87
|
+
<Self extends Runtime>(): Self => {
|
|
81
88
|
const Tag = Context.Tag(type)();
|
|
82
89
|
const provider = {
|
|
83
90
|
tag: Tag,
|
|
@@ -122,7 +129,7 @@ export const Runtime =
|
|
|
122
129
|
parent: self,
|
|
123
130
|
// @ts-expect-error
|
|
124
131
|
provider,
|
|
125
|
-
} satisfies IService<string, Self, any, any>,
|
|
132
|
+
} satisfies IService<string, Self, any, any, Self>,
|
|
126
133
|
);
|
|
127
134
|
}
|
|
128
135
|
},
|
package/src/schema.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as S from "effect/Schema";
|
|
2
|
+
import type { AST } from "effect/SchemaAST";
|
|
3
|
+
|
|
4
|
+
const Description = Symbol.for("effect/annotation/Description");
|
|
5
|
+
|
|
6
|
+
export const isTag = <T extends S.Schema<any>>(tag: T["ast"]["_tag"]) =>
|
|
7
|
+
((schema) =>
|
|
8
|
+
S.isSchema(schema)
|
|
9
|
+
? S.encodedSchema(schema).ast._tag === tag
|
|
10
|
+
: schema._tag === tag) as {
|
|
11
|
+
(schema: S.Schema<any>): schema is T;
|
|
12
|
+
(schema: AST): boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const hasGenericAnnotation =
|
|
16
|
+
(type: string) => (ast: AST | undefined) => {
|
|
17
|
+
const description: string | undefined = ast?.annotations?.[
|
|
18
|
+
Description
|
|
19
|
+
] as string;
|
|
20
|
+
return (
|
|
21
|
+
description &&
|
|
22
|
+
description?.startsWith(`${type}<`) &&
|
|
23
|
+
description?.endsWith(">")
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const isNullishSchema = (schema: S.Schema<any>) =>
|
|
28
|
+
isNullSchema(schema) || isUndefinedSchema(schema);
|
|
29
|
+
export const isNullSchema = (schema: S.Schema<any>) =>
|
|
30
|
+
schema.ast._tag === "Literal" && schema.ast.literal === null;
|
|
31
|
+
export const isUndefinedSchema = isTag("UndefinedKeyword");
|
|
32
|
+
export const isBooleanSchema = isTag<S.Schema<boolean>>("BooleanKeyword");
|
|
33
|
+
export const isStringSchema = isTag<S.Schema<string>>("StringKeyword");
|
|
34
|
+
export const isNumberSchema = isTag<S.Schema<number>>("NumberKeyword");
|
|
35
|
+
|
|
36
|
+
export const hasMapAnnotation = hasGenericAnnotation("Map");
|
|
37
|
+
|
|
38
|
+
export const isRecordLikeSchema = (schema: S.Schema<any>) =>
|
|
39
|
+
isMapSchema(schema) ||
|
|
40
|
+
isRecordSchema(schema) ||
|
|
41
|
+
isStructSchema(schema) ||
|
|
42
|
+
isClassSchema(schema) ||
|
|
43
|
+
false;
|
|
44
|
+
|
|
45
|
+
export const isMapSchema = (schema: S.Schema<any>) =>
|
|
46
|
+
hasMapAnnotation(schema.ast) ||
|
|
47
|
+
// @ts-expect-error - ast.to?. is not narrowed, we don't care
|
|
48
|
+
hasMapAnnotation(schema.ast.to) ||
|
|
49
|
+
false;
|
|
50
|
+
|
|
51
|
+
export const isClassSchema = (schema: S.Schema<any>) => {
|
|
52
|
+
const encoded = S.encodedSchema(schema);
|
|
53
|
+
return (
|
|
54
|
+
encoded.ast._tag === "TypeLiteral" &&
|
|
55
|
+
encoded.ast.propertySignatures !== undefined
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const isStructSchema = (schema: S.Schema<any>) => {
|
|
60
|
+
return (
|
|
61
|
+
schema.ast._tag === "TypeLiteral" &&
|
|
62
|
+
schema.ast.propertySignatures !== undefined
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const isRecordSchema = (schema: S.Schema<any>) => {
|
|
67
|
+
const encoded = S.encodedSchema(schema);
|
|
68
|
+
return (
|
|
69
|
+
encoded.ast._tag === "TypeLiteral" &&
|
|
70
|
+
encoded.ast.indexSignatures?.[0] !== undefined
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const isListSchema = (schema: S.Schema<any>) => {
|
|
75
|
+
return (
|
|
76
|
+
hasListAnnotation(schema.ast) ||
|
|
77
|
+
(S.encodedSchema(schema).ast._tag === "TupleType" && !isMapSchema(schema))
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
export const hasListAnnotation = (ast: AST | undefined) => {
|
|
81
|
+
const description: string | undefined = ast?.annotations?.[
|
|
82
|
+
Description
|
|
83
|
+
] as string;
|
|
84
|
+
return (
|
|
85
|
+
description &&
|
|
86
|
+
description?.startsWith("List<") &&
|
|
87
|
+
description?.endsWith(">")
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const isSetSchema = (schema: S.Schema<any>) => {
|
|
92
|
+
return (
|
|
93
|
+
// @ts-expect-error - ast.to?. is not narrowed, we don't care
|
|
94
|
+
hasSetAnnotation(schema.ast) || hasSetAnnotation(schema.ast.to) || false
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const hasSetAnnotation = hasGenericAnnotation("Set");
|
|
99
|
+
|
|
100
|
+
export const getSetValueAST = (schema: S.Schema<any>): AST =>
|
|
101
|
+
// @ts-expect-error - ast.to?. is not narrowed, we don't care
|
|
102
|
+
isSetSchema(schema) && schema.ast.to?.typeParameters[0];
|
package/src/service.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { Effect } from "effect/Effect";
|
|
2
2
|
import type { Capability } from "./capability.ts";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { IResource } from "./resource.ts";
|
|
4
|
+
import type { IRuntime, RuntimeHandler, RuntimeProps } from "./runtime.ts";
|
|
5
5
|
|
|
6
6
|
export interface IService<
|
|
7
7
|
ID extends string = string,
|
|
8
|
-
F extends
|
|
8
|
+
F extends IRuntime = IRuntime,
|
|
9
9
|
Handler extends RuntimeHandler = RuntimeHandler,
|
|
10
10
|
Props extends RuntimeProps<F, any> = RuntimeProps<F, any>,
|
|
11
11
|
Attr = (F & { props: Props })["attr"],
|
|
12
|
-
|
|
12
|
+
Base = unknown,
|
|
13
|
+
> extends IResource<F["type"], ID, Props, Attr, F> {
|
|
13
14
|
kind: "Service";
|
|
14
15
|
type: F["type"];
|
|
15
16
|
id: ID;
|
|
@@ -39,16 +40,19 @@ export interface IService<
|
|
|
39
40
|
attr: Attr;
|
|
40
41
|
/** @internal phantom type of this resource's parent */
|
|
41
42
|
parent: unknown;
|
|
43
|
+
new (): Service<ID, F, Handler, Props, Attr, Base>;
|
|
42
44
|
}
|
|
43
45
|
|
|
46
|
+
export interface AnyService extends IService {}
|
|
47
|
+
|
|
44
48
|
export interface Service<
|
|
45
49
|
ID extends string = string,
|
|
46
|
-
F extends
|
|
50
|
+
F extends IRuntime = IRuntime,
|
|
47
51
|
Handler extends RuntimeHandler = RuntimeHandler,
|
|
48
52
|
Props extends RuntimeProps<F, any> = RuntimeProps<F, any>,
|
|
49
53
|
Attr = (F & { props: Props })["attr"],
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
Base = unknown,
|
|
55
|
+
> extends IService<ID, F, Handler, Props, Attr, Base> {}
|
|
52
56
|
|
|
53
57
|
export const isService = (resource: any): resource is IService => {
|
|
54
58
|
return resource && resource.kind === "Service";
|
package/src/sha256.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
|
|
3
|
+
type Input = ArrayBuffer | Uint8Array | string;
|
|
4
|
+
|
|
5
|
+
export const sha256 = (input: Input) =>
|
|
6
|
+
Effect.promise(async () => {
|
|
7
|
+
const digest = await crypto.subtle.digest("SHA-256", toArrayBuffer(input));
|
|
8
|
+
const hashArray = Array.from(new Uint8Array(digest));
|
|
9
|
+
return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const toArrayBuffer = (input: Input) => {
|
|
13
|
+
if (input instanceof ArrayBuffer) {
|
|
14
|
+
return input;
|
|
15
|
+
}
|
|
16
|
+
if (typeof input === "string") {
|
|
17
|
+
return new TextEncoder().encode(input);
|
|
18
|
+
}
|
|
19
|
+
return input.buffer.slice(
|
|
20
|
+
input.byteOffset,
|
|
21
|
+
input.byteOffset + input.byteLength,
|
|
22
|
+
) as ArrayBuffer;
|
|
23
|
+
};
|
package/src/stack.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { HttpClient } from "@effect/platform/HttpClient";
|
|
2
|
+
import { FileSystem } from "@effect/platform/FileSystem";
|
|
3
|
+
import { Path } from "@effect/platform/Path";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Layer from "effect/Layer";
|
|
6
|
+
import * as App from "./app.ts";
|
|
7
|
+
import { type AppliedPlan } from "./apply.ts";
|
|
8
|
+
import { DotAlchemy } from "./dot-alchemy.ts";
|
|
9
|
+
import type { DerivePlan, Providers, TraverseResources } from "./plan.ts";
|
|
10
|
+
import type { Instance } from "./policy.ts";
|
|
11
|
+
import type { AnyResource } from "./resource.ts";
|
|
12
|
+
import type { AnyService } from "./service.ts";
|
|
13
|
+
import { type StageConfig, type Stages } from "./stage.ts";
|
|
14
|
+
import * as State from "./state.ts";
|
|
15
|
+
import type { Ref } from "./ref.ts";
|
|
16
|
+
import type { CLI } from "./cli/service.ts";
|
|
17
|
+
|
|
18
|
+
export const defineStack = <
|
|
19
|
+
const Name extends string,
|
|
20
|
+
Resources extends (AnyResource | AnyService)[],
|
|
21
|
+
Req = never,
|
|
22
|
+
Err = never,
|
|
23
|
+
>(
|
|
24
|
+
stack: StackConfig<Name, Resources, Req, Err>,
|
|
25
|
+
): Stack<Name, Instance<Resources[number]>, Req, Err> => stack as any;
|
|
26
|
+
|
|
27
|
+
export type StackConfig<
|
|
28
|
+
Name extends string,
|
|
29
|
+
Resources extends (AnyResource | AnyService)[] = (AnyResource | AnyService)[],
|
|
30
|
+
StagesReq = never,
|
|
31
|
+
StagesErr = never,
|
|
32
|
+
TapReq = never,
|
|
33
|
+
TapErr = never,
|
|
34
|
+
> = {
|
|
35
|
+
name: Name;
|
|
36
|
+
stages: Stages<StagesReq, StagesErr>;
|
|
37
|
+
resources: Resources;
|
|
38
|
+
providers: Layer.Layer<
|
|
39
|
+
Providers<Instance<Resources[number]>>,
|
|
40
|
+
any,
|
|
41
|
+
App.App | FileSystem | Path | DotAlchemy | HttpClient
|
|
42
|
+
>;
|
|
43
|
+
state?: Layer.Layer<State.State>;
|
|
44
|
+
tap?: (
|
|
45
|
+
output: StackOutput<Instance<Resources[number]>>,
|
|
46
|
+
) => Effect.Effect<any, TapErr, TapReq>;
|
|
47
|
+
} & (Exclude<NoInfer<StagesReq | TapReq>, BuiltInServices> extends never
|
|
48
|
+
? {
|
|
49
|
+
layers?: never;
|
|
50
|
+
}
|
|
51
|
+
: {
|
|
52
|
+
layers: Layer.Layer<
|
|
53
|
+
Exclude<StagesReq | TapReq, BuiltInServices>,
|
|
54
|
+
never,
|
|
55
|
+
never
|
|
56
|
+
>;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export type StackOutput<Resources extends AnyResource | AnyService> =
|
|
60
|
+
AppliedPlan<DerivePlan<Resources>>;
|
|
61
|
+
|
|
62
|
+
export type Stack<
|
|
63
|
+
Name extends string = string,
|
|
64
|
+
Resources extends AnyResource | AnyService = any,
|
|
65
|
+
StagesReq = any,
|
|
66
|
+
StagesErr = any,
|
|
67
|
+
TapReq = any,
|
|
68
|
+
TapErr = any,
|
|
69
|
+
> = {
|
|
70
|
+
name: Name;
|
|
71
|
+
stages: Stages<StagesReq, StagesErr>;
|
|
72
|
+
resources: Resources[];
|
|
73
|
+
providers: Layer.Layer<Providers<Resources>, any, BuiltInServices>;
|
|
74
|
+
state?: Layer.Layer<State.State>;
|
|
75
|
+
cli?: Layer.Layer<CLI>;
|
|
76
|
+
tap?: (output: StackOutput<Resources>) => Effect.Effect<void, TapErr, TapReq>;
|
|
77
|
+
} & (Exclude<StagesReq | TapReq, BuiltInServices> extends never
|
|
78
|
+
? {
|
|
79
|
+
layers?: never;
|
|
80
|
+
}
|
|
81
|
+
: {
|
|
82
|
+
layers: Layer.Layer<
|
|
83
|
+
Exclude<StagesReq | TapReq, BuiltInServices>,
|
|
84
|
+
never,
|
|
85
|
+
never
|
|
86
|
+
>;
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export type StackName<S extends Stack> =
|
|
90
|
+
S extends Stack<infer Name, infer _> ? Name : never;
|
|
91
|
+
|
|
92
|
+
export type StackResources<S extends Stack> =
|
|
93
|
+
S extends Stack<infer _, infer Resources> ? Resources : never;
|
|
94
|
+
|
|
95
|
+
export type BuiltInServices =
|
|
96
|
+
| App.App
|
|
97
|
+
| FileSystem
|
|
98
|
+
| Path
|
|
99
|
+
| DotAlchemy
|
|
100
|
+
| HttpClient;
|
|
101
|
+
|
|
102
|
+
export interface StackRefConfig<S extends Stack> extends StageConfig {
|
|
103
|
+
stack: S extends Stack<infer Name, any> ? Name : never;
|
|
104
|
+
stage?: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export type StackRef<Resources extends AnyResource | AnyService> = {
|
|
108
|
+
[Id in keyof AsRecord<Resources>]: Ref<AsRecord<Resources>[Id]>;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
type AsRecord<Resources extends AnyResource | AnyService> = {
|
|
112
|
+
[Id in TraverseResources<Resources>["id"]]: Extract<
|
|
113
|
+
TraverseResources<Resources>,
|
|
114
|
+
{ id: Id }
|
|
115
|
+
>;
|
|
116
|
+
};
|