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/output.ts
ADDED
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
import { pipe } from "effect";
|
|
2
|
+
import * as App from "./app.ts";
|
|
3
|
+
import * as Data from "effect/Data";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { isPrimitive } from "./data.ts";
|
|
6
|
+
import type { From } from "./policy.ts";
|
|
7
|
+
import type { AnyResource, Resource } from "./resource.ts";
|
|
8
|
+
import type { IsAny, UnionToIntersection } from "./util.ts";
|
|
9
|
+
import * as State from "./state.ts";
|
|
10
|
+
import { isRef, type Ref, getRefMetadata, ref as stageRef } from "./ref.ts";
|
|
11
|
+
|
|
12
|
+
// a special symbol only used at runtime to probe the Output proxy
|
|
13
|
+
const ExprSymbol = Symbol.for("alchemy/Expr");
|
|
14
|
+
|
|
15
|
+
export const isOutput = (value: any): value is Output<any> =>
|
|
16
|
+
value &&
|
|
17
|
+
(typeof value === "object" || typeof value === "function") &&
|
|
18
|
+
ExprSymbol in value;
|
|
19
|
+
|
|
20
|
+
export const of = <R extends Resource>(
|
|
21
|
+
resource: Ref<R> | R,
|
|
22
|
+
): Output.Of<R["attr"], From<R>> => {
|
|
23
|
+
if (isRef(resource)) {
|
|
24
|
+
const metadata = getRefMetadata(resource);
|
|
25
|
+
return new RefExpr(
|
|
26
|
+
metadata.stack,
|
|
27
|
+
metadata.stage,
|
|
28
|
+
metadata.resourceId,
|
|
29
|
+
) as any;
|
|
30
|
+
}
|
|
31
|
+
return new ResourceExpr(resource) as any;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const ref = <R extends Resource<string, string, any, any>>(
|
|
35
|
+
resourceId: R["id"],
|
|
36
|
+
options?: {
|
|
37
|
+
stage?: string;
|
|
38
|
+
stack?: string;
|
|
39
|
+
},
|
|
40
|
+
) => of(stageRef({ resourceId, ...options }));
|
|
41
|
+
|
|
42
|
+
export interface Output<A = any, Src extends Resource = any, Req = any> {
|
|
43
|
+
readonly kind: string;
|
|
44
|
+
readonly src: Src;
|
|
45
|
+
readonly req: Req;
|
|
46
|
+
apply<B>(fn: (value: A) => B): Output.Of<B, Src, Req>;
|
|
47
|
+
effect<B, Req2>(
|
|
48
|
+
// Outputs are not allowed to fail, so we use never for the error type
|
|
49
|
+
fn: (value: A) => Effect.Effect<B, never, Req2>,
|
|
50
|
+
): Output.Of<B, Src, Req | Req2>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export declare namespace Output {
|
|
54
|
+
// TODO(sam): doesn't support disjunct unions very well
|
|
55
|
+
export type Of<A, Src extends Resource = any, Req = never> = [
|
|
56
|
+
Extract<A, object>,
|
|
57
|
+
] extends [never]
|
|
58
|
+
? Output<A, Src, Req>
|
|
59
|
+
: [Extract<A, any[]>] extends [never]
|
|
60
|
+
? Object<
|
|
61
|
+
{
|
|
62
|
+
[attr in keyof A]: A[attr];
|
|
63
|
+
},
|
|
64
|
+
Src,
|
|
65
|
+
Req
|
|
66
|
+
>
|
|
67
|
+
: Array<Extract<A, any[]>, Src, Req>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type Object<A, Src extends Resource, Req = any> = Output<A, Src, Req> & {
|
|
71
|
+
[Prop in keyof Exclude<A, undefined>]-?: Output.Of<
|
|
72
|
+
Exclude<A, undefined>[Prop] | Extract<A, undefined>,
|
|
73
|
+
Src,
|
|
74
|
+
Req
|
|
75
|
+
>;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type Array<A extends any[], Src extends Resource, Req = any> = Output<
|
|
79
|
+
A,
|
|
80
|
+
Src,
|
|
81
|
+
Req
|
|
82
|
+
> & {
|
|
83
|
+
[i in Extract<keyof A, number>]: Output.Of<A[i], Src, Req>;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const isExpr = (value: any): value is Expr<any> =>
|
|
87
|
+
value &&
|
|
88
|
+
(typeof value === "object" || typeof value === "function") &&
|
|
89
|
+
ExprSymbol in value;
|
|
90
|
+
|
|
91
|
+
export type Expr<A = any, Src extends AnyResource = AnyResource, Req = any> =
|
|
92
|
+
| AllExpr<Expr<A, Src, Req>[]>
|
|
93
|
+
| ApplyExpr<any, A, Src, Req>
|
|
94
|
+
| EffectExpr<any, A, Src, Req>
|
|
95
|
+
| LiteralExpr<A>
|
|
96
|
+
| PropExpr<A, keyof A, Src, Req>
|
|
97
|
+
| ResourceExpr<A, Src, Req>
|
|
98
|
+
| RefExpr<A>;
|
|
99
|
+
|
|
100
|
+
const proxy = (self: any): any => {
|
|
101
|
+
const proxy = new Proxy(
|
|
102
|
+
Object.assign(() => {}, self),
|
|
103
|
+
{
|
|
104
|
+
has: (_, prop) => (prop === ExprSymbol ? true : prop in self),
|
|
105
|
+
get: (_, prop) =>
|
|
106
|
+
prop === Symbol.toPrimitive
|
|
107
|
+
? (hint: string) => (hint === "string" ? self.toString() : self)
|
|
108
|
+
: prop === ExprSymbol
|
|
109
|
+
? self
|
|
110
|
+
: isResourceExpr(self) && self.stables && prop in self.stables
|
|
111
|
+
? self.stables[prop as keyof typeof self.stables]
|
|
112
|
+
: prop === "apply"
|
|
113
|
+
? self[prop]
|
|
114
|
+
: prop in self
|
|
115
|
+
? typeof self[prop as keyof typeof self] === "function" &&
|
|
116
|
+
!("kind" in self)
|
|
117
|
+
? new PropExpr(proxy, prop as never)
|
|
118
|
+
: self[prop as keyof typeof self]
|
|
119
|
+
: new PropExpr(proxy, prop as never),
|
|
120
|
+
apply: (_, thisArg, args) => {
|
|
121
|
+
if (isPropExpr(self)) {
|
|
122
|
+
if (self.identifier === "apply") {
|
|
123
|
+
return new ApplyExpr(self.expr, args[0]);
|
|
124
|
+
} else if (self.identifier === "effect") {
|
|
125
|
+
return new EffectExpr(self.expr, args[0]);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
throw new Error("Not callable");
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
);
|
|
132
|
+
return proxy;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export abstract class BaseExpr<A = any, Src extends Resource = any, Req = any>
|
|
136
|
+
implements Output<A, Src, Req>
|
|
137
|
+
{
|
|
138
|
+
declare readonly kind: any;
|
|
139
|
+
declare readonly src: Src;
|
|
140
|
+
declare readonly req: Req;
|
|
141
|
+
// we use a kind tag instead of instanceof to protect ourselves from duplicate alchemy-effect module imports
|
|
142
|
+
constructor() {}
|
|
143
|
+
public apply<B>(fn: (value: A) => B): Output.Of<B, Src> {
|
|
144
|
+
return new ApplyExpr(this as Expr<A, Src, Req>, fn) as any;
|
|
145
|
+
}
|
|
146
|
+
public effect<B, Req2>(
|
|
147
|
+
fn: (value: A) => Effect.Effect<B, never, Req2>,
|
|
148
|
+
): Output.Of<B, Src, Req | Req2> {
|
|
149
|
+
return new EffectExpr(this as any, fn) as any;
|
|
150
|
+
}
|
|
151
|
+
public pipe(...fns: any[]): any {
|
|
152
|
+
// @ts-expect-error
|
|
153
|
+
return pipe(this, ...fns);
|
|
154
|
+
}
|
|
155
|
+
toString(): string {
|
|
156
|
+
return JSON.stringify(this, null, 2);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export const isResourceExpr = <
|
|
161
|
+
Value = any,
|
|
162
|
+
Src extends AnyResource = AnyResource,
|
|
163
|
+
Req = any,
|
|
164
|
+
>(
|
|
165
|
+
node: Expr<Value, Src, Req> | any,
|
|
166
|
+
): node is ResourceExpr<Value, Src, Req> => node?.kind === "ResourceExpr";
|
|
167
|
+
|
|
168
|
+
export class ResourceExpr<
|
|
169
|
+
Value,
|
|
170
|
+
Src extends AnyResource,
|
|
171
|
+
Req = never,
|
|
172
|
+
> extends BaseExpr<Value, Src, Req> {
|
|
173
|
+
readonly kind = "ResourceExpr";
|
|
174
|
+
constructor(
|
|
175
|
+
public readonly src: Src,
|
|
176
|
+
readonly stables?: Record<string, any>,
|
|
177
|
+
) {
|
|
178
|
+
super();
|
|
179
|
+
return proxy(this);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export const isPropExpr = <
|
|
184
|
+
A = any,
|
|
185
|
+
Prop extends keyof A = keyof A,
|
|
186
|
+
Src extends AnyResource = AnyResource,
|
|
187
|
+
Req = any,
|
|
188
|
+
>(
|
|
189
|
+
node: any,
|
|
190
|
+
): node is PropExpr<A, Prop, Src, Req> => node?.kind === "PropExpr";
|
|
191
|
+
|
|
192
|
+
export class PropExpr<
|
|
193
|
+
A = any,
|
|
194
|
+
Id extends keyof A = keyof A,
|
|
195
|
+
Src extends AnyResource = AnyResource,
|
|
196
|
+
Req = any,
|
|
197
|
+
> extends BaseExpr<A[Id], Src, Req> {
|
|
198
|
+
readonly kind = "PropExpr";
|
|
199
|
+
constructor(
|
|
200
|
+
public readonly expr: Expr<A, Src, Req>,
|
|
201
|
+
public readonly identifier: Id,
|
|
202
|
+
) {
|
|
203
|
+
super();
|
|
204
|
+
return proxy(this);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export const literal = <A>(value: A) => new LiteralExpr(value);
|
|
209
|
+
|
|
210
|
+
export const isLiteralExpr = <A = any>(node: any): node is LiteralExpr<A> =>
|
|
211
|
+
node?.kind === "LiteralExpr";
|
|
212
|
+
|
|
213
|
+
export class LiteralExpr<A> extends BaseExpr<A, never> {
|
|
214
|
+
readonly kind = "LiteralExpr";
|
|
215
|
+
constructor(public readonly value: A) {
|
|
216
|
+
super();
|
|
217
|
+
return proxy(this);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
//Output.ApplyExpr<any, any, AnyResource, any>
|
|
222
|
+
export const isApplyExpr = <
|
|
223
|
+
In = any,
|
|
224
|
+
Out = any,
|
|
225
|
+
Src extends AnyResource = AnyResource,
|
|
226
|
+
Req = any,
|
|
227
|
+
>(
|
|
228
|
+
node: Output<Out, Src, Req>,
|
|
229
|
+
): node is ApplyExpr<In, Out, Src, Req> => node?.kind === "ApplyExpr";
|
|
230
|
+
|
|
231
|
+
export class ApplyExpr<
|
|
232
|
+
A,
|
|
233
|
+
B,
|
|
234
|
+
Src extends AnyResource,
|
|
235
|
+
Req = never,
|
|
236
|
+
> extends BaseExpr<B, Src, Req> {
|
|
237
|
+
readonly kind = "ApplyExpr";
|
|
238
|
+
constructor(
|
|
239
|
+
public readonly expr: Expr<A, Src, Req>,
|
|
240
|
+
public readonly f: (value: A) => B,
|
|
241
|
+
) {
|
|
242
|
+
super();
|
|
243
|
+
return proxy(this);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export const isEffectExpr = <
|
|
248
|
+
In = any,
|
|
249
|
+
Out = any,
|
|
250
|
+
Src extends AnyResource = AnyResource,
|
|
251
|
+
Req = any,
|
|
252
|
+
Req2 = any,
|
|
253
|
+
>(
|
|
254
|
+
node: any,
|
|
255
|
+
): node is EffectExpr<In, Out, Src, Req, Req2> => node?.kind === "EffectExpr";
|
|
256
|
+
|
|
257
|
+
export class EffectExpr<
|
|
258
|
+
A,
|
|
259
|
+
B,
|
|
260
|
+
Src extends AnyResource,
|
|
261
|
+
Req = never,
|
|
262
|
+
Req2 = never,
|
|
263
|
+
> extends BaseExpr<B, Src, Req> {
|
|
264
|
+
readonly kind = "EffectExpr";
|
|
265
|
+
constructor(
|
|
266
|
+
public readonly expr: Expr<A, Src, Req>,
|
|
267
|
+
public readonly f: (value: A) => Effect.Effect<B, never, Req2>,
|
|
268
|
+
) {
|
|
269
|
+
super();
|
|
270
|
+
return proxy(this);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export const isAllExpr = <Outs extends Expr[] = Expr[]>(
|
|
275
|
+
node: any,
|
|
276
|
+
): node is AllExpr<Outs> => node?.kind === "AllExpr";
|
|
277
|
+
|
|
278
|
+
export class AllExpr<Outs extends Expr[]> extends BaseExpr<Outs> {
|
|
279
|
+
readonly kind = "AllExpr";
|
|
280
|
+
constructor(public readonly outs: Outs) {
|
|
281
|
+
super();
|
|
282
|
+
return proxy(this);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export const isRefExpr = <A = any>(node: any): node is RefExpr<A> =>
|
|
287
|
+
node?.kind === "RefExpr";
|
|
288
|
+
|
|
289
|
+
export class RefExpr<A> extends BaseExpr<A, never, never> {
|
|
290
|
+
readonly kind = "RefExpr";
|
|
291
|
+
constructor(
|
|
292
|
+
public readonly stack: string | undefined,
|
|
293
|
+
public readonly stage: string | undefined,
|
|
294
|
+
public readonly resourceId: string,
|
|
295
|
+
) {
|
|
296
|
+
super();
|
|
297
|
+
return proxy(this);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export class MissingSourceError extends Data.TaggedError("MissingSourceError")<{
|
|
302
|
+
message: string;
|
|
303
|
+
srcId: string;
|
|
304
|
+
}> {}
|
|
305
|
+
|
|
306
|
+
export class InvalidReferenceError extends Data.TaggedError(
|
|
307
|
+
"InvalidReferenceError",
|
|
308
|
+
)<{
|
|
309
|
+
message: string;
|
|
310
|
+
stack: string;
|
|
311
|
+
stage: string;
|
|
312
|
+
resourceId: string;
|
|
313
|
+
}> {}
|
|
314
|
+
|
|
315
|
+
export const evaluate: <A, Upstream extends AnyResource, Req>(
|
|
316
|
+
expr: Output<A, Upstream, Req>,
|
|
317
|
+
upstream: {
|
|
318
|
+
[Id in Upstream["id"]]: Extract<Upstream, { id: Id }>["attr"];
|
|
319
|
+
},
|
|
320
|
+
) => Effect.Effect<
|
|
321
|
+
A,
|
|
322
|
+
InvalidReferenceError | MissingSourceError,
|
|
323
|
+
State.State
|
|
324
|
+
> = (expr, upstream) =>
|
|
325
|
+
Effect.gen(function* () {
|
|
326
|
+
if (isResourceExpr(expr)) {
|
|
327
|
+
const srcId = expr.src.id;
|
|
328
|
+
const src = upstream[srcId as keyof typeof upstream];
|
|
329
|
+
if (!src) {
|
|
330
|
+
// type-safety should prevent this but let the caller decide how to handle it
|
|
331
|
+
return yield* Effect.fail(
|
|
332
|
+
new MissingSourceError({
|
|
333
|
+
message: `Source ${srcId} not found`,
|
|
334
|
+
srcId,
|
|
335
|
+
}),
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
return src;
|
|
339
|
+
} else if (isLiteralExpr(expr)) {
|
|
340
|
+
return expr.value;
|
|
341
|
+
} else if (isApplyExpr(expr)) {
|
|
342
|
+
return expr.f(yield* evaluate(expr.expr, upstream));
|
|
343
|
+
} else if (isEffectExpr(expr)) {
|
|
344
|
+
// TODO(sam): the same effect shoudl be memoized so that it's not run multiple times
|
|
345
|
+
return yield* expr.f(yield* evaluate(expr.expr, upstream));
|
|
346
|
+
} else if (isAllExpr(expr)) {
|
|
347
|
+
return yield* Effect.all(expr.outs.map((out) => evaluate(out, upstream)));
|
|
348
|
+
} else if (isPropExpr(expr)) {
|
|
349
|
+
return (yield* evaluate(expr.expr, upstream))?.[expr.identifier];
|
|
350
|
+
} else if (isRefExpr(expr)) {
|
|
351
|
+
const state = yield* State.State;
|
|
352
|
+
const app = yield* App.App;
|
|
353
|
+
const stack = expr.stack ?? app.name;
|
|
354
|
+
const stage = expr.stage ?? app.stage;
|
|
355
|
+
const resource = yield* state.get({
|
|
356
|
+
stack,
|
|
357
|
+
stage,
|
|
358
|
+
resourceId: expr.resourceId,
|
|
359
|
+
});
|
|
360
|
+
if (!resource) {
|
|
361
|
+
return yield* Effect.fail(
|
|
362
|
+
new InvalidReferenceError({
|
|
363
|
+
message: `Reference to '${expr.resourceId}' in stack '${stack}' and stage '${stage}' not found. Have you deployed '${stage}' or '${stack}'?`,
|
|
364
|
+
stack,
|
|
365
|
+
stage,
|
|
366
|
+
resourceId: expr.resourceId,
|
|
367
|
+
}),
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
return resource.output;
|
|
371
|
+
} else if (Array.isArray(expr)) {
|
|
372
|
+
return yield* Effect.all(expr.map((item) => evaluate(item, upstream)));
|
|
373
|
+
} else if (typeof expr === "object" && expr !== null) {
|
|
374
|
+
return Object.fromEntries(
|
|
375
|
+
yield* Effect.all(
|
|
376
|
+
Object.entries(expr).map(([key, value]) =>
|
|
377
|
+
evaluate(value, upstream).pipe(Effect.map((value) => [key, value])),
|
|
378
|
+
),
|
|
379
|
+
),
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
return expr;
|
|
383
|
+
}) as Effect.Effect<any>;
|
|
384
|
+
|
|
385
|
+
export type Upstream<O extends Output<any, any, any>> =
|
|
386
|
+
O extends Output<infer _V, infer Up, infer _Req>
|
|
387
|
+
? {
|
|
388
|
+
[Id in Up["id"]]: Extract<Up, { id: Id }>;
|
|
389
|
+
}
|
|
390
|
+
: never;
|
|
391
|
+
|
|
392
|
+
export const upstream = <E extends Output<any, AnyResource, any>>(
|
|
393
|
+
expr: E,
|
|
394
|
+
): {
|
|
395
|
+
[Id in keyof Upstream<E>]: Upstream<E>[Id];
|
|
396
|
+
} => _upstream(expr);
|
|
397
|
+
|
|
398
|
+
const _upstream = (expr: any): any => {
|
|
399
|
+
if (isResourceExpr(expr)) {
|
|
400
|
+
return {
|
|
401
|
+
[expr.src.id]: expr.src,
|
|
402
|
+
};
|
|
403
|
+
} else if (isPropExpr(expr)) {
|
|
404
|
+
return upstream(expr.expr);
|
|
405
|
+
} else if (isAllExpr(expr)) {
|
|
406
|
+
return Object.assign({}, ...expr.outs.map((out) => upstream(out)));
|
|
407
|
+
} else if (isEffectExpr(expr) || isApplyExpr(expr)) {
|
|
408
|
+
return upstream(expr.expr);
|
|
409
|
+
} else if (Array.isArray(expr)) {
|
|
410
|
+
return expr.map(_upstream).reduce(toObject, {});
|
|
411
|
+
} else if (typeof expr === "object" && expr !== null) {
|
|
412
|
+
return Object.values(expr)
|
|
413
|
+
.map((v) => _upstream(v))
|
|
414
|
+
.reduce(toObject, {});
|
|
415
|
+
}
|
|
416
|
+
return {};
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
const toObject = <A, B>(acc: B, v: A) => ({
|
|
420
|
+
...acc,
|
|
421
|
+
...v,
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
export type ResolveUpstream<A> = unknown extends A
|
|
425
|
+
? { [id: string]: Resource }
|
|
426
|
+
: A extends undefined | null | boolean | number | string | symbol | bigint
|
|
427
|
+
? {}
|
|
428
|
+
: IsAny<A> extends true
|
|
429
|
+
? {}
|
|
430
|
+
: A extends Output<any, infer Upstream, any>
|
|
431
|
+
? {
|
|
432
|
+
[Id in Upstream["id"]]: Extract<Upstream, { id: Id }>;
|
|
433
|
+
}
|
|
434
|
+
: A extends readonly any[] | any[]
|
|
435
|
+
? ResolveUpstream<A[number]>
|
|
436
|
+
: A extends Record<string, any>
|
|
437
|
+
? {
|
|
438
|
+
[Id in keyof UnionToIntersection<
|
|
439
|
+
ResolveUpstream<A[keyof A]>
|
|
440
|
+
>]: UnionToIntersection<ResolveUpstream<A[keyof A]>>[Id];
|
|
441
|
+
}
|
|
442
|
+
: {};
|
|
443
|
+
|
|
444
|
+
export const resolveUpstream = <const A>(value: A): ResolveUpstream<A> => {
|
|
445
|
+
if (isPrimitive(value)) {
|
|
446
|
+
return {} as any;
|
|
447
|
+
} else if (isOutput(value)) {
|
|
448
|
+
return upstream(value) as any;
|
|
449
|
+
} else if (Array.isArray(value)) {
|
|
450
|
+
return Object.fromEntries(
|
|
451
|
+
value.map((v) => resolveUpstream(v)).flatMap(Object.entries),
|
|
452
|
+
) as any;
|
|
453
|
+
} else if (typeof value === "object" || typeof value === "function") {
|
|
454
|
+
return Object.fromEntries(
|
|
455
|
+
Object.values(value as any)
|
|
456
|
+
.map(resolveUpstream)
|
|
457
|
+
.flatMap(Object.entries),
|
|
458
|
+
) as any;
|
|
459
|
+
}
|
|
460
|
+
return {} as any;
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
export const interpolate = <Args extends any[]>(
|
|
464
|
+
template: TemplateStringsArray,
|
|
465
|
+
...args: Args
|
|
466
|
+
): All<Args> extends Output<any, infer Src, infer Req>
|
|
467
|
+
? Output<string, Src, Req>
|
|
468
|
+
: never =>
|
|
469
|
+
all(...args.map((arg) => (isOutput(arg) ? arg : literal(arg)))).apply(
|
|
470
|
+
(args) =>
|
|
471
|
+
template
|
|
472
|
+
.map((str, i) => str + (args[i] == null ? "" : String(args[i])))
|
|
473
|
+
.join(""),
|
|
474
|
+
) as any;
|
|
475
|
+
|
|
476
|
+
export const all = <Outs extends (Output | Expr)[]>(...outs: Outs) =>
|
|
477
|
+
new AllExpr(outs as any) as unknown as All<Outs>;
|
|
478
|
+
|
|
479
|
+
export type All<Outs extends (Output | Expr)[]> = number extends Outs["length"]
|
|
480
|
+
? [Outs[number]] extends [
|
|
481
|
+
| Output<infer V, infer Src, infer Req>
|
|
482
|
+
| Expr<infer V, infer Src, infer Req>,
|
|
483
|
+
]
|
|
484
|
+
? Output<V, Src, Req>
|
|
485
|
+
: never
|
|
486
|
+
: Tuple<Outs>;
|
|
487
|
+
|
|
488
|
+
export type Tuple<
|
|
489
|
+
Outs extends (Output | Expr)[],
|
|
490
|
+
Values extends any[] = [],
|
|
491
|
+
Src extends Resource = never,
|
|
492
|
+
Req = never,
|
|
493
|
+
> = Outs extends [infer H, ...infer Tail extends (Output | Expr)[]]
|
|
494
|
+
? H extends Output<infer V, infer Src2, infer Req2>
|
|
495
|
+
? Tuple<Tail, [...Values, V], Src | Src2, Req | Req2>
|
|
496
|
+
: never
|
|
497
|
+
: Output<Values, Src, Req>;
|
|
498
|
+
|
|
499
|
+
export const filter = <Outs extends any[]>(...outs: Outs) =>
|
|
500
|
+
outs.filter(isOutput) as unknown as Filter<Outs>;
|
|
501
|
+
|
|
502
|
+
export type Filter<Outs extends any[]> = number extends Outs["length"]
|
|
503
|
+
? Output<
|
|
504
|
+
Extract<Outs[number], Output>["value"],
|
|
505
|
+
Extract<Outs[number], Output>["src"],
|
|
506
|
+
Extract<Outs[number], Output>["req"]
|
|
507
|
+
>
|
|
508
|
+
: FilterTuple<Outs>;
|
|
509
|
+
|
|
510
|
+
export type FilterTuple<
|
|
511
|
+
Outs extends (Output | Expr)[],
|
|
512
|
+
Values extends any[] = [],
|
|
513
|
+
Src extends Resource = never,
|
|
514
|
+
> = Outs extends [infer H, ...infer Tail extends (Output | Expr)[]]
|
|
515
|
+
? H extends Output<infer V, infer Src2>
|
|
516
|
+
? FilterTuple<Tail, [...Values, V], Src | Src2>
|
|
517
|
+
: FilterTuple<Tail, Values, Src>
|
|
518
|
+
: Output<Values, Src>;
|