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
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Data from "effect/Data";
|
|
3
|
+
|
|
4
|
+
export class UnexpectedValueError extends Data.TaggedError(
|
|
5
|
+
"UnexpectedValueError",
|
|
6
|
+
)<{
|
|
7
|
+
message: string;
|
|
8
|
+
value: never;
|
|
9
|
+
}> {}
|
|
10
|
+
|
|
11
|
+
export const assertNeverOrDie = (value: never): Effect.Effect<never> => {
|
|
12
|
+
return Effect.die(
|
|
13
|
+
new UnexpectedValueError({
|
|
14
|
+
message: `Unexpected value: ${value}`,
|
|
15
|
+
value,
|
|
16
|
+
}),
|
|
17
|
+
);
|
|
18
|
+
};
|
package/src/aws/account.ts
CHANGED
|
@@ -3,6 +3,8 @@ import * as Data from "effect/Data";
|
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Layer from "effect/Layer";
|
|
5
5
|
import * as STS from "./sts.ts";
|
|
6
|
+
import { App } from "../app.ts";
|
|
7
|
+
import { loadProfile } from "./credentials.ts";
|
|
6
8
|
|
|
7
9
|
export class FailedToGetAccount extends Data.TaggedError(
|
|
8
10
|
"AWS::Account::FailedToGetAccount",
|
|
@@ -18,12 +20,30 @@ export class Account extends Context.Tag("AWS::AccountID")<
|
|
|
18
20
|
AccountID
|
|
19
21
|
>() {}
|
|
20
22
|
|
|
21
|
-
export
|
|
23
|
+
export class AWSStageConfigAccountMissing extends Data.TaggedError(
|
|
24
|
+
"AWSStageConfigAccountMissing",
|
|
25
|
+
)<{
|
|
26
|
+
message: string;
|
|
27
|
+
stage: string;
|
|
28
|
+
}> {}
|
|
29
|
+
|
|
30
|
+
export const fromStageConfig = () =>
|
|
22
31
|
Layer.effect(
|
|
23
32
|
Account,
|
|
24
33
|
Effect.gen(function* () {
|
|
25
|
-
const
|
|
26
|
-
|
|
34
|
+
const app = yield* App;
|
|
35
|
+
if (app.config.aws?.account) {
|
|
36
|
+
return app.config.aws.account;
|
|
37
|
+
}
|
|
38
|
+
const profileName = app.config.aws?.profile;
|
|
39
|
+
if (profileName) {
|
|
40
|
+
const profile = yield* loadProfile(profileName);
|
|
41
|
+
if (profile.sso_account_id) {
|
|
42
|
+
return profile.sso_account_id;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const client = yield* STS.STSClient;
|
|
46
|
+
const identity = yield* client.getCallerIdentity({}).pipe(
|
|
27
47
|
Effect.catchAll(
|
|
28
48
|
(err) =>
|
|
29
49
|
new FailedToGetAccount({
|
package/src/aws/client.ts
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AccountID } from "./account.ts";
|
|
2
|
+
import type { RegionID } from "./region.ts";
|
|
3
|
+
import type { AwsCredentialIdentity } from "@smithy/types";
|
|
4
|
+
|
|
5
|
+
export interface AwsStageConfig {
|
|
6
|
+
account?: AccountID;
|
|
7
|
+
region?: RegionID;
|
|
8
|
+
profile?: string;
|
|
9
|
+
credentials?: AwsCredentialIdentity;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare module "../stage.ts" {
|
|
13
|
+
interface StageConfig {
|
|
14
|
+
aws?: AwsStageConfig;
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/aws/credentials.ts
CHANGED
|
@@ -26,7 +26,8 @@ import * as Redacted from "effect/Redacted";
|
|
|
26
26
|
import { createHash } from "node:crypto";
|
|
27
27
|
import * as path from "node:path";
|
|
28
28
|
import { parseIni, parseSSOSessionData } from "./parse-ini.ts";
|
|
29
|
-
import {
|
|
29
|
+
import { Profile } from "./profile.ts";
|
|
30
|
+
import { App } from "../app.ts";
|
|
30
31
|
|
|
31
32
|
export class Credentials extends Context.Tag("AWS::Credentials")<
|
|
32
33
|
Credentials,
|
|
@@ -164,201 +165,235 @@ export interface SsoProfileConfig extends AwsProfileConfig {
|
|
|
164
165
|
sso_role_name: string;
|
|
165
166
|
}
|
|
166
167
|
|
|
168
|
+
export const fromStageConfig = () =>
|
|
169
|
+
Layer.effect(
|
|
170
|
+
Credentials,
|
|
171
|
+
Effect.gen(function* () {
|
|
172
|
+
const app = yield* App;
|
|
173
|
+
if (app.config.aws?.profile) {
|
|
174
|
+
return yield* loadSSOCredentials(app.config.aws.profile);
|
|
175
|
+
} else if (app.config.aws?.credentials) {
|
|
176
|
+
return fromAwsCredentialIdentity(app.config.aws.credentials);
|
|
177
|
+
}
|
|
178
|
+
return yield* Effect.dieMessage(
|
|
179
|
+
"No AWS credentials found in stage config",
|
|
180
|
+
);
|
|
181
|
+
}),
|
|
182
|
+
);
|
|
183
|
+
|
|
167
184
|
export const fromSSO = () =>
|
|
168
185
|
Layer.effect(
|
|
169
186
|
Credentials,
|
|
170
187
|
Effect.gen(function* () {
|
|
171
|
-
const client = yield* HttpClient.HttpClient;
|
|
172
|
-
const fs = yield* FileSystem.FileSystem;
|
|
173
188
|
const profileName = Option.getOrElse(
|
|
174
|
-
yield* Effect.serviceOption(
|
|
189
|
+
yield* Effect.serviceOption(Profile),
|
|
175
190
|
() => "default",
|
|
176
191
|
);
|
|
192
|
+
return yield* loadSSOCredentials(profileName);
|
|
193
|
+
}),
|
|
194
|
+
);
|
|
177
195
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
196
|
+
export const loadSSOCredentials = Effect.fn(function* (profileName: string) {
|
|
197
|
+
const client = yield* HttpClient.HttpClient;
|
|
198
|
+
const fs = yield* FileSystem.FileSystem;
|
|
199
|
+
const awsDir = path.join(ini.getHomeDir(), ".aws");
|
|
200
|
+
const cachePath = path.join(awsDir, "sso", "cache");
|
|
201
|
+
|
|
202
|
+
const profile = yield* loadProfile(profileName);
|
|
203
|
+
|
|
204
|
+
if (profile.sso_session) {
|
|
205
|
+
const hasher = createHash("sha1");
|
|
206
|
+
const cacheName = hasher.update(profile.sso_session).digest("hex");
|
|
207
|
+
const ssoTokenFilepath = path.join(cachePath, `${cacheName}.json`);
|
|
208
|
+
const cachedCredsFilePath = path.join(
|
|
209
|
+
cachePath,
|
|
210
|
+
`${cacheName}.credentials.json`,
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
const cachedCreds = yield* fs.readFileString(cachedCredsFilePath).pipe(
|
|
214
|
+
Effect.map((text) => JSON.parse(text)),
|
|
215
|
+
Effect.catchAll(() => Effect.void),
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
const isExpired = (expiry: number | string | undefined) => {
|
|
219
|
+
return (
|
|
220
|
+
expiry === undefined ||
|
|
221
|
+
new Date(expiry).getTime() - Date.now() <= EXPIRE_WINDOW_MS
|
|
182
222
|
);
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
if (cachedCreds && !isExpired(cachedCreds.expiry)) {
|
|
226
|
+
return Credentials.of({
|
|
227
|
+
accessKeyId: Redacted.make(cachedCreds.accessKeyId),
|
|
228
|
+
secretAccessKey: Redacted.make(cachedCreds.secretAccessKey),
|
|
229
|
+
sessionToken: cachedCreds.sessionToken
|
|
230
|
+
? Redacted.make(cachedCreds.sessionToken)
|
|
231
|
+
: undefined,
|
|
232
|
+
expiration: cachedCreds.expiry,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const ssoToken = yield* fs.readFileString(ssoTokenFilepath).pipe(
|
|
237
|
+
Effect.map((text) => JSON.parse(text) as SSOToken),
|
|
238
|
+
Effect.catchAll(() =>
|
|
239
|
+
Effect.fail(
|
|
240
|
+
new InvalidSSOToken({
|
|
241
|
+
message: `The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`,
|
|
242
|
+
sso_session: profile.sso_session!,
|
|
191
243
|
}),
|
|
192
|
-
)
|
|
193
|
-
|
|
244
|
+
),
|
|
245
|
+
),
|
|
246
|
+
);
|
|
194
247
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
yield* Effect.fail(
|
|
226
|
-
new ConflictingSSOStartUrl({
|
|
227
|
-
message: `Conflicting SSO start url`,
|
|
228
|
-
ssoStartUrl: ssoStartUrl,
|
|
229
|
-
profile: profile.sso_session,
|
|
230
|
-
}),
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
profile.sso_region = session.sso_region;
|
|
234
|
-
profile.sso_start_url = session.sso_start_url;
|
|
235
|
-
|
|
236
|
-
const ssoFields = [
|
|
237
|
-
"sso_start_url",
|
|
238
|
-
"sso_account_id",
|
|
239
|
-
"sso_region",
|
|
240
|
-
"sso_role_name",
|
|
241
|
-
] as const satisfies (keyof SsoProfileConfig)[];
|
|
242
|
-
const missingFields = ssoFields.filter((field) => !profile[field]);
|
|
243
|
-
if (missingFields.length > 0) {
|
|
244
|
-
yield* Effect.fail(
|
|
245
|
-
new InvalidSSOProfile({
|
|
246
|
-
profile: profileName,
|
|
247
|
-
missingFields,
|
|
248
|
-
message:
|
|
249
|
-
`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", ` +
|
|
250
|
-
`"sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(
|
|
251
|
-
profile,
|
|
252
|
-
).join(
|
|
253
|
-
", ",
|
|
254
|
-
)}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,
|
|
255
|
-
}),
|
|
256
|
-
);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
const hasher = createHash("sha1");
|
|
260
|
-
const cacheName = hasher.update(profile.sso_session).digest("hex");
|
|
261
|
-
const ssoTokenFilepath = path.join(cachePath, `${cacheName}.json`);
|
|
262
|
-
const cachedCredsFilePath = path.join(
|
|
263
|
-
cachePath,
|
|
264
|
-
`${cacheName}.credentials.json`,
|
|
265
|
-
);
|
|
266
|
-
|
|
267
|
-
const cachedCreds = yield* fs.readFileString(cachedCredsFilePath).pipe(
|
|
268
|
-
Effect.map((text) => JSON.parse(text)),
|
|
269
|
-
Effect.catchAll(() => Effect.void),
|
|
270
|
-
);
|
|
271
|
-
|
|
272
|
-
const isExpired = (expiry: number | string | undefined) => {
|
|
273
|
-
return (
|
|
274
|
-
expiry === undefined ||
|
|
275
|
-
new Date(expiry).getTime() - Date.now() <= EXPIRE_WINDOW_MS
|
|
276
|
-
);
|
|
248
|
+
if (isExpired(ssoToken.expiresAt)) {
|
|
249
|
+
yield* Console.log(
|
|
250
|
+
`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`,
|
|
251
|
+
);
|
|
252
|
+
yield* Effect.fail(
|
|
253
|
+
new ExpiredSSOToken({
|
|
254
|
+
message: `The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`,
|
|
255
|
+
profile: profileName,
|
|
256
|
+
}),
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const response = yield* client.get(
|
|
261
|
+
`https://portal.sso.${profile.sso_region}.amazonaws.com/federation/credentials?account_id=${profile.sso_account_id}&role_name=${profile.sso_role_name}`,
|
|
262
|
+
{
|
|
263
|
+
headers: {
|
|
264
|
+
"User-Agent": "alchemy.run",
|
|
265
|
+
"Content-Type": "application/json",
|
|
266
|
+
"x-amz-sso_bearer_token": ssoToken.accessToken,
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
const credentials = (
|
|
272
|
+
(yield* response.json) as {
|
|
273
|
+
roleCredentials: {
|
|
274
|
+
accessKeyId: string;
|
|
275
|
+
secretAccessKey: string;
|
|
276
|
+
sessionToken: string;
|
|
277
|
+
expiration: number;
|
|
277
278
|
};
|
|
278
|
-
|
|
279
|
-
if (cachedCreds && !isExpired(cachedCreds.expiry)) {
|
|
280
|
-
return Credentials.of({
|
|
281
|
-
accessKeyId: Redacted.make(cachedCreds.accessKeyId),
|
|
282
|
-
secretAccessKey: Redacted.make(cachedCreds.secretAccessKey),
|
|
283
|
-
sessionToken: cachedCreds.sessionToken
|
|
284
|
-
? Redacted.make(cachedCreds.sessionToken)
|
|
285
|
-
: undefined,
|
|
286
|
-
expiration: cachedCreds.expiry,
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
const ssoToken = yield* fs.readFileString(ssoTokenFilepath).pipe(
|
|
291
|
-
Effect.map((text) => JSON.parse(text) as SSOToken),
|
|
292
|
-
Effect.catchAll(() =>
|
|
293
|
-
Effect.fail(
|
|
294
|
-
new InvalidSSOToken({
|
|
295
|
-
message: `The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`,
|
|
296
|
-
sso_session: profile.sso_session!,
|
|
297
|
-
}),
|
|
298
|
-
),
|
|
299
|
-
),
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
if (isExpired(ssoToken.expiresAt)) {
|
|
303
|
-
yield* Console.log(
|
|
304
|
-
`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`,
|
|
305
|
-
);
|
|
306
|
-
yield* Effect.fail(
|
|
307
|
-
new ExpiredSSOToken({
|
|
308
|
-
message: `The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`,
|
|
309
|
-
profile: profileName,
|
|
310
|
-
}),
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
const response = yield* client.get(
|
|
315
|
-
`https://portal.sso.${profile.sso_region}.amazonaws.com/federation/credentials?account_id=${profile.sso_account_id}&role_name=${profile.sso_role_name}`,
|
|
316
|
-
{
|
|
317
|
-
headers: {
|
|
318
|
-
"User-Agent": "alchemy.run",
|
|
319
|
-
"Content-Type": "application/json",
|
|
320
|
-
"x-amz-sso_bearer_token": ssoToken.accessToken,
|
|
321
|
-
},
|
|
322
|
-
},
|
|
323
|
-
);
|
|
324
|
-
|
|
325
|
-
const credentials = (
|
|
326
|
-
(yield* response.json) as {
|
|
327
|
-
roleCredentials: {
|
|
328
|
-
accessKeyId: string;
|
|
329
|
-
secretAccessKey: string;
|
|
330
|
-
sessionToken: string;
|
|
331
|
-
expiration: number;
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
).roleCredentials;
|
|
335
|
-
|
|
336
|
-
yield* fs.writeFileString(
|
|
337
|
-
cachedCredsFilePath,
|
|
338
|
-
JSON.stringify({
|
|
339
|
-
accessKeyId: credentials.accessKeyId,
|
|
340
|
-
secretAccessKey: credentials.secretAccessKey,
|
|
341
|
-
sessionToken: credentials.sessionToken,
|
|
342
|
-
expiry: credentials.expiration,
|
|
343
|
-
}),
|
|
344
|
-
);
|
|
345
|
-
|
|
346
|
-
return Credentials.of({
|
|
347
|
-
accessKeyId: Redacted.make(credentials.accessKeyId),
|
|
348
|
-
secretAccessKey: Redacted.make(credentials.secretAccessKey),
|
|
349
|
-
sessionToken: Redacted.make(credentials.sessionToken),
|
|
350
|
-
expiration: credentials.expiration,
|
|
351
|
-
});
|
|
352
279
|
}
|
|
280
|
+
).roleCredentials;
|
|
281
|
+
|
|
282
|
+
yield* fs.writeFileString(
|
|
283
|
+
cachedCredsFilePath,
|
|
284
|
+
JSON.stringify({
|
|
285
|
+
accessKeyId: credentials.accessKeyId,
|
|
286
|
+
secretAccessKey: credentials.secretAccessKey,
|
|
287
|
+
sessionToken: credentials.sessionToken,
|
|
288
|
+
expiry: credentials.expiration,
|
|
289
|
+
}),
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
return Credentials.of({
|
|
293
|
+
accessKeyId: Redacted.make(credentials.accessKeyId),
|
|
294
|
+
secretAccessKey: Redacted.make(credentials.secretAccessKey),
|
|
295
|
+
sessionToken: Redacted.make(credentials.sessionToken),
|
|
296
|
+
expiration: credentials.expiration,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return yield* Effect.fail(
|
|
301
|
+
new ProfileNotFound({
|
|
302
|
+
message: `Profile ${profileName} not found`,
|
|
303
|
+
profile: profileName,
|
|
304
|
+
}),
|
|
305
|
+
);
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
export const loadProfile = Effect.fn(function* (profileName: string) {
|
|
309
|
+
const fs = yield* FileSystem.FileSystem;
|
|
310
|
+
const profiles: {
|
|
311
|
+
[profileName: string]: AwsProfileConfig;
|
|
312
|
+
} = yield* Effect.promise(() =>
|
|
313
|
+
ini.parseKnownFiles({ profile: profileName }),
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
const profile = profiles[profileName];
|
|
353
317
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
318
|
+
if (!profile) {
|
|
319
|
+
yield* Effect.fail(
|
|
320
|
+
new ProfileNotFound({
|
|
321
|
+
message: `Profile ${profileName} not found`,
|
|
322
|
+
profile: profileName,
|
|
323
|
+
}),
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
const awsDir = path.join(ini.getHomeDir(), ".aws");
|
|
328
|
+
const configPath = path.join(awsDir, "config");
|
|
329
|
+
|
|
330
|
+
if (profile.sso_session) {
|
|
331
|
+
const ssoRegion = Option.getOrUndefined(
|
|
332
|
+
yield* Effect.serviceOption(SsoRegion),
|
|
333
|
+
);
|
|
334
|
+
const ssoStartUrl = Option.getOrElse(
|
|
335
|
+
yield* Effect.serviceOption(SsoStartUrl),
|
|
336
|
+
() => profile.sso_start_url,
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
const ssoSessions = yield* fs.readFileString(configPath).pipe(
|
|
340
|
+
Effect.flatMap((config) => Effect.promise(async () => parseIni(config))),
|
|
341
|
+
Effect.map(parseSSOSessionData),
|
|
342
|
+
);
|
|
343
|
+
const session = ssoSessions[profile.sso_session];
|
|
344
|
+
if (ssoRegion && ssoRegion !== session.sso_region) {
|
|
345
|
+
yield* Effect.fail(
|
|
346
|
+
new ConflictingSSORegion({
|
|
347
|
+
message: `Conflicting SSO region`,
|
|
348
|
+
ssoRegion: ssoRegion,
|
|
349
|
+
profile: profile.sso_session,
|
|
350
|
+
}),
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {
|
|
354
|
+
yield* Effect.fail(
|
|
355
|
+
new ConflictingSSOStartUrl({
|
|
356
|
+
message: `Conflicting SSO start url`,
|
|
357
|
+
ssoStartUrl: ssoStartUrl,
|
|
358
|
+
profile: profile.sso_session,
|
|
359
|
+
}),
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
profile.sso_region = session.sso_region;
|
|
363
|
+
profile.sso_start_url = session.sso_start_url;
|
|
364
|
+
|
|
365
|
+
const ssoFields = [
|
|
366
|
+
"sso_start_url",
|
|
367
|
+
"sso_account_id",
|
|
368
|
+
"sso_region",
|
|
369
|
+
"sso_role_name",
|
|
370
|
+
] as const satisfies (keyof SsoProfileConfig)[];
|
|
371
|
+
const missingFields = ssoFields.filter((field) => !profile[field]);
|
|
372
|
+
if (missingFields.length > 0) {
|
|
373
|
+
yield* Effect.fail(
|
|
374
|
+
new InvalidSSOProfile({
|
|
357
375
|
profile: profileName,
|
|
376
|
+
missingFields,
|
|
377
|
+
message:
|
|
378
|
+
`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", ` +
|
|
379
|
+
`"sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(
|
|
380
|
+
profile,
|
|
381
|
+
).join(
|
|
382
|
+
", ",
|
|
383
|
+
)}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,
|
|
358
384
|
}),
|
|
359
385
|
);
|
|
386
|
+
}
|
|
387
|
+
return profile;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
return yield* Effect.fail(
|
|
391
|
+
new ProfileNotFound({
|
|
392
|
+
message: `Profile ${profileName} not found`,
|
|
393
|
+
profile: profileName,
|
|
360
394
|
}),
|
|
361
395
|
);
|
|
396
|
+
});
|
|
362
397
|
|
|
363
398
|
/**
|
|
364
399
|
* Cached SSO token retrieved from SSO login flow.
|
|
@@ -6,7 +6,7 @@ export * from "./table.get-item.ts";
|
|
|
6
6
|
export * from "./table.provider.ts";
|
|
7
7
|
export * from "./table.ts";
|
|
8
8
|
|
|
9
|
-
export type * as Alchemy from "../../index.ts";
|
|
10
|
-
|
|
11
9
|
// TODO(sam): figure out a better strategy to workaround non-portable types
|
|
12
|
-
|
|
10
|
+
export type * from "../../exports.ts";
|
|
11
|
+
|
|
12
|
+
import "../config.ts";
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Binding,
|
|
3
|
-
declare,
|
|
4
|
-
Policy,
|
|
5
|
-
toEnvKey,
|
|
6
|
-
type Capability,
|
|
7
|
-
type From,
|
|
8
|
-
} from "alchemy-effect";
|
|
9
1
|
import { Effect } from "effect";
|
|
10
2
|
import type { ReturnConsumedCapacity } from "itty-aws/dynamodb";
|
|
11
|
-
import {
|
|
3
|
+
import { Binding } from "../../binding.ts";
|
|
4
|
+
import type { Capability } from "../../capability.ts";
|
|
5
|
+
import { toEnvKey } from "../../env.ts";
|
|
6
|
+
import { declare, type From, type Policy } from "../../policy.ts";
|
|
7
|
+
import { Function } from "../lambda/function.ts";
|
|
12
8
|
import { fromAttributeValue } from "./attribute-value.ts";
|
|
13
9
|
import { DynamoDBClient } from "./client.ts";
|
|
14
10
|
import type { Identifier } from "./expr.ts";
|