alchemy-effect 0.2.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 +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 +14 -74
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +62 -57
- 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 +17 -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 +3 -0
- package/lib/aws/ec2/index.d.ts.map +1 -1
- package/lib/aws/ec2/index.js +3 -0
- package/lib/aws/ec2/index.js.map +1 -1
- 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 +12 -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 +3 -4
- package/lib/aws/ec2/vpc.provider.d.ts.map +1 -1
- package/lib/aws/ec2/vpc.provider.js +11 -26
- package/lib/aws/ec2/vpc.provider.js.map +1 -1
- package/lib/aws/index.d.ts +16 -19
- package/lib/aws/index.d.ts.map +1 -1
- package/lib/aws/index.js +7 -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 +5 -4
- package/lib/aws/lambda/function.provider.d.ts.map +1 -1
- package/lib/aws/lambda/function.provider.js +16 -14
- 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 +4 -4
- package/lib/aws/sqs/queue.provider.d.ts.map +1 -1
- package/lib/aws/sqs/queue.provider.js +3 -3
- 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 +265 -224
- 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.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 +8 -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 +8 -7
- 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 +7 -6
- 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 +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/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/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/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 +47 -28
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +257 -151
- 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 +14 -16
- 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 +11 -6
- 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 +51 -10
- package/lib/state.d.ts.map +1 -1
- package/lib/state.js +30 -29
- package/lib/state.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/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 +429 -441
- 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 +35 -39
- package/src/aws/dynamodb/table.ts +29 -84
- package/src/aws/ec2/index.ts +4 -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 +20 -36
- package/src/aws/ec2/vpc.ts +19 -8
- package/src/aws/index.ts +46 -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 +28 -21
- 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 +11 -4
- 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 +9 -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 +9 -8
- 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 +16 -13
- 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 +30 -0
- package/src/env.ts +20 -32
- package/src/exports.ts +21 -0
- package/src/index.ts +10 -5
- package/src/input.ts +81 -0
- package/src/output.ts +518 -0
- package/src/plan.ts +380 -192
- package/src/policy.ts +3 -5
- package/src/provider.ts +25 -23
- package/src/ref.ts +48 -0
- package/src/resource.ts +20 -6
- 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 +138 -60
- package/src/test.ts +117 -16
- 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/lib/cli/index.d.ts
CHANGED
|
@@ -1,45 +1,68 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import * as Layer from "effect/Layer";
|
|
3
2
|
import * as Effect$1 from "effect/Effect";
|
|
4
3
|
import { Effect } from "effect/Effect";
|
|
5
4
|
import * as Context from "effect/Context";
|
|
6
|
-
import "
|
|
7
|
-
import "@effect/platform/Path";
|
|
5
|
+
import * as Layer from "effect/Layer";
|
|
8
6
|
import * as S from "effect/Schema";
|
|
9
|
-
import * as effect_Types0 from "effect/Types";
|
|
10
|
-
import * as effect_Cause0 from "effect/Cause";
|
|
11
7
|
import { Types } from "effect";
|
|
8
|
+
import "@effect/platform/FileSystem";
|
|
9
|
+
import "@effect/platform/Path";
|
|
12
10
|
|
|
13
|
-
//#region src/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
//#region src/diff.d.ts
|
|
12
|
+
type Diff = {
|
|
13
|
+
action: "noop";
|
|
14
|
+
deleteFirst?: undefined;
|
|
15
|
+
stables?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
action: "update";
|
|
18
|
+
deleteFirst?: undefined;
|
|
19
|
+
/** properties that won't change as part of this update */
|
|
20
|
+
stables?: string[];
|
|
21
|
+
} | {
|
|
22
|
+
action: "replace";
|
|
23
|
+
deleteFirst?: boolean;
|
|
24
|
+
stables?: undefined;
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/data.d.ts
|
|
28
|
+
type Primitive = never | undefined | null | boolean | number | string | bigint | symbol;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/output.d.ts
|
|
31
|
+
interface Output<A = any, Src$1 extends Resource = any, Req$1 = any> {
|
|
32
|
+
readonly kind: string;
|
|
33
|
+
readonly src: Src$1;
|
|
34
|
+
readonly req: Req$1;
|
|
35
|
+
apply<B>(fn: (value: A) => B): Output.Of<B, Src$1, Req$1>;
|
|
36
|
+
effect<B, Req2$1>(fn: (value: A) => Effect$1.Effect<B, never, Req2$1>): Output.Of<B, Src$1, Req$1 | Req2$1>;
|
|
21
37
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
tag: Context.TagClass<Provider<R>, R["type"], ProviderService<R>>;
|
|
25
|
-
effect<Err, Req>(eff: Effect<ProviderService<R>, Err, Req>): Layer.Layer<Provider<R>, Err, Req>;
|
|
26
|
-
succeed(service: ProviderService<R>): Layer.Layer<Provider<R>>;
|
|
38
|
+
declare namespace Output {
|
|
39
|
+
type Of<A, Src$1 extends Resource = any, Req$1 = never> = [Extract<A, object>] extends [never] ? Output<A, Src$1, Req$1> : [Extract<A, any[]>] extends [never] ? Object$1<{ [attr in keyof A]: A[attr] }, Src$1, Req$1> : Array<Extract<A, any[]>, Src$1, Req$1>;
|
|
27
40
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
provider: ResourceTags<ReturnType<Ctor>>;
|
|
41
|
+
type Object$1<A, Src$1 extends Resource, Req$1 = any> = Output<A, Src$1, Req$1> & { [Prop in keyof Exclude<A, undefined>]-?: Output.Of<Exclude<A, undefined>[Prop] | Extract<A, undefined>, Src$1, Req$1> };
|
|
42
|
+
type Array<A extends any[], Src$1 extends Resource, Req$1 = any> = Output<A, Src$1, Req$1> & { [i in Extract<keyof A, number>]: Output.Of<A[i], Src$1, Req$1> };
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/input.d.ts
|
|
45
|
+
type Function = (...args: any[]) => any;
|
|
46
|
+
type Constructor = new (...args: any[]) => any;
|
|
47
|
+
type PolicyLike = {
|
|
48
|
+
kind: "alchemy/Policy";
|
|
37
49
|
};
|
|
50
|
+
type Input<T> = T | (T extends S.Schema<any> ? never : Output<T, any, any> | (T extends Primitive ? never : T extends any[] ? number extends T["length"] ? Input<T[number]>[] : Inputs<T> : T extends object ? { [K in keyof T]: Input<T[K]> } : never));
|
|
51
|
+
declare namespace Input {
|
|
52
|
+
type Resolve<T> = T extends Output<infer U> ? U : T extends Primitive | Constructor | Function | S.Schema<any> | PolicyLike ? T : T extends any[] ? ResolveArray<T> : T extends Record<string, any> ? { [k in keyof T]: Input.Resolve<T[k]> } : never;
|
|
53
|
+
type ResolveArray<T extends any[]> = number extends T["length"] ? Resolve<T[number]>[] : ResolveTuple<T>;
|
|
54
|
+
type ResolveTuple<T extends any[], Accum extends any[] = []> = T extends [infer H, ...infer Tail] ? ResolveTuple<Tail, [...Accum, Input.Resolve<H>]> : Accum;
|
|
55
|
+
type ResolveProps<Props$1 extends Record<string, any>> = { [k in keyof Props$1]: Input.Resolve<Props$1[k]> };
|
|
56
|
+
type ResolveOpaque<T> = true extends IsOut<T> ? ResolveOut<T> : Resolve<T>;
|
|
57
|
+
type IsOut<T> = T extends Output<infer U> ? true : never;
|
|
58
|
+
type ResolveOut<T> = T extends Output<infer U> ? U : never;
|
|
59
|
+
}
|
|
60
|
+
type Inputs<T extends any[], Out extends any[] = []> = T extends [infer H, ...infer T] ? Inputs<T, [...Out, Input<H>]> : Out;
|
|
38
61
|
//#endregion
|
|
39
62
|
//#region src/service.d.ts
|
|
40
|
-
interface IService<ID$1 extends string = string, F extends
|
|
41
|
-
props: Props;
|
|
42
|
-
})["attr"]> extends
|
|
63
|
+
interface IService<ID$1 extends string = string, F extends IRuntime = IRuntime, Handler extends RuntimeHandler = RuntimeHandler, Props$1 extends RuntimeProps<F, any> = RuntimeProps<F, any>, Attr = (F & {
|
|
64
|
+
props: Props$1;
|
|
65
|
+
})["attr"], Base = unknown> extends IResource<F["type"], ID$1, Props$1, Attr, F> {
|
|
43
66
|
kind: "Service";
|
|
44
67
|
type: F["type"];
|
|
45
68
|
id: ID$1;
|
|
@@ -54,193 +77,130 @@ interface IService<ID$1 extends string = string, F extends Runtime = Runtime, Ha
|
|
|
54
77
|
* An Effect that produces a handler stripped of its Infrastructure-time-only Capabilities.
|
|
55
78
|
*/
|
|
56
79
|
handler: Effect<(...inputs: Parameters<Handler>) => Effect<Effect.Success<ReturnType<Handler>>, Effect.Error<ReturnType<Handler>>, never>, never, Exclude<Effect.Context<ReturnType<Handler>>, Capability>>;
|
|
57
|
-
props: Props;
|
|
80
|
+
props: Props$1;
|
|
58
81
|
/** @internal phantom type of this resource's output attributes */
|
|
59
82
|
attr: Attr;
|
|
60
83
|
/** @internal phantom type of this resource's parent */
|
|
61
84
|
parent: unknown;
|
|
85
|
+
new (): Service<ID$1, F, Handler, Props$1, Attr, Base>;
|
|
62
86
|
}
|
|
63
|
-
interface Service<ID$1 extends string = string, F extends
|
|
64
|
-
props: Props;
|
|
65
|
-
})["attr"]> extends IService<ID$1, F, Handler, Props
|
|
66
|
-
//#endregion
|
|
67
|
-
//#region src/event.d.ts
|
|
68
|
-
type ApplyStatus = "pending" | "creating" | "created" | "updating" | "updated" | "deleting" | "deleted" | "success" | "fail";
|
|
69
|
-
type ApplyEvent = AnnotateEvent | StatusChangeEvent;
|
|
70
|
-
interface AnnotateEvent {
|
|
71
|
-
kind: "annotate";
|
|
72
|
-
id: string;
|
|
73
|
-
message: string;
|
|
74
|
-
}
|
|
75
|
-
interface StatusChangeEvent {
|
|
76
|
-
kind: "status-change";
|
|
77
|
-
id: string;
|
|
78
|
-
type: string;
|
|
79
|
-
status: ApplyStatus;
|
|
80
|
-
message?: string;
|
|
81
|
-
bindingId?: string;
|
|
82
|
-
}
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/apply.d.ts
|
|
85
|
-
interface PlanStatusSession {
|
|
86
|
-
emit: (event: ApplyEvent) => Effect$1.Effect<void>;
|
|
87
|
-
done: () => Effect$1.Effect<void>;
|
|
88
|
-
}
|
|
89
|
-
interface ScopedPlanStatusSession extends PlanStatusSession {
|
|
90
|
-
note: (note: string) => Effect$1.Effect<void>;
|
|
91
|
-
}
|
|
92
|
-
declare const PlanStatusReporter_base: Context.TagClass<PlanStatusReporter, "PlanStatusReporter", {
|
|
93
|
-
start(plan: Plan): Effect$1.Effect<PlanStatusSession, never>;
|
|
94
|
-
}>;
|
|
95
|
-
declare class PlanStatusReporter extends PlanStatusReporter_base {}
|
|
87
|
+
interface Service<ID$1 extends string = string, F extends IRuntime = IRuntime, Handler extends RuntimeHandler = RuntimeHandler, Props$1 extends RuntimeProps<F, any> = RuntimeProps<F, any>, Attr = (F & {
|
|
88
|
+
props: Props$1;
|
|
89
|
+
})["attr"], Base = unknown> extends IService<ID$1, F, Handler, Props$1, Attr, Base> {}
|
|
96
90
|
//#endregion
|
|
97
91
|
//#region src/provider.d.ts
|
|
98
|
-
|
|
99
|
-
type Diff = {
|
|
100
|
-
action: "update" | "noop";
|
|
101
|
-
deleteFirst?: undefined;
|
|
102
|
-
} | {
|
|
103
|
-
action: "replace";
|
|
104
|
-
deleteFirst?: boolean;
|
|
105
|
-
};
|
|
92
|
+
interface Provider<R extends Resource | Service> extends Context.TagClass<Provider<R>, R["type"], ProviderService<any>> {}
|
|
106
93
|
type BindingData<Res extends Resource> = [Res] extends [Runtime] ? Res["binding"][] : any[];
|
|
94
|
+
type Props<Res extends Resource> = Input.ResolveOpaque<Res["props"]>;
|
|
107
95
|
interface ProviderService<Res extends Resource = Resource> {
|
|
108
96
|
read?(input: {
|
|
109
97
|
id: string;
|
|
110
|
-
olds: Res
|
|
98
|
+
olds: Props<Res> | undefined;
|
|
111
99
|
output: Res["attr"] | undefined;
|
|
112
100
|
session: ScopedPlanStatusSession;
|
|
113
101
|
bindings: BindingData<Res>;
|
|
114
102
|
}): Effect$1.Effect<Res["attr"] | undefined, any, never>;
|
|
115
103
|
diff?(input: {
|
|
116
104
|
id: string;
|
|
117
|
-
olds: Res
|
|
105
|
+
olds: Props<Res>;
|
|
118
106
|
news: Res["props"];
|
|
119
107
|
output: Res["attr"];
|
|
120
108
|
}): Effect$1.Effect<Diff | void, never, never>;
|
|
121
109
|
precreate?(input: {
|
|
122
110
|
id: string;
|
|
123
|
-
news: Res
|
|
111
|
+
news: Props<Res>;
|
|
124
112
|
session: ScopedPlanStatusSession;
|
|
125
113
|
}): Effect$1.Effect<Res["attr"], any, never>;
|
|
126
114
|
create(input: {
|
|
127
115
|
id: string;
|
|
128
|
-
news: Res
|
|
116
|
+
news: Props<Res>;
|
|
129
117
|
session: ScopedPlanStatusSession;
|
|
130
118
|
bindings: BindingData<Res>;
|
|
131
119
|
}): Effect$1.Effect<Res["attr"], any, never>;
|
|
132
120
|
update(input: {
|
|
133
121
|
id: string;
|
|
134
|
-
news: Res
|
|
135
|
-
olds: Res
|
|
122
|
+
news: Props<Res>;
|
|
123
|
+
olds: Props<Res>;
|
|
136
124
|
output: Res["attr"];
|
|
137
125
|
session: ScopedPlanStatusSession;
|
|
138
126
|
bindings: BindingData<Res>;
|
|
139
127
|
}): Effect$1.Effect<Res["attr"], any, never>;
|
|
140
128
|
delete(input: {
|
|
141
129
|
id: string;
|
|
142
|
-
olds: Res
|
|
130
|
+
olds: Props<Res>;
|
|
143
131
|
output: Res["attr"];
|
|
144
132
|
session: ScopedPlanStatusSession;
|
|
145
133
|
bindings: BindingData<Res>;
|
|
146
134
|
}): Effect$1.Effect<void, any, never>;
|
|
147
135
|
}
|
|
148
136
|
//#endregion
|
|
149
|
-
//#region src/
|
|
150
|
-
type
|
|
151
|
-
interface
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
props: Props;
|
|
156
|
-
|
|
157
|
-
isCustom: IsCustom;
|
|
158
|
-
}
|
|
159
|
-
/** Tag for a Service that can bind a Capability to a Runtime */
|
|
160
|
-
interface Bind<F extends Runtime, Cap extends Capability, Tag extends string> extends Context.Tag<`${F["type"]}(${Cap["type"]}, ${Tag})`, BindingService<F, Extract<Extract<Cap["resource"], Resource>["parent"], Resource>, F["props"]>> {
|
|
137
|
+
//#region src/resource.d.ts
|
|
138
|
+
type AnyResource = Resource<string, string, any, any>;
|
|
139
|
+
interface IResource<Type extends string = string, ID$1 extends string = string, Props$1 = unknown, Attrs = unknown, Base = unknown> {
|
|
140
|
+
id: ID$1;
|
|
141
|
+
type: Type;
|
|
142
|
+
Props: unknown;
|
|
143
|
+
props: Props$1;
|
|
144
|
+
base: Base;
|
|
161
145
|
/** @internal phantom */
|
|
162
|
-
|
|
146
|
+
attr: Attrs;
|
|
163
147
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
isCustom: true;
|
|
167
|
-
}>(runtime: ReturnType<F>["runtime"], type: ReturnType<F>["capability"]["type"], tag: ReturnType<F>["tag"]): F & BindingDeclaration<ReturnType<F>["runtime"], F>;
|
|
168
|
-
<F extends (resource: any, props?: any) => AnyBinding & {
|
|
169
|
-
isCustom: false;
|
|
170
|
-
}>(runtime: ReturnType<F>["runtime"], type: ReturnType<F>["capability"]["type"]): F & BindingDeclaration<ReturnType<F>["runtime"], F>;
|
|
171
|
-
};
|
|
172
|
-
interface BindingDeclaration<Run extends Runtime, F extends (target: any, props?: any) => AnyBinding<Run>, Tag extends string = ReturnType<F>["tag"], Cap extends Capability = ReturnType<F>["capability"]> {
|
|
173
|
-
provider: {
|
|
174
|
-
effect<Err, Req>(eff: Effect<BindingService<Run, Parameters<F>[0], Parameters<F>[1], ReturnType<F>["attr"]>, Err, Req>): Layer.Layer<Bind<Run, Cap, Tag>, Err, Req>;
|
|
175
|
-
succeed(service: BindingService<Run, Parameters<F>[0], Parameters<F>[1], ReturnType<F>["attr"]>): Layer.Layer<Bind<Run, Cap, Tag>>;
|
|
176
|
-
};
|
|
148
|
+
interface Resource<Type extends string = string, ID$1 extends string = string, Props$1 = unknown, Attrs = unknown, Base = unknown> extends IResource<Type, ID$1, Props$1, Attrs, Base> {
|
|
149
|
+
new (): Resource<Type, ID$1, Props$1, Attrs, Base>;
|
|
177
150
|
}
|
|
178
|
-
interface
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
oldAttr?: Source["attr"];
|
|
184
|
-
};
|
|
185
|
-
props: Props;
|
|
186
|
-
attr: Attr | undefined;
|
|
187
|
-
target: {
|
|
188
|
-
id: string;
|
|
189
|
-
props: Target["props"];
|
|
190
|
-
oldProps?: Target["props"];
|
|
191
|
-
oldAttr?: Target["attr"];
|
|
192
|
-
};
|
|
151
|
+
interface ResourceTags<R extends Resource<string, string, any, any>> {
|
|
152
|
+
of<S$1 extends ProviderService<R>>(service: S$1): S$1;
|
|
153
|
+
tag: Provider<R>;
|
|
154
|
+
effect<Err, Req$1>(eff: Effect<ProviderService<R>, Err, Req$1>): Layer.Layer<Provider<R>, Err, Req$1>;
|
|
155
|
+
succeed(service: ProviderService<R>): Layer.Layer<Provider<R>>;
|
|
193
156
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
attr: Source["attr"];
|
|
198
|
-
props: Source["props"];
|
|
199
|
-
};
|
|
200
|
-
props: Props;
|
|
201
|
-
attr: Attr | undefined;
|
|
202
|
-
target: {
|
|
203
|
-
id: string;
|
|
204
|
-
props: Target["props"];
|
|
205
|
-
attr: Target["attr"];
|
|
157
|
+
declare const Resource: <Ctor extends (id: string, props: any) => Resource>(type: ReturnType<Ctor>["type"]) => Ctor & {
|
|
158
|
+
new (): ReturnType<Ctor> & {
|
|
159
|
+
parent: ReturnType<Ctor>;
|
|
206
160
|
};
|
|
161
|
+
type: ReturnType<Ctor>["type"];
|
|
162
|
+
parent: ReturnType<Ctor>;
|
|
163
|
+
provider: ResourceTags<ReturnType<Ctor>>;
|
|
164
|
+
} & {
|
|
165
|
+
type: ReturnType<Ctor>["type"];
|
|
166
|
+
provider: ResourceTags<ReturnType<Ctor>>;
|
|
167
|
+
};
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/runtime.d.ts
|
|
170
|
+
type RuntimeHandler<Inputs$1 extends any[] = any[], Output$1 = any, Err = any, Req$1 = any> = (...inputs: Inputs$1) => Effect$1.Effect<Output$1, Err, Req$1>;
|
|
171
|
+
declare namespace RuntimeHandler {
|
|
172
|
+
type Caps<H$1 extends RuntimeHandler | unknown> = Extract<Effect$1.Effect.Context<ReturnType<Extract<H$1, RuntimeHandler>>>, Capability>;
|
|
207
173
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
target: {
|
|
217
|
-
id: string;
|
|
218
|
-
props: Target["props"];
|
|
219
|
-
attr: Target["attr"];
|
|
174
|
+
declare namespace Runtime {
|
|
175
|
+
type Binding<F, Cap> = F extends {
|
|
176
|
+
readonly Binding: unknown;
|
|
177
|
+
} ? (F & {
|
|
178
|
+
readonly cap: Cap;
|
|
179
|
+
})["Binding"] : {
|
|
180
|
+
readonly F: F;
|
|
181
|
+
readonly cap: Types.Contravariant<Cap>;
|
|
220
182
|
};
|
|
221
183
|
}
|
|
222
|
-
interface
|
|
223
|
-
|
|
224
|
-
id: string;
|
|
225
|
-
attr: Source["attr"];
|
|
226
|
-
props: Source["props"];
|
|
227
|
-
};
|
|
228
|
-
props: Props;
|
|
229
|
-
attr: Attr | undefined;
|
|
230
|
-
target: {
|
|
231
|
-
id: string;
|
|
232
|
-
props: Target["props"];
|
|
233
|
-
attr: Target["attr"];
|
|
234
|
-
};
|
|
184
|
+
interface RuntimeProps<Run extends IRuntime, Req$1> {
|
|
185
|
+
bindings: Policy<Run, Extract<Req$1, Capability>, unknown>;
|
|
235
186
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
187
|
+
interface IRuntime<Type extends string = string, Handler = unknown, Props$1 = unknown> extends IResource<Type, string, Props$1> {
|
|
188
|
+
type: Type;
|
|
189
|
+
props: Props$1;
|
|
190
|
+
handler: Handler;
|
|
191
|
+
binding: unknown;
|
|
192
|
+
/** @internal phantom */
|
|
193
|
+
capability: unknown;
|
|
194
|
+
}
|
|
195
|
+
interface Runtime<Type extends string = string, Handler = unknown, Props$1 = unknown> extends IRuntime<Type, Handler, Props$1>, Resource<Type, string, Props$1> {
|
|
196
|
+
provider: ResourceTags<this>;
|
|
197
|
+
<const ID$1 extends string, Inputs$1 extends any[], Output$1, Err, Req$1, Handler extends RuntimeHandler<Inputs$1, Output$1, Err, Req$1>>(id: ID$1, {
|
|
198
|
+
handle
|
|
199
|
+
}: {
|
|
200
|
+
handle: Handler;
|
|
201
|
+
}): <const Props$1 extends this["props"]>(props: Props$1) => Service<ID$1, this, Handler, Props$1>;
|
|
202
|
+
}
|
|
203
|
+
declare const Runtime: <const Type extends string>(type: Type) => <Self extends Runtime>() => Self;
|
|
244
204
|
//#endregion
|
|
245
205
|
//#region src/policy.d.ts
|
|
246
206
|
/**
|
|
@@ -252,7 +212,8 @@ type BindingService<Target extends Runtime = any, Source extends Resource = Reso
|
|
|
252
212
|
*
|
|
253
213
|
* A Policy is invariant over the set of Capabilities to ensure least-privilege.
|
|
254
214
|
*/
|
|
255
|
-
interface Policy<F extends
|
|
215
|
+
interface Policy<F extends IRuntime, in out Capabilities, Tags = unknown> {
|
|
216
|
+
readonly kind: "alchemy/Policy";
|
|
256
217
|
readonly runtime: F;
|
|
257
218
|
readonly tags: Tags[];
|
|
258
219
|
readonly capabilities: Capabilities[];
|
|
@@ -300,9 +261,9 @@ declare namespace Capability {
|
|
|
300
261
|
resource: c["resource"];
|
|
301
262
|
constraint: Constraint.Simplify<c["constraint"]>;
|
|
302
263
|
})["Reduce"] : never;
|
|
303
|
-
type KeysWithNever<T> = { [K in keyof T]: T[K] extends never | Policy.AnyOf<never> ? K : never }[keyof T];
|
|
264
|
+
type KeysWithNever<T> = { [K in keyof T]: T[K$1] extends never | Policy.AnyOf<never> ? K$1 : never }[keyof T];
|
|
304
265
|
type DropIrrelevant<T> = T extends any ? { [k in keyof Omit<T, KeysWithNever<T>>]: Omit<T, KeysWithNever<T>>[k] } : never;
|
|
305
|
-
type Get<T, K extends string | number | symbol> = T extends { [k in K]: infer V } ? V : never;
|
|
266
|
+
type Get<T, K$1 extends string | number | symbol> = T extends { [k in K$1]: infer V } ? V : never;
|
|
306
267
|
type Keys<T> = T extends any ? keyof T : never;
|
|
307
268
|
type BoxPolicy<T> = [T] extends [{
|
|
308
269
|
anyOf: (infer U)[];
|
|
@@ -312,44 +273,102 @@ declare namespace Capability {
|
|
|
312
273
|
}
|
|
313
274
|
}
|
|
314
275
|
//#endregion
|
|
315
|
-
//#region src/
|
|
316
|
-
type
|
|
317
|
-
|
|
318
|
-
|
|
276
|
+
//#region src/binding.d.ts
|
|
277
|
+
type AnyBinding<F extends IRuntime = any> = Binding<F, any, any, any, string, boolean>;
|
|
278
|
+
interface Binding<Run extends IRuntime<any, any, any>, Cap extends Capability = Capability, Props$1 = any, Attr extends Run["binding"] = any, Tag extends string = Cap["type"], IsCustom extends boolean = (Cap["type"] extends Tag ? false : true)> {
|
|
279
|
+
runtime: Run;
|
|
280
|
+
capability: Cap;
|
|
281
|
+
tag: Tag;
|
|
282
|
+
props: Props$1;
|
|
283
|
+
attr: Attr;
|
|
284
|
+
isCustom: IsCustom;
|
|
319
285
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
286
|
+
/** Tag for a Service that can bind a Capability to a Runtime */
|
|
287
|
+
interface Bind<F extends IRuntime, Cap extends Capability, Tag extends string> extends Context.Tag<`${F["type"]}(${Cap["type"]}, ${Tag})`, BindingService<F, Extract<Extract<Cap["resource"], Resource>["base"], Resource>, F["props"]>> {
|
|
288
|
+
/** @internal phantom */
|
|
289
|
+
name: Tag;
|
|
290
|
+
}
|
|
291
|
+
declare const Binding: {
|
|
292
|
+
<F extends (resource: any, props?: any) => AnyBinding & {
|
|
293
|
+
isCustom: true;
|
|
294
|
+
}>(runtime: ReturnType<F>["runtime"], type: ReturnType<F>["capability"]["type"], tag: ReturnType<F>["tag"]): F & BindingDeclaration<ReturnType<F>["runtime"], F>;
|
|
295
|
+
<F extends (resource: any, props?: any) => AnyBinding & {
|
|
296
|
+
isCustom: false;
|
|
297
|
+
}>(runtime: ReturnType<F>["runtime"], type: ReturnType<F>["capability"]["type"]): F & BindingDeclaration<ReturnType<F>["runtime"], F>;
|
|
298
|
+
};
|
|
299
|
+
interface BindingDeclaration<Run extends IRuntime, F extends (target: any, props?: any) => AnyBinding<Run>, Tag extends string = ReturnType<F>["tag"], Cap extends Capability = ReturnType<F>["capability"]> {
|
|
300
|
+
provider: {
|
|
301
|
+
effect<Err, Req$1>(eff: Effect<BindingService<Run, Parameters<F>[0], Parameters<F>[1], ReturnType<F>["attr"]>, Err, Req$1>): Layer.Layer<Bind<Run, Cap, Tag>, Err, Req$1>;
|
|
302
|
+
succeed(service: BindingService<Run, Parameters<F>[0], Parameters<F>[1], ReturnType<F>["attr"]>): Layer.Layer<Bind<Run, Cap, Tag>>;
|
|
328
303
|
};
|
|
329
304
|
}
|
|
330
|
-
interface
|
|
331
|
-
|
|
305
|
+
interface BindingDiffProps<Source extends IResource = IResource, Target extends IResource = IResource, Props$1 = any, Attr = any> {
|
|
306
|
+
source: {
|
|
307
|
+
id: string;
|
|
308
|
+
props: Source["props"];
|
|
309
|
+
oldProps?: Source["props"];
|
|
310
|
+
oldAttr?: Source["attr"];
|
|
311
|
+
};
|
|
312
|
+
props: Props$1;
|
|
313
|
+
attr: Attr | undefined;
|
|
314
|
+
target: {
|
|
315
|
+
id: string;
|
|
316
|
+
props: Target["props"];
|
|
317
|
+
oldProps?: Target["props"];
|
|
318
|
+
oldAttr?: Target["attr"];
|
|
319
|
+
};
|
|
332
320
|
}
|
|
333
|
-
interface
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
321
|
+
interface BindingAttachProps<Source extends IResource, Target extends IResource, Props$1, Attr> {
|
|
322
|
+
source: {
|
|
323
|
+
id: string;
|
|
324
|
+
attr: Source["attr"];
|
|
325
|
+
props: Source["props"];
|
|
326
|
+
};
|
|
327
|
+
props: Props$1;
|
|
328
|
+
attr: Attr | undefined;
|
|
329
|
+
target: {
|
|
330
|
+
id: string;
|
|
331
|
+
props: Target["props"];
|
|
332
|
+
attr: Target["attr"];
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
interface BindingReattachProps<Source extends IResource, Target extends IResource, Props$1, Attr> {
|
|
336
|
+
source: {
|
|
337
|
+
id: string;
|
|
338
|
+
attr: Source["attr"];
|
|
339
|
+
props: Source["props"];
|
|
340
|
+
};
|
|
341
|
+
props: Props$1;
|
|
342
|
+
attr: Attr;
|
|
343
|
+
target: {
|
|
344
|
+
id: string;
|
|
345
|
+
props: Target["props"];
|
|
346
|
+
attr: Target["attr"];
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
interface BindingDetachProps<Source extends IResource, Target extends IResource, Props$1, Attr> {
|
|
350
|
+
source: {
|
|
351
|
+
id: string;
|
|
352
|
+
attr: Source["attr"];
|
|
353
|
+
props: Source["props"];
|
|
354
|
+
};
|
|
355
|
+
props: Props$1;
|
|
356
|
+
attr: Attr | undefined;
|
|
357
|
+
target: {
|
|
358
|
+
id: string;
|
|
359
|
+
props: Target["props"];
|
|
360
|
+
attr: Target["attr"];
|
|
361
|
+
};
|
|
345
362
|
}
|
|
346
|
-
|
|
347
|
-
|
|
363
|
+
type BindingService<Target extends IRuntime = any, Source extends IResource = IResource, Props$1 = any, Attr extends Target["binding"] = any, DiffReq = never, PreReattachReq = never, AttachReq = never, ReattachReq = never, DetachReq = never, PostAttachReq = never> = {
|
|
364
|
+
diff?: (props: BindingDiffProps<Source, Target, Props$1>) => Effect<Diff, never, DiffReq>;
|
|
365
|
+
preattach?: (props: BindingAttachProps<Source, Target, Props$1, Attr>) => Effect<Partial<Target["attr"]>, never, PreReattachReq>;
|
|
366
|
+
attach: (props: BindingAttachProps<Source, Target, Props$1, Attr>) => Effect<Attr, never, AttachReq> | Attr;
|
|
367
|
+
postattach?: (props: BindingAttachProps<Source, Target, Props$1, Attr>) => Effect<Omit<Attr, keyof Target["binding"]>, never, PostAttachReq>;
|
|
368
|
+
reattach?: (props: BindingReattachProps<Source, Target, Props$1, Attr>) => Effect<Attr, never, ReattachReq> | Attr;
|
|
369
|
+
detach?: (props: BindingDetachProps<Source, Target, Props$1, Attr>) => Effect<void, never, DetachReq> | void;
|
|
348
370
|
};
|
|
349
371
|
//#endregion
|
|
350
|
-
//#region src/phase.d.ts
|
|
351
|
-
type Phase = "update" | "destroy";
|
|
352
|
-
//#endregion
|
|
353
372
|
//#region src/plan.d.ts
|
|
354
373
|
/**
|
|
355
374
|
* A node in the plan that represents a binding operation acting on a resource.
|
|
@@ -380,70 +399,92 @@ type NoopBind<B extends AnyBinding = AnyBinding> = {
|
|
|
380
399
|
/**
|
|
381
400
|
* A node in the plan that represents a resource CRUD operation.
|
|
382
401
|
*/
|
|
383
|
-
type CRUD<R extends Resource =
|
|
384
|
-
type Create<R extends Resource> = {
|
|
402
|
+
type CRUD<R extends Resource = AnyResource> = Create<R> | Update<R> | Delete<R> | Replace<R> | NoopUpdate<R>;
|
|
403
|
+
type Create<R extends Resource = AnyResource> = {
|
|
385
404
|
action: "create";
|
|
386
405
|
resource: R;
|
|
387
406
|
news: any;
|
|
388
|
-
provider: ProviderService
|
|
407
|
+
provider: ProviderService<R>;
|
|
389
408
|
attributes: R["attr"];
|
|
390
409
|
bindings: BindNode[];
|
|
391
410
|
};
|
|
392
|
-
type Update<R extends Resource> = {
|
|
411
|
+
type Update<R extends Resource = AnyResource> = {
|
|
393
412
|
action: "update";
|
|
394
413
|
resource: R;
|
|
395
414
|
olds: any;
|
|
396
415
|
news: any;
|
|
397
416
|
output: any;
|
|
398
|
-
provider: ProviderService
|
|
417
|
+
provider: ProviderService<R>;
|
|
399
418
|
attributes: R["attr"];
|
|
400
419
|
bindings: BindNode[];
|
|
401
420
|
};
|
|
402
|
-
type Delete<R extends Resource> = {
|
|
421
|
+
type Delete<R extends Resource = AnyResource> = {
|
|
403
422
|
action: "delete";
|
|
404
423
|
resource: R;
|
|
405
424
|
olds: any;
|
|
406
425
|
output: any;
|
|
407
|
-
provider: ProviderService
|
|
426
|
+
provider: ProviderService<R>;
|
|
408
427
|
bindings: BindNode[];
|
|
409
428
|
attributes: R["attr"];
|
|
410
429
|
downstream: string[];
|
|
411
430
|
};
|
|
412
|
-
type NoopUpdate<R extends Resource> = {
|
|
431
|
+
type NoopUpdate<R extends Resource = AnyResource> = {
|
|
413
432
|
action: "noop";
|
|
414
433
|
resource: R;
|
|
415
434
|
attributes: R["attr"];
|
|
416
435
|
bindings: BindNode[];
|
|
417
436
|
};
|
|
418
|
-
type Replace<R extends Resource> = {
|
|
437
|
+
type Replace<R extends Resource = AnyResource> = {
|
|
419
438
|
action: "replace";
|
|
420
439
|
resource: R;
|
|
421
440
|
olds: any;
|
|
422
441
|
news: any;
|
|
423
442
|
output: any;
|
|
424
|
-
provider: ProviderService
|
|
443
|
+
provider: ProviderService<R>;
|
|
425
444
|
bindings: BindNode[];
|
|
426
445
|
attributes: R["attr"];
|
|
427
446
|
deleteFirst?: boolean;
|
|
428
447
|
};
|
|
429
|
-
type
|
|
430
|
-
|
|
431
|
-
resources: { [id in string]: CRUD };
|
|
448
|
+
type IPlan = {
|
|
449
|
+
resources: { [id in string]: CRUD<any> };
|
|
432
450
|
deletions: { [id in string]?: Delete<Resource> };
|
|
433
451
|
};
|
|
434
452
|
//#endregion
|
|
435
|
-
//#region src/
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
443
|
-
|
|
453
|
+
//#region src/event.d.ts
|
|
454
|
+
type ApplyStatus = "pending" | "creating" | "created" | "updating" | "updated" | "deleting" | "deleted" | "success" | "fail";
|
|
455
|
+
type ApplyEvent = AnnotateEvent | StatusChangeEvent;
|
|
456
|
+
interface AnnotateEvent {
|
|
457
|
+
kind: "annotate";
|
|
458
|
+
id: string;
|
|
459
|
+
message: string;
|
|
460
|
+
}
|
|
461
|
+
interface StatusChangeEvent {
|
|
462
|
+
kind: "status-change";
|
|
463
|
+
id: string;
|
|
464
|
+
type: string;
|
|
465
|
+
status: ApplyStatus;
|
|
466
|
+
message?: string;
|
|
467
|
+
bindingId?: string;
|
|
468
|
+
}
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region src/cli/service.d.ts
|
|
471
|
+
interface PlanStatusSession {
|
|
472
|
+
emit: (event: ApplyEvent) => Effect$1.Effect<void>;
|
|
473
|
+
done: () => Effect$1.Effect<void>;
|
|
474
|
+
}
|
|
475
|
+
interface ScopedPlanStatusSession extends PlanStatusSession {
|
|
476
|
+
note: (note: string) => Effect$1.Effect<void>;
|
|
477
|
+
}
|
|
478
|
+
interface CLIService {
|
|
479
|
+
approvePlan: <P$1 extends IPlan>(plan: P$1) => Effect$1.Effect<boolean>;
|
|
480
|
+
displayPlan: <P$1 extends IPlan>(plan: P$1) => Effect$1.Effect<void>;
|
|
481
|
+
startApplySession: <P$1 extends IPlan>(plan: P$1) => Effect$1.Effect<PlanStatusSession>;
|
|
482
|
+
}
|
|
483
|
+
declare const CLI_base: Context.TagClass<CLI, "CLIService", CLIService>;
|
|
484
|
+
declare class CLI extends CLI_base {}
|
|
444
485
|
//#endregion
|
|
445
|
-
//#region src/cli/
|
|
446
|
-
declare const
|
|
486
|
+
//#region src/cli/ink-service.d.ts
|
|
487
|
+
declare const inkCLI: () => Layer.Layer<CLI, never, never>;
|
|
447
488
|
//#endregion
|
|
448
|
-
export {
|
|
489
|
+
export { CLI, CLIService, PlanStatusSession, ScopedPlanStatusSession, inkCLI };
|
|
449
490
|
//# sourceMappingURL=index.d.ts.map
|