alchemy-effect 0.2.0 → 0.4.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 +55354 -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 +4 -17
- package/lib/app.d.ts.map +1 -1
- package/lib/app.js +0 -20
- package/lib/app.js.map +1 -1
- package/lib/apply.d.ts +15 -75
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +439 -154
- 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 +10 -1
- package/lib/aws/account.d.ts.map +1 -1
- package/lib/aws/account.js +18 -3
- package/lib/aws/account.js.map +1 -1
- package/lib/aws/client.d.ts.map +1 -1
- package/lib/aws/client.js +0 -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 +10 -0
- 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/client.d.ts +1 -1
- package/lib/aws/dynamodb/client.d.ts.map +1 -1
- package/lib/aws/dynamodb/index.d.ts +2 -1
- package/lib/aws/dynamodb/index.d.ts.map +1 -1
- package/lib/aws/dynamodb/index.js +1 -2
- package/lib/aws/dynamodb/index.js.map +1 -1
- package/lib/aws/dynamodb/secondary-index.d.ts +5 -4
- package/lib/aws/dynamodb/secondary-index.d.ts.map +1 -1
- package/lib/aws/dynamodb/table.d.ts +23 -20
- package/lib/aws/dynamodb/table.d.ts.map +1 -1
- package/lib/aws/dynamodb/table.get-item.d.ts +8 -6
- package/lib/aws/dynamodb/table.get-item.d.ts.map +1 -1
- package/lib/aws/dynamodb/table.get-item.js +4 -2
- package/lib/aws/dynamodb/table.get-item.js.map +1 -1
- package/lib/aws/dynamodb/table.js.map +1 -1
- package/lib/aws/dynamodb/table.provider.d.ts +3 -4
- package/lib/aws/dynamodb/table.provider.d.ts.map +1 -1
- package/lib/aws/dynamodb/table.provider.js +18 -29
- package/lib/aws/dynamodb/table.provider.js.map +1 -1
- package/lib/aws/ec2/client.d.ts +1 -1
- package/lib/aws/ec2/client.d.ts.map +1 -1
- package/lib/aws/ec2/index.d.ts +11 -0
- package/lib/aws/ec2/index.d.ts.map +1 -1
- package/lib/aws/ec2/index.js +11 -0
- package/lib/aws/ec2/index.js.map +1 -1
- package/lib/aws/ec2/internet-gateway.d.ts +65 -0
- package/lib/aws/ec2/internet-gateway.d.ts.map +1 -0
- package/lib/aws/ec2/internet-gateway.js +4 -0
- package/lib/aws/ec2/internet-gateway.js.map +1 -0
- package/lib/aws/ec2/internet-gateway.provider.d.ts +6 -0
- package/lib/aws/ec2/internet-gateway.provider.d.ts.map +1 -0
- package/lib/aws/ec2/internet-gateway.provider.js +193 -0
- package/lib/aws/ec2/internet-gateway.provider.js.map +1 -0
- package/lib/aws/ec2/route-table-association.d.ts +63 -0
- package/lib/aws/ec2/route-table-association.d.ts.map +1 -0
- package/lib/aws/ec2/route-table-association.js +4 -0
- package/lib/aws/ec2/route-table-association.js.map +1 -0
- package/lib/aws/ec2/route-table-association.provider.d.ts +4 -0
- package/lib/aws/ec2/route-table-association.provider.d.ts.map +1 -0
- package/lib/aws/ec2/route-table-association.provider.js +121 -0
- package/lib/aws/ec2/route-table-association.provider.js.map +1 -0
- package/lib/aws/ec2/route-table.d.ts +159 -0
- package/lib/aws/ec2/route-table.d.ts.map +1 -0
- package/lib/aws/ec2/route-table.js +4 -0
- package/lib/aws/ec2/route-table.js.map +1 -0
- package/lib/aws/ec2/route-table.provider.d.ts +6 -0
- package/lib/aws/ec2/route-table.provider.d.ts.map +1 -0
- package/lib/aws/ec2/route-table.provider.js +213 -0
- package/lib/aws/ec2/route-table.provider.js.map +1 -0
- package/lib/aws/ec2/route.d.ts +155 -0
- package/lib/aws/ec2/route.d.ts.map +1 -0
- package/lib/aws/ec2/route.js +3 -0
- package/lib/aws/ec2/route.js.map +1 -0
- package/lib/aws/ec2/route.provider.d.ts +4 -0
- package/lib/aws/ec2/route.provider.d.ts.map +1 -0
- package/lib/aws/ec2/route.provider.js +166 -0
- package/lib/aws/ec2/route.provider.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 +13 -8
- package/lib/aws/ec2/vpc.d.ts.map +1 -1
- package/lib/aws/ec2/vpc.js +1 -0
- package/lib/aws/ec2/vpc.js.map +1 -1
- package/lib/aws/ec2/vpc.provider.d.ts +1 -2
- package/lib/aws/ec2/vpc.provider.d.ts.map +1 -1
- package/lib/aws/ec2/vpc.provider.js +45 -37
- package/lib/aws/ec2/vpc.provider.js.map +1 -1
- package/lib/aws/index.d.ts +15 -19
- package/lib/aws/index.d.ts.map +1 -1
- package/lib/aws/index.js +8 -10
- package/lib/aws/index.js.map +1 -1
- 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 +7 -7
- 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 +6 -4
- package/lib/aws/lambda/function.invoke.d.ts.map +1 -1
- package/lib/aws/lambda/function.invoke.js +3 -1
- 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 +3 -2
- package/lib/aws/lambda/function.provider.d.ts.map +1 -1
- package/lib/aws/lambda/function.provider.js +28 -25
- package/lib/aws/lambda/function.provider.js.map +1 -1
- package/lib/aws/lambda/index.d.ts +1 -0
- package/lib/aws/lambda/index.d.ts.map +1 -1
- package/lib/aws/lambda/index.js +1 -0
- 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/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 -2
- 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 +1 -1
- package/lib/aws/sqs/client.d.ts.map +1 -1
- package/lib/aws/sqs/index.d.ts +1 -0
- package/lib/aws/sqs/index.d.ts.map +1 -1
- package/lib/aws/sqs/index.js +1 -0
- package/lib/aws/sqs/index.js.map +1 -1
- package/lib/aws/sqs/queue.consume.d.ts +1 -1
- package/lib/aws/sqs/queue.consume.d.ts.map +1 -1
- package/lib/aws/sqs/queue.consume.js +0 -1
- package/lib/aws/sqs/queue.consume.js.map +1 -1
- package/lib/aws/sqs/queue.d.ts +6 -4
- package/lib/aws/sqs/queue.d.ts.map +1 -1
- package/lib/aws/sqs/queue.event-source.d.ts +8 -6
- package/lib/aws/sqs/queue.event-source.d.ts.map +1 -1
- package/lib/aws/sqs/queue.event-source.js +26 -44
- package/lib/aws/sqs/queue.event-source.js.map +1 -1
- 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 +2 -2
- package/lib/aws/sqs/queue.provider.d.ts.map +1 -1
- package/lib/aws/sqs/queue.provider.js +2 -1
- package/lib/aws/sqs/queue.provider.js.map +1 -1
- package/lib/aws/sqs/queue.send-message.d.ts +7 -5
- package/lib/aws/sqs/queue.send-message.d.ts.map +1 -1
- package/lib/aws/sqs/queue.send-message.js +4 -2
- package/lib/aws/sqs/queue.send-message.js.map +1 -1
- package/lib/binding.d.ts +12 -12
- package/lib/binding.d.ts.map +1 -1
- package/lib/binding.js.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.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 +384 -264
- package/lib/cli/index.d.ts.map +1 -1
- package/lib/cli/index.js +57 -65
- 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 +7 -7
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +18 -17
- 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/index.d.ts +3 -1
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +3 -0
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/kv/namespace.binding.d.ts +5 -3
- package/lib/cloudflare/kv/namespace.binding.d.ts.map +1 -1
- package/lib/cloudflare/kv/namespace.binding.js +1 -1
- package/lib/cloudflare/kv/namespace.binding.js.map +1 -1
- package/lib/cloudflare/kv/namespace.client.d.ts +1 -1
- package/lib/cloudflare/kv/namespace.d.ts +3 -2
- package/lib/cloudflare/kv/namespace.d.ts.map +1 -1
- package/lib/cloudflare/kv/namespace.js.map +1 -1
- package/lib/cloudflare/kv/namespace.provider.d.ts +3 -2
- package/lib/cloudflare/kv/namespace.provider.d.ts.map +1 -1
- package/lib/cloudflare/kv/namespace.provider.js +9 -7
- package/lib/cloudflare/kv/namespace.provider.js.map +1 -1
- package/lib/cloudflare/live.d.ts +5 -5
- package/lib/cloudflare/live.d.ts.map +1 -1
- package/lib/cloudflare/live.js +5 -8
- package/lib/cloudflare/live.js.map +1 -1
- package/lib/cloudflare/r2/bucket.binding.d.ts +5 -3
- package/lib/cloudflare/r2/bucket.binding.d.ts.map +1 -1
- package/lib/cloudflare/r2/bucket.binding.js +1 -1
- package/lib/cloudflare/r2/bucket.binding.js.map +1 -1
- package/lib/cloudflare/r2/bucket.d.ts +3 -2
- package/lib/cloudflare/r2/bucket.d.ts.map +1 -1
- package/lib/cloudflare/r2/bucket.js.map +1 -1
- package/lib/cloudflare/r2/bucket.provider.d.ts +3 -2
- package/lib/cloudflare/r2/bucket.provider.d.ts.map +1 -1
- package/lib/cloudflare/r2/bucket.provider.js +14 -8
- package/lib/cloudflare/r2/bucket.provider.js.map +1 -1
- package/lib/cloudflare/worker/assets.fetch.d.ts +3 -2
- package/lib/cloudflare/worker/assets.fetch.d.ts.map +1 -1
- package/lib/cloudflare/worker/assets.fetch.js +2 -1
- package/lib/cloudflare/worker/assets.fetch.js.map +1 -1
- package/lib/cloudflare/worker/assets.provider.d.ts +1 -1
- package/lib/cloudflare/worker/assets.provider.d.ts.map +1 -1
- package/lib/cloudflare/worker/index.d.ts +0 -1
- package/lib/cloudflare/worker/index.d.ts.map +1 -1
- package/lib/cloudflare/worker/worker.d.ts +5 -6
- package/lib/cloudflare/worker/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker/worker.handler.d.ts +1 -1
- package/lib/cloudflare/worker/worker.handler.d.ts.map +1 -1
- package/lib/cloudflare/worker/worker.handler.js.map +1 -1
- package/lib/cloudflare/worker/worker.js.map +1 -1
- package/lib/cloudflare/worker/worker.provider.d.ts +3 -2
- package/lib/cloudflare/worker/worker.provider.d.ts.map +1 -1
- package/lib/cloudflare/worker/worker.provider.js +12 -7
- package/lib/cloudflare/worker/worker.provider.js.map +1 -1
- package/lib/cloudflare/worker/worker.serve.d.ts +7 -7
- package/lib/cloudflare/worker/worker.serve.d.ts.map +1 -1
- package/lib/cloudflare/worker/worker.serve.js.map +1 -1
- 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 -1
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js +1 -4
- package/lib/destroy.js.map +1 -1
- package/lib/diff.d.ts +18 -0
- package/lib/diff.d.ts.map +1 -0
- package/lib/diff.js +22 -0
- package/lib/diff.js.map +1 -0
- 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/event.d.ts +1 -1
- package/lib/event.d.ts.map +1 -1
- 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 +10 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -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/instance-id.d.ts +8 -0
- package/lib/instance-id.d.ts.map +1 -0
- package/lib/instance-id.js +12 -0
- package/lib/instance-id.js.map +1 -0
- package/lib/output.d.ts +145 -0
- package/lib/output.d.ts.map +1 -0
- package/lib/output.js +283 -0
- package/lib/output.js.map +1 -0
- package/lib/physical-name.d.ts +14 -1
- package/lib/physical-name.d.ts.map +1 -1
- package/lib/physical-name.js +41 -2
- package/lib/physical-name.js.map +1 -1
- package/lib/plan.d.ts +84 -58
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +504 -166
- package/lib/plan.js.map +1 -1
- package/lib/policy.d.ts +3 -4
- package/lib/policy.d.ts.map +1 -1
- package/lib/policy.js +0 -1
- package/lib/policy.js.map +1 -1
- package/lib/provider.d.ts +39 -24
- package/lib/provider.d.ts.map +1 -1
- package/lib/provider.js +9 -0
- package/lib/provider.js.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 -8
- package/lib/resource.d.ts.map +1 -1
- package/lib/resource.js.map +1 -1
- package/lib/runtime.d.ts +7 -6
- package/lib/runtime.d.ts.map +1 -1
- package/lib/runtime.js.map +1 -1
- package/lib/service.d.ts +9 -6
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js.map +1 -1
- 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 +135 -17
- package/lib/state.d.ts.map +1 -1
- package/lib/state.js +34 -30
- package/lib/state.js.map +1 -1
- package/lib/tags.d.ts +15 -0
- package/lib/tags.d.ts.map +1 -1
- package/lib/tags.js +27 -0
- package/lib/tags.js.map +1 -1
- package/lib/test.d.ts +25 -4
- package/lib/test.d.ts.map +1 -1
- package/lib/test.js +54 -14
- package/lib/test.js.map +1 -1
- package/lib/todo.d.ts +3 -0
- package/lib/todo.d.ts.map +1 -0
- package/lib/todo.js +3 -0
- package/lib/todo.js.map +1 -0
- package/lib/tsconfig.test.tsbuildinfo +1 -1
- package/lib/type.d.ts +3 -0
- package/lib/type.d.ts.map +1 -1
- 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 +18 -12
- package/src/$.ts +17 -0
- package/src/app.ts +3 -32
- package/src/apply.ts +824 -452
- package/src/assert-never.ts +18 -0
- package/src/aws/account.ts +23 -3
- package/src/aws/client.ts +0 -1
- package/src/aws/config.ts +16 -0
- package/src/aws/credentials.ts +212 -177
- package/src/aws/dynamodb/index.ts +3 -3
- package/src/aws/dynamodb/table.get-item.ts +5 -9
- package/src/aws/dynamodb/table.provider.ts +36 -39
- package/src/aws/dynamodb/table.ts +29 -84
- package/src/aws/ec2/index.ts +12 -0
- package/src/aws/ec2/internet-gateway.provider.ts +316 -0
- package/src/aws/ec2/internet-gateway.ts +79 -0
- package/src/aws/ec2/route-table-association.provider.ts +214 -0
- package/src/aws/ec2/route-table-association.ts +82 -0
- package/src/aws/ec2/route-table.provider.ts +306 -0
- package/src/aws/ec2/route-table.ts +175 -0
- package/src/aws/ec2/route.provider.ts +213 -0
- package/src/aws/ec2/route.ts +192 -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 +58 -50
- package/src/aws/ec2/vpc.ts +21 -8
- package/src/aws/index.ts +49 -40
- package/src/aws/lambda/consume.ts +8 -7
- package/src/aws/lambda/function.handler.ts +1 -1
- package/src/aws/lambda/function.invoke.ts +6 -2
- package/src/aws/lambda/function.provider.ts +41 -32
- package/src/aws/lambda/function.ts +7 -4
- package/src/aws/lambda/index.ts +2 -0
- package/src/aws/profile.ts +1 -4
- package/src/aws/region.ts +42 -3
- package/src/aws/sqs/index.ts +2 -0
- package/src/aws/sqs/queue.consume.ts +1 -1
- package/src/aws/sqs/queue.event-source.ts +29 -55
- package/src/aws/sqs/queue.provider.ts +10 -2
- package/src/aws/sqs/queue.send-message.ts +5 -8
- package/src/aws/sqs/queue.ts +9 -4
- package/src/binding.ts +19 -19
- package/src/cli/components/ApprovePlan.tsx +2 -2
- package/src/cli/components/Plan.tsx +3 -2
- 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 +33 -29
- package/src/cloudflare/config.ts +7 -0
- package/src/cloudflare/index.ts +3 -1
- package/src/cloudflare/kv/namespace.binding.ts +3 -1
- package/src/cloudflare/kv/namespace.provider.ts +10 -8
- package/src/cloudflare/kv/namespace.ts +3 -2
- package/src/cloudflare/live.ts +11 -17
- package/src/cloudflare/r2/bucket.binding.ts +3 -1
- package/src/cloudflare/r2/bucket.provider.ts +16 -9
- package/src/cloudflare/r2/bucket.ts +8 -2
- package/src/cloudflare/worker/assets.fetch.ts +3 -1
- package/src/cloudflare/worker/assets.provider.ts +1 -1
- package/src/cloudflare/worker/index.ts +0 -2
- package/src/cloudflare/worker/worker.handler.ts +1 -1
- package/src/cloudflare/worker/worker.provider.ts +21 -14
- package/src/cloudflare/worker/worker.serve.ts +5 -2
- package/src/cloudflare/worker/worker.ts +4 -3
- package/src/data.ts +18 -0
- package/src/destroy.ts +1 -5
- package/src/diff.ts +48 -0
- package/src/env.ts +20 -32
- package/src/event.ts +6 -0
- package/src/exports.ts +21 -0
- package/src/index.ts +10 -5
- package/src/input.ts +81 -0
- package/src/instance-id.ts +16 -0
- package/src/output.ts +542 -0
- package/src/physical-name.ts +57 -2
- package/src/plan.ts +757 -278
- package/src/policy.ts +3 -5
- package/src/provider.ts +70 -31
- package/src/ref.ts +48 -0
- package/src/resource.ts +70 -10
- package/src/runtime.ts +15 -8
- package/src/service.ts +11 -7
- package/src/stack.ts +116 -0
- package/src/stage.ts +85 -0
- package/src/state.ts +269 -76
- package/src/tags.ts +31 -0
- package/src/test.ts +118 -17
- package/src/todo.ts +4 -0
- package/src/type.ts +4 -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/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 -30
- 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/src/approve.ts +0 -13
- 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 -46
- package/src/cli/spinner.ts +0 -14
package/src/aws/sqs/index.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { Binding, type From } from "alchemy-effect";
|
|
2
1
|
import * as Effect from "effect/Effect";
|
|
3
2
|
import * as Schedule from "effect/Schedule";
|
|
4
3
|
import type * as Lambda from "itty-aws/lambda";
|
|
4
|
+
import { Binding } from "../../binding.ts";
|
|
5
|
+
import type { From } from "../../policy.ts";
|
|
5
6
|
import { createTagger, hasTags } from "../../tags.ts";
|
|
6
|
-
import { Account } from "../account.ts";
|
|
7
|
-
import {
|
|
8
|
-
Function,
|
|
9
|
-
LambdaClient,
|
|
10
|
-
type FunctionBinding,
|
|
11
|
-
} from "../lambda/index.ts";
|
|
12
|
-
import { Region } from "../region.ts";
|
|
13
7
|
import type { Consume } from "./queue.consume.ts";
|
|
14
8
|
import { Queue, type QueueAttrs, type QueueProps } from "./queue.ts";
|
|
9
|
+
import { Function, type FunctionBinding } from "../lambda/function.ts";
|
|
10
|
+
import { LambdaClient } from "../lambda/client.ts";
|
|
11
|
+
import { Account } from "../account.ts";
|
|
12
|
+
import { Region } from "../region.ts";
|
|
15
13
|
|
|
16
14
|
export interface QueueEventSourceProps {
|
|
17
15
|
batchSize?: number;
|
|
@@ -43,10 +41,9 @@ export const QueueEventSource = Binding<
|
|
|
43
41
|
|
|
44
42
|
export const queueEventSourceProvider = () =>
|
|
45
43
|
QueueEventSource.provider.effect(
|
|
46
|
-
// @ts-expect-error
|
|
47
44
|
Effect.gen(function* () {
|
|
48
|
-
const region = yield* Region;
|
|
49
45
|
const accountId = yield* Account;
|
|
46
|
+
const region = yield* Region;
|
|
50
47
|
const lambda = yield* LambdaClient;
|
|
51
48
|
const tagged = yield* createTagger();
|
|
52
49
|
|
|
@@ -113,45 +110,26 @@ export const queueEventSourceProvider = () =>
|
|
|
113
110
|
return undefined;
|
|
114
111
|
});
|
|
115
112
|
|
|
116
|
-
const createFunctionBinding = (queue: {
|
|
117
|
-
attr: { queueArn: string };
|
|
118
|
-
}) => ({
|
|
119
|
-
// we need the policies to be present before the event source mapping is created
|
|
120
|
-
policyStatements: [
|
|
121
|
-
{
|
|
122
|
-
Sid: "AWS.SQS.Consume",
|
|
123
|
-
Effect: "Allow" as const,
|
|
124
|
-
Action: [
|
|
125
|
-
"sqs:ReceiveMessage",
|
|
126
|
-
"sqs:DeleteMessage",
|
|
127
|
-
"sqs:ChangeMessageVisibility",
|
|
128
|
-
],
|
|
129
|
-
Resource: [queue.attr.queueArn],
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
});
|
|
133
|
-
|
|
134
113
|
return {
|
|
135
|
-
attach: ({ source: queue }) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
},
|
|
114
|
+
attach: ({ source: queue, attr }) => ({
|
|
115
|
+
// TODO(sam): bit of a broken model here - we can't know the UUID until post-attach
|
|
116
|
+
uuid: attr?.uuid ?? undefined!,
|
|
117
|
+
// we need the policies to be present before the event source mapping is created
|
|
118
|
+
policyStatements: [
|
|
119
|
+
{
|
|
120
|
+
Sid: "AWS.SQS.Consume",
|
|
121
|
+
Effect: "Allow" as const,
|
|
122
|
+
Action: [
|
|
123
|
+
"sqs:ReceiveMessage",
|
|
124
|
+
"sqs:DeleteMessage",
|
|
125
|
+
"sqs:ChangeMessageVisibility",
|
|
126
|
+
"sqs:GetQueueAttributes",
|
|
127
|
+
"sqs:GetQueueUrl",
|
|
128
|
+
],
|
|
129
|
+
Resource: [queue.attr.queueArn],
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
}),
|
|
155
133
|
postattach: Effect.fn(function* ({
|
|
156
134
|
source: queue,
|
|
157
135
|
props: { batchSize, maxBatchingWindow, scalingConfig } = {},
|
|
@@ -160,11 +138,6 @@ export const queueEventSourceProvider = () =>
|
|
|
160
138
|
attr: { functionName },
|
|
161
139
|
},
|
|
162
140
|
}) {
|
|
163
|
-
console.log(
|
|
164
|
-
"postattaching queue event source",
|
|
165
|
-
queue.id,
|
|
166
|
-
functionName,
|
|
167
|
-
);
|
|
168
141
|
const config:
|
|
169
142
|
| Lambda.CreateEventSourceMappingRequest
|
|
170
143
|
| Lambda.UpdateEventSourceMappingRequest = {
|
|
@@ -220,10 +193,11 @@ export const queueEventSourceProvider = () =>
|
|
|
220
193
|
),
|
|
221
194
|
schedule: Schedule.exponential(100),
|
|
222
195
|
}),
|
|
196
|
+
Effect.orDie,
|
|
223
197
|
);
|
|
224
198
|
return {
|
|
225
199
|
...attr,
|
|
226
|
-
uuid: eventSourceMapping.UUID
|
|
200
|
+
uuid: eventSourceMapping.UUID!,
|
|
227
201
|
};
|
|
228
202
|
}),
|
|
229
203
|
detach: Effect.fn(function* ({
|
|
@@ -235,7 +209,7 @@ export const queueEventSourceProvider = () =>
|
|
|
235
209
|
}) {
|
|
236
210
|
const uuid =
|
|
237
211
|
attr?.uuid ??
|
|
238
|
-
(yield* findEventSourceMapping(queue, functionName))?.UUID
|
|
212
|
+
(yield* findEventSourceMapping(queue, functionName))?.UUID;
|
|
239
213
|
if (uuid) {
|
|
240
214
|
// we found (or were aware of) the event source mapping, so we can delete it
|
|
241
215
|
yield* (
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import * as Schedule from "effect/Schedule";
|
|
3
3
|
|
|
4
|
-
import { App
|
|
4
|
+
import { App } from "../../app.ts";
|
|
5
|
+
import type { ProviderService } from "../../provider.ts";
|
|
5
6
|
import { Account } from "../account.ts";
|
|
6
7
|
import { Region } from "../region.ts";
|
|
7
8
|
import { SQSClient } from "./client.ts";
|
|
@@ -14,7 +15,13 @@ export const queueProvider = () =>
|
|
|
14
15
|
const app = yield* App;
|
|
15
16
|
const region = yield* Region;
|
|
16
17
|
const accountId = yield* Account;
|
|
17
|
-
const createQueueName = (
|
|
18
|
+
const createQueueName = (
|
|
19
|
+
id: string,
|
|
20
|
+
props: {
|
|
21
|
+
queueName?: string | undefined;
|
|
22
|
+
fifo?: boolean;
|
|
23
|
+
},
|
|
24
|
+
) =>
|
|
18
25
|
props.queueName ??
|
|
19
26
|
`${app.name}-${id}-${app.stage}${props.fifo ? ".fifo" : ""}`;
|
|
20
27
|
const createAttributes = (props: QueueProps) => ({
|
|
@@ -32,6 +39,7 @@ export const queueProvider = () =>
|
|
|
32
39
|
VisibilityTimeout: props.visibilityTimeout?.toString(),
|
|
33
40
|
});
|
|
34
41
|
return {
|
|
42
|
+
stables: ["queueName", "queueUrl", "queueArn"],
|
|
35
43
|
diff: Effect.fn(function* ({ id, news, olds }) {
|
|
36
44
|
const oldFifo = olds.fifo ?? false;
|
|
37
45
|
const newFifo = news.fifo ?? false;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type To,
|
|
9
|
-
} from "alchemy-effect";
|
|
10
|
-
import { Function } from "../lambda/index.ts";
|
|
3
|
+
import { Binding } from "../../binding.ts";
|
|
4
|
+
import type { Capability } from "../../capability.ts";
|
|
5
|
+
import { toEnvKey } from "../../env.ts";
|
|
6
|
+
import { declare, type To } from "../../policy.ts";
|
|
7
|
+
import { Function } from "../lambda/function.ts";
|
|
11
8
|
import { SQSClient } from "./client.ts";
|
|
12
9
|
import { Queue } from "./queue.ts";
|
|
13
10
|
|
package/src/aws/sqs/queue.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type * as S from "effect/Schema";
|
|
2
|
-
|
|
3
|
-
import { Resource } from "
|
|
4
|
-
|
|
2
|
+
import type { Input } from "../../input.ts";
|
|
3
|
+
import { Resource } from "../../resource.ts";
|
|
5
4
|
// required to avoid this error in consumers: "The inferred type of 'Messages' cannot be named without a reference to '../../effect-aws/node_modules/@types/aws-lambda'. This is likely not portable. A type annotation is necessary.ts(2742)"
|
|
6
5
|
export type * as lambda from "aws-lambda";
|
|
7
6
|
|
|
@@ -15,7 +14,13 @@ export const Queue = Resource<{
|
|
|
15
14
|
export interface Queue<
|
|
16
15
|
ID extends string = string,
|
|
17
16
|
Props extends QueueProps = QueueProps,
|
|
18
|
-
> extends Resource<
|
|
17
|
+
> extends Resource<
|
|
18
|
+
"AWS.SQS.Queue",
|
|
19
|
+
ID,
|
|
20
|
+
Props,
|
|
21
|
+
QueueAttrs<Extract<Input.Resolve<Props>, QueueProps>>,
|
|
22
|
+
Queue
|
|
23
|
+
> {}
|
|
19
24
|
|
|
20
25
|
export type QueueAttrs<Props extends QueueProps> = {
|
|
21
26
|
queueName: Props["queueName"] extends string ? Props["queueName"] : string;
|
package/src/binding.ts
CHANGED
|
@@ -2,9 +2,9 @@ import * as Context from "effect/Context";
|
|
|
2
2
|
import type { Effect } from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import type { Capability, ICapability } from "./capability.ts";
|
|
5
|
-
import type { Diff } from "./
|
|
6
|
-
import type { Resource } from "./resource.ts";
|
|
7
|
-
import type {
|
|
5
|
+
import type { Diff } from "./diff.ts";
|
|
6
|
+
import type { IResource, Resource } from "./resource.ts";
|
|
7
|
+
import type { IRuntime } from "./runtime.ts";
|
|
8
8
|
|
|
9
9
|
export interface BindingProps {
|
|
10
10
|
[key: string]: any;
|
|
@@ -13,7 +13,7 @@ export interface BindingProps {
|
|
|
13
13
|
export const isBinding = (b: any): b is AnyBinding =>
|
|
14
14
|
"runtime" in b && "capability" in b && "tag" in b && "output" in b;
|
|
15
15
|
|
|
16
|
-
export type AnyBinding<F extends
|
|
16
|
+
export type AnyBinding<F extends IRuntime = any> = Binding<
|
|
17
17
|
F,
|
|
18
18
|
any,
|
|
19
19
|
any,
|
|
@@ -23,7 +23,7 @@ export type AnyBinding<F extends Runtime = any> = Binding<
|
|
|
23
23
|
>;
|
|
24
24
|
|
|
25
25
|
export interface Binding<
|
|
26
|
-
Run extends
|
|
26
|
+
Run extends IRuntime<any, any, any>,
|
|
27
27
|
Cap extends Capability = Capability,
|
|
28
28
|
Props = any,
|
|
29
29
|
Attr extends Run["binding"] = any,
|
|
@@ -40,14 +40,14 @@ export interface Binding<
|
|
|
40
40
|
|
|
41
41
|
/** Tag for a Service that can bind a Capability to a Runtime */
|
|
42
42
|
export interface Bind<
|
|
43
|
-
F extends
|
|
43
|
+
F extends IRuntime,
|
|
44
44
|
Cap extends Capability,
|
|
45
45
|
Tag extends string,
|
|
46
46
|
> extends Context.Tag<
|
|
47
47
|
`${F["type"]}(${Cap["type"]}, ${Tag})`,
|
|
48
48
|
BindingService<
|
|
49
49
|
F,
|
|
50
|
-
Extract<Extract<Cap["resource"], Resource>["
|
|
50
|
+
Extract<Extract<Cap["resource"], Resource>["base"], Resource>,
|
|
51
51
|
F["props"]
|
|
52
52
|
>
|
|
53
53
|
> {
|
|
@@ -91,12 +91,12 @@ export const Binding: {
|
|
|
91
91
|
effect: (eff) => Layer.effect(Tag, eff),
|
|
92
92
|
succeed: (service) => Layer.succeed(Tag, service),
|
|
93
93
|
},
|
|
94
|
-
} satisfies BindingDeclaration<
|
|
94
|
+
} satisfies BindingDeclaration<IRuntime, any>,
|
|
95
95
|
);
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
export interface BindingDeclaration<
|
|
99
|
-
Run extends
|
|
99
|
+
Run extends IRuntime,
|
|
100
100
|
F extends (target: any, props?: any) => AnyBinding<Run>,
|
|
101
101
|
Tag extends string = ReturnType<F>["tag"],
|
|
102
102
|
Cap extends Capability = ReturnType<F>["capability"],
|
|
@@ -126,8 +126,8 @@ export interface BindingDeclaration<
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
export interface BindingDiffProps<
|
|
129
|
-
Source extends
|
|
130
|
-
Target extends
|
|
129
|
+
Source extends IResource = IResource,
|
|
130
|
+
Target extends IResource = IResource,
|
|
131
131
|
Props = any,
|
|
132
132
|
Attr = any,
|
|
133
133
|
> {
|
|
@@ -148,8 +148,8 @@ export interface BindingDiffProps<
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
export interface BindingAttachProps<
|
|
151
|
-
Source extends
|
|
152
|
-
Target extends
|
|
151
|
+
Source extends IResource,
|
|
152
|
+
Target extends IResource,
|
|
153
153
|
Props,
|
|
154
154
|
Attr,
|
|
155
155
|
> {
|
|
@@ -168,8 +168,8 @@ export interface BindingAttachProps<
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
export interface BindingReattachProps<
|
|
171
|
-
Source extends
|
|
172
|
-
Target extends
|
|
171
|
+
Source extends IResource,
|
|
172
|
+
Target extends IResource,
|
|
173
173
|
Props,
|
|
174
174
|
Attr,
|
|
175
175
|
> {
|
|
@@ -188,8 +188,8 @@ export interface BindingReattachProps<
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
export interface BindingDetachProps<
|
|
191
|
-
Source extends
|
|
192
|
-
Target extends
|
|
191
|
+
Source extends IResource,
|
|
192
|
+
Target extends IResource,
|
|
193
193
|
Props,
|
|
194
194
|
Attr,
|
|
195
195
|
> {
|
|
@@ -208,8 +208,8 @@ export interface BindingDetachProps<
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
export type BindingService<
|
|
211
|
-
Target extends
|
|
212
|
-
Source extends
|
|
211
|
+
Target extends IRuntime = any,
|
|
212
|
+
Source extends IResource = IResource,
|
|
213
213
|
Props = any,
|
|
214
214
|
Attr extends Target["binding"] = any,
|
|
215
215
|
DiffReq = never,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// biome-ignore lint/style/useImportType: UMD global
|
|
2
2
|
import React, { useState } from "react";
|
|
3
3
|
|
|
4
|
-
import type * as Alchemy from "alchemy-effect";
|
|
5
4
|
import { Box, Text, useApp, useInput } from "ink";
|
|
5
|
+
import type { IPlan as AlchemyPlan } from "../../plan.ts";
|
|
6
6
|
|
|
7
7
|
import { Plan } from "./Plan.tsx";
|
|
8
8
|
|
|
9
9
|
export interface ApprovePlanProps {
|
|
10
|
-
plan:
|
|
10
|
+
plan: AlchemyPlan;
|
|
11
11
|
approve: (result: boolean) => void;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// biome-ignore lint/style/useImportType: UMD global
|
|
2
2
|
import React, { useMemo } from "react";
|
|
3
3
|
|
|
4
|
-
import type { BindNode, Capability, CRUD, Plan } from "alchemy-effect";
|
|
5
4
|
import { Box, Text } from "ink";
|
|
5
|
+
import type { Capability } from "../../capability.ts";
|
|
6
|
+
import type { IPlan as AlchemyPlan, BindNode, CRUD } from "../../plan.ts";
|
|
6
7
|
|
|
7
8
|
export interface PlanProps {
|
|
8
|
-
plan:
|
|
9
|
+
plan: AlchemyPlan;
|
|
9
10
|
}
|
|
10
11
|
export function Plan({ plan }: PlanProps): React.JSX.Element {
|
|
11
12
|
const items = useMemo(
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
// biome-ignore lint/style/useImportType: UMD global
|
|
2
2
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
|
|
4
|
-
import type * as Alchemy from "alchemy-effect";
|
|
5
4
|
import { Box, Text } from "ink";
|
|
6
|
-
import type {
|
|
7
|
-
|
|
5
|
+
import type {
|
|
6
|
+
ApplyEvent,
|
|
7
|
+
ApplyStatus,
|
|
8
|
+
StatusChangeEvent,
|
|
9
|
+
} from "../../event.ts";
|
|
10
|
+
import type { IPlan } from "../../plan.ts";
|
|
11
|
+
|
|
12
|
+
interface ProgressEventSource {
|
|
13
|
+
subscribe(listener: (event: ApplyEvent) => void): () => void;
|
|
14
|
+
}
|
|
8
15
|
|
|
9
16
|
interface PlanTask
|
|
10
|
-
extends Required<Pick<
|
|
17
|
+
extends Required<Pick<StatusChangeEvent, "id" | "type" | "status">> {
|
|
11
18
|
message?: string;
|
|
12
19
|
updatedAt: number;
|
|
13
20
|
}
|
|
14
21
|
|
|
15
|
-
|
|
22
|
+
interface PlanProgressProps {
|
|
16
23
|
source: ProgressEventSource;
|
|
17
|
-
plan:
|
|
24
|
+
plan: IPlan;
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
export function PlanProgress(props: PlanProgressProps): React.JSX.Element {
|
|
@@ -29,7 +36,7 @@ export function PlanProgress(props: PlanProgressProps): React.JSX.Element {
|
|
|
29
36
|
];
|
|
30
37
|
for (const [id, item] of nodes) {
|
|
31
38
|
const planItem = item!;
|
|
32
|
-
const status:
|
|
39
|
+
const status: ApplyStatus =
|
|
33
40
|
planItem.action === "noop" ? "success" : "pending";
|
|
34
41
|
initialTasks.set(id, {
|
|
35
42
|
id,
|
|
@@ -89,7 +96,7 @@ export function PlanProgress(props: PlanProgressProps): React.JSX.Element {
|
|
|
89
96
|
];
|
|
90
97
|
for (const [id, item] of nodes) {
|
|
91
98
|
const planItem = item!;
|
|
92
|
-
const status:
|
|
99
|
+
const status: ApplyStatus =
|
|
93
100
|
planItem.action === "noop" ? "success" : "pending";
|
|
94
101
|
initialTasks.set(id, {
|
|
95
102
|
id,
|
|
@@ -146,7 +153,7 @@ export function PlanProgress(props: PlanProgressProps): React.JSX.Element {
|
|
|
146
153
|
);
|
|
147
154
|
}
|
|
148
155
|
|
|
149
|
-
function statusPriority(status:
|
|
156
|
+
function statusPriority(status: ApplyStatus): number {
|
|
150
157
|
switch (status) {
|
|
151
158
|
case "success":
|
|
152
159
|
case "created":
|
|
@@ -166,9 +173,7 @@ function statusPriority(status: Alchemy.ApplyStatus): number {
|
|
|
166
173
|
}
|
|
167
174
|
}
|
|
168
175
|
|
|
169
|
-
function statusColor(
|
|
170
|
-
status: Alchemy.ApplyStatus,
|
|
171
|
-
): Parameters<typeof Text>[0]["color"] {
|
|
176
|
+
function statusColor(status: ApplyStatus): Parameters<typeof Text>[0]["color"] {
|
|
172
177
|
switch (status) {
|
|
173
178
|
case "pending":
|
|
174
179
|
return "gray";
|
|
@@ -190,13 +195,13 @@ function statusColor(
|
|
|
190
195
|
}
|
|
191
196
|
}
|
|
192
197
|
|
|
193
|
-
function statusIcon(status:
|
|
198
|
+
function statusIcon(status: ApplyStatus, spinnerChar: string): string {
|
|
194
199
|
if (isInProgress(status)) return spinnerChar;
|
|
195
200
|
if (status === "fail") return "✗";
|
|
196
201
|
return "✓"; // created/updated/deleted/success
|
|
197
202
|
}
|
|
198
203
|
|
|
199
|
-
function isInProgress(status:
|
|
204
|
+
function isInProgress(status: ApplyStatus): boolean {
|
|
200
205
|
return (
|
|
201
206
|
status === "pending" ||
|
|
202
207
|
status === "creating" ||
|
|
@@ -204,3 +209,16 @@ function isInProgress(status: Alchemy.ApplyStatus): boolean {
|
|
|
204
209
|
status === "deleting"
|
|
205
210
|
);
|
|
206
211
|
}
|
|
212
|
+
|
|
213
|
+
const spinnerFrames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
214
|
+
|
|
215
|
+
function useGlobalSpinner(intervalMs = 80): string {
|
|
216
|
+
const [index, setIndex] = useState(0);
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
const timer = setInterval(() => {
|
|
219
|
+
setIndex((i) => (i + 1) % spinnerFrames.length);
|
|
220
|
+
}, intervalMs);
|
|
221
|
+
return () => clearInterval(timer);
|
|
222
|
+
}, [intervalMs]);
|
|
223
|
+
return spinnerFrames[index];
|
|
224
|
+
}
|
package/src/cli/index.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { requireApproval } from "./approve.tsx";
|
|
4
|
-
import { reportProgress } from "./progress.tsx";
|
|
5
|
-
|
|
6
|
-
export const layer = Layer.merge(requireApproval, reportProgress);
|
|
1
|
+
export * from "./service.ts";
|
|
2
|
+
export * from "./ink-service.tsx";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { type PlanStatusSession, CLI } from "./service.ts";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Layer from "effect/Layer";
|
|
6
|
+
import type { IPlan } from "../plan.ts";
|
|
7
|
+
import { render } from "ink";
|
|
8
|
+
import { ApprovePlan } from "./components/ApprovePlan.tsx";
|
|
9
|
+
import { Plan } from "./components/Plan.tsx";
|
|
10
|
+
import { PlanProgress } from "./components/PlanProgress.tsx";
|
|
11
|
+
import type { ApplyEvent } from "../event.ts";
|
|
12
|
+
|
|
13
|
+
export const inkCLI = () =>
|
|
14
|
+
Layer.succeed(
|
|
15
|
+
CLI,
|
|
16
|
+
CLI.of({
|
|
17
|
+
approvePlan,
|
|
18
|
+
displayPlan,
|
|
19
|
+
startApplySession,
|
|
20
|
+
}),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const approvePlan = Effect.fn(function* <P extends IPlan>(plan: P) {
|
|
24
|
+
let approved = false;
|
|
25
|
+
const { waitUntilExit } = render(
|
|
26
|
+
<ApprovePlan plan={plan} approve={(a) => (approved = a)} />,
|
|
27
|
+
);
|
|
28
|
+
yield* Effect.promise(waitUntilExit);
|
|
29
|
+
return approved;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const displayPlan = <P extends IPlan>(plan: P): Effect.Effect<void> =>
|
|
33
|
+
Effect.sync(() => {
|
|
34
|
+
const { unmount } = render(<Plan plan={plan} />);
|
|
35
|
+
unmount();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const startApplySession = Effect.fn(function* <P extends IPlan>(plan: P) {
|
|
39
|
+
const listeners = new Set<(event: ApplyEvent) => void>();
|
|
40
|
+
const { unmount } = render(
|
|
41
|
+
<PlanProgress
|
|
42
|
+
plan={plan}
|
|
43
|
+
source={{
|
|
44
|
+
subscribe(listener) {
|
|
45
|
+
listeners.add(listener);
|
|
46
|
+
return () => listeners.delete(listener);
|
|
47
|
+
},
|
|
48
|
+
}}
|
|
49
|
+
/>,
|
|
50
|
+
);
|
|
51
|
+
return {
|
|
52
|
+
done: Effect.fn(function* () {
|
|
53
|
+
yield* Effect.sleep(10); // give the react event loop time to re-render
|
|
54
|
+
yield* Effect.sync(() => unmount());
|
|
55
|
+
}),
|
|
56
|
+
emit: (event) =>
|
|
57
|
+
Effect.sync(() => {
|
|
58
|
+
for (const listener of listeners) listener(event);
|
|
59
|
+
}),
|
|
60
|
+
} satisfies PlanStatusSession;
|
|
61
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IPlan } from "../plan.ts";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Context from "effect/Context";
|
|
4
|
+
import type { ApplyEvent } from "../event.ts";
|
|
5
|
+
|
|
6
|
+
export interface PlanStatusSession {
|
|
7
|
+
emit: (event: ApplyEvent) => Effect.Effect<void>;
|
|
8
|
+
done: () => Effect.Effect<void>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ScopedPlanStatusSession extends PlanStatusSession {
|
|
12
|
+
note: (note: string) => Effect.Effect<void>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface CLIService {
|
|
16
|
+
approvePlan: <P extends IPlan>(plan: P) => Effect.Effect<boolean>;
|
|
17
|
+
displayPlan: <P extends IPlan>(plan: P) => Effect.Effect<void>;
|
|
18
|
+
startApplySession: <P extends IPlan>(
|
|
19
|
+
plan: P,
|
|
20
|
+
) => Effect.Effect<PlanStatusSession>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class CLI extends Context.Tag("CLIService")<CLI, CLIService>() {}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as Layer from "effect/Layer";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Config from "effect/Config";
|
|
5
|
+
import { App } from "../app.ts";
|
|
6
|
+
|
|
7
|
+
export class Account extends Context.Tag("cloudflare/account-id")<
|
|
8
|
+
Account,
|
|
9
|
+
string
|
|
10
|
+
>() {}
|
|
11
|
+
|
|
12
|
+
export const fromEnv = () =>
|
|
13
|
+
Layer.effect(
|
|
14
|
+
Account,
|
|
15
|
+
Effect.gen(function* () {
|
|
16
|
+
const accountId = yield* Config.string("CLOUDFLARE_ACCOUNT_ID");
|
|
17
|
+
if (!accountId) {
|
|
18
|
+
return yield* Effect.die("CLOUDFLARE_ACCOUNT_ID is not set");
|
|
19
|
+
}
|
|
20
|
+
return accountId;
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export const fromStageConfig = () =>
|
|
25
|
+
Layer.effect(
|
|
26
|
+
Account,
|
|
27
|
+
Effect.gen(function* () {
|
|
28
|
+
const app = yield* App;
|
|
29
|
+
const accountId =
|
|
30
|
+
app.config.cloudflare?.account ??
|
|
31
|
+
(yield* Config.string("CLOUDFLARE_ACCOUNT_ID"));
|
|
32
|
+
if (!accountId) {
|
|
33
|
+
return yield* Effect.die("CLOUDFLARE_ACCOUNT_ID is not set");
|
|
34
|
+
}
|
|
35
|
+
return accountId;
|
|
36
|
+
}),
|
|
37
|
+
);
|