alchemy 2.0.0-beta.34 → 2.0.0-beta.36
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/cli.js +8 -7
- package/bin/exec.js +253 -52
- package/bin/exec.js.map +1 -1
- package/lib/AWS/AuthProvider.d.ts +7 -6
- package/lib/AWS/AuthProvider.d.ts.map +1 -1
- package/lib/AWS/AuthProvider.js +143 -134
- package/lib/AWS/AuthProvider.js.map +1 -1
- package/lib/AWS/Bootstrap.d.ts +2 -2
- package/lib/AWS/Bootstrap.d.ts.map +1 -1
- package/lib/AWS/EC2/hosted.d.ts +1 -1
- package/lib/AWS/Environment.d.ts +25 -3
- package/lib/AWS/Environment.d.ts.map +1 -1
- package/lib/AWS/Environment.js +47 -3
- package/lib/AWS/Environment.js.map +1 -1
- package/lib/AWS/IAM/OpenIDConnectProvider.d.ts +14 -6
- package/lib/AWS/IAM/OpenIDConnectProvider.d.ts.map +1 -1
- package/lib/AWS/IAM/OpenIDConnectProvider.js +6 -3
- package/lib/AWS/IAM/OpenIDConnectProvider.js.map +1 -1
- package/lib/AWS/IAM/Policy.d.ts +1 -1
- package/lib/AWS/IAM/Policy.d.ts.map +1 -1
- package/lib/AWS/IAM/Policy.js.map +1 -1
- package/lib/AWS/Lambda/BucketEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/BucketEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/EventBridgeEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/EventBridgeEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/QueueEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/QueueEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/StreamEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/StreamEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/TableEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/TableEventSource.d.ts.map +1 -1
- package/lib/AWS/Lambda/TopicEventSource.d.ts +1 -1
- package/lib/AWS/Lambda/TopicEventSource.d.ts.map +1 -1
- package/lib/AWS/Providers.d.ts +1 -1
- package/lib/AWS/Providers.d.ts.map +1 -1
- package/lib/AWS/Providers.js +2 -1
- package/lib/AWS/Providers.js.map +1 -1
- package/lib/Auth/Credentials.d.ts +21 -6
- package/lib/Auth/Credentials.d.ts.map +1 -1
- package/lib/Auth/Credentials.js +30 -31
- package/lib/Auth/Credentials.js.map +1 -1
- package/lib/Auth/Profile.d.ts +31 -34
- package/lib/Auth/Profile.d.ts.map +1 -1
- package/lib/Auth/Profile.js +46 -31
- package/lib/Auth/Profile.js.map +1 -1
- package/lib/Axiom/AuthProvider.d.ts +2 -1
- package/lib/Axiom/AuthProvider.d.ts.map +1 -1
- package/lib/Axiom/AuthProvider.js +149 -143
- package/lib/Axiom/AuthProvider.js.map +1 -1
- package/lib/Axiom/Credentials.d.ts +2 -1
- package/lib/Axiom/Credentials.d.ts.map +1 -1
- package/lib/Axiom/Credentials.js +4 -4
- package/lib/Axiom/Credentials.js.map +1 -1
- package/lib/Axiom/Providers.d.ts +1 -1
- package/lib/Axiom/Providers.d.ts.map +1 -1
- package/lib/Axiom/Providers.js +3 -1
- package/lib/Axiom/Providers.js.map +1 -1
- package/lib/Cli/LoggingCli.d.ts.map +1 -1
- package/lib/Cli/LoggingCli.js +105 -7
- package/lib/Cli/LoggingCli.js.map +1 -1
- package/lib/Cli/checkVersion.d.ts +13 -0
- package/lib/Cli/checkVersion.d.ts.map +1 -0
- package/lib/Cli/checkVersion.js +47 -0
- package/lib/Cli/checkVersion.js.map +1 -0
- package/lib/Cli/commands/_shared.d.ts +2 -2
- package/lib/Cli/commands/_shared.d.ts.map +1 -1
- package/lib/Cli/commands/_shared.js +3 -3
- package/lib/Cli/commands/_shared.js.map +1 -1
- package/lib/Cli/commands/aws.d.ts +6 -0
- package/lib/Cli/commands/aws.d.ts.map +1 -0
- package/lib/Cli/commands/aws.js +63 -0
- package/lib/Cli/commands/aws.js.map +1 -0
- package/lib/Cli/commands/cloudflare.d.ts +17 -0
- package/lib/Cli/commands/cloudflare.d.ts.map +1 -0
- package/lib/Cli/commands/cloudflare.js +111 -0
- package/lib/Cli/commands/cloudflare.js.map +1 -0
- package/lib/Cli/commands/deploy.d.ts +6 -5
- package/lib/Cli/commands/deploy.d.ts.map +1 -1
- package/lib/Cli/commands/deploy.js +10 -10
- package/lib/Cli/commands/deploy.js.map +1 -1
- package/lib/Cli/commands/dev.d.ts.map +1 -1
- package/lib/Cli/commands/dev.js +16 -16
- package/lib/Cli/commands/dev.js.map +1 -1
- package/lib/Cli/commands/login.d.ts +2 -1
- package/lib/Cli/commands/login.d.ts.map +1 -1
- package/lib/Cli/commands/login.js +9 -8
- package/lib/Cli/commands/login.js.map +1 -1
- package/lib/Cli/commands/logs.d.ts +1 -1
- package/lib/Cli/commands/logs.d.ts.map +1 -1
- package/lib/Cli/commands/logs.js +7 -7
- package/lib/Cli/commands/logs.js.map +1 -1
- package/lib/Cli/commands/profile.d.ts +3 -1
- package/lib/Cli/commands/profile.d.ts.map +1 -1
- package/lib/Cli/commands/profile.js +14 -11
- package/lib/Cli/commands/profile.js.map +1 -1
- package/lib/Cli/commands/state.d.ts +1 -1
- package/lib/Cli/commands/state.d.ts.map +1 -1
- package/lib/Cli/commands/state.js +8 -8
- package/lib/Cli/commands/state.js.map +1 -1
- package/lib/Cli/commands/tail.d.ts +1 -1
- package/lib/Cli/commands/tail.d.ts.map +1 -1
- package/lib/Cli/commands/tail.js +7 -7
- package/lib/Cli/commands/tail.js.map +1 -1
- package/lib/Cli/exec.d.ts.map +1 -1
- package/lib/Cli/exec.js +5 -3
- package/lib/Cli/exec.js.map +1 -1
- package/lib/Cli/main.d.ts.map +1 -1
- package/lib/Cli/main.js +19 -5
- package/lib/Cli/main.js.map +1 -1
- package/lib/Cli/selectCli.d.ts +12 -0
- package/lib/Cli/selectCli.d.ts.map +1 -0
- package/lib/Cli/selectCli.js +32 -0
- package/lib/Cli/selectCli.js.map +1 -0
- package/lib/Cloudflare/Auth/AuthProvider.d.ts +2 -1
- package/lib/Cloudflare/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Auth/AuthProvider.js +235 -214
- package/lib/Cloudflare/Auth/AuthProvider.js.map +1 -1
- package/lib/Cloudflare/CloudflareEnvironment.d.ts +2 -1
- package/lib/Cloudflare/CloudflareEnvironment.d.ts.map +1 -1
- package/lib/Cloudflare/CloudflareEnvironment.js +3 -2
- package/lib/Cloudflare/CloudflareEnvironment.js.map +1 -1
- package/lib/Cloudflare/Credentials.d.ts +2 -1
- package/lib/Cloudflare/Credentials.d.ts.map +1 -1
- package/lib/Cloudflare/Credentials.js +4 -4
- package/lib/Cloudflare/Credentials.js.map +1 -1
- package/lib/Cloudflare/D1/D1Clone.d.ts +2 -1
- package/lib/Cloudflare/D1/D1Clone.d.ts.map +1 -1
- package/lib/Cloudflare/D1/D1Database.d.ts +2 -1
- package/lib/Cloudflare/D1/D1Database.d.ts.map +1 -1
- package/lib/Cloudflare/D1/D1Import.d.ts +3 -1
- package/lib/Cloudflare/D1/D1Import.d.ts.map +1 -1
- package/lib/Cloudflare/Images/Images.d.ts +103 -0
- package/lib/Cloudflare/Images/Images.d.ts.map +1 -0
- package/lib/Cloudflare/Images/Images.js +82 -0
- package/lib/Cloudflare/Images/Images.js.map +1 -0
- package/lib/Cloudflare/Images/ImagesBinding.d.ts +73 -0
- package/lib/Cloudflare/Images/ImagesBinding.d.ts.map +1 -0
- package/lib/Cloudflare/Images/ImagesBinding.js +83 -0
- package/lib/Cloudflare/Images/ImagesBinding.js.map +1 -0
- package/lib/Cloudflare/Images/index.d.ts +3 -0
- package/lib/Cloudflare/Images/index.d.ts.map +1 -0
- package/lib/Cloudflare/Images/index.js +3 -0
- package/lib/Cloudflare/Images/index.js.map +1 -0
- package/lib/Cloudflare/Local/Sidecar.d.ts +11 -4
- package/lib/Cloudflare/Local/Sidecar.d.ts.map +1 -1
- package/lib/Cloudflare/Local/Sidecar.js +8 -6
- package/lib/Cloudflare/Local/Sidecar.js.map +1 -1
- package/lib/Cloudflare/Local/SidecarHandlers.d.ts.map +1 -1
- package/lib/Cloudflare/Local/SidecarHandlers.js +1 -5
- package/lib/Cloudflare/Local/SidecarHandlers.js.map +1 -1
- package/lib/Cloudflare/Local/SidecarServer.js +5 -2
- package/lib/Cloudflare/Local/SidecarServer.js.map +1 -1
- package/lib/Cloudflare/Logs.d.ts +5 -0
- package/lib/Cloudflare/Logs.d.ts.map +1 -1
- package/lib/Cloudflare/Logs.js +70 -1
- package/lib/Cloudflare/Logs.js.map +1 -1
- package/lib/Cloudflare/Providers.d.ts +1 -1
- package/lib/Cloudflare/Providers.d.ts.map +1 -1
- package/lib/Cloudflare/Providers.js +6 -1
- package/lib/Cloudflare/Providers.js.map +1 -1
- package/lib/Cloudflare/Queue/Queue.d.ts +1 -1
- package/lib/Cloudflare/Queue/Queue.js +1 -1
- package/lib/Cloudflare/Queue/QueueConsumer.d.ts +6 -2
- package/lib/Cloudflare/Queue/QueueConsumer.d.ts.map +1 -1
- package/lib/Cloudflare/Queue/QueueConsumer.js +194 -53
- package/lib/Cloudflare/Queue/QueueConsumer.js.map +1 -1
- package/lib/Cloudflare/Queue/QueueEventSource.d.ts +106 -0
- package/lib/Cloudflare/Queue/QueueEventSource.d.ts.map +1 -0
- package/lib/Cloudflare/Queue/QueueEventSource.js +145 -0
- package/lib/Cloudflare/Queue/QueueEventSource.js.map +1 -0
- package/lib/Cloudflare/Queue/index.d.ts +1 -0
- package/lib/Cloudflare/Queue/index.d.ts.map +1 -1
- package/lib/Cloudflare/Queue/index.js +1 -0
- package/lib/Cloudflare/Queue/index.js.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.d.ts +229 -0
- package/lib/Cloudflare/R2/R2Bucket.d.ts.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.js +309 -2
- package/lib/Cloudflare/R2/R2Bucket.js.map +1 -1
- package/lib/Cloudflare/StateStore/State.d.ts +4 -3
- package/lib/Cloudflare/StateStore/State.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/State.js +16 -8
- package/lib/Cloudflare/StateStore/State.js.map +1 -1
- package/lib/Cloudflare/VpcService/VpcServiceRef.d.ts +1 -1
- package/lib/Cloudflare/VpcService/VpcServiceRef.d.ts.map +1 -1
- package/lib/Cloudflare/Website/StaticSite.d.ts.map +1 -1
- package/lib/Cloudflare/Website/StaticSite.js +10 -1
- package/lib/Cloudflare/Website/StaticSite.js.map +1 -1
- package/lib/Cloudflare/Workers/Assets.d.ts +1 -1
- package/lib/Cloudflare/Workers/Assets.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/InferEnv.d.ts +1 -1
- package/lib/Cloudflare/Workers/InferEnv.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js +11 -1
- package/lib/Cloudflare/Workers/LocalWorkerProvider.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +14 -12
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +96 -165
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.d.ts +2 -0
- package/lib/Cloudflare/Workers/WorkerBundle.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/WorkerBundle.js +21 -7
- package/lib/Cloudflare/Workers/WorkerBundle.js.map +1 -1
- package/lib/Cloudflare/Zone.d.ts +14 -0
- package/lib/Cloudflare/Zone.d.ts.map +1 -0
- package/lib/Cloudflare/Zone.js +44 -0
- package/lib/Cloudflare/Zone.js.map +1 -0
- package/lib/Cloudflare/index.d.ts +1 -0
- package/lib/Cloudflare/index.d.ts.map +1 -1
- package/lib/Cloudflare/index.js +1 -0
- package/lib/Cloudflare/index.js.map +1 -1
- package/lib/Drizzle/Schema.d.ts.map +1 -1
- package/lib/Drizzle/Schema.js +20 -5
- package/lib/Drizzle/Schema.js.map +1 -1
- package/lib/GitHub/AuthProvider.d.ts +3 -1
- package/lib/GitHub/AuthProvider.d.ts.map +1 -1
- package/lib/GitHub/AuthProvider.js +114 -108
- package/lib/GitHub/AuthProvider.js.map +1 -1
- package/lib/GitHub/Credentials.d.ts +2 -1
- package/lib/GitHub/Credentials.d.ts.map +1 -1
- package/lib/GitHub/Credentials.js +4 -4
- package/lib/GitHub/Credentials.js.map +1 -1
- package/lib/GitHub/Providers.d.ts +1 -1
- package/lib/GitHub/Providers.d.ts.map +1 -1
- package/lib/GitHub/Providers.js +3 -1
- package/lib/GitHub/Providers.js.map +1 -1
- package/lib/GitHub/Secrets.d.ts.map +1 -1
- package/lib/GitHub/Secrets.js +14 -1
- package/lib/GitHub/Secrets.js.map +1 -1
- package/lib/GitHub/Variables.d.ts +40 -0
- package/lib/GitHub/Variables.d.ts.map +1 -0
- package/lib/GitHub/Variables.js +28 -0
- package/lib/GitHub/Variables.js.map +1 -0
- package/lib/GitHub/index.d.ts +1 -0
- package/lib/GitHub/index.d.ts.map +1 -1
- package/lib/GitHub/index.js +1 -0
- package/lib/GitHub/index.js.map +1 -1
- package/lib/Neon/AuthProvider.d.ts +3 -1
- package/lib/Neon/AuthProvider.d.ts.map +1 -1
- package/lib/Neon/AuthProvider.js +87 -80
- package/lib/Neon/AuthProvider.js.map +1 -1
- package/lib/Neon/Credentials.d.ts +2 -1
- package/lib/Neon/Credentials.d.ts.map +1 -1
- package/lib/Neon/Credentials.js +4 -4
- package/lib/Neon/Credentials.js.map +1 -1
- package/lib/Neon/NeonEnvironment.d.ts +2 -1
- package/lib/Neon/NeonEnvironment.d.ts.map +1 -1
- package/lib/Neon/NeonEnvironment.js +3 -2
- package/lib/Neon/NeonEnvironment.js.map +1 -1
- package/lib/Neon/Project.d.ts +16 -0
- package/lib/Neon/Project.d.ts.map +1 -1
- package/lib/Neon/Project.js +25 -0
- package/lib/Neon/Project.js.map +1 -1
- package/lib/Neon/Providers.d.ts +1 -1
- package/lib/Neon/Providers.d.ts.map +1 -1
- package/lib/Neon/Providers.js +3 -1
- package/lib/Neon/Providers.js.map +1 -1
- package/lib/Neon/api.d.ts +1 -0
- package/lib/Neon/api.d.ts.map +1 -1
- package/lib/Neon/api.js +1 -0
- package/lib/Neon/api.js.map +1 -1
- package/lib/Sidecar/RpcClient.d.ts.map +1 -1
- package/lib/Sidecar/RpcClient.js +8 -5
- package/lib/Sidecar/RpcClient.js.map +1 -1
- package/lib/Sidecar/RpcPaths.d.ts +5 -0
- package/lib/Sidecar/RpcPaths.d.ts.map +1 -1
- package/lib/Sidecar/RpcPaths.js +10 -1
- package/lib/Sidecar/RpcPaths.js.map +1 -1
- package/lib/Sidecar/RpcServer.d.ts +24 -4
- package/lib/Sidecar/RpcServer.d.ts.map +1 -1
- package/lib/Sidecar/RpcServer.js +70 -15
- package/lib/Sidecar/RpcServer.js.map +1 -1
- package/lib/Sidecar/RpcServerBun.d.ts +4 -0
- package/lib/Sidecar/RpcServerBun.d.ts.map +1 -0
- package/lib/Sidecar/RpcServerBun.js +28 -0
- package/lib/Sidecar/RpcServerBun.js.map +1 -0
- package/lib/Sidecar/RpcServerNode.d.ts +4 -0
- package/lib/Sidecar/RpcServerNode.d.ts.map +1 -0
- package/lib/Sidecar/RpcServerNode.js +39 -0
- package/lib/Sidecar/RpcServerNode.js.map +1 -0
- package/lib/Sidecar/RpcServices.d.ts +6 -0
- package/lib/Sidecar/RpcServices.d.ts.map +1 -0
- package/lib/Sidecar/RpcServices.js +29 -0
- package/lib/Sidecar/RpcServices.js.map +1 -0
- package/lib/Stack.d.ts +5 -3
- package/lib/Stack.d.ts.map +1 -1
- package/lib/Stack.js +3 -1
- package/lib/Stack.js.map +1 -1
- package/lib/Test/Core.d.ts.map +1 -1
- package/lib/Test/Core.js +5 -4
- package/lib/Test/Core.js.map +1 -1
- package/lib/Test/Vitest.d.ts.map +1 -1
- package/lib/Test/Vitest.js +2 -0
- package/lib/Test/Vitest.js.map +1 -1
- package/lib/Util/LocalhostDns.d.ts +19 -0
- package/lib/Util/LocalhostDns.d.ts.map +1 -0
- package/lib/Util/LocalhostDns.js +55 -0
- package/lib/Util/LocalhostDns.js.map +1 -0
- package/lib/Util/PlatformServices.d.ts.map +1 -1
- package/lib/Util/PlatformServices.js +3 -1
- package/lib/Util/PlatformServices.js.map +1 -1
- package/lib/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +16 -12
- package/src/AWS/AuthProvider.ts +269 -259
- package/src/AWS/Environment.ts +57 -3
- package/src/AWS/IAM/OpenIDConnectProvider.ts +19 -8
- package/src/AWS/IAM/Policy.ts +1 -1
- package/src/AWS/Providers.ts +2 -0
- package/src/Auth/Credentials.ts +82 -46
- package/src/Auth/Profile.ts +123 -69
- package/src/Axiom/AuthProvider.ts +263 -255
- package/src/Axiom/Credentials.ts +3 -4
- package/src/Axiom/Providers.ts +4 -0
- package/src/Cli/LoggingCli.ts +127 -11
- package/src/Cli/checkVersion.ts +57 -0
- package/src/Cli/commands/_shared.ts +4 -4
- package/src/Cli/commands/aws.ts +127 -0
- package/src/Cli/commands/cloudflare.ts +222 -0
- package/src/Cli/commands/deploy.ts +11 -10
- package/src/Cli/commands/dev.ts +28 -33
- package/src/Cli/commands/login.ts +9 -12
- package/src/Cli/commands/logs.ts +8 -8
- package/src/Cli/commands/profile.ts +14 -16
- package/src/Cli/commands/state.ts +8 -8
- package/src/Cli/commands/tail.ts +8 -8
- package/src/Cli/exec.ts +7 -3
- package/src/Cli/main.ts +23 -5
- package/src/Cli/selectCli.ts +33 -0
- package/src/Cloudflare/Auth/AuthProvider.ts +445 -430
- package/src/Cloudflare/CloudflareEnvironment.ts +3 -2
- package/src/Cloudflare/Credentials.ts +3 -4
- package/src/Cloudflare/Images/Images.ts +121 -0
- package/src/Cloudflare/Images/ImagesBinding.ts +192 -0
- package/src/Cloudflare/Images/index.ts +2 -0
- package/src/Cloudflare/Local/Sidecar.ts +13 -10
- package/src/Cloudflare/Local/SidecarHandlers.ts +8 -13
- package/src/Cloudflare/Local/SidecarServer.ts +6 -1
- package/src/Cloudflare/Logs.ts +115 -1
- package/src/Cloudflare/Providers.ts +9 -0
- package/src/Cloudflare/Queue/Queue.ts +1 -1
- package/src/Cloudflare/Queue/QueueConsumer.ts +262 -60
- package/src/Cloudflare/Queue/QueueEventSource.ts +234 -0
- package/src/Cloudflare/Queue/index.ts +1 -0
- package/src/Cloudflare/R2/R2Bucket.ts +570 -2
- package/src/Cloudflare/StateStore/State.ts +25 -16
- package/src/Cloudflare/Website/StaticSite.ts +11 -1
- package/src/Cloudflare/Workers/InferEnv.ts +7 -3
- package/src/Cloudflare/Workers/LocalWorkerProvider.ts +9 -1
- package/src/Cloudflare/Workers/Worker.ts +130 -231
- package/src/Cloudflare/Workers/WorkerBundle.ts +38 -12
- package/src/Cloudflare/Zone.ts +88 -0
- package/src/Cloudflare/index.ts +1 -0
- package/src/Drizzle/Schema.ts +21 -5
- package/src/GitHub/AuthProvider.ts +221 -217
- package/src/GitHub/Credentials.ts +3 -4
- package/src/GitHub/Providers.ts +4 -0
- package/src/GitHub/Secrets.ts +25 -1
- package/src/GitHub/Variables.ts +54 -0
- package/src/GitHub/index.ts +1 -0
- package/src/Neon/AuthProvider.ts +160 -154
- package/src/Neon/Credentials.ts +3 -4
- package/src/Neon/NeonEnvironment.ts +3 -2
- package/src/Neon/Project.ts +42 -0
- package/src/Neon/Providers.ts +4 -0
- package/src/Neon/api.ts +2 -0
- package/src/Sidecar/RpcClient.ts +8 -7
- package/src/Sidecar/RpcPaths.ts +11 -1
- package/src/Sidecar/RpcServer.ts +97 -24
- package/src/Sidecar/RpcServerBun.ts +41 -0
- package/src/Sidecar/RpcServerNode.ts +51 -0
- package/src/Sidecar/RpcServices.ts +48 -0
- package/src/Stack.ts +8 -0
- package/src/Test/Core.ts +10 -4
- package/src/Test/Vitest.ts +3 -0
- package/src/Util/LocalhostDns.ts +58 -0
- package/src/Util/PlatformServices.ts +3 -1
- package/lib/Cli/commands/bootstrap.d.ts +0 -20
- package/lib/Cli/commands/bootstrap.d.ts.map +0 -1
- package/lib/Cli/commands/bootstrap.js +0 -107
- package/lib/Cli/commands/bootstrap.js.map +0 -1
- package/lib/Sidecar/RpcTransport.d.ts +0 -22
- package/lib/Sidecar/RpcTransport.d.ts.map +0 -1
- package/lib/Sidecar/RpcTransport.js +0 -81
- package/lib/Sidecar/RpcTransport.js.map +0 -1
- package/lib/Test/TestCli.d.ts +0 -19
- package/lib/Test/TestCli.d.ts.map +0 -1
- package/lib/Test/TestCli.js +0 -175
- package/lib/Test/TestCli.js.map +0 -1
- package/src/Cli/commands/bootstrap.ts +0 -216
- package/src/Sidecar/RpcTransport.ts +0 -85
- package/src/Test/TestCli.ts +0 -221
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import * as Console from "effect/Console";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
|
-
import * as FileSystem from "effect/FileSystem";
|
|
4
3
|
import * as Match from "effect/Match";
|
|
5
4
|
import * as Redacted from "effect/Redacted";
|
|
6
5
|
import * as Stream from "effect/Stream";
|
|
7
6
|
import * as ChildProcess from "effect/unstable/process/ChildProcess";
|
|
8
|
-
import
|
|
7
|
+
import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
|
|
9
8
|
import {
|
|
10
9
|
AuthError,
|
|
11
10
|
AuthProviderLayer,
|
|
12
11
|
type ConfigureContext,
|
|
13
12
|
} from "../Auth/AuthProvider.ts";
|
|
14
|
-
import {
|
|
15
|
-
deleteCredentials,
|
|
16
|
-
displayRedacted,
|
|
17
|
-
readCredentials,
|
|
18
|
-
writeCredentials,
|
|
19
|
-
} from "../Auth/Credentials.ts";
|
|
13
|
+
import { CredentialsStore, displayRedacted } from "../Auth/Credentials.ts";
|
|
20
14
|
import { getEnvRedacted, retryOnce } from "../Auth/Env.ts";
|
|
21
15
|
import * as Clank from "../Util/Clank.ts";
|
|
22
16
|
|
|
@@ -60,6 +54,10 @@ export interface GitHubResolvedCredentials {
|
|
|
60
54
|
|
|
61
55
|
export const GITHUB_AUTH_PROVIDER_NAME = "GitHub";
|
|
62
56
|
|
|
57
|
+
class GhCliError extends Error {
|
|
58
|
+
readonly _tag = "GhCliError";
|
|
59
|
+
}
|
|
60
|
+
|
|
63
61
|
/**
|
|
64
62
|
* Layer that registers the GitHub {@link AuthProvider} into the
|
|
65
63
|
* {@link AuthProviders} registry when built. Include this in the GitHub
|
|
@@ -77,233 +75,239 @@ export const GITHUB_AUTH_PROVIDER_NAME = "GitHub";
|
|
|
77
75
|
export const GitHubAuth = AuthProviderLayer<
|
|
78
76
|
GitHubAuthConfig,
|
|
79
77
|
GitHubResolvedCredentials
|
|
80
|
-
>()(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
read: (profileName, config) => resolveCredentials(profileName, config),
|
|
86
|
-
});
|
|
78
|
+
>()(
|
|
79
|
+
GITHUB_AUTH_PROVIDER_NAME,
|
|
80
|
+
Effect.gen(function* () {
|
|
81
|
+
const store = yield* CredentialsStore;
|
|
82
|
+
const cp = yield* ChildProcessSpawner;
|
|
87
83
|
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (
|
|
102
|
-
return
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
details: "GITHUB_ACCESS_TOKEN",
|
|
108
|
-
},
|
|
109
|
-
};
|
|
84
|
+
const ghCliToken = (): Effect.Effect<string, AuthError> =>
|
|
85
|
+
Effect.gen(function* () {
|
|
86
|
+
const handle = yield* cp.spawn(
|
|
87
|
+
ChildProcess.make("gh", ["auth", "token"], { shell: false }),
|
|
88
|
+
);
|
|
89
|
+
const [exitCode, stdout, stderr] = yield* Effect.all(
|
|
90
|
+
[
|
|
91
|
+
handle.exitCode,
|
|
92
|
+
Stream.mkString(Stream.decodeText(handle.stdout)),
|
|
93
|
+
Stream.mkString(Stream.decodeText(handle.stderr)),
|
|
94
|
+
],
|
|
95
|
+
{ concurrency: 3 },
|
|
96
|
+
);
|
|
97
|
+
if (exitCode !== 0) {
|
|
98
|
+
return yield* Effect.fail(
|
|
99
|
+
new GhCliError(
|
|
100
|
+
`gh auth token exited with ${exitCode}: ${stderr.trim() || stdout.trim()}`,
|
|
101
|
+
),
|
|
102
|
+
);
|
|
110
103
|
}
|
|
111
|
-
const token =
|
|
112
|
-
if (token) {
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
source: { type: "env" as const, details: "GITHUB_TOKEN" },
|
|
117
|
-
};
|
|
104
|
+
const token = stdout.trim();
|
|
105
|
+
if (!token) {
|
|
106
|
+
return yield* Effect.fail(
|
|
107
|
+
new GhCliError("gh auth token returned empty output"),
|
|
108
|
+
);
|
|
118
109
|
}
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
? Effect.fail(
|
|
130
|
-
new AuthError({
|
|
131
|
-
message:
|
|
132
|
-
"GitHub stored credentials not found. Run: alchemy login --configure",
|
|
133
|
-
}),
|
|
134
|
-
)
|
|
135
|
-
: Effect.succeed({
|
|
136
|
-
type: "token" as const,
|
|
137
|
-
token: Redacted.make(creds.token),
|
|
138
|
-
source: { type: "stored" as const },
|
|
110
|
+
return token;
|
|
111
|
+
}).pipe(
|
|
112
|
+
Effect.scoped,
|
|
113
|
+
Effect.mapError((e) =>
|
|
114
|
+
e instanceof GhCliError
|
|
115
|
+
? new AuthError({ message: e.message, cause: e })
|
|
116
|
+
: new AuthError({
|
|
117
|
+
message:
|
|
118
|
+
"Could not invoke `gh`. Install GitHub CLI from https://cli.github.com/ and run `gh auth login`.",
|
|
119
|
+
cause: e,
|
|
139
120
|
}),
|
|
140
121
|
),
|
|
141
|
-
)
|
|
142
|
-
),
|
|
143
|
-
Match.when({ method: "gh-cli" }, () =>
|
|
144
|
-
ghCliToken().pipe(
|
|
145
|
-
Effect.map((token) => ({
|
|
146
|
-
type: "token" as const,
|
|
147
|
-
token: Redacted.make(token),
|
|
148
|
-
source: { type: "gh-cli" as const },
|
|
149
|
-
})),
|
|
150
|
-
),
|
|
151
|
-
),
|
|
152
|
-
Match.exhaustive,
|
|
153
|
-
);
|
|
122
|
+
);
|
|
154
123
|
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
Effect.andThen(Clank.success("GitHub: stored credentials removed")),
|
|
162
|
-
),
|
|
163
|
-
),
|
|
164
|
-
Match.exhaustive,
|
|
165
|
-
);
|
|
124
|
+
const loginStored = Effect.fnUntraced(function* (profileName: string) {
|
|
125
|
+
const token = yield* Clank.password({
|
|
126
|
+
message:
|
|
127
|
+
"GitHub Personal Access Token (needs `repo` scope; `workflow` for Actions)",
|
|
128
|
+
validate: (v) => (v.length === 0 ? "Required" : undefined),
|
|
129
|
+
}).pipe(retryOnce);
|
|
166
130
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
131
|
+
yield* store.write<GitHubStoredCredentials>(profileName, "gh-stored", {
|
|
132
|
+
type: "pat",
|
|
133
|
+
token,
|
|
134
|
+
});
|
|
135
|
+
yield* Clank.success("GitHub: credentials saved.");
|
|
136
|
+
return { method: "stored" as const };
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const configureInteractive = (profileName: string) =>
|
|
140
|
+
Clank.select({
|
|
141
|
+
message: "GitHub authentication method",
|
|
142
|
+
options,
|
|
143
|
+
}).pipe(
|
|
144
|
+
Effect.flatMap((method) =>
|
|
145
|
+
Match.value(method).pipe(
|
|
146
|
+
Match.when("env", () => Effect.succeed({ method: "env" as const })),
|
|
147
|
+
Match.when("gh-cli", () =>
|
|
148
|
+
ghCliToken().pipe(
|
|
149
|
+
Effect.as({ method: "gh-cli" as const }),
|
|
150
|
+
Effect.mapError(
|
|
151
|
+
(e) =>
|
|
152
|
+
new AuthError({
|
|
153
|
+
message: `gh CLI not available: ${e.message}`,
|
|
154
|
+
cause: e,
|
|
155
|
+
}),
|
|
156
|
+
),
|
|
157
|
+
),
|
|
158
|
+
),
|
|
159
|
+
Match.when("stored", () => loginStored(profileName)),
|
|
160
|
+
Match.exhaustive,
|
|
183
161
|
),
|
|
184
162
|
),
|
|
185
|
-
)
|
|
186
|
-
Match.exhaustive,
|
|
187
|
-
)
|
|
188
|
-
.pipe(
|
|
189
|
-
Effect.mapError(
|
|
190
|
-
(e) => new AuthError({ message: "login failed", cause: e }),
|
|
191
|
-
),
|
|
192
|
-
);
|
|
163
|
+
);
|
|
193
164
|
|
|
194
|
-
const configureCredentials = (profileName: string, ctx: ConfigureContext) =>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
165
|
+
const configureCredentials = (profileName: string, ctx: ConfigureContext) =>
|
|
166
|
+
Effect.gen(function* () {
|
|
167
|
+
if (ctx.ci) {
|
|
168
|
+
return { method: "env" as const };
|
|
169
|
+
}
|
|
170
|
+
return yield* configureInteractive(profileName);
|
|
171
|
+
}).pipe(
|
|
172
|
+
Effect.mapError(
|
|
173
|
+
(e) =>
|
|
174
|
+
new AuthError({
|
|
175
|
+
message: "failed to configure credentials",
|
|
176
|
+
cause: e,
|
|
177
|
+
}),
|
|
178
|
+
),
|
|
179
|
+
);
|
|
209
180
|
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
181
|
+
const resolveCredentials = (
|
|
182
|
+
profileName: string,
|
|
183
|
+
config: GitHubAuthConfig,
|
|
184
|
+
): Effect.Effect<GitHubResolvedCredentials, AuthError> =>
|
|
185
|
+
Match.value(config).pipe(
|
|
186
|
+
Match.when(
|
|
187
|
+
{ method: "env" },
|
|
188
|
+
Effect.fnUntraced(function* () {
|
|
189
|
+
const access = yield* getEnvRedacted("GITHUB_ACCESS_TOKEN");
|
|
190
|
+
if (access) {
|
|
191
|
+
return {
|
|
192
|
+
type: "token" as const,
|
|
193
|
+
token: access,
|
|
194
|
+
source: {
|
|
195
|
+
type: "env" as const,
|
|
196
|
+
details: "GITHUB_ACCESS_TOKEN",
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
const token = yield* getEnvRedacted("GITHUB_TOKEN");
|
|
201
|
+
if (token) {
|
|
202
|
+
return {
|
|
203
|
+
type: "token" as const,
|
|
204
|
+
token,
|
|
205
|
+
source: { type: "env" as const, details: "GITHUB_TOKEN" },
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
return yield* new AuthError({
|
|
209
|
+
message:
|
|
210
|
+
"GitHub env credentials not found. Set GITHUB_ACCESS_TOKEN or GITHUB_TOKEN.",
|
|
211
|
+
});
|
|
212
|
+
}),
|
|
213
|
+
),
|
|
214
|
+
Match.when({ method: "stored" }, () =>
|
|
215
|
+
store.read<GitHubStoredCredentials>(profileName, "gh-stored").pipe(
|
|
216
|
+
Effect.flatMap((creds) =>
|
|
217
|
+
creds == null
|
|
218
|
+
? Effect.fail(
|
|
219
|
+
new AuthError({
|
|
220
|
+
message:
|
|
221
|
+
"GitHub stored credentials not found. Run: alchemy login --configure",
|
|
222
|
+
}),
|
|
223
|
+
)
|
|
224
|
+
: Effect.succeed({
|
|
225
|
+
type: "token" as const,
|
|
226
|
+
token: Redacted.make(creds.token),
|
|
227
|
+
source: { type: "stored" as const },
|
|
228
|
+
}),
|
|
227
229
|
),
|
|
228
230
|
),
|
|
229
231
|
),
|
|
230
|
-
Match.when("
|
|
232
|
+
Match.when({ method: "gh-cli" }, () =>
|
|
233
|
+
ghCliToken().pipe(
|
|
234
|
+
Effect.map((token) => ({
|
|
235
|
+
type: "token" as const,
|
|
236
|
+
token: Redacted.make(token),
|
|
237
|
+
source: { type: "gh-cli" as const },
|
|
238
|
+
})),
|
|
239
|
+
),
|
|
240
|
+
),
|
|
231
241
|
Match.exhaustive,
|
|
232
|
-
)
|
|
233
|
-
),
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
const loginStored = Effect.fnUntraced(function* (profileName: string) {
|
|
237
|
-
const token = yield* Clank.password({
|
|
238
|
-
message:
|
|
239
|
-
"GitHub Personal Access Token (needs `repo` scope; `workflow` for Actions)",
|
|
240
|
-
validate: (v) => (v.length === 0 ? "Required" : undefined),
|
|
241
|
-
}).pipe(retryOnce);
|
|
242
|
+
);
|
|
242
243
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
244
|
+
const logout = (profileName: string, config: GitHubAuthConfig) =>
|
|
245
|
+
Match.value(config).pipe(
|
|
246
|
+
Match.when({ method: "env" }, () => Effect.void),
|
|
247
|
+
Match.when({ method: "gh-cli" }, () => Effect.void),
|
|
248
|
+
Match.when({ method: "stored" }, () =>
|
|
249
|
+
store
|
|
250
|
+
.delete(profileName, "gh-stored")
|
|
251
|
+
.pipe(
|
|
252
|
+
Effect.andThen(
|
|
253
|
+
Clank.success("GitHub: stored credentials removed"),
|
|
254
|
+
),
|
|
255
|
+
),
|
|
256
|
+
),
|
|
257
|
+
Match.exhaustive,
|
|
258
|
+
);
|
|
250
259
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
260
|
+
const login = (profileName: string, config: GitHubAuthConfig) =>
|
|
261
|
+
Match.value(config)
|
|
262
|
+
.pipe(
|
|
263
|
+
Match.when({ method: "env" }, () => Effect.void),
|
|
264
|
+
Match.when({ method: "gh-cli" }, () =>
|
|
265
|
+
ghCliToken().pipe(
|
|
266
|
+
Effect.tap(() =>
|
|
267
|
+
Clank.success("GitHub: gh CLI authentication available."),
|
|
268
|
+
),
|
|
269
|
+
Effect.asVoid,
|
|
270
|
+
),
|
|
271
|
+
),
|
|
272
|
+
Match.when({ method: "stored" }, () =>
|
|
273
|
+
store
|
|
274
|
+
.read<GitHubStoredCredentials>(profileName, "gh-stored")
|
|
275
|
+
.pipe(
|
|
276
|
+
Effect.flatMap((creds) =>
|
|
277
|
+
creds == null ? loginStored(profileName) : Effect.void,
|
|
278
|
+
),
|
|
279
|
+
),
|
|
280
|
+
),
|
|
281
|
+
Match.exhaustive,
|
|
282
|
+
)
|
|
283
|
+
.pipe(
|
|
284
|
+
Effect.mapError(
|
|
285
|
+
(e) => new AuthError({ message: "login failed", cause: e }),
|
|
286
|
+
),
|
|
287
|
+
);
|
|
254
288
|
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
if (exitCode !== 0) {
|
|
269
|
-
return yield* Effect.fail(
|
|
270
|
-
new GhCliError(
|
|
271
|
-
`gh auth token exited with ${exitCode}: ${stderr.trim() || stdout.trim()}`,
|
|
289
|
+
const prettyPrint = (profileName: string, config: GitHubAuthConfig) =>
|
|
290
|
+
resolveCredentials(profileName, config).pipe(
|
|
291
|
+
Effect.tap((creds) => {
|
|
292
|
+
const sourceStr = creds.source.details
|
|
293
|
+
? `${creds.source.type} - ${creds.source.details}`
|
|
294
|
+
: creds.source.type;
|
|
295
|
+
return Effect.all([
|
|
296
|
+
Console.log(` token: ${displayRedacted(creds.token, 6)}`),
|
|
297
|
+
Console.log(` source: ${sourceStr}`),
|
|
298
|
+
]);
|
|
299
|
+
}),
|
|
300
|
+
Effect.catch((e) =>
|
|
301
|
+
Console.error(` Failed to retrieve credentials: ${e}`),
|
|
272
302
|
),
|
|
273
303
|
);
|
|
274
|
-
}
|
|
275
|
-
const token = stdout.trim();
|
|
276
|
-
if (!token) {
|
|
277
|
-
return yield* Effect.fail(
|
|
278
|
-
new GhCliError("gh auth token returned empty output"),
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
return token;
|
|
282
|
-
}).pipe(
|
|
283
|
-
Effect.scoped,
|
|
284
|
-
Effect.mapError((e) =>
|
|
285
|
-
e instanceof GhCliError
|
|
286
|
-
? new AuthError({ message: e.message, cause: e })
|
|
287
|
-
: new AuthError({
|
|
288
|
-
message:
|
|
289
|
-
"Could not invoke `gh`. Install GitHub CLI from https://cli.github.com/ and run `gh auth login`.",
|
|
290
|
-
cause: e,
|
|
291
|
-
}),
|
|
292
|
-
),
|
|
293
|
-
);
|
|
294
304
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
]);
|
|
305
|
-
}),
|
|
306
|
-
Effect.catch((e) =>
|
|
307
|
-
Console.error(` Failed to retrieve credentials: ${e}`),
|
|
308
|
-
),
|
|
309
|
-
);
|
|
305
|
+
return {
|
|
306
|
+
configure: configureCredentials,
|
|
307
|
+
logout,
|
|
308
|
+
login,
|
|
309
|
+
prettyPrint,
|
|
310
|
+
read: resolveCredentials,
|
|
311
|
+
};
|
|
312
|
+
}),
|
|
313
|
+
);
|
|
@@ -5,7 +5,7 @@ import * as Effect from "effect/Effect";
|
|
|
5
5
|
import * as Layer from "effect/Layer";
|
|
6
6
|
import * as Redacted from "effect/Redacted";
|
|
7
7
|
import { AuthError, getAuthProvider } from "../Auth/AuthProvider.ts";
|
|
8
|
-
import { ALCHEMY_PROFILE,
|
|
8
|
+
import { ALCHEMY_PROFILE, Profile } from "../Auth/Profile.ts";
|
|
9
9
|
import {
|
|
10
10
|
GITHUB_AUTH_PROVIDER_NAME,
|
|
11
11
|
type GitHubAuthConfig,
|
|
@@ -74,15 +74,15 @@ export const fromAuthProvider = () =>
|
|
|
74
74
|
Layer.effect(
|
|
75
75
|
GitHubCredentials,
|
|
76
76
|
Effect.gen(function* () {
|
|
77
|
+
const profile = yield* Profile;
|
|
77
78
|
const auth = yield* getAuthProvider<
|
|
78
79
|
GitHubAuthConfig,
|
|
79
80
|
GitHubResolvedCredentials
|
|
80
81
|
>(GITHUB_AUTH_PROVIDER_NAME);
|
|
81
82
|
const profileName = yield* ALCHEMY_PROFILE;
|
|
82
83
|
const ci = yield* Config.boolean("CI").pipe(Config.withDefault(false));
|
|
83
|
-
const ctx = yield* Effect.context<never>();
|
|
84
84
|
|
|
85
|
-
return yield* loadOrConfigure(auth, profileName, { ci }).pipe(
|
|
85
|
+
return yield* profile.loadOrConfigure(auth, profileName, { ci }).pipe(
|
|
86
86
|
Effect.flatMap((config) =>
|
|
87
87
|
auth.read(profileName, config as GitHubAuthConfig),
|
|
88
88
|
),
|
|
@@ -93,7 +93,6 @@ export const fromAuthProvider = () =>
|
|
|
93
93
|
message: `Failed to resolve GitHub credentials for profile '${profileName}': ${(e as { message?: string }).message ?? String(e)}`,
|
|
94
94
|
}),
|
|
95
95
|
),
|
|
96
|
-
Effect.provide(ctx),
|
|
97
96
|
);
|
|
98
97
|
}).pipe(Effect.orDie),
|
|
99
98
|
);
|
package/src/GitHub/Providers.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as Layer from "effect/Layer";
|
|
2
|
+
import { CredentialsStoreLive } from "../Auth/Credentials.ts";
|
|
3
|
+
import { ProfileLive } from "../Auth/Profile.ts";
|
|
2
4
|
import * as Provider from "../Provider.ts";
|
|
3
5
|
import { GitHubAuth } from "./AuthProvider.ts";
|
|
4
6
|
import { Comment, CommentProvider } from "./Comment.ts";
|
|
@@ -28,5 +30,7 @@ export const providers = () =>
|
|
|
28
30
|
),
|
|
29
31
|
Layer.provideMerge(Credentials.fromAuthProvider()),
|
|
30
32
|
Layer.provideMerge(GitHubAuth),
|
|
33
|
+
Layer.provideMerge(ProfileLive),
|
|
34
|
+
Layer.provideMerge(CredentialsStoreLive),
|
|
31
35
|
Layer.orDie,
|
|
32
36
|
);
|
package/src/GitHub/Secrets.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as Effect from "effect/Effect";
|
|
|
2
2
|
import * as Redacted from "effect/Redacted";
|
|
3
3
|
|
|
4
4
|
import type { Input } from "../Input.ts";
|
|
5
|
+
import * as Output from "../Output.ts";
|
|
5
6
|
import { Secret } from "./Secret.ts";
|
|
6
7
|
|
|
7
8
|
export interface SecretsProps {
|
|
@@ -60,7 +61,30 @@ export const Secrets = ({
|
|
|
60
61
|
repository,
|
|
61
62
|
environment,
|
|
62
63
|
name,
|
|
63
|
-
value:
|
|
64
|
+
value: liftValue(value),
|
|
64
65
|
}),
|
|
65
66
|
),
|
|
66
67
|
);
|
|
68
|
+
|
|
69
|
+
// Accepts a plain string, an existing `Redacted<string>`, or an `Output`
|
|
70
|
+
// of either. We must lift via `Output.map` for the `Output` case so the
|
|
71
|
+
// inner string gets wrapped after the engine resolves it — otherwise the
|
|
72
|
+
// `Redacted.make(output)` path produces `Redacted<Output<...>>`, which
|
|
73
|
+
// later double-wraps to `Redacted<Redacted<string>>` and stringifies to
|
|
74
|
+
// `<redacted>` inside `sodium.from_string`.
|
|
75
|
+
const liftValue = (
|
|
76
|
+
value: Input<string | Redacted.Redacted<string>>,
|
|
77
|
+
): Input<Redacted.Redacted<string>> =>
|
|
78
|
+
Output.isOutput(value)
|
|
79
|
+
? Output.map(
|
|
80
|
+
value as Output.Output<string | Redacted.Redacted<string>>,
|
|
81
|
+
toRedacted,
|
|
82
|
+
)
|
|
83
|
+
: toRedacted(value as string | Redacted.Redacted<string>);
|
|
84
|
+
|
|
85
|
+
const toRedacted = (
|
|
86
|
+
value: string | Redacted.Redacted<string>,
|
|
87
|
+
): Redacted.Redacted<string> =>
|
|
88
|
+
Redacted.isRedacted(value)
|
|
89
|
+
? (value as Redacted.Redacted<string>)
|
|
90
|
+
: Redacted.make(value);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
|
|
3
|
+
import type { Input } from "../Input.ts";
|
|
4
|
+
import { Variable } from "./Variable.ts";
|
|
5
|
+
|
|
6
|
+
export interface VariablesProps {
|
|
7
|
+
/**
|
|
8
|
+
* Repository owner (user or organization).
|
|
9
|
+
*/
|
|
10
|
+
owner: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Repository name.
|
|
14
|
+
*/
|
|
15
|
+
repository: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Map of variable name to value. Each entry becomes one
|
|
19
|
+
* `GitHub.Variable` resource, using the map key as both the alchemy
|
|
20
|
+
* logical id and the variable name.
|
|
21
|
+
*/
|
|
22
|
+
variables: Record<string, Input<string>>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Bulk-creates a set of {@link Variable}s in the same repository.
|
|
27
|
+
*
|
|
28
|
+
* Plural counterpart of {@link import("./Secrets.ts").Secrets}, for
|
|
29
|
+
* non-sensitive values like region names, role ARNs, environment labels,
|
|
30
|
+
* or feature flags.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* yield* GitHub.Variables({
|
|
35
|
+
* owner: "alchemy-run",
|
|
36
|
+
* repository: "alchemy-effect",
|
|
37
|
+
* variables: {
|
|
38
|
+
* AWS_ROLE_ARN: role.roleArn,
|
|
39
|
+
* AWS_REGION: region,
|
|
40
|
+
* },
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export const Variables = ({ owner, repository, variables }: VariablesProps) =>
|
|
45
|
+
Effect.all(
|
|
46
|
+
Object.entries(variables).map(([name, value]) =>
|
|
47
|
+
Variable(name, {
|
|
48
|
+
owner,
|
|
49
|
+
repository,
|
|
50
|
+
name,
|
|
51
|
+
value,
|
|
52
|
+
}),
|
|
53
|
+
),
|
|
54
|
+
);
|
package/src/GitHub/index.ts
CHANGED