alchemy-effect 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/alchemy-effect.js +55038 -8
- package/bin/alchemy-effect.js.map +1 -1
- package/bin/alchemy-effect.ts +266 -10
- package/lib/$.d.ts +5 -0
- package/lib/$.d.ts.map +1 -0
- package/lib/$.js +9 -0
- package/lib/$.js.map +1 -0
- package/lib/app.d.ts +7 -15
- package/lib/app.d.ts.map +1 -1
- package/lib/app.js +1 -20
- package/lib/app.js.map +1 -1
- package/lib/apply.d.ts +15 -19
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +173 -82
- package/lib/apply.js.map +1 -1
- package/lib/assert-never.d.ts +12 -0
- package/lib/assert-never.d.ts.map +1 -0
- package/lib/assert-never.js +11 -0
- package/lib/assert-never.js.map +1 -0
- package/lib/aws/account.d.ts +13 -3
- package/lib/aws/account.d.ts.map +1 -1
- package/lib/aws/account.js +19 -4
- package/lib/aws/account.js.map +1 -1
- package/lib/aws/arn.d.ts +1 -5
- package/lib/aws/arn.d.ts.map +1 -1
- package/lib/aws/client.d.ts.map +1 -1
- package/lib/aws/client.js +8 -1
- package/lib/aws/client.js.map +1 -1
- package/lib/aws/config.d.ts +15 -0
- package/lib/aws/config.d.ts.map +1 -0
- package/lib/aws/config.js +1 -0
- package/lib/aws/config.js.map +1 -0
- package/lib/aws/credentials.d.ts +11 -1
- package/lib/aws/credentials.d.ts.map +1 -1
- package/lib/aws/credentials.js +73 -47
- package/lib/aws/credentials.js.map +1 -1
- package/lib/aws/dynamodb/attribute-value.d.ts +20 -0
- package/lib/aws/dynamodb/attribute-value.d.ts.map +1 -0
- package/lib/aws/dynamodb/attribute-value.js +217 -0
- package/lib/aws/dynamodb/attribute-value.js.map +1 -0
- package/lib/aws/dynamodb/client.d.ts +12 -0
- package/lib/aws/dynamodb/client.d.ts.map +1 -0
- package/lib/aws/{sqs/queue.client.js → dynamodb/client.js} +6 -6
- package/lib/aws/dynamodb/client.js.map +1 -0
- package/lib/aws/dynamodb/expr.d.ts +41 -0
- package/lib/aws/dynamodb/expr.d.ts.map +1 -0
- package/lib/aws/dynamodb/expr.js +1 -0
- package/lib/aws/dynamodb/expr.js.map +1 -0
- package/lib/aws/dynamodb/index.d.ts +10 -0
- package/lib/aws/dynamodb/index.d.ts.map +1 -0
- package/lib/aws/dynamodb/index.js +9 -0
- package/lib/aws/dynamodb/index.js.map +1 -0
- package/lib/aws/dynamodb/projection.d.ts +25 -0
- package/lib/aws/dynamodb/projection.d.ts.map +1 -0
- package/lib/aws/dynamodb/projection.js +1 -0
- package/lib/aws/dynamodb/projection.js.map +1 -0
- package/lib/aws/dynamodb/secondary-index.d.ts +26 -0
- package/lib/aws/dynamodb/secondary-index.d.ts.map +1 -0
- package/lib/aws/dynamodb/secondary-index.js +4 -0
- package/lib/aws/dynamodb/secondary-index.js.map +1 -0
- package/lib/aws/dynamodb/table.d.ts +59 -0
- package/lib/aws/dynamodb/table.d.ts.map +1 -0
- package/lib/aws/dynamodb/table.get-item.d.ts +57 -0
- package/lib/aws/dynamodb/table.get-item.d.ts.map +1 -0
- package/lib/aws/dynamodb/table.get-item.js +77 -0
- package/lib/aws/dynamodb/table.get-item.js.map +1 -0
- package/lib/aws/dynamodb/table.js +4 -0
- package/lib/aws/dynamodb/table.js.map +1 -0
- package/lib/aws/dynamodb/table.provider.d.ts +7 -0
- package/lib/aws/dynamodb/table.provider.d.ts.map +1 -0
- package/lib/aws/dynamodb/table.provider.js +187 -0
- package/lib/aws/dynamodb/table.provider.js.map +1 -0
- package/lib/aws/ec2/client.d.ts +12 -0
- package/lib/aws/ec2/client.d.ts.map +1 -0
- package/lib/aws/ec2/client.js +11 -0
- package/lib/aws/ec2/client.js.map +1 -0
- package/lib/aws/ec2/index.d.ts +7 -0
- package/lib/aws/ec2/index.d.ts.map +1 -0
- package/lib/aws/ec2/index.js +7 -0
- package/lib/aws/ec2/index.js.map +1 -0
- package/lib/aws/ec2/subnet.d.ts +175 -0
- package/lib/aws/ec2/subnet.d.ts.map +1 -0
- package/lib/aws/ec2/subnet.js +4 -0
- package/lib/aws/ec2/subnet.js.map +1 -0
- package/lib/aws/ec2/subnet.provider.d.ts +4 -0
- package/lib/aws/ec2/subnet.provider.d.ts.map +1 -0
- package/lib/aws/ec2/subnet.provider.js +250 -0
- package/lib/aws/ec2/subnet.provider.js.map +1 -0
- package/lib/aws/ec2/vpc.d.ts +135 -0
- package/lib/aws/ec2/vpc.d.ts.map +1 -0
- package/lib/aws/ec2/vpc.js +4 -0
- package/lib/aws/ec2/vpc.js.map +1 -0
- package/lib/aws/ec2/vpc.provider.d.ts +6 -0
- package/lib/aws/ec2/vpc.provider.d.ts.map +1 -0
- package/lib/aws/ec2/vpc.provider.js +183 -0
- package/lib/aws/ec2/vpc.provider.js.map +1 -0
- package/lib/aws/index.d.ts +23 -16
- package/lib/aws/index.d.ts.map +1 -1
- package/lib/aws/index.js +10 -18
- package/lib/aws/index.js.map +1 -1
- package/lib/aws/lambda/client.d.ts +8 -0
- package/lib/aws/lambda/client.d.ts.map +1 -0
- package/lib/aws/lambda/client.js +7 -0
- package/lib/aws/lambda/client.js.map +1 -0
- package/lib/aws/lambda/consume.d.ts +10 -11
- package/lib/aws/lambda/consume.d.ts.map +1 -1
- package/lib/aws/lambda/consume.js +3 -3
- package/lib/aws/lambda/consume.js.map +1 -1
- package/lib/aws/lambda/function.d.ts +18 -15
- package/lib/aws/lambda/function.d.ts.map +1 -1
- package/lib/aws/lambda/function.handler.d.ts +1 -1
- package/lib/aws/lambda/function.handler.d.ts.map +1 -1
- package/lib/aws/lambda/function.handler.js.map +1 -1
- package/lib/aws/lambda/function.invoke.d.ts +7 -5
- package/lib/aws/lambda/function.invoke.d.ts.map +1 -1
- package/lib/aws/lambda/function.invoke.js +5 -3
- package/lib/aws/lambda/function.invoke.js.map +1 -1
- package/lib/aws/lambda/function.js +1 -1
- package/lib/aws/lambda/function.js.map +1 -1
- package/lib/aws/lambda/function.provider.d.ts +6 -5
- package/lib/aws/lambda/function.provider.d.ts.map +1 -1
- package/lib/aws/lambda/function.provider.js +150 -58
- package/lib/aws/lambda/function.provider.js.map +1 -1
- package/lib/aws/lambda/index.d.ts +2 -2
- package/lib/aws/lambda/index.d.ts.map +1 -1
- package/lib/aws/lambda/index.js +2 -1
- package/lib/aws/lambda/index.js.map +1 -1
- package/lib/aws/lambda/serve.d.ts +2 -4
- package/lib/aws/lambda/serve.d.ts.map +1 -1
- package/lib/aws/lambda/serve.js.map +1 -1
- package/lib/aws/profile.d.ts +2 -2
- package/lib/aws/profile.d.ts.map +1 -1
- package/lib/aws/profile.js +1 -1
- package/lib/aws/profile.js.map +1 -1
- package/lib/aws/region.d.ts +14 -1
- package/lib/aws/region.d.ts.map +1 -1
- package/lib/aws/region.js +26 -1
- package/lib/aws/region.js.map +1 -1
- package/lib/aws/sqs/client.d.ts +12 -0
- package/lib/aws/sqs/client.d.ts.map +1 -0
- package/lib/aws/sqs/client.js +11 -0
- package/lib/aws/sqs/client.js.map +1 -0
- package/lib/aws/sqs/index.d.ts +3 -1
- package/lib/aws/sqs/index.d.ts.map +1 -1
- package/lib/aws/sqs/index.js +3 -1
- package/lib/aws/sqs/index.js.map +1 -1
- package/lib/aws/sqs/queue.consume.d.ts +1 -10
- package/lib/aws/sqs/queue.consume.d.ts.map +1 -1
- package/lib/aws/sqs/queue.consume.js +0 -19
- package/lib/aws/sqs/queue.consume.js.map +1 -1
- package/lib/aws/sqs/queue.d.ts +6 -12
- package/lib/aws/sqs/queue.d.ts.map +1 -1
- package/lib/aws/sqs/queue.event-source.d.ts +22 -0
- package/lib/aws/sqs/queue.event-source.d.ts.map +1 -0
- package/lib/aws/sqs/queue.event-source.js +130 -0
- package/lib/aws/sqs/queue.event-source.js.map +1 -0
- package/lib/aws/sqs/queue.js +1 -1
- package/lib/aws/sqs/queue.js.map +1 -1
- package/lib/aws/sqs/queue.provider.d.ts +5 -4
- package/lib/aws/sqs/queue.provider.d.ts.map +1 -1
- package/lib/aws/sqs/queue.provider.js +6 -6
- package/lib/aws/sqs/queue.provider.js.map +1 -1
- package/lib/aws/sqs/queue.send-message.d.ts +8 -6
- package/lib/aws/sqs/queue.send-message.d.ts.map +1 -1
- package/lib/aws/sqs/queue.send-message.js +6 -4
- package/lib/aws/sqs/queue.send-message.js.map +1 -1
- package/lib/binding.d.ts +74 -26
- package/lib/binding.d.ts.map +1 -1
- package/lib/binding.js.map +1 -1
- package/lib/capability.d.ts +38 -0
- package/lib/capability.d.ts.map +1 -1
- package/lib/cli/components/ApprovePlan.d.ts +2 -2
- package/lib/cli/components/ApprovePlan.d.ts.map +1 -1
- package/lib/cli/components/ApprovePlan.js.map +1 -1
- package/lib/cli/components/Plan.d.ts +2 -2
- package/lib/cli/components/Plan.d.ts.map +1 -1
- package/lib/cli/components/Plan.js +3 -1
- package/lib/cli/components/Plan.js.map +1 -1
- package/lib/cli/components/PlanProgress.d.ts +8 -4
- package/lib/cli/components/PlanProgress.d.ts.map +1 -1
- package/lib/cli/components/PlanProgress.js +11 -1
- package/lib/cli/components/PlanProgress.js.map +1 -1
- package/lib/cli/index.d.ts +342 -213
- package/lib/cli/index.d.ts.map +1 -1
- package/lib/cli/index.js +26047 -11403
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/ink-service.d.ts +4 -0
- package/lib/cli/ink-service.d.ts.map +1 -0
- package/lib/cli/ink-service.js +43 -0
- package/lib/cli/ink-service.js.map +1 -0
- package/lib/cli/service.d.ts +21 -0
- package/lib/cli/service.d.ts.map +1 -0
- package/lib/cli/service.js +5 -0
- package/lib/cli/service.js.map +1 -0
- package/lib/cloudflare/account.d.ts +10 -0
- package/lib/cloudflare/account.d.ts.map +1 -0
- package/lib/cloudflare/account.js +24 -0
- package/lib/cloudflare/account.js.map +1 -0
- package/lib/cloudflare/api.d.ts +31 -19
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +95 -29
- package/lib/cloudflare/api.js.map +1 -1
- package/lib/cloudflare/config.d.ts +9 -0
- package/lib/cloudflare/config.d.ts.map +1 -0
- package/lib/cloudflare/config.js +1 -0
- package/lib/cloudflare/config.js.map +1 -0
- package/lib/cloudflare/context.d.ts +27 -0
- package/lib/cloudflare/context.d.ts.map +1 -0
- package/lib/cloudflare/context.js +24 -0
- package/lib/cloudflare/context.js.map +1 -0
- package/lib/cloudflare/index.d.ts +7 -4
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +7 -4
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/kv/index.d.ts +4 -0
- package/lib/cloudflare/kv/index.d.ts.map +1 -0
- package/lib/cloudflare/kv/index.js +4 -0
- package/lib/cloudflare/kv/index.js.map +1 -0
- package/lib/cloudflare/kv/namespace.binding.d.ts +10 -0
- package/lib/cloudflare/kv/namespace.binding.d.ts.map +1 -0
- package/lib/cloudflare/kv/namespace.binding.js +15 -0
- package/lib/cloudflare/kv/namespace.binding.js.map +1 -0
- package/lib/cloudflare/kv/namespace.client.d.ts +11 -0
- package/lib/cloudflare/kv/namespace.client.d.ts.map +1 -0
- package/lib/cloudflare/kv/namespace.client.js +31 -0
- package/lib/cloudflare/kv/namespace.client.js.map +1 -0
- package/lib/cloudflare/kv/namespace.d.ts +24 -0
- package/lib/cloudflare/kv/namespace.d.ts.map +1 -0
- package/lib/cloudflare/kv/namespace.js +3 -0
- package/lib/cloudflare/kv/namespace.js.map +1 -0
- package/lib/cloudflare/kv/namespace.provider.d.ts +6 -0
- package/lib/cloudflare/kv/namespace.provider.d.ts.map +1 -0
- package/lib/cloudflare/kv/namespace.provider.js +81 -0
- package/lib/cloudflare/kv/namespace.provider.js.map +1 -0
- package/lib/cloudflare/live.d.ts +11 -0
- package/lib/cloudflare/live.d.ts.map +1 -0
- package/lib/cloudflare/live.js +15 -0
- package/lib/cloudflare/live.js.map +1 -0
- package/lib/cloudflare/r2/bucket.binding.d.ts +10 -0
- package/lib/cloudflare/r2/bucket.binding.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.binding.js +18 -0
- package/lib/cloudflare/r2/bucket.binding.js.map +1 -0
- package/lib/cloudflare/r2/bucket.client.d.ts +8 -0
- package/lib/cloudflare/r2/bucket.client.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.client.js +9 -0
- package/lib/cloudflare/r2/bucket.client.js.map +1 -0
- package/lib/cloudflare/r2/bucket.d.ts +33 -0
- package/lib/cloudflare/r2/bucket.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.del.d.ts +4 -0
- package/lib/cloudflare/r2/bucket.del.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.del.js +7 -0
- package/lib/cloudflare/r2/bucket.del.js.map +1 -0
- package/lib/cloudflare/r2/bucket.get.d.ts +5 -0
- package/lib/cloudflare/r2/bucket.get.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.get.js +7 -0
- package/lib/cloudflare/r2/bucket.get.js.map +1 -0
- package/lib/cloudflare/r2/bucket.head.d.ts +4 -0
- package/lib/cloudflare/r2/bucket.head.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.head.js +7 -0
- package/lib/cloudflare/r2/bucket.head.js.map +1 -0
- package/lib/cloudflare/r2/bucket.js +3 -0
- package/lib/cloudflare/r2/bucket.js.map +1 -0
- package/lib/cloudflare/r2/bucket.list.d.ts +5 -0
- package/lib/cloudflare/r2/bucket.list.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.list.js +7 -0
- package/lib/cloudflare/r2/bucket.list.js.map +1 -0
- package/lib/cloudflare/r2/bucket.multipart.d.ts +19 -0
- package/lib/cloudflare/r2/bucket.multipart.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.multipart.js +25 -0
- package/lib/cloudflare/r2/bucket.multipart.js.map +1 -0
- package/lib/cloudflare/r2/bucket.provider.d.ts +6 -0
- package/lib/cloudflare/r2/bucket.provider.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.provider.js +67 -0
- package/lib/cloudflare/r2/bucket.provider.js.map +1 -0
- package/lib/cloudflare/r2/bucket.put.d.ts +6 -0
- package/lib/cloudflare/r2/bucket.put.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.put.js +8 -0
- package/lib/cloudflare/r2/bucket.put.js.map +1 -0
- package/lib/cloudflare/r2/index.d.ts +10 -0
- package/lib/cloudflare/r2/index.d.ts.map +1 -0
- package/lib/cloudflare/r2/index.js +10 -0
- package/lib/cloudflare/r2/index.js.map +1 -0
- package/lib/cloudflare/stream.d.ts +10 -0
- package/lib/cloudflare/stream.d.ts.map +1 -0
- package/lib/cloudflare/stream.js +16 -0
- package/lib/cloudflare/stream.js.map +1 -0
- package/lib/cloudflare/worker/assets.fetch.d.ts +9 -0
- package/lib/cloudflare/worker/assets.fetch.d.ts.map +1 -0
- package/lib/cloudflare/worker/assets.fetch.js +12 -0
- package/lib/cloudflare/worker/assets.fetch.js.map +1 -0
- package/lib/cloudflare/worker/assets.provider.d.ts +66 -0
- package/lib/cloudflare/worker/assets.provider.d.ts.map +1 -0
- package/lib/cloudflare/worker/assets.provider.js +145 -0
- package/lib/cloudflare/worker/assets.provider.js.map +1 -0
- package/lib/cloudflare/worker/index.d.ts +5 -0
- package/lib/cloudflare/worker/index.d.ts.map +1 -0
- package/lib/cloudflare/worker/index.js +5 -0
- package/lib/cloudflare/worker/index.js.map +1 -0
- package/lib/cloudflare/worker/worker.d.ts +66 -0
- package/lib/cloudflare/worker/worker.d.ts.map +1 -0
- package/lib/cloudflare/worker/worker.handler.d.ts +11 -0
- package/lib/cloudflare/worker/worker.handler.d.ts.map +1 -0
- package/lib/cloudflare/worker/worker.handler.js +15 -0
- package/lib/cloudflare/worker/worker.handler.js.map +1 -0
- package/lib/cloudflare/worker/worker.js +4 -0
- package/lib/cloudflare/worker/worker.js.map +1 -0
- package/lib/cloudflare/worker/worker.provider.d.ts +11 -0
- package/lib/cloudflare/worker/worker.provider.d.ts.map +1 -0
- package/lib/cloudflare/worker/worker.provider.js +194 -0
- package/lib/cloudflare/worker/worker.provider.js.map +1 -0
- package/lib/cloudflare/worker/worker.serve.d.ts +39 -0
- package/lib/cloudflare/worker/worker.serve.d.ts.map +1 -0
- package/lib/cloudflare/worker/worker.serve.js +4 -0
- package/lib/cloudflare/worker/worker.serve.js.map +1 -0
- package/lib/data.d.ts +3 -0
- package/lib/data.d.ts.map +1 -0
- package/lib/data.js +8 -0
- package/lib/data.js.map +1 -0
- package/lib/destroy.d.ts +1 -3
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js +2 -0
- package/lib/destroy.js.map +1 -1
- package/lib/diff.d.ts +16 -0
- package/lib/diff.d.ts.map +1 -0
- package/lib/diff.js +9 -0
- package/lib/diff.js.map +1 -0
- package/lib/dot-alchemy.d.ts +3 -2
- package/lib/dot-alchemy.d.ts.map +1 -1
- package/lib/dot-alchemy.js +3 -2
- package/lib/dot-alchemy.js.map +1 -1
- package/lib/env.d.ts +5 -0
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +15 -29
- package/lib/env.js.map +1 -1
- package/lib/esbuild.d.ts +28 -0
- package/lib/esbuild.d.ts.map +1 -0
- package/lib/esbuild.js +63 -0
- package/lib/esbuild.js.map +1 -0
- package/lib/exports.d.ts +9 -0
- package/lib/exports.d.ts.map +1 -0
- package/lib/exports.js +13 -0
- package/lib/exports.js.map +1 -0
- package/lib/index.d.ts +11 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +11 -5
- package/lib/index.js.map +1 -1
- package/lib/input.d.ts +32 -0
- package/lib/input.d.ts.map +1 -0
- package/lib/input.js +1 -0
- package/lib/input.js.map +1 -0
- package/lib/output.d.ts +143 -0
- package/lib/output.d.ts.map +1 -0
- package/lib/output.js +269 -0
- package/lib/output.js.map +1 -0
- package/lib/plan.d.ts +59 -29
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +347 -169
- package/lib/plan.js.map +1 -1
- package/lib/policy.d.ts +22 -5
- package/lib/policy.d.ts.map +1 -1
- package/lib/policy.js +10 -2
- package/lib/policy.js.map +1 -1
- package/lib/provider.d.ts +16 -18
- package/lib/provider.d.ts.map +1 -1
- package/lib/ref.d.ts +14 -0
- package/lib/ref.d.ts.map +1 -0
- package/lib/ref.js +21 -0
- package/lib/ref.js.map +1 -0
- package/lib/resource.d.ts +13 -16
- package/lib/resource.d.ts.map +1 -1
- package/lib/resource.js +1 -0
- package/lib/resource.js.map +1 -1
- package/lib/runtime.d.ts +8 -7
- package/lib/runtime.d.ts.map +1 -1
- package/lib/runtime.js.map +1 -1
- package/lib/schema.d.ts +37 -0
- package/lib/schema.d.ts.map +1 -0
- package/lib/schema.js +61 -0
- package/lib/schema.js.map +1 -0
- package/lib/service.d.ts +9 -6
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js.map +1 -1
- package/lib/sha256.d.ts +5 -0
- package/lib/sha256.d.ts.map +1 -0
- package/lib/sha256.js +16 -0
- package/lib/sha256.js.map +1 -0
- package/lib/stack.d.ts +60 -0
- package/lib/stack.d.ts.map +1 -0
- package/lib/stack.js +11 -0
- package/lib/stack.js.map +1 -0
- package/lib/stage.d.ts +39 -0
- package/lib/stage.d.ts.map +1 -0
- package/lib/stage.js +32 -0
- package/lib/stage.js.map +1 -0
- package/lib/state.d.ts +53 -11
- package/lib/state.d.ts.map +1 -1
- package/lib/state.js +33 -31
- package/lib/state.js.map +1 -1
- package/lib/tags.d.ts +17 -0
- package/lib/tags.d.ts.map +1 -0
- package/lib/tags.js +22 -0
- package/lib/tags.js.map +1 -0
- package/lib/test.d.ts +35 -0
- package/lib/test.d.ts.map +1 -0
- package/lib/test.js +68 -0
- package/lib/test.js.map +1 -0
- package/lib/tsconfig.test.tsbuildinfo +1 -0
- package/lib/type.d.ts +6 -0
- package/lib/type.d.ts.map +1 -0
- package/lib/type.js +3 -0
- package/lib/type.js.map +1 -0
- package/lib/unknown.d.ts +4 -0
- package/lib/unknown.d.ts.map +1 -0
- package/lib/unknown.js +4 -0
- package/lib/unknown.js.map +1 -0
- package/lib/user.d.ts +3 -0
- package/lib/user.d.ts.map +1 -0
- package/lib/user.js +3 -0
- package/lib/user.js.map +1 -0
- package/lib/util.d.ts +6 -0
- package/lib/util.d.ts.map +1 -0
- package/lib/util.js +9 -0
- package/lib/util.js.map +1 -0
- package/package.json +58 -7
- package/src/$.ts +17 -0
- package/src/app.ts +9 -37
- package/src/apply.ts +435 -289
- package/src/assert-never.ts +18 -0
- package/src/aws/account.ts +29 -7
- package/src/aws/arn.ts +1 -7
- package/src/aws/client.ts +14 -1
- package/src/aws/config.ts +16 -0
- package/src/aws/credentials.ts +213 -177
- package/src/aws/dynamodb/attribute-value.ts +240 -0
- package/src/aws/{sqs/queue.client.ts → dynamodb/client.ts} +9 -9
- package/src/aws/dynamodb/expr.ts +90 -0
- package/src/aws/dynamodb/index.ts +12 -0
- package/src/aws/dynamodb/projection.ts +159 -0
- package/src/aws/dynamodb/secondary-index.ts +45 -0
- package/src/aws/dynamodb/table.get-item.ts +173 -0
- package/src/aws/dynamodb/table.provider.ts +276 -0
- package/src/aws/dynamodb/table.ts +101 -0
- package/src/aws/ec2/client.ts +20 -0
- package/src/aws/ec2/index.ts +7 -0
- package/src/aws/ec2/subnet.provider.ts +358 -0
- package/src/aws/ec2/subnet.ts +213 -0
- package/src/aws/ec2/vpc.provider.ts +269 -0
- package/src/aws/ec2/vpc.ts +163 -0
- package/src/aws/index.ts +50 -45
- package/src/aws/lambda/client.ts +14 -0
- package/src/aws/lambda/consume.ts +8 -8
- package/src/aws/lambda/function.handler.ts +1 -1
- package/src/aws/lambda/function.invoke.ts +8 -4
- package/src/aws/lambda/function.provider.ts +208 -109
- package/src/aws/lambda/function.ts +21 -12
- package/src/aws/lambda/index.ts +3 -4
- package/src/aws/lambda/serve.ts +1 -1
- package/src/aws/profile.ts +1 -4
- package/src/aws/region.ts +43 -2
- package/src/aws/sqs/client.ts +20 -0
- package/src/aws/sqs/index.ts +4 -1
- package/src/aws/sqs/queue.consume.ts +1 -34
- package/src/aws/sqs/queue.event-source.ts +227 -0
- package/src/aws/sqs/queue.provider.ts +14 -7
- package/src/aws/sqs/queue.send-message.ts +7 -10
- package/src/aws/sqs/queue.ts +9 -4
- package/src/binding.ts +130 -34
- package/src/capability.ts +44 -0
- package/src/cli/components/ApprovePlan.tsx +2 -2
- package/src/cli/components/Plan.tsx +6 -3
- package/src/cli/components/PlanProgress.tsx +32 -14
- package/src/cli/index.ts +2 -6
- package/src/cli/ink-service.tsx +61 -0
- package/src/cli/service.ts +23 -0
- package/src/cloudflare/account.ts +37 -0
- package/src/cloudflare/api.ts +147 -63
- package/src/cloudflare/config.ts +7 -0
- package/src/cloudflare/context.ts +49 -0
- package/src/cloudflare/index.ts +8 -4
- package/src/cloudflare/kv/index.ts +3 -0
- package/src/cloudflare/kv/namespace.binding.ts +27 -0
- package/src/cloudflare/kv/namespace.client.ts +70 -0
- package/src/cloudflare/kv/namespace.provider.ts +100 -0
- package/src/cloudflare/kv/namespace.ts +30 -0
- package/src/cloudflare/live.ts +32 -0
- package/src/cloudflare/r2/bucket.binding.ts +29 -0
- package/src/cloudflare/r2/bucket.client.ts +22 -0
- package/src/cloudflare/r2/bucket.del.ts +11 -0
- package/src/cloudflare/r2/bucket.get.ts +13 -0
- package/src/cloudflare/r2/bucket.head.ts +11 -0
- package/src/cloudflare/r2/bucket.list.ts +12 -0
- package/src/cloudflare/r2/bucket.multipart.ts +55 -0
- package/src/cloudflare/r2/bucket.provider.ts +84 -0
- package/src/cloudflare/r2/bucket.put.ts +17 -0
- package/src/cloudflare/r2/bucket.ts +44 -0
- package/src/cloudflare/r2/index.ts +9 -0
- package/src/cloudflare/stream.ts +21 -0
- package/src/cloudflare/worker/assets.fetch.ts +29 -0
- package/src/cloudflare/worker/assets.provider.ts +249 -0
- package/src/cloudflare/worker/index.ts +4 -0
- package/src/cloudflare/worker/worker.handler.ts +39 -0
- package/src/cloudflare/worker/worker.provider.ts +249 -0
- package/src/cloudflare/worker/worker.serve.ts +22 -0
- package/src/cloudflare/worker/worker.ts +77 -0
- package/src/data.ts +18 -0
- package/src/destroy.ts +2 -3
- package/src/diff.ts +30 -0
- package/src/dot-alchemy.ts +3 -2
- package/src/env.ts +20 -32
- package/src/esbuild.ts +98 -0
- package/src/exports.ts +21 -0
- package/src/index.ts +12 -6
- package/src/input.ts +81 -0
- package/src/output.ts +518 -0
- package/src/plan.ts +544 -243
- package/src/policy.ts +58 -7
- package/src/provider.ts +27 -25
- package/src/ref.ts +48 -0
- package/src/resource.ts +23 -8
- package/src/runtime.ts +16 -9
- package/src/schema.ts +102 -0
- package/src/service.ts +11 -7
- package/src/sha256.ts +23 -0
- package/src/stack.ts +116 -0
- package/src/stage.ts +85 -0
- package/src/state.ts +141 -62
- package/src/tags.ts +38 -0
- package/src/test.ts +172 -0
- package/src/type.ts +6 -0
- package/src/unknown.ts +6 -0
- package/src/user.ts +4 -0
- package/src/util.ts +21 -0
- package/lib/approve.d.ts +0 -15
- package/lib/approve.d.ts.map +0 -1
- package/lib/approve.js +0 -7
- package/lib/approve.js.map +0 -1
- package/lib/aws/lambda/function.client.d.ts +0 -8
- package/lib/aws/lambda/function.client.d.ts.map +0 -1
- package/lib/aws/lambda/function.client.js +0 -7
- package/lib/aws/lambda/function.client.js.map +0 -1
- package/lib/aws/sqs/queue.client.d.ts +0 -12
- package/lib/aws/sqs/queue.client.d.ts.map +0 -1
- package/lib/aws/sqs/queue.client.js.map +0 -1
- package/lib/cli/approve.d.ts +0 -4
- package/lib/cli/approve.d.ts.map +0 -1
- package/lib/cli/approve.js +0 -18
- package/lib/cli/approve.js.map +0 -1
- package/lib/cli/clack.d.ts +0 -14
- package/lib/cli/clack.d.ts.map +0 -1
- package/lib/cli/clack.js +0 -12
- package/lib/cli/clack.js.map +0 -1
- package/lib/cli/main.d.ts +0 -2
- package/lib/cli/main.d.ts.map +0 -1
- package/lib/cli/main.js +0 -1
- package/lib/cli/main.js.map +0 -1
- package/lib/cli/plan.d.ts +0 -13
- package/lib/cli/plan.d.ts.map +0 -1
- package/lib/cli/plan.js +0 -1
- package/lib/cli/plan.js.map +0 -1
- package/lib/cli/progress.d.ts +0 -7
- package/lib/cli/progress.d.ts.map +0 -1
- package/lib/cli/progress.js +0 -29
- package/lib/cli/progress.js.map +0 -1
- package/lib/cli/spinner.d.ts +0 -2
- package/lib/cli/spinner.d.ts.map +0 -1
- package/lib/cli/spinner.js +0 -13
- package/lib/cli/spinner.js.map +0 -1
- package/lib/cloudflare/kv.d.ts +0 -29
- package/lib/cloudflare/kv.d.ts.map +0 -1
- package/lib/cloudflare/kv.js +0 -3
- package/lib/cloudflare/kv.js.map +0 -1
- package/lib/cloudflare/kv.provider.d.ts +0 -4
- package/lib/cloudflare/kv.provider.d.ts.map +0 -1
- package/lib/cloudflare/kv.provider.js +0 -39
- package/lib/cloudflare/kv.provider.js.map +0 -1
- package/lib/cloudflare/worker.d.ts +0 -33
- package/lib/cloudflare/worker.d.ts.map +0 -1
- package/lib/cloudflare/worker.js +0 -4
- package/lib/cloudflare/worker.js.map +0 -1
- package/src/approve.ts +0 -13
- package/src/aws/lambda/function.client.ts +0 -14
- package/src/cli/approve.tsx +0 -30
- package/src/cli/clack.ts +0 -22
- package/src/cli/main.ts +0 -0
- package/src/cli/plan.ts +0 -16
- package/src/cli/progress.tsx +0 -45
- package/src/cli/spinner.ts +0 -14
- package/src/cloudflare/kv.provider.ts +0 -51
- package/src/cloudflare/kv.ts +0 -20
- package/src/cloudflare/worker.ts +0 -34
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import * as Data from "effect/Data";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as S from "effect/Schema";
|
|
4
|
+
import type { AttributeValue, ScalarAttributeType } from "itty-aws/dynamodb";
|
|
5
|
+
import {
|
|
6
|
+
getSetValueAST,
|
|
7
|
+
isClassSchema,
|
|
8
|
+
isListSchema,
|
|
9
|
+
isMapSchema,
|
|
10
|
+
isNumberSchema,
|
|
11
|
+
isRecordLikeSchema,
|
|
12
|
+
isRecordSchema,
|
|
13
|
+
isSetSchema,
|
|
14
|
+
isStringSchema,
|
|
15
|
+
isStructSchema,
|
|
16
|
+
} from "../../schema.ts";
|
|
17
|
+
|
|
18
|
+
// this seems important for handling S.Struct.Fields https://effect.website/docs/schema/classes/#recursive-types-with-different-encoded-and-type
|
|
19
|
+
// interface CategoryEncoded extends Schema.Struct.Encoded<typeof fields> { .. }
|
|
20
|
+
|
|
21
|
+
export class InvalidAttributeValue extends Data.TaggedError(
|
|
22
|
+
"InvalidAttributeValue",
|
|
23
|
+
)<{
|
|
24
|
+
message: string;
|
|
25
|
+
value: any;
|
|
26
|
+
}> {}
|
|
27
|
+
|
|
28
|
+
export const toAttributeValue: (
|
|
29
|
+
value: any,
|
|
30
|
+
) => Effect.Effect<AttributeValue, InvalidAttributeValue, never> = Effect.fn(
|
|
31
|
+
function* (value: any) {
|
|
32
|
+
if (value === undefined) {
|
|
33
|
+
return {
|
|
34
|
+
NULL: false,
|
|
35
|
+
};
|
|
36
|
+
} else if (value === null) {
|
|
37
|
+
return {
|
|
38
|
+
NULL: true,
|
|
39
|
+
};
|
|
40
|
+
} else if (typeof value === "boolean") {
|
|
41
|
+
return {
|
|
42
|
+
BOOL: value,
|
|
43
|
+
};
|
|
44
|
+
} else if (typeof value === "string") {
|
|
45
|
+
return {
|
|
46
|
+
S: value,
|
|
47
|
+
};
|
|
48
|
+
} else if (typeof value === "number") {
|
|
49
|
+
return {
|
|
50
|
+
N: value.toString(10),
|
|
51
|
+
};
|
|
52
|
+
} else if (Array.isArray(value)) {
|
|
53
|
+
return {
|
|
54
|
+
L: yield* Effect.all(value.map(toAttributeValue)),
|
|
55
|
+
};
|
|
56
|
+
} else if (value instanceof Set) {
|
|
57
|
+
const setType = getType(value);
|
|
58
|
+
if (setType === "EMPTY_SET") {
|
|
59
|
+
return {
|
|
60
|
+
SS: [],
|
|
61
|
+
};
|
|
62
|
+
} else if (Array.isArray(setType)) {
|
|
63
|
+
return {
|
|
64
|
+
L: yield* Effect.all(setType.map(toAttributeValue)),
|
|
65
|
+
};
|
|
66
|
+
} else if (setType === "SS") {
|
|
67
|
+
return {
|
|
68
|
+
SS: Array.from(value.values()),
|
|
69
|
+
};
|
|
70
|
+
} else if (setType === "NS") {
|
|
71
|
+
return {
|
|
72
|
+
NS: Array.from(value.values()).map((value) => value.toString(10)),
|
|
73
|
+
};
|
|
74
|
+
} else if (setType === "BS") {
|
|
75
|
+
return {
|
|
76
|
+
BS: Array.from(value.values()),
|
|
77
|
+
};
|
|
78
|
+
} else {
|
|
79
|
+
return {
|
|
80
|
+
L: yield* Effect.all(
|
|
81
|
+
Array.from(value.values()).map(toAttributeValue),
|
|
82
|
+
),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
} else if (Buffer.isBuffer(value)) {
|
|
86
|
+
return {
|
|
87
|
+
B: new Uint8Array(value),
|
|
88
|
+
};
|
|
89
|
+
} else if (value instanceof File) {
|
|
90
|
+
return {
|
|
91
|
+
B: new Uint8Array(yield* Effect.promise(() => value.arrayBuffer())),
|
|
92
|
+
};
|
|
93
|
+
} else if (value instanceof Uint8Array) {
|
|
94
|
+
return {
|
|
95
|
+
B: value,
|
|
96
|
+
};
|
|
97
|
+
} else if (value instanceof ArrayBuffer) {
|
|
98
|
+
return {
|
|
99
|
+
B: new Uint8Array(value),
|
|
100
|
+
};
|
|
101
|
+
} else if (typeof value === "object") {
|
|
102
|
+
return {
|
|
103
|
+
M: Object.fromEntries(
|
|
104
|
+
yield* Effect.all(
|
|
105
|
+
Object.entries(value).map(([key, value]) =>
|
|
106
|
+
toAttributeValue(value).pipe(Effect.map((value) => [key, value])),
|
|
107
|
+
),
|
|
108
|
+
),
|
|
109
|
+
),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return yield* Effect.fail(
|
|
114
|
+
new InvalidAttributeValue({
|
|
115
|
+
message: `Unknown value type: ${typeof value}`,
|
|
116
|
+
value,
|
|
117
|
+
}),
|
|
118
|
+
);
|
|
119
|
+
},
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
export const fromAttributeValue = (value: AttributeValue): any => {
|
|
123
|
+
if (value.NULL) {
|
|
124
|
+
return null;
|
|
125
|
+
} else if (typeof value.BOOL === "boolean") {
|
|
126
|
+
return value.BOOL;
|
|
127
|
+
} else if (value.L) {
|
|
128
|
+
return value.L.map(fromAttributeValue);
|
|
129
|
+
} else if (value.M) {
|
|
130
|
+
return Object.fromEntries(
|
|
131
|
+
Object.entries(value.M).map(([key, value]) => [
|
|
132
|
+
key,
|
|
133
|
+
fromAttributeValue(value),
|
|
134
|
+
]),
|
|
135
|
+
);
|
|
136
|
+
} else if (value.N) {
|
|
137
|
+
return parseFloat(value.N);
|
|
138
|
+
} else if (value.S) {
|
|
139
|
+
// how do we know if this is a date?
|
|
140
|
+
return value.S;
|
|
141
|
+
} else if (value.SS) {
|
|
142
|
+
return new Set(value.SS);
|
|
143
|
+
} else if (value.NS) {
|
|
144
|
+
return new Set(value.NS);
|
|
145
|
+
} else if (value.BS) {
|
|
146
|
+
return new Set(value.BS);
|
|
147
|
+
} else {
|
|
148
|
+
throw new Error(`Unknown attribute value: ${JSON.stringify(value)}`);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
type ValueType =
|
|
153
|
+
| "L"
|
|
154
|
+
| "BOOL"
|
|
155
|
+
| "EMPTY_SET"
|
|
156
|
+
| "M"
|
|
157
|
+
| "NULL"
|
|
158
|
+
| "N"
|
|
159
|
+
| "M"
|
|
160
|
+
| "S"
|
|
161
|
+
| "SS"
|
|
162
|
+
| "BS"
|
|
163
|
+
| "NS"
|
|
164
|
+
| "undefined";
|
|
165
|
+
|
|
166
|
+
const getType = (value: any): ValueType | ValueType[] => {
|
|
167
|
+
if (value === undefined) {
|
|
168
|
+
return "undefined";
|
|
169
|
+
} else if (value === null) {
|
|
170
|
+
return "NULL";
|
|
171
|
+
} else if (typeof value === "boolean") {
|
|
172
|
+
return "BOOL";
|
|
173
|
+
} else if (typeof value === "string") {
|
|
174
|
+
return "S";
|
|
175
|
+
} else if (typeof value === "number") {
|
|
176
|
+
return "N";
|
|
177
|
+
} else if (Array.isArray(value)) {
|
|
178
|
+
return "L";
|
|
179
|
+
} else if (value instanceof Set) {
|
|
180
|
+
return value.size === 0
|
|
181
|
+
? "EMPTY_SET"
|
|
182
|
+
: (() => {
|
|
183
|
+
const types = Array.from(value.values())
|
|
184
|
+
.flatMap(getType)
|
|
185
|
+
.filter((type, i, arr) => arr.indexOf(type) === i);
|
|
186
|
+
|
|
187
|
+
return types.length === 1
|
|
188
|
+
? types[0] === "S"
|
|
189
|
+
? "SS"
|
|
190
|
+
: types[0] === "N"
|
|
191
|
+
? "NS"
|
|
192
|
+
: types[0] === "BOOL"
|
|
193
|
+
? "BS"
|
|
194
|
+
: types[0]
|
|
195
|
+
: "L";
|
|
196
|
+
})();
|
|
197
|
+
} else if (value instanceof Map) {
|
|
198
|
+
return "M";
|
|
199
|
+
} else if (typeof value === "object") {
|
|
200
|
+
return "M";
|
|
201
|
+
} else {
|
|
202
|
+
throw new Error(`Unknown value type: ${typeof value}`);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export const isScalarAttributeType = (
|
|
207
|
+
type: string,
|
|
208
|
+
): type is ScalarAttributeType => {
|
|
209
|
+
return type === "S" || type === "N" || type === "B";
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export const toAttributeType = (schema: S.Schema<any>) => {
|
|
213
|
+
if (isStringSchema(schema)) {
|
|
214
|
+
return "S";
|
|
215
|
+
} else if (isNumberSchema(schema)) {
|
|
216
|
+
return "N";
|
|
217
|
+
} else if (isRecordLikeSchema(schema)) {
|
|
218
|
+
return "M";
|
|
219
|
+
} else if (isStringSetSchema(schema)) {
|
|
220
|
+
return "SS";
|
|
221
|
+
} else if (isNumberSetSchema(schema)) {
|
|
222
|
+
return "NS";
|
|
223
|
+
} else if (isListSchema(schema)) {
|
|
224
|
+
return "L";
|
|
225
|
+
}
|
|
226
|
+
return "S";
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export const isMapSchemaType = (schema: S.Schema<any>) =>
|
|
230
|
+
isMapSchema(schema) ||
|
|
231
|
+
isRecordSchema(schema) ||
|
|
232
|
+
isStructSchema(schema) ||
|
|
233
|
+
isClassSchema(schema) ||
|
|
234
|
+
false;
|
|
235
|
+
|
|
236
|
+
export const isStringSetSchema = (schema: S.Schema<any>) =>
|
|
237
|
+
isSetSchema(schema) && isStringSchema(getSetValueAST(schema));
|
|
238
|
+
|
|
239
|
+
export const isNumberSetSchema = (schema: S.Schema<any>) =>
|
|
240
|
+
isSetSchema(schema) && isNumberSchema(getSetValueAST(schema));
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
1
|
import * as Layer from "effect/Layer";
|
|
2
|
+
import * as Context from "effect/Context";
|
|
3
|
+
import { DynamoDB } from "itty-aws/dynamodb";
|
|
3
4
|
|
|
4
|
-
import { SQS as SQSClient } from "itty-aws/sqs";
|
|
5
|
-
import { createAWSServiceClientLayer } from "../client.ts";
|
|
6
5
|
import * as Credentials from "../credentials.ts";
|
|
7
6
|
import * as Region from "../region.ts";
|
|
7
|
+
import { createAWSServiceClientLayer } from "../client.ts";
|
|
8
8
|
|
|
9
|
-
export class
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
export class DynamoDBClient extends Context.Tag("AWS::DynamoDB::Client")<
|
|
10
|
+
DynamoDBClient,
|
|
11
|
+
DynamoDB
|
|
12
12
|
>() {}
|
|
13
13
|
|
|
14
14
|
export const client = createAWSServiceClientLayer<
|
|
15
|
-
typeof
|
|
16
|
-
|
|
17
|
-
>(
|
|
15
|
+
typeof DynamoDBClient,
|
|
16
|
+
DynamoDB
|
|
17
|
+
>(DynamoDBClient, DynamoDB);
|
|
18
18
|
|
|
19
19
|
export const clientFromEnv = () =>
|
|
20
20
|
Layer.provide(client(), Layer.merge(Credentials.fromEnv(), Region.fromEnv()));
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export type Expr =
|
|
2
|
+
| ArrayIndex
|
|
3
|
+
| Identifier
|
|
4
|
+
| NumberLiteral
|
|
5
|
+
| OperatorExpr
|
|
6
|
+
| NameRef
|
|
7
|
+
| PropRef
|
|
8
|
+
| ValueRef;
|
|
9
|
+
//
|
|
10
|
+
|
|
11
|
+
export interface NameRef<Name extends string = string> {
|
|
12
|
+
kind: "name-ref";
|
|
13
|
+
name: Name;
|
|
14
|
+
}
|
|
15
|
+
export interface ValueRef<Name extends string = string> {
|
|
16
|
+
kind: "value-ref";
|
|
17
|
+
name: Name;
|
|
18
|
+
}
|
|
19
|
+
export interface Identifier<I extends string = string> {
|
|
20
|
+
kind: "identifier";
|
|
21
|
+
name: I;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface NumberLiteral<N extends string = string> {
|
|
25
|
+
kind: "index";
|
|
26
|
+
number: N;
|
|
27
|
+
}
|
|
28
|
+
export interface PropRef<Ex extends Expr = any, Id extends Identifier = any> {
|
|
29
|
+
kind: "prop-ref";
|
|
30
|
+
expr: Ex;
|
|
31
|
+
name: Id;
|
|
32
|
+
}
|
|
33
|
+
export interface ArrayIndex<
|
|
34
|
+
List extends Expr = any,
|
|
35
|
+
Number extends NumberLiteral | ValueRef = NumberLiteral | ValueRef,
|
|
36
|
+
> {
|
|
37
|
+
kind: "array-index";
|
|
38
|
+
list: List;
|
|
39
|
+
number: Number;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type Operator = "and" | "or" | "=" | "<" | "<=" | ">=" | ">";
|
|
43
|
+
export interface OperatorExpr<
|
|
44
|
+
Left extends Expr = any,
|
|
45
|
+
Op extends Operator = Operator,
|
|
46
|
+
Right extends Expr = any,
|
|
47
|
+
> {
|
|
48
|
+
kind: "op";
|
|
49
|
+
left: Left;
|
|
50
|
+
op: Op;
|
|
51
|
+
right: Right;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type LowercaseLetter =
|
|
55
|
+
| "a"
|
|
56
|
+
| "b"
|
|
57
|
+
| "c"
|
|
58
|
+
| "d"
|
|
59
|
+
| "e"
|
|
60
|
+
| "f"
|
|
61
|
+
| "g"
|
|
62
|
+
| "h"
|
|
63
|
+
| "i"
|
|
64
|
+
| "j"
|
|
65
|
+
| "k"
|
|
66
|
+
| "l"
|
|
67
|
+
| "m"
|
|
68
|
+
| "n"
|
|
69
|
+
| "o"
|
|
70
|
+
| "p"
|
|
71
|
+
| "q"
|
|
72
|
+
| "r"
|
|
73
|
+
| "s"
|
|
74
|
+
| "t"
|
|
75
|
+
| "u"
|
|
76
|
+
| "v"
|
|
77
|
+
| "w"
|
|
78
|
+
| "x"
|
|
79
|
+
| "y"
|
|
80
|
+
| "z";
|
|
81
|
+
|
|
82
|
+
export type UppercaseLetter = Uppercase<LowercaseLetter>;
|
|
83
|
+
|
|
84
|
+
export type Letter = LowercaseLetter | UppercaseLetter;
|
|
85
|
+
|
|
86
|
+
export type Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
|
|
87
|
+
|
|
88
|
+
export type SpecialCharacter = "_";
|
|
89
|
+
|
|
90
|
+
export type Word = Digit | Letter | SpecialCharacter;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./attribute-value.ts";
|
|
2
|
+
export * from "./client.ts";
|
|
3
|
+
export * from "./expr.ts";
|
|
4
|
+
export * from "./secondary-index.ts";
|
|
5
|
+
export * from "./table.get-item.ts";
|
|
6
|
+
export * from "./table.provider.ts";
|
|
7
|
+
export * from "./table.ts";
|
|
8
|
+
|
|
9
|
+
// TODO(sam): figure out a better strategy to workaround non-portable types
|
|
10
|
+
export type * from "../../exports.ts";
|
|
11
|
+
|
|
12
|
+
import "../config.ts";
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ArrayIndex,
|
|
3
|
+
Expr,
|
|
4
|
+
Identifier,
|
|
5
|
+
NameRef,
|
|
6
|
+
NumberLiteral,
|
|
7
|
+
PropRef,
|
|
8
|
+
ValueRef,
|
|
9
|
+
Word,
|
|
10
|
+
} from "./expr.ts";
|
|
11
|
+
|
|
12
|
+
export type ParseProjectionExpression<Text extends string> = Parse<
|
|
13
|
+
Text,
|
|
14
|
+
[],
|
|
15
|
+
undefined
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
type AsExpr<T> = Extract<T, Expr>;
|
|
19
|
+
|
|
20
|
+
type Parse<
|
|
21
|
+
Text extends string,
|
|
22
|
+
Expressions extends Expr[],
|
|
23
|
+
Exp extends Expr | undefined,
|
|
24
|
+
> = Text extends `.${infer Rest}`
|
|
25
|
+
? Exp extends Expr
|
|
26
|
+
? Parse<Rest, Expressions, PropRef<Exp, Identifier<"">>>
|
|
27
|
+
: never
|
|
28
|
+
: Text extends `[:${infer Rest}`
|
|
29
|
+
? Parse<Rest, Expressions, ArrayIndex<AsExpr<Exp>, ValueRef<"">>>
|
|
30
|
+
: Text extends `[${infer Rest}`
|
|
31
|
+
? Parse<Rest, Expressions, ArrayIndex<AsExpr<Exp>, NumberLiteral<"">>>
|
|
32
|
+
: Text extends `]${infer Rest}`
|
|
33
|
+
? Parse<Rest, Expressions, Exp>
|
|
34
|
+
: Text extends `]`
|
|
35
|
+
? Concat<Expressions, Exp>
|
|
36
|
+
: Text extends `${"," | " "}${infer Rest}`
|
|
37
|
+
? Parse<Rest, Concat<Expressions, Exp>, undefined>
|
|
38
|
+
: Text extends `#${infer Rest}`
|
|
39
|
+
? Parse<Rest, Concat<Expressions, Exp>, NameRef<Rest>>
|
|
40
|
+
: Text extends `:${infer Rest}`
|
|
41
|
+
? Parse<Rest, Concat<Expressions, Exp>, ValueRef<Rest>>
|
|
42
|
+
: Text extends `${Word}${string}`
|
|
43
|
+
? Text extends `${infer char}${infer Rest}`
|
|
44
|
+
? Parse<Rest, Expressions, Append<Exp, char>>
|
|
45
|
+
: never
|
|
46
|
+
: Text extends `${Word}${string}`
|
|
47
|
+
? Text extends `${infer char}${infer Rest}`
|
|
48
|
+
? Parse<Rest, Expressions, Append<Exp, char>>
|
|
49
|
+
: never
|
|
50
|
+
: Concat<Expressions, Exp>;
|
|
51
|
+
|
|
52
|
+
type Concat<
|
|
53
|
+
Expressions extends Expr[],
|
|
54
|
+
CurrentExpr extends Expr | undefined,
|
|
55
|
+
> = undefined extends CurrentExpr
|
|
56
|
+
? Expressions
|
|
57
|
+
: [...Expressions, Extract<CurrentExpr, Expr>];
|
|
58
|
+
|
|
59
|
+
type Append<
|
|
60
|
+
Exp extends Expr | undefined,
|
|
61
|
+
char extends string,
|
|
62
|
+
> = Exp extends undefined
|
|
63
|
+
? Identifier<char>
|
|
64
|
+
: Exp extends Identifier<infer Name>
|
|
65
|
+
? Identifier<`${Name}${char}`>
|
|
66
|
+
: Exp extends NumberLiteral<infer Name>
|
|
67
|
+
? NumberLiteral<`${Name}${char}`>
|
|
68
|
+
: Exp extends NameRef<infer Name>
|
|
69
|
+
? NameRef<`${Name}${char}`>
|
|
70
|
+
: Exp extends ValueRef<infer Name>
|
|
71
|
+
? ValueRef<`${Name}${char}`>
|
|
72
|
+
: Exp extends PropRef<infer expr, infer name>
|
|
73
|
+
? PropRef<expr, Extract<Append<name, char>, Identifier>>
|
|
74
|
+
: Exp extends ArrayIndex<infer expr, infer idx>
|
|
75
|
+
? ArrayIndex<expr, Extract<Append<idx, char>, NumberLiteral>>
|
|
76
|
+
: never;
|
|
77
|
+
|
|
78
|
+
export type ApplyProjection<T, Expr extends string> = Flatten<
|
|
79
|
+
UnionToIntersection<
|
|
80
|
+
ApplyProjectionExpr<T, ParseProjectionExpression<Expr>[number]>
|
|
81
|
+
>
|
|
82
|
+
>;
|
|
83
|
+
|
|
84
|
+
type ApplyProjectionExpr<T, Exp extends Expr> = T extends undefined
|
|
85
|
+
? never
|
|
86
|
+
: Exp extends PropRef<infer expr, infer i>
|
|
87
|
+
? {
|
|
88
|
+
[p in keyof ApplyProjectionExpr<T, expr>]: ApplyProjectionExpr<
|
|
89
|
+
ApplyProjectionExpr<T, expr>[p],
|
|
90
|
+
i
|
|
91
|
+
>;
|
|
92
|
+
}
|
|
93
|
+
: Exp extends ArrayIndex<infer expr, infer i>
|
|
94
|
+
? {
|
|
95
|
+
[p in keyof ApplyProjectionExpr<T, expr>]: ApplyProjectionExpr<
|
|
96
|
+
ApplyProjectionExpr<T, expr>[keyof ApplyProjectionExpr<T, expr>],
|
|
97
|
+
i
|
|
98
|
+
>;
|
|
99
|
+
}
|
|
100
|
+
: Exp extends Identifier<infer I>
|
|
101
|
+
? I extends keyof T
|
|
102
|
+
? Pick<T, I>
|
|
103
|
+
: never
|
|
104
|
+
: Exp extends NumberLiteral<infer I>
|
|
105
|
+
? ParseInt<I> extends keyof T
|
|
106
|
+
? Pick<T, ParseInt<I>>
|
|
107
|
+
: never
|
|
108
|
+
: never;
|
|
109
|
+
|
|
110
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
|
|
111
|
+
k: infer I,
|
|
112
|
+
) => void
|
|
113
|
+
? I
|
|
114
|
+
: never;
|
|
115
|
+
|
|
116
|
+
type Flatten<T> = T extends object
|
|
117
|
+
? keyof T extends number
|
|
118
|
+
? FlattenArray<Extract<T, Record<number, any>>>
|
|
119
|
+
: {
|
|
120
|
+
[k in keyof T]: Flatten<T[k]>;
|
|
121
|
+
}
|
|
122
|
+
: T;
|
|
123
|
+
|
|
124
|
+
type FlattenArray<
|
|
125
|
+
T extends { [i in number]: any },
|
|
126
|
+
i extends number = 0,
|
|
127
|
+
> = i extends keyof T
|
|
128
|
+
? [T[i], ...FlattenArray<T, Inc<i>>]
|
|
129
|
+
: number extends i
|
|
130
|
+
? []
|
|
131
|
+
: FlattenArray<T, Inc<i>>;
|
|
132
|
+
|
|
133
|
+
type BuildTuple<N extends number, T extends any[] = []> = T["length"] extends N
|
|
134
|
+
? T
|
|
135
|
+
: BuildTuple<N, [...T, any]>;
|
|
136
|
+
|
|
137
|
+
type Inc<N extends number> = Extract<[...BuildTuple<N>, any]["length"], number>;
|
|
138
|
+
|
|
139
|
+
type ParseInt<N extends string> = N extends "0"
|
|
140
|
+
? 0
|
|
141
|
+
: N extends "1"
|
|
142
|
+
? 1
|
|
143
|
+
: N extends "2"
|
|
144
|
+
? 2
|
|
145
|
+
: N extends "3"
|
|
146
|
+
? 3
|
|
147
|
+
: N extends "4"
|
|
148
|
+
? 4
|
|
149
|
+
: N extends "5"
|
|
150
|
+
? 5
|
|
151
|
+
: N extends "6"
|
|
152
|
+
? 6
|
|
153
|
+
: N extends "7"
|
|
154
|
+
? 7
|
|
155
|
+
: N extends "8"
|
|
156
|
+
? 8
|
|
157
|
+
: N extends "9"
|
|
158
|
+
? 9
|
|
159
|
+
: number;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as S from "effect/Schema";
|
|
2
|
+
import { Resource } from "../../resource.ts";
|
|
3
|
+
import type { Table } from "./table.ts";
|
|
4
|
+
|
|
5
|
+
export const SecondaryIndex = Resource<{
|
|
6
|
+
<
|
|
7
|
+
const ID extends string,
|
|
8
|
+
const Source extends Table,
|
|
9
|
+
const Attributes extends S.Struct.Fields,
|
|
10
|
+
const PartitionKey extends keyof Attributes,
|
|
11
|
+
const SortKey extends keyof Attributes | undefined = undefined,
|
|
12
|
+
>(
|
|
13
|
+
id: ID,
|
|
14
|
+
props: SecondaryIndexProps<Source, Attributes, PartitionKey, SortKey>,
|
|
15
|
+
): SecondaryIndex<
|
|
16
|
+
ID,
|
|
17
|
+
SecondaryIndexProps<Source, Attributes, PartitionKey, SortKey>
|
|
18
|
+
>;
|
|
19
|
+
}>("AWS.DynamoDB.SecondaryIndex");
|
|
20
|
+
|
|
21
|
+
export interface SecondaryIndex<
|
|
22
|
+
ID extends string = string,
|
|
23
|
+
Props extends SecondaryIndexProps = SecondaryIndexProps,
|
|
24
|
+
> extends Resource<
|
|
25
|
+
"AWS.DynamoDB.SecondaryIndex",
|
|
26
|
+
ID,
|
|
27
|
+
Props,
|
|
28
|
+
SecondaryIndexAttrs<Props>
|
|
29
|
+
> {}
|
|
30
|
+
|
|
31
|
+
export interface SecondaryIndexProps<
|
|
32
|
+
Source extends Table = Table,
|
|
33
|
+
Attributes extends S.Struct.Fields = S.Struct.Fields,
|
|
34
|
+
PartitionKey extends keyof Attributes = keyof Attributes,
|
|
35
|
+
SortKey extends keyof Attributes | undefined = keyof Attributes | undefined,
|
|
36
|
+
> {
|
|
37
|
+
table: new () => Source;
|
|
38
|
+
indexName?: string;
|
|
39
|
+
partitionKey: PartitionKey;
|
|
40
|
+
sortKey?: SortKey;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type SecondaryIndexAttrs<Props extends SecondaryIndexProps> = {
|
|
44
|
+
indexName: Props["indexName"] extends string ? Props["indexName"] : string;
|
|
45
|
+
};
|