alchemy-effect 0.1.0 → 0.2.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/lib/app.d.ts +7 -2
- package/lib/app.d.ts.map +1 -1
- package/lib/app.js +1 -0
- package/lib/app.js.map +1 -1
- package/lib/apply.d.ts +57 -1
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +141 -55
- package/lib/apply.js.map +1 -1
- package/lib/aws/account.d.ts +4 -3
- package/lib/aws/account.d.ts.map +1 -1
- package/lib/aws/account.js +2 -2
- 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 +9 -1
- package/lib/aws/client.js.map +1 -1
- package/lib/aws/credentials.d.ts +1 -1
- package/lib/aws/credentials.d.ts.map +1 -1
- 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 +9 -0
- package/lib/aws/dynamodb/index.d.ts.map +1 -0
- package/lib/aws/dynamodb/index.js +10 -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 +25 -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 +56 -0
- package/lib/aws/dynamodb/table.d.ts.map +1 -0
- package/lib/aws/dynamodb/table.get-item.d.ts +55 -0
- package/lib/aws/dynamodb/table.get-item.d.ts.map +1 -0
- package/lib/aws/dynamodb/table.get-item.js +75 -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 +8 -0
- package/lib/aws/dynamodb/table.provider.d.ts.map +1 -0
- package/lib/aws/dynamodb/table.provider.js +199 -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 +4 -0
- package/lib/aws/ec2/index.d.ts.map +1 -0
- package/lib/aws/ec2/index.js +4 -0
- package/lib/aws/ec2/index.js.map +1 -0
- package/lib/aws/ec2/vpc.d.ts +131 -0
- package/lib/aws/ec2/vpc.d.ts.map +1 -0
- package/lib/aws/ec2/vpc.js +3 -0
- package/lib/aws/ec2/vpc.js.map +1 -0
- package/lib/aws/ec2/vpc.provider.d.ts +7 -0
- package/lib/aws/ec2/vpc.provider.d.ts.map +1 -0
- package/lib/aws/ec2/vpc.provider.js +198 -0
- package/lib/aws/ec2/vpc.provider.js.map +1 -0
- package/lib/aws/index.d.ts +24 -14
- package/lib/aws/index.d.ts.map +1 -1
- package/lib/aws/index.js +7 -12
- 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 +3 -3
- package/lib/aws/lambda/consume.d.ts.map +1 -1
- package/lib/aws/lambda/consume.js.map +1 -1
- package/lib/aws/lambda/function.d.ts +13 -10
- package/lib/aws/lambda/function.d.ts.map +1 -1
- package/lib/aws/lambda/function.invoke.d.ts +2 -2
- package/lib/aws/lambda/function.invoke.d.ts.map +1 -1
- package/lib/aws/lambda/function.invoke.js +2 -2
- 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 -3
- package/lib/aws/lambda/function.provider.d.ts.map +1 -1
- package/lib/aws/lambda/function.provider.js +145 -55
- package/lib/aws/lambda/function.provider.js.map +1 -1
- package/lib/aws/lambda/index.d.ts +1 -2
- package/lib/aws/lambda/index.d.ts.map +1 -1
- package/lib/aws/lambda/index.js +1 -1
- package/lib/aws/lambda/index.js.map +1 -1
- package/lib/aws/lambda/serve.d.ts +1 -1
- package/lib/aws/lambda/serve.d.ts.map +1 -1
- package/lib/aws/lambda/serve.js.map +1 -1
- package/lib/aws/region.d.ts +1 -0
- package/lib/aws/region.d.ts.map +1 -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 +2 -1
- package/lib/aws/sqs/index.d.ts.map +1 -1
- package/lib/aws/sqs/index.js +2 -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 +1 -19
- package/lib/aws/sqs/queue.consume.js.map +1 -1
- package/lib/aws/sqs/queue.d.ts +2 -10
- package/lib/aws/sqs/queue.d.ts.map +1 -1
- package/lib/aws/sqs/queue.event-source.d.ts +20 -0
- package/lib/aws/sqs/queue.event-source.d.ts.map +1 -0
- package/lib/aws/sqs/queue.event-source.js +148 -0
- package/lib/aws/sqs/queue.event-source.js.map +1 -0
- package/lib/aws/sqs/queue.provider.d.ts +4 -3
- package/lib/aws/sqs/queue.provider.d.ts.map +1 -1
- package/lib/aws/sqs/queue.provider.js +4 -4
- package/lib/aws/sqs/queue.provider.js.map +1 -1
- package/lib/aws/sqs/queue.send-message.d.ts +2 -2
- package/lib/aws/sqs/queue.send-message.d.ts.map +1 -1
- package/lib/aws/sqs/queue.send-message.js +2 -2
- package/lib/aws/sqs/queue.send-message.js.map +1 -1
- package/lib/binding.d.ts +70 -22
- 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/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/index.d.ts +204 -116
- package/lib/cli/index.d.ts.map +1 -1
- package/lib/cli/index.js +25707 -11055
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/progress.d.ts.map +1 -1
- package/lib/cli/progress.js +1 -0
- package/lib/cli/progress.js.map +1 -1
- package/lib/cloudflare/api.d.ts +29 -17
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +92 -27
- package/lib/cloudflare/api.js.map +1 -1
- 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 +5 -4
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +4 -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 +8 -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 +23 -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 +5 -0
- package/lib/cloudflare/kv/namespace.provider.d.ts.map +1 -0
- package/lib/cloudflare/kv/namespace.provider.js +80 -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 +18 -0
- package/lib/cloudflare/live.js.map +1 -0
- package/lib/cloudflare/r2/bucket.binding.d.ts +8 -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 +32 -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 +5 -0
- package/lib/cloudflare/r2/bucket.provider.d.ts.map +1 -0
- package/lib/cloudflare/r2/bucket.provider.js +66 -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 +8 -0
- package/lib/cloudflare/worker/assets.fetch.d.ts.map +1 -0
- package/lib/cloudflare/worker/assets.fetch.js +11 -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 +6 -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 +67 -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 +10 -0
- package/lib/cloudflare/worker/worker.provider.d.ts.map +1 -0
- package/lib/cloudflare/worker/worker.provider.js +193 -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/destroy.d.ts +1 -3
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js +5 -0
- package/lib/destroy.js.map +1 -1
- 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/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/index.d.ts +1 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/lib/plan.d.ts +19 -8
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +144 -72
- package/lib/plan.js.map +1 -1
- package/lib/policy.d.ts +19 -1
- package/lib/policy.d.ts.map +1 -1
- package/lib/policy.js +10 -1
- package/lib/policy.js.map +1 -1
- package/lib/provider.d.ts +2 -2
- package/lib/provider.d.ts.map +1 -1
- package/lib/resource.d.ts +2 -10
- 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 +1 -1
- package/lib/runtime.d.ts.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/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/state.d.ts +3 -2
- package/lib/state.d.ts.map +1 -1
- package/lib/state.js +3 -2
- 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 +14 -0
- package/lib/test.d.ts.map +1 -0
- package/lib/test.js +28 -0
- package/lib/test.js.map +1 -0
- package/lib/tsconfig.test.tsbuildinfo +1 -0
- package/lib/type.d.ts +3 -0
- package/lib/type.d.ts.map +1 -0
- package/lib/type.js +3 -0
- package/lib/type.js.map +1 -0
- package/package.json +48 -3
- package/src/app.ts +8 -7
- package/src/apply.ts +251 -93
- package/src/aws/account.ts +6 -4
- package/src/aws/arn.ts +1 -7
- package/src/aws/client.ts +15 -1
- package/src/aws/credentials.ts +1 -0
- 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 +177 -0
- package/src/aws/dynamodb/table.provider.ts +280 -0
- package/src/aws/dynamodb/table.ts +156 -0
- package/src/aws/ec2/client.ts +20 -0
- package/src/aws/ec2/index.ts +3 -0
- package/src/aws/ec2/vpc.provider.ts +285 -0
- package/src/aws/ec2/vpc.ts +152 -0
- package/src/aws/index.ts +15 -16
- package/src/aws/lambda/client.ts +14 -0
- package/src/aws/lambda/consume.ts +0 -1
- package/src/aws/lambda/function.invoke.ts +2 -2
- package/src/aws/lambda/function.provider.ts +197 -105
- package/src/aws/lambda/function.ts +16 -10
- package/src/aws/lambda/index.ts +1 -4
- package/src/aws/lambda/serve.ts +1 -1
- package/src/aws/region.ts +3 -1
- package/src/aws/sqs/client.ts +20 -0
- package/src/aws/sqs/index.ts +2 -1
- package/src/aws/sqs/queue.consume.ts +1 -34
- package/src/aws/sqs/queue.event-source.ts +253 -0
- package/src/aws/sqs/queue.provider.ts +4 -4
- package/src/aws/sqs/queue.send-message.ts +2 -2
- package/src/binding.ts +121 -25
- package/src/capability.ts +44 -0
- package/src/cli/components/Plan.tsx +4 -2
- package/src/cli/progress.tsx +1 -0
- package/src/cloudflare/api.ts +141 -61
- package/src/cloudflare/context.ts +49 -0
- package/src/cloudflare/index.ts +6 -4
- package/src/cloudflare/kv/index.ts +3 -0
- package/src/cloudflare/kv/namespace.binding.ts +25 -0
- package/src/cloudflare/kv/namespace.client.ts +70 -0
- package/src/cloudflare/kv/namespace.provider.ts +99 -0
- package/src/cloudflare/kv/namespace.ts +29 -0
- package/src/cloudflare/live.ts +38 -0
- package/src/cloudflare/r2/bucket.binding.ts +27 -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 +83 -0
- package/src/cloudflare/r2/bucket.put.ts +17 -0
- package/src/cloudflare/r2/bucket.ts +38 -0
- package/src/cloudflare/r2/index.ts +9 -0
- package/src/cloudflare/stream.ts +21 -0
- package/src/cloudflare/worker/assets.fetch.ts +27 -0
- package/src/cloudflare/worker/assets.provider.ts +249 -0
- package/src/cloudflare/worker/index.ts +6 -0
- package/src/cloudflare/worker/worker.handler.ts +39 -0
- package/src/cloudflare/worker/worker.provider.ts +246 -0
- package/src/cloudflare/worker/worker.serve.ts +19 -0
- package/src/cloudflare/worker/worker.ts +76 -0
- package/src/destroy.ts +6 -3
- package/src/dot-alchemy.ts +3 -2
- package/src/esbuild.ts +98 -0
- package/src/index.ts +5 -4
- package/src/plan.ts +233 -120
- package/src/policy.ts +55 -2
- package/src/provider.ts +2 -2
- package/src/resource.ts +3 -2
- package/src/runtime.ts +1 -1
- package/src/schema.ts +102 -0
- package/src/sha256.ts +23 -0
- package/src/state.ts +3 -2
- package/src/tags.ts +38 -0
- package/src/test.ts +71 -0
- package/src/type.ts +2 -0
- 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/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/aws/lambda/function.client.ts +0 -14
- package/src/cloudflare/kv.provider.ts +0 -51
- package/src/cloudflare/kv.ts +0 -20
- package/src/cloudflare/worker.ts +0 -34
package/src/schema.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as S from "effect/Schema";
|
|
2
|
+
import type { AST } from "effect/SchemaAST";
|
|
3
|
+
|
|
4
|
+
const Description = Symbol.for("effect/annotation/Description");
|
|
5
|
+
|
|
6
|
+
export const isTag = <T extends S.Schema<any>>(tag: T["ast"]["_tag"]) =>
|
|
7
|
+
((schema) =>
|
|
8
|
+
S.isSchema(schema)
|
|
9
|
+
? S.encodedSchema(schema).ast._tag === tag
|
|
10
|
+
: schema._tag === tag) as {
|
|
11
|
+
(schema: S.Schema<any>): schema is T;
|
|
12
|
+
(schema: AST): boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const hasGenericAnnotation =
|
|
16
|
+
(type: string) => (ast: AST | undefined) => {
|
|
17
|
+
const description: string | undefined = ast?.annotations?.[
|
|
18
|
+
Description
|
|
19
|
+
] as string;
|
|
20
|
+
return (
|
|
21
|
+
description &&
|
|
22
|
+
description?.startsWith(`${type}<`) &&
|
|
23
|
+
description?.endsWith(">")
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const isNullishSchema = (schema: S.Schema<any>) =>
|
|
28
|
+
isNullSchema(schema) || isUndefinedSchema(schema);
|
|
29
|
+
export const isNullSchema = (schema: S.Schema<any>) =>
|
|
30
|
+
schema.ast._tag === "Literal" && schema.ast.literal === null;
|
|
31
|
+
export const isUndefinedSchema = isTag("UndefinedKeyword");
|
|
32
|
+
export const isBooleanSchema = isTag<S.Schema<boolean>>("BooleanKeyword");
|
|
33
|
+
export const isStringSchema = isTag<S.Schema<string>>("StringKeyword");
|
|
34
|
+
export const isNumberSchema = isTag<S.Schema<number>>("NumberKeyword");
|
|
35
|
+
|
|
36
|
+
export const hasMapAnnotation = hasGenericAnnotation("Map");
|
|
37
|
+
|
|
38
|
+
export const isRecordLikeSchema = (schema: S.Schema<any>) =>
|
|
39
|
+
isMapSchema(schema) ||
|
|
40
|
+
isRecordSchema(schema) ||
|
|
41
|
+
isStructSchema(schema) ||
|
|
42
|
+
isClassSchema(schema) ||
|
|
43
|
+
false;
|
|
44
|
+
|
|
45
|
+
export const isMapSchema = (schema: S.Schema<any>) =>
|
|
46
|
+
hasMapAnnotation(schema.ast) ||
|
|
47
|
+
// @ts-expect-error - ast.to?. is not narrowed, we don't care
|
|
48
|
+
hasMapAnnotation(schema.ast.to) ||
|
|
49
|
+
false;
|
|
50
|
+
|
|
51
|
+
export const isClassSchema = (schema: S.Schema<any>) => {
|
|
52
|
+
const encoded = S.encodedSchema(schema);
|
|
53
|
+
return (
|
|
54
|
+
encoded.ast._tag === "TypeLiteral" &&
|
|
55
|
+
encoded.ast.propertySignatures !== undefined
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const isStructSchema = (schema: S.Schema<any>) => {
|
|
60
|
+
return (
|
|
61
|
+
schema.ast._tag === "TypeLiteral" &&
|
|
62
|
+
schema.ast.propertySignatures !== undefined
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const isRecordSchema = (schema: S.Schema<any>) => {
|
|
67
|
+
const encoded = S.encodedSchema(schema);
|
|
68
|
+
return (
|
|
69
|
+
encoded.ast._tag === "TypeLiteral" &&
|
|
70
|
+
encoded.ast.indexSignatures?.[0] !== undefined
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const isListSchema = (schema: S.Schema<any>) => {
|
|
75
|
+
return (
|
|
76
|
+
hasListAnnotation(schema.ast) ||
|
|
77
|
+
(S.encodedSchema(schema).ast._tag === "TupleType" && !isMapSchema(schema))
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
export const hasListAnnotation = (ast: AST | undefined) => {
|
|
81
|
+
const description: string | undefined = ast?.annotations?.[
|
|
82
|
+
Description
|
|
83
|
+
] as string;
|
|
84
|
+
return (
|
|
85
|
+
description &&
|
|
86
|
+
description?.startsWith("List<") &&
|
|
87
|
+
description?.endsWith(">")
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const isSetSchema = (schema: S.Schema<any>) => {
|
|
92
|
+
return (
|
|
93
|
+
// @ts-expect-error - ast.to?. is not narrowed, we don't care
|
|
94
|
+
hasSetAnnotation(schema.ast) || hasSetAnnotation(schema.ast.to) || false
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const hasSetAnnotation = hasGenericAnnotation("Set");
|
|
99
|
+
|
|
100
|
+
export const getSetValueAST = (schema: S.Schema<any>): AST =>
|
|
101
|
+
// @ts-expect-error - ast.to?. is not narrowed, we don't care
|
|
102
|
+
isSetSchema(schema) && schema.ast.to?.typeParameters[0];
|
package/src/sha256.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
|
|
3
|
+
type Input = ArrayBuffer | Uint8Array | string;
|
|
4
|
+
|
|
5
|
+
export const sha256 = (input: Input) =>
|
|
6
|
+
Effect.promise(async () => {
|
|
7
|
+
const digest = await crypto.subtle.digest("SHA-256", toArrayBuffer(input));
|
|
8
|
+
const hashArray = Array.from(new Uint8Array(digest));
|
|
9
|
+
return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const toArrayBuffer = (input: Input) => {
|
|
13
|
+
if (input instanceof ArrayBuffer) {
|
|
14
|
+
return input;
|
|
15
|
+
}
|
|
16
|
+
if (typeof input === "string") {
|
|
17
|
+
return new TextEncoder().encode(input);
|
|
18
|
+
}
|
|
19
|
+
return input.buffer.slice(
|
|
20
|
+
input.byteOffset,
|
|
21
|
+
input.byteOffset + input.byteLength,
|
|
22
|
+
) as ArrayBuffer;
|
|
23
|
+
};
|
package/src/state.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { FileSystem } from "@effect/platform";
|
|
2
1
|
import type { PlatformError } from "@effect/platform/Error";
|
|
2
|
+
import * as FileSystem from "@effect/platform/FileSystem";
|
|
3
|
+
import * as Path from "@effect/platform/Path";
|
|
3
4
|
import * as Context from "effect/Context";
|
|
4
5
|
import * as Data from "effect/Data";
|
|
5
6
|
import * as Effect from "effect/Effect";
|
|
6
7
|
import * as Layer from "effect/Layer";
|
|
7
|
-
import path from "node:path";
|
|
8
8
|
import { App } from "./app.ts";
|
|
9
9
|
import type { BindNode } from "./plan.ts";
|
|
10
10
|
import { isResource } from "./resource.ts";
|
|
@@ -100,6 +100,7 @@ export const localFs = Layer.effect(
|
|
|
100
100
|
Effect.gen(function* () {
|
|
101
101
|
const app = yield* App;
|
|
102
102
|
const fs = yield* FileSystem.FileSystem;
|
|
103
|
+
const path = yield* Path.Path;
|
|
103
104
|
const dotAlchemy = path.join(process.cwd(), ".alchemy");
|
|
104
105
|
const stateDir = path.join(dotAlchemy, "state");
|
|
105
106
|
const appDir = path.join(stateDir, app.name);
|
package/src/tags.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { App } from "./app.ts";
|
|
3
|
+
|
|
4
|
+
export type Tags =
|
|
5
|
+
| Record<string, string>
|
|
6
|
+
| [string, string][]
|
|
7
|
+
| { Key: string; Value: string }[];
|
|
8
|
+
|
|
9
|
+
const normalizeTags = (tags: Tags) =>
|
|
10
|
+
Array.isArray(tags)
|
|
11
|
+
? Object.fromEntries(
|
|
12
|
+
tags.map((tag) =>
|
|
13
|
+
Array.isArray(tag) ? [tag[0], tag[1]] : [tag.Key, tag.Value],
|
|
14
|
+
),
|
|
15
|
+
)
|
|
16
|
+
: tags;
|
|
17
|
+
|
|
18
|
+
export const hasTags = (expectedTags: Tags, tags: Tags | undefined) => {
|
|
19
|
+
const actualTags = normalizeTags(tags ?? []);
|
|
20
|
+
return Object.entries(normalizeTags(expectedTags)).every(
|
|
21
|
+
([key, value]) => actualTags[key] === value,
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const createTagsList = (tags: Tags) =>
|
|
26
|
+
Object.entries(normalizeTags(tags)).map(([Key, Value]) => ({
|
|
27
|
+
Key,
|
|
28
|
+
Value,
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
export const createTagger = Effect.fn(function* () {
|
|
32
|
+
const app = yield* App;
|
|
33
|
+
return (id: string) => ({
|
|
34
|
+
"alchemy::app": app.name,
|
|
35
|
+
"alchemy::stage": app.stage,
|
|
36
|
+
"alchemy::id": id,
|
|
37
|
+
});
|
|
38
|
+
});
|
package/src/test.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { FetchHttpClient, FileSystem, HttpClient } from "@effect/platform";
|
|
2
|
+
import { NodeContext } from "@effect/platform-node";
|
|
3
|
+
import type * as Path from "@effect/platform/Path";
|
|
4
|
+
import { it } from "@effect/vitest";
|
|
5
|
+
import { LogLevel } from "effect";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import * as Layer from "effect/Layer";
|
|
8
|
+
import * as Logger from "effect/Logger";
|
|
9
|
+
import * as Scope from "effect/Scope";
|
|
10
|
+
import * as App from "./app.ts";
|
|
11
|
+
import { PlanStatusReporter } from "./apply.ts";
|
|
12
|
+
import { DotAlchemy, dotAlchemy } from "./dot-alchemy.ts";
|
|
13
|
+
import * as State from "./state.ts";
|
|
14
|
+
|
|
15
|
+
type Provided =
|
|
16
|
+
| Scope.Scope
|
|
17
|
+
| App.App
|
|
18
|
+
| State.State
|
|
19
|
+
| DotAlchemy
|
|
20
|
+
| HttpClient.HttpClient
|
|
21
|
+
| FileSystem.FileSystem
|
|
22
|
+
| Path.Path;
|
|
23
|
+
|
|
24
|
+
export function test(
|
|
25
|
+
name: string,
|
|
26
|
+
testCase: Effect.Effect<void, any, Provided>,
|
|
27
|
+
timeout: number = 120_000,
|
|
28
|
+
) {
|
|
29
|
+
const platform = Layer.mergeAll(
|
|
30
|
+
NodeContext.layer,
|
|
31
|
+
FetchHttpClient.layer,
|
|
32
|
+
Logger.pretty,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const alchemy = Layer.provideMerge(
|
|
36
|
+
Layer.mergeAll(State.localFs, report),
|
|
37
|
+
Layer.mergeAll(
|
|
38
|
+
App.make({ name: name.replaceAll(/[^a-zA-Z0-9_]/g, "-"), stage: "test" }),
|
|
39
|
+
dotAlchemy,
|
|
40
|
+
),
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return it.scopedLive(
|
|
44
|
+
name,
|
|
45
|
+
() =>
|
|
46
|
+
testCase.pipe(
|
|
47
|
+
Effect.provide(Layer.provideMerge(alchemy, platform)),
|
|
48
|
+
Logger.withMinimumLogLevel(
|
|
49
|
+
process.env.DEBUG ? LogLevel.Debug : LogLevel.Info,
|
|
50
|
+
),
|
|
51
|
+
),
|
|
52
|
+
timeout,
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const report = Layer.succeed(
|
|
57
|
+
PlanStatusReporter,
|
|
58
|
+
PlanStatusReporter.of({
|
|
59
|
+
start: Effect.fn(function* (plan) {
|
|
60
|
+
return {
|
|
61
|
+
done: () => Effect.void,
|
|
62
|
+
emit: (event) =>
|
|
63
|
+
Effect.log(
|
|
64
|
+
event.kind === "status-change"
|
|
65
|
+
? `${event.status} ${event.id}(${event.type})`
|
|
66
|
+
: event.message,
|
|
67
|
+
),
|
|
68
|
+
};
|
|
69
|
+
}),
|
|
70
|
+
}),
|
|
71
|
+
);
|
package/src/type.ts
ADDED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
|
-
import { Lambda as LambdaClient } from "itty-aws/lambda";
|
|
3
|
-
declare const FunctionClient_base: Context.TagClass<FunctionClient, "AWS::Lambda::Function.Client", LambdaClient>;
|
|
4
|
-
export declare class FunctionClient extends FunctionClient_base {
|
|
5
|
-
}
|
|
6
|
-
export declare const client: () => import("effect/Layer").Layer<FunctionClient, never, import("../credentials.ts").Credentials | import("../region.ts").Region>;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=function.client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function.client.d.ts","sourceRoot":"","sources":["../../../src/aws/lambda/function.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;;AAGzD,qBAAa,cAAe,SAAQ,mBAGjC;CAAG;AAEN,eAAO,MAAM,MAAM,oIAGY,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
|
-
import { Lambda as LambdaClient } from "itty-aws/lambda";
|
|
3
|
-
import { createAWSServiceClientLayer } from "../client.js";
|
|
4
|
-
export class FunctionClient extends Context.Tag("AWS::Lambda::Function.Client")() {
|
|
5
|
-
}
|
|
6
|
-
export const client = createAWSServiceClientLayer(FunctionClient, LambdaClient);
|
|
7
|
-
//# sourceMappingURL=function.client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function.client.js","sourceRoot":"","sources":["../../../src/aws/lambda/function.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAE3D,MAAM,OAAO,cAAe,SAAQ,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,EAG5E;CAAG;AAEN,MAAM,CAAC,MAAM,MAAM,GAAG,2BAA2B,CAG/C,cAAc,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
|
-
import * as Layer from "effect/Layer";
|
|
3
|
-
import { SQS as SQSClient } from "itty-aws/sqs";
|
|
4
|
-
import * as Credentials from "../credentials.ts";
|
|
5
|
-
import * as Region from "../region.ts";
|
|
6
|
-
declare const QueueClient_base: Context.TagClass<QueueClient, "AWS::SQS::Queue.Client", SQSClient>;
|
|
7
|
-
export declare class QueueClient extends QueueClient_base {
|
|
8
|
-
}
|
|
9
|
-
export declare const client: () => Layer.Layer<QueueClient, never, Credentials.Credentials | Region.Region>;
|
|
10
|
-
export declare const clientFromEnv: () => Layer.Layer<QueueClient, Region.EnvironmentVariableNotSet, never>;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=queue.client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue.client.d.ts","sourceRoot":"","sources":["../../../src/aws/sqs/queue.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;;AAEvC,qBAAa,WAAY,SAAQ,gBAG9B;CAAG;AAEN,eAAO,MAAM,MAAM,gFAGM,CAAC;AAE1B,eAAO,MAAM,aAAa,yEACqD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue.client.js","sourceRoot":"","sources":["../../../src/aws/sqs/queue.client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAEvC,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,EAGnE;CAAG;AAEN,MAAM,CAAC,MAAM,MAAM,GAAG,2BAA2B,CAG/C,WAAW,EAAE,SAAS,CAAC,CAAC;AAE1B,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAChC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC"}
|
package/lib/cloudflare/kv.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Resource } from "alchemy-effect";
|
|
2
|
-
export type KVProps = {
|
|
3
|
-
title?: string;
|
|
4
|
-
};
|
|
5
|
-
export type KVAttr<Props extends KVProps> = {
|
|
6
|
-
title: Props["title"] extends string ? Props["title"] : string;
|
|
7
|
-
namespaceId: string;
|
|
8
|
-
};
|
|
9
|
-
export interface KV<ID extends string, Props extends KVProps> extends Resource<"Cloudflare.KVNamespace", ID, Props, KVAttr<Props>> {
|
|
10
|
-
}
|
|
11
|
-
export declare const KV: (<const ID extends string, const Props extends KVProps>(id: ID, props: Props) => KV<ID, Props>) & {
|
|
12
|
-
new (): KV<string, KVProps> & {
|
|
13
|
-
parent: KV<string, KVProps>;
|
|
14
|
-
};
|
|
15
|
-
type: "Cloudflare.KVNamespace";
|
|
16
|
-
provider: {
|
|
17
|
-
tag: import("effect/Context").TagClass<unknown, "Cloudflare.KVNamespace", unknown>;
|
|
18
|
-
effect: <Err, Req>(eff: import("effect/Effect").Effect<import("alchemy-effect").ProviderService<KV<string, KVProps>>, Err, Req>) => import("effect/Layer").Layer<unknown, Err, Req>;
|
|
19
|
-
succeed: (service: import("alchemy-effect").ProviderService<KV<string, KVProps>>) => import("effect/Layer").Layer<unknown, never, never>;
|
|
20
|
-
};
|
|
21
|
-
} & {
|
|
22
|
-
type: "Cloudflare.KVNamespace";
|
|
23
|
-
provider: {
|
|
24
|
-
tag: import("effect/Context").TagClass<unknown, "Cloudflare.KVNamespace", unknown>;
|
|
25
|
-
effect: <Err, Req>(eff: import("effect/Effect").Effect<import("alchemy-effect").ProviderService<KV<string, KVProps>>, Err, Req>) => import("effect/Layer").Layer<unknown, Err, Req>;
|
|
26
|
-
succeed: (service: import("alchemy-effect").ProviderService<KV<string, KVProps>>) => import("effect/Layer").Layer<unknown, never, never>;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=kv.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kv.d.ts","sourceRoot":"","sources":["../../src/cloudflare/kv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,MAAM,CAAC,KAAK,SAAS,OAAO,IAAI;IAC1C,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC;IAC/D,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,KAAK,SAAS,OAAO,CAC1D,SAAQ,QAAQ,CAAC,wBAAwB,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;CAAG;AAEzE,eAAO,MAAM,EAAE,UACN,EAAE,SAAS,MAAM,QAAQ,KAAK,SAAS,OAAO,MAC/C,EAAE,SACC,KAAK,KACX,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC;;;;;;;;;;;;;;;;;CACU,CAAC"}
|
package/lib/cloudflare/kv.js
DELETED
package/lib/cloudflare/kv.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kv.js","sourceRoot":"","sources":["../../src/cloudflare/kv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAc1C,MAAM,CAAC,MAAM,EAAE,GAAG,QAAQ,CAKvB,wBAAwB,CAAC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { App } from "alchemy-effect";
|
|
2
|
-
import { CloudflareAccountId, CloudflareApi } from "./api.ts";
|
|
3
|
-
export declare const kvProvider: () => import("effect/Layer").Layer<unknown, never, CloudflareApi | CloudflareAccountId | App>;
|
|
4
|
-
//# sourceMappingURL=kv.provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kv.provider.d.ts","sourceRoot":"","sources":["../../src/cloudflare/kv.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9D,eAAO,MAAM,UAAU,+FA6CpB,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { App } from "alchemy-effect";
|
|
2
|
-
import * as Effect from "effect/Effect";
|
|
3
|
-
import { CloudflareAccountId, CloudflareApi } from "./api.js";
|
|
4
|
-
import { KV as KVNamespace } from "./kv.js";
|
|
5
|
-
export const kvProvider = () => KVNamespace.provider.effect(Effect.gen(function* () {
|
|
6
|
-
const app = yield* App;
|
|
7
|
-
const api = yield* CloudflareApi;
|
|
8
|
-
const accountId = yield* CloudflareAccountId;
|
|
9
|
-
const createTitle = (id, news) => news.title ?? `${app.name}-${id}-${app.stage}`;
|
|
10
|
-
return {
|
|
11
|
-
create: Effect.fn(function* ({ id, news }) {
|
|
12
|
-
const result = yield* Effect.promise(() => api.kv.namespaces.create({
|
|
13
|
-
account_id: accountId,
|
|
14
|
-
title: createTitle(id, news),
|
|
15
|
-
}));
|
|
16
|
-
return {
|
|
17
|
-
title: result.title,
|
|
18
|
-
namespaceId: result.id,
|
|
19
|
-
};
|
|
20
|
-
}),
|
|
21
|
-
update: Effect.fn(function* ({ id, news, output }) {
|
|
22
|
-
const title = createTitle(id, news);
|
|
23
|
-
yield* Effect.promise(() => api.kv.namespaces.update(output.namespaceId, {
|
|
24
|
-
account_id: accountId,
|
|
25
|
-
title,
|
|
26
|
-
}));
|
|
27
|
-
return {
|
|
28
|
-
title,
|
|
29
|
-
namespaceId: output.namespaceId,
|
|
30
|
-
};
|
|
31
|
-
}),
|
|
32
|
-
delete: Effect.fn(function* ({ output }) {
|
|
33
|
-
yield* Effect.promise(() => api.kv.namespaces.delete(output.namespaceId, {
|
|
34
|
-
account_id: accountId,
|
|
35
|
-
}));
|
|
36
|
-
}),
|
|
37
|
-
};
|
|
38
|
-
}));
|
|
39
|
-
//# sourceMappingURL=kv.provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kv.provider.js","sourceRoot":"","sources":["../../src/cloudflare/kv.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,EAAE,IAAI,WAAW,EAAgB,MAAM,SAAS,CAAC;AAE1D,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAC7B,WAAW,CAAC,QAAQ,CAAC,MAAM,CACzB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC;IACvB,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,aAAa,CAAC;IACjC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,mBAAmB,CAAC;IAE7C,MAAM,WAAW,GAAG,CAAC,EAAU,EAAE,IAAa,EAAE,EAAE,CAChD,IAAI,CAAC,KAAK,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;IAEjD,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;YACvC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CACxC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;gBACvB,UAAU,EAAE,SAAS;gBACrB,KAAK,EAAE,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC;aAC7B,CAAC,CACH,CAAC;YACF,OAAO;gBACL,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,WAAW,EAAE,MAAM,CAAC,EAAE;aACvB,CAAC;QACJ,CAAC,CAAC;QACF,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YAC/C,MAAM,KAAK,GAAG,WAAW,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YACpC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CACzB,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE;gBAC3C,UAAU,EAAE,SAAS;gBACrB,KAAK;aACN,CAAC,CACH,CAAC;YACF,OAAO;gBACL,KAAK;gBACL,WAAW,EAAE,MAAM,CAAC,WAAW;aAChC,CAAC;QACJ,CAAC,CAAC;QACF,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE;YACrC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CACzB,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE;gBAC3C,UAAU,EAAE,SAAS;aACtB,CAAC,CACH,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Runtime } from "alchemy-effect";
|
|
2
|
-
export declare const WorkerType = "AWS.Lambda.Worker";
|
|
3
|
-
export type WorkerType = typeof WorkerType;
|
|
4
|
-
export type WorkerProps = {
|
|
5
|
-
name?: string;
|
|
6
|
-
main: string;
|
|
7
|
-
handler?: string;
|
|
8
|
-
memory?: number;
|
|
9
|
-
compatibilityDate?: string;
|
|
10
|
-
compatibilityFlags?: string[];
|
|
11
|
-
compatibility?: "node" | "browser";
|
|
12
|
-
adopt?: boolean;
|
|
13
|
-
observability?: {
|
|
14
|
-
enabled?: boolean;
|
|
15
|
-
};
|
|
16
|
-
url?: boolean;
|
|
17
|
-
};
|
|
18
|
-
export type WorkerAttr<Props extends WorkerProps = WorkerProps> = {
|
|
19
|
-
url: Props["url"] extends false ? undefined : string;
|
|
20
|
-
};
|
|
21
|
-
export interface Worker extends Runtime<WorkerType> {
|
|
22
|
-
props: WorkerProps;
|
|
23
|
-
attr: WorkerAttr<Extract<this["props"], WorkerProps>>;
|
|
24
|
-
binding: {
|
|
25
|
-
bindings: {
|
|
26
|
-
[key: string]: any;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export declare const Worker: Worker & {
|
|
31
|
-
provider: import("alchemy-effect").ResourceTags<Worker>;
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/cloudflare/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,eAAO,MAAM,UAAU,sBAAsB,CAAC;AAC9C,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE;QACd,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IACF,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,WAAW,GAAG,WAAW,IAAI;IAChE,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;CACtD,CAAC;AAEF,MAAM,WAAW,MAAO,SAAQ,OAAO,CAAC,UAAU,CAAC;IACjD,KAAK,EAAE,WAAW,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;IACtD,OAAO,EAAE;QACP,QAAQ,EAAE;YACR,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;SACpB,CAAC;KACH,CAAC;CACH;AACD,eAAO,MAAM,MAAM;;CAAgC,CAAC"}
|
package/lib/cloudflare/worker.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/cloudflare/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAC;AA+B9C,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,EAAU,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
|
-
|
|
3
|
-
import { Lambda as LambdaClient } from "itty-aws/lambda";
|
|
4
|
-
import { createAWSServiceClientLayer } from "../client.ts";
|
|
5
|
-
|
|
6
|
-
export class FunctionClient extends Context.Tag("AWS::Lambda::Function.Client")<
|
|
7
|
-
FunctionClient,
|
|
8
|
-
LambdaClient
|
|
9
|
-
>() {}
|
|
10
|
-
|
|
11
|
-
export const client = createAWSServiceClientLayer<
|
|
12
|
-
typeof FunctionClient,
|
|
13
|
-
LambdaClient
|
|
14
|
-
>(FunctionClient, LambdaClient);
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { App } from "alchemy-effect";
|
|
2
|
-
import * as Effect from "effect/Effect";
|
|
3
|
-
import { CloudflareAccountId, CloudflareApi } from "./api.ts";
|
|
4
|
-
import { KV as KVNamespace, type KVProps } from "./kv.ts";
|
|
5
|
-
|
|
6
|
-
export const kvProvider = () =>
|
|
7
|
-
KVNamespace.provider.effect(
|
|
8
|
-
Effect.gen(function* () {
|
|
9
|
-
const app = yield* App;
|
|
10
|
-
const api = yield* CloudflareApi;
|
|
11
|
-
const accountId = yield* CloudflareAccountId;
|
|
12
|
-
|
|
13
|
-
const createTitle = (id: string, news: KVProps) =>
|
|
14
|
-
news.title ?? `${app.name}-${id}-${app.stage}`;
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
create: Effect.fn(function* ({ id, news }) {
|
|
18
|
-
const result = yield* Effect.promise(() =>
|
|
19
|
-
api.kv.namespaces.create({
|
|
20
|
-
account_id: accountId,
|
|
21
|
-
title: createTitle(id, news),
|
|
22
|
-
}),
|
|
23
|
-
);
|
|
24
|
-
return {
|
|
25
|
-
title: result.title,
|
|
26
|
-
namespaceId: result.id,
|
|
27
|
-
};
|
|
28
|
-
}),
|
|
29
|
-
update: Effect.fn(function* ({ id, news, output }) {
|
|
30
|
-
const title = createTitle(id, news);
|
|
31
|
-
yield* Effect.promise(() =>
|
|
32
|
-
api.kv.namespaces.update(output.namespaceId, {
|
|
33
|
-
account_id: accountId,
|
|
34
|
-
title,
|
|
35
|
-
}),
|
|
36
|
-
);
|
|
37
|
-
return {
|
|
38
|
-
title,
|
|
39
|
-
namespaceId: output.namespaceId,
|
|
40
|
-
};
|
|
41
|
-
}),
|
|
42
|
-
delete: Effect.fn(function* ({ output }) {
|
|
43
|
-
yield* Effect.promise(() =>
|
|
44
|
-
api.kv.namespaces.delete(output.namespaceId, {
|
|
45
|
-
account_id: accountId,
|
|
46
|
-
}),
|
|
47
|
-
);
|
|
48
|
-
}),
|
|
49
|
-
};
|
|
50
|
-
}),
|
|
51
|
-
);
|
package/src/cloudflare/kv.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Resource } from "alchemy-effect";
|
|
2
|
-
|
|
3
|
-
export type KVProps = {
|
|
4
|
-
title?: string;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export type KVAttr<Props extends KVProps> = {
|
|
8
|
-
title: Props["title"] extends string ? Props["title"] : string;
|
|
9
|
-
namespaceId: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export interface KV<ID extends string, Props extends KVProps>
|
|
13
|
-
extends Resource<"Cloudflare.KVNamespace", ID, Props, KVAttr<Props>> {}
|
|
14
|
-
|
|
15
|
-
export const KV = Resource<{
|
|
16
|
-
<const ID extends string, const Props extends KVProps>(
|
|
17
|
-
id: ID,
|
|
18
|
-
props: Props,
|
|
19
|
-
): KV<ID, Props>;
|
|
20
|
-
}>("Cloudflare.KVNamespace");
|
package/src/cloudflare/worker.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Runtime } from "alchemy-effect";
|
|
2
|
-
|
|
3
|
-
export const WorkerType = "AWS.Lambda.Worker";
|
|
4
|
-
export type WorkerType = typeof WorkerType;
|
|
5
|
-
|
|
6
|
-
export type WorkerProps = {
|
|
7
|
-
name?: string;
|
|
8
|
-
main: string;
|
|
9
|
-
handler?: string;
|
|
10
|
-
memory?: number;
|
|
11
|
-
compatibilityDate?: string;
|
|
12
|
-
compatibilityFlags?: string[];
|
|
13
|
-
compatibility?: "node" | "browser";
|
|
14
|
-
adopt?: boolean;
|
|
15
|
-
observability?: {
|
|
16
|
-
enabled?: boolean;
|
|
17
|
-
};
|
|
18
|
-
url?: boolean;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type WorkerAttr<Props extends WorkerProps = WorkerProps> = {
|
|
22
|
-
url: Props["url"] extends false ? undefined : string;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export interface Worker extends Runtime<WorkerType> {
|
|
26
|
-
props: WorkerProps;
|
|
27
|
-
attr: WorkerAttr<Extract<this["props"], WorkerProps>>;
|
|
28
|
-
binding: {
|
|
29
|
-
bindings: {
|
|
30
|
-
[key: string]: any;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export const Worker = Runtime(WorkerType)<Worker>();
|