alchemy 2.0.0-beta.33 → 2.0.0-beta.35
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 +226 -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 +20 -15
- 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 +17 -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/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 +4 -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 +94 -0
- package/lib/Cloudflare/R2/R2Bucket.d.ts.map +1 -1
- package/lib/Cloudflare/R2/R2Bucket.js +186 -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/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 +9 -7
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +62 -142
- 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/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/Util/PlatformServices.js +1 -1
- package/lib/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +15 -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 -28
- 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 +20 -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/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 +6 -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 +337 -2
- package/src/Cloudflare/StateStore/State.ts +25 -16
- package/src/Cloudflare/Website/StaticSite.ts +11 -1
- package/src/Cloudflare/Workers/LocalWorkerProvider.ts +9 -1
- package/src/Cloudflare/Workers/Worker.ts +83 -203
- package/src/Cloudflare/Workers/WorkerBundle.ts +38 -12
- package/src/Cloudflare/Zone.ts +88 -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/Util/PlatformServices.ts +1 -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
package/lib/Auth/Profile.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import * as ConfigProvider from "effect/ConfigProvider";
|
|
|
3
3
|
import * as Context from "effect/Context";
|
|
4
4
|
import * as Effect from "effect/Effect";
|
|
5
5
|
import * as FileSystem from "effect/FileSystem";
|
|
6
|
-
import
|
|
6
|
+
import * as Layer from "effect/Layer";
|
|
7
|
+
import type { PlatformError } from "effect/PlatformError";
|
|
8
|
+
import type { AuthError, AuthProvider, ConfigureContext } from "./AuthProvider.ts";
|
|
7
9
|
export declare const rootDir: string;
|
|
8
10
|
export declare const configFilePath: string;
|
|
9
11
|
/**
|
|
@@ -36,20 +38,36 @@ export interface AlchemyProfile {
|
|
|
36
38
|
method: string;
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
|
-
export declare const readConfig: Effect.Effect<{
|
|
40
|
-
version: typeof CONFIG_VERSION;
|
|
41
|
-
profiles: {
|
|
42
|
-
[profileName: string]: AlchemyProfile;
|
|
43
|
-
};
|
|
44
|
-
}, never, FileSystem.FileSystem>;
|
|
45
|
-
export declare const writeConfig: (config: AlchemyConfig["Service"]) => Effect.Effect<void, import("effect/PlatformError").PlatformError, FileSystem.FileSystem>;
|
|
46
|
-
export declare const getProfile: (name: string) => Effect.Effect<AlchemyProfile, never, FileSystem.FileSystem>;
|
|
47
|
-
export declare const setProfile: (name: string, profile: AlchemyProfile) => Effect.Effect<void, import("effect/PlatformError").PlatformError, FileSystem.FileSystem>;
|
|
48
41
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
42
|
+
* Service exposing on-disk profile helpers. All methods have `R = never` —
|
|
43
|
+
* the {@link FileSystem.FileSystem} requirement is captured by
|
|
44
|
+
* {@link ProfileLive} when the layer is built, freeing call sites from
|
|
45
|
+
* having to thread `FileSystem` through their own Effects.
|
|
46
|
+
*
|
|
47
|
+
* Use {@link Profile} directly when you need profile helpers — yield it
|
|
48
|
+
* from your `Effect.gen` and call its methods (each has `R = never`).
|
|
49
|
+
*/
|
|
50
|
+
export interface ProfileService {
|
|
51
|
+
readonly readConfig: Effect.Effect<AlchemyConfig["Service"]>;
|
|
52
|
+
readonly writeConfig: (config: AlchemyConfig["Service"]) => Effect.Effect<void, PlatformError>;
|
|
53
|
+
readonly getProfile: (name: string) => Effect.Effect<AlchemyProfile | undefined>;
|
|
54
|
+
readonly setProfile: (name: string, profile: AlchemyProfile) => Effect.Effect<void, PlatformError>;
|
|
55
|
+
readonly deleteProfile: (name: string) => Effect.Effect<boolean, PlatformError>;
|
|
56
|
+
readonly loadOrConfigure: <Config extends {
|
|
57
|
+
method: string;
|
|
58
|
+
}>(auth: AuthProvider<Config>, profileName: string, ctx: ConfigureContext) => Effect.Effect<Config, AuthError | PlatformError>;
|
|
59
|
+
}
|
|
60
|
+
declare const Profile_base: Context.ServiceClass<Profile, "Alchemy::Profile", ProfileService>;
|
|
61
|
+
export declare class Profile extends Profile_base {
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Layer that builds the {@link Profile} service. Captures the
|
|
65
|
+
* {@link FileSystem.FileSystem} dependency at layer-build time, so any
|
|
66
|
+
* Effect that yields {@link Profile} ends up with `R = Profile` (no
|
|
67
|
+
* `FileSystem` leak). Provide this once at the top of your runtime
|
|
68
|
+
* (alongside `PlatformServices` / `NodeContext`).
|
|
51
69
|
*/
|
|
52
|
-
export declare const
|
|
70
|
+
export declare const ProfileLive: Layer.Layer<Profile, never, FileSystem.FileSystem>;
|
|
53
71
|
/**
|
|
54
72
|
* Returns a `ConfigProvider` that overrides `ALCHEMY_PROFILE` with the
|
|
55
73
|
* given `profile` (when explicitly passed via the CLI `--profile` flag),
|
|
@@ -59,26 +77,5 @@ export declare const deleteProfile: (name: string) => Effect.Effect<boolean, imp
|
|
|
59
77
|
* without disturbing other config lookups.
|
|
60
78
|
*/
|
|
61
79
|
export declare const withProfileOverride: (base: ConfigProvider.ConfigProvider, profile: string | undefined) => ConfigProvider.ConfigProvider;
|
|
62
|
-
/**
|
|
63
|
-
* Load the stored config for the given AuthProvider in `profileName`.
|
|
64
|
-
* If absent, run the provider's `configure` step (passing through `ctx` so
|
|
65
|
-
* providers can pick a CI-friendly default) and persist the resulting config
|
|
66
|
-
* under the provider's name.
|
|
67
|
-
*/
|
|
68
|
-
export declare const loadOrConfigure: <Config extends {
|
|
69
|
-
method: string;
|
|
70
|
-
}>(auth: AuthProvider<Config>, profileName: string, ctx: ConfigureContext) => Effect.Effect<{
|
|
71
|
-
/**
|
|
72
|
-
* The method used to login to the provider. Different providers may use different methods, but common ones are:
|
|
73
|
-
* - oauth: OAuth authentication
|
|
74
|
-
* - api-key: API key authentication
|
|
75
|
-
* - username-password: Username and password authentication
|
|
76
|
-
* - token: Token authentication
|
|
77
|
-
* - certificate: Certificate authentication
|
|
78
|
-
* - ssh: SSH authentication
|
|
79
|
-
* - other: Other authentication methods
|
|
80
|
-
*/
|
|
81
|
-
method: string;
|
|
82
|
-
}, import("effect/PlatformError").PlatformError | import("./AuthProvider.ts").AuthError, FileSystem.FileSystem>;
|
|
83
80
|
export {};
|
|
84
81
|
//# sourceMappingURL=Profile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../src/Auth/Profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../src/Auth/Profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EACZ,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,OAAO,QAAsC,CAAC;AAC3D,eAAO,MAAM,cAAc,QAAsC,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,eAAe,uBAE3B,CAAC;AAEF,eAAO,MAAM,cAAc,IAAI,CAAC;;aAKnB,OAAO,cAAc;cACpB;QACR,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,CAAC;KACvC;;AANL,qBAAa,aAAc,SAAQ,kBAQX;CAAG;AAE3B,MAAM,WAAW,cAAc;IAC7B,CAAC,YAAY,EAAE,MAAM,GAAG;QACtB;;;;;;;;;WASG;QACH,MAAM,EAAE,MAAM,CAAC;KAChB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
|
|
3
3
|
import * as Context from "effect/Context";
|
|
4
4
|
import * as Effect from "effect/Effect";
|
|
5
5
|
import * as FileSystem from "effect/FileSystem";
|
|
6
|
+
import * as Layer from "effect/Layer";
|
|
6
7
|
import os from "node:os";
|
|
7
8
|
import path from "pathe";
|
|
8
9
|
export const rootDir = path.join(os.homedir(), ".alchemy");
|
|
@@ -20,30 +21,53 @@ const emptyConfig = () => ({
|
|
|
20
21
|
version: CONFIG_VERSION,
|
|
21
22
|
profiles: {},
|
|
22
23
|
});
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
const parsed = JSON.parse(data);
|
|
26
|
-
if (parsed?.version !== CONFIG_VERSION) {
|
|
27
|
-
// TODO(sam): this is destructive, should we maintain a chain of migrations from 0 to current?
|
|
28
|
-
return emptyConfig();
|
|
29
|
-
}
|
|
30
|
-
return parsed;
|
|
31
|
-
},
|
|
32
|
-
catch: emptyConfig,
|
|
33
|
-
})), Effect.orElseSucceed(emptyConfig));
|
|
34
|
-
export const writeConfig = (config) => FileSystem.FileSystem.asEffect().pipe(Effect.tap((fs) => fs.makeDirectory(path.dirname(configFilePath), { recursive: true })), Effect.flatMap((fs) => fs.writeFileString(configFilePath, JSON.stringify(config, null, 2))));
|
|
35
|
-
export const getProfile = (name) => readConfig.pipe(Effect.map((config) => config.profiles[name]));
|
|
36
|
-
export const setProfile = (name, profile) => readConfig.pipe(Effect.tap((config) => Effect.sync(() => (config.profiles[name] = profile))), Effect.flatMap(writeConfig));
|
|
24
|
+
export class Profile extends Context.Service()("Alchemy::Profile") {
|
|
25
|
+
}
|
|
37
26
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
27
|
+
* Layer that builds the {@link Profile} service. Captures the
|
|
28
|
+
* {@link FileSystem.FileSystem} dependency at layer-build time, so any
|
|
29
|
+
* Effect that yields {@link Profile} ends up with `R = Profile` (no
|
|
30
|
+
* `FileSystem` leak). Provide this once at the top of your runtime
|
|
31
|
+
* (alongside `PlatformServices` / `NodeContext`).
|
|
40
32
|
*/
|
|
41
|
-
export const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
export const ProfileLive = Layer.effect(Profile, Effect.gen(function* () {
|
|
34
|
+
const fs = yield* FileSystem.FileSystem;
|
|
35
|
+
const readConfig = fs
|
|
36
|
+
.readFileString(configFilePath)
|
|
37
|
+
.pipe(Effect.flatMap((data) => Effect.try({
|
|
38
|
+
try: () => {
|
|
39
|
+
const parsed = JSON.parse(data);
|
|
40
|
+
if (parsed?.version !== CONFIG_VERSION) {
|
|
41
|
+
// TODO(sam): this is destructive, should we maintain a chain of migrations from 0 to current?
|
|
42
|
+
return emptyConfig();
|
|
43
|
+
}
|
|
44
|
+
return parsed;
|
|
45
|
+
},
|
|
46
|
+
catch: emptyConfig,
|
|
47
|
+
})), Effect.orElseSucceed(emptyConfig));
|
|
48
|
+
const writeConfig = (config) => fs
|
|
49
|
+
.makeDirectory(path.dirname(configFilePath), { recursive: true })
|
|
50
|
+
.pipe(Effect.flatMap(() => fs.writeFileString(configFilePath, JSON.stringify(config, null, 2))));
|
|
51
|
+
const getProfile = (name) => readConfig.pipe(Effect.map((config) => config.profiles[name]));
|
|
52
|
+
const setProfile = (name, profile) => readConfig.pipe(Effect.tap((config) => Effect.sync(() => (config.profiles[name] = profile))), Effect.flatMap(writeConfig));
|
|
53
|
+
const deleteProfile = (name) => readConfig.pipe(Effect.flatMap((config) => {
|
|
54
|
+
if (!(name in config.profiles)) {
|
|
55
|
+
return Effect.succeed(false);
|
|
56
|
+
}
|
|
57
|
+
delete config.profiles[name];
|
|
58
|
+
return writeConfig(config).pipe(Effect.as(true));
|
|
59
|
+
}));
|
|
60
|
+
const loadOrConfigure = (auth, profileName, ctx) => Effect.flatMap(getProfile(profileName), (existing) => existing?.[auth.name]
|
|
61
|
+
? Effect.succeed(existing[auth.name])
|
|
62
|
+
: Effect.tap(auth.configure(profileName, ctx), (config) => setProfile(profileName, { ...existing, [auth.name]: config })));
|
|
63
|
+
return {
|
|
64
|
+
readConfig,
|
|
65
|
+
writeConfig,
|
|
66
|
+
getProfile,
|
|
67
|
+
setProfile,
|
|
68
|
+
deleteProfile,
|
|
69
|
+
loadOrConfigure,
|
|
70
|
+
};
|
|
47
71
|
}));
|
|
48
72
|
/**
|
|
49
73
|
* Returns a `ConfigProvider` that overrides `ALCHEMY_PROFILE` with the
|
|
@@ -62,13 +86,4 @@ export const withProfileOverride = (base, profile) => {
|
|
|
62
86
|
: undefined));
|
|
63
87
|
return ConfigProvider.orElse(base)(overrideProvider);
|
|
64
88
|
};
|
|
65
|
-
/**
|
|
66
|
-
* Load the stored config for the given AuthProvider in `profileName`.
|
|
67
|
-
* If absent, run the provider's `configure` step (passing through `ctx` so
|
|
68
|
-
* providers can pick a CI-friendly default) and persist the resulting config
|
|
69
|
-
* under the provider's name.
|
|
70
|
-
*/
|
|
71
|
-
export const loadOrConfigure = (auth, profileName, ctx) => Effect.flatMap(getProfile(profileName), (existing) => existing?.[auth.name]
|
|
72
|
-
? Effect.succeed(existing?.[auth.name])
|
|
73
|
-
: Effect.tap(auth.configure(profileName, ctx), (config) => setProfile(profileName, { ...existing, [auth.name]: config })));
|
|
74
89
|
//# sourceMappingURL=Profile.js.map
|
package/lib/Auth/Profile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Profile.js","sourceRoot":"","sources":["../../src/Auth/Profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Profile.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C;AAC7B,CAAC,CAAC,CACH,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,IAAmC,EACnC,OAA2B,EACI,EAAE;IACjC,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACvC,MAAM,SAAS,GAA2B,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC;IACvE,MAAM,gBAAgB,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CACpD,MAAM,CAAC,OAAO,CACZ,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,SAAS;QACtE,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAC;QAC/C,CAAC,CAAC,SAAS,CACd,CACF,CAAC;IACF,OAAO,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC,CAAC;AACvD,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Redacted from "effect/Redacted";
|
|
2
|
+
import { CredentialsStore } from "../Auth/Credentials.ts";
|
|
2
3
|
export type AxiomAuthConfig = {
|
|
3
4
|
method: "env";
|
|
4
5
|
} | {
|
|
@@ -44,5 +45,5 @@ export declare const AXIOM_AUTH_PROVIDER_NAME = "Axiom";
|
|
|
44
45
|
* {@link AuthProviders} registry when built. Include this in the Axiom
|
|
45
46
|
* `providers()` layer so `alchemy login` can discover it.
|
|
46
47
|
*/
|
|
47
|
-
export declare const AxiomAuth: import("effect/Layer").Layer<never, never, import("../index.ts").AuthProviders>;
|
|
48
|
+
export declare const AxiomAuth: import("effect/Layer").Layer<never, never, import("../index.ts").AuthProviders | CredentialsStore>;
|
|
48
49
|
//# sourceMappingURL=AuthProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthProvider.d.ts","sourceRoot":"","sources":["../../src/Axiom/AuthProvider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"AuthProvider.d.ts","sourceRoot":"","sources":["../../src/Axiom/AuthProvider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAM5C,OAAO,EAAE,gBAAgB,EAAmB,MAAM,wBAAwB,CAAC;AAuB3E,MAAM,MAAM,eAAe,GACvB;IAAE,MAAM,EAAE,KAAK,CAAA;CAAE,GACjB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,cAAc,EAAE,UAAU,CAAA;CAAE,GAChD;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,cAAc,EAAE,KAAK,CAAA;CAAE,CAAC;AAEhD,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3E;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1E,MAAM,MAAM,wBAAwB,GAChC;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QAAE,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/D,GACD;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QAAE,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/D,CAAC;AAEN,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAkBhD;;;;GAIG;AACH,eAAO,MAAM,SAAS,oGAsQrB,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
import { DEFAULT_API_BASE_URL } from "@distilled.cloud/axiom/Credentials";
|
|
1
2
|
import * as Console from "effect/Console";
|
|
2
3
|
import * as Effect from "effect/Effect";
|
|
3
|
-
import * as FileSystem from "effect/FileSystem";
|
|
4
4
|
import * as Match from "effect/Match";
|
|
5
5
|
import * as Redacted from "effect/Redacted";
|
|
6
6
|
import { AuthError, AuthProviderLayer, } from "../Auth/AuthProvider.js";
|
|
7
|
-
import {
|
|
7
|
+
import { CredentialsStore, displayRedacted } from "../Auth/Credentials.js";
|
|
8
8
|
import { getEnv, getEnvRedacted, retryOnce } from "../Auth/Env.js";
|
|
9
9
|
import * as Clank from "../Util/Clank.js";
|
|
10
|
-
import { DEFAULT_API_BASE_URL } from "@distilled.cloud/axiom/Credentials";
|
|
11
10
|
const STORAGE_KEY = "axiom-stored";
|
|
12
11
|
const options = [
|
|
13
12
|
{
|
|
@@ -22,156 +21,163 @@ const options = [
|
|
|
22
21
|
},
|
|
23
22
|
];
|
|
24
23
|
export const AXIOM_AUTH_PROVIDER_NAME = "Axiom";
|
|
24
|
+
const promptOrgId = (required) => getEnv("AXIOM_ORG_ID").pipe(Effect.flatMap((envOrgId) => Clank.text({
|
|
25
|
+
message: required
|
|
26
|
+
? "Axiom Org ID (required for PAT)"
|
|
27
|
+
: "Axiom Org ID (Enter to skip)",
|
|
28
|
+
placeholder: envOrgId ?? "",
|
|
29
|
+
defaultValue: envOrgId ?? "",
|
|
30
|
+
validate: required
|
|
31
|
+
? (v) => (v.length === 0 ? "Required" : undefined)
|
|
32
|
+
: undefined,
|
|
33
|
+
}).pipe(retryOnce)));
|
|
25
34
|
/**
|
|
26
35
|
* Layer that registers the Axiom {@link AuthProvider} into the
|
|
27
36
|
* {@link AuthProviders} registry when built. Include this in the Axiom
|
|
28
37
|
* `providers()` layer so `alchemy login` can discover it.
|
|
29
38
|
*/
|
|
30
|
-
export const AxiomAuth = AuthProviderLayer()(AXIOM_AUTH_PROVIDER_NAME, {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
export const AxiomAuth = AuthProviderLayer()(AXIOM_AUTH_PROVIDER_NAME, Effect.gen(function* () {
|
|
40
|
+
const store = yield* CredentialsStore;
|
|
41
|
+
const loginStored = Effect.fnUntraced(function* (profileName) {
|
|
42
|
+
const credentialType = yield* Clank.select({
|
|
43
|
+
message: "Axiom credential type",
|
|
44
|
+
options: [
|
|
45
|
+
{
|
|
46
|
+
value: "apiToken",
|
|
47
|
+
label: "API Token",
|
|
48
|
+
hint: "recommended — scoped to specific datasets/actions",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: "pat",
|
|
52
|
+
label: "Personal Access Token",
|
|
53
|
+
hint: "full account control, requires Org ID",
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
}).pipe(retryOnce);
|
|
57
|
+
const apiBaseUrlPrompt = yield* Clank.text({
|
|
58
|
+
message: "Axiom API Base URL (Enter for default)",
|
|
59
|
+
placeholder: DEFAULT_API_BASE_URL,
|
|
60
|
+
defaultValue: DEFAULT_API_BASE_URL,
|
|
61
|
+
}).pipe(retryOnce);
|
|
62
|
+
const apiBaseUrl = apiBaseUrlPrompt && apiBaseUrlPrompt.length > 0
|
|
63
|
+
? apiBaseUrlPrompt
|
|
64
|
+
: undefined;
|
|
65
|
+
return yield* Match.value(credentialType).pipe(Match.when("apiToken", () => Effect.gen(function* () {
|
|
66
|
+
const apiToken = yield* Clank.password({
|
|
67
|
+
message: "Axiom API Token",
|
|
68
|
+
validate: (v) => (v.length === 0 ? "Required" : undefined),
|
|
69
|
+
}).pipe(retryOnce);
|
|
70
|
+
const orgId = yield* promptOrgId(false);
|
|
71
|
+
yield* store.write(profileName, STORAGE_KEY, {
|
|
72
|
+
type: "apiToken",
|
|
73
|
+
apiToken,
|
|
74
|
+
apiBaseUrl,
|
|
75
|
+
orgId: orgId && orgId.length > 0 ? orgId : undefined,
|
|
76
|
+
});
|
|
77
|
+
yield* Clank.success("Axiom: credentials saved.");
|
|
78
|
+
return {
|
|
79
|
+
method: "stored",
|
|
80
|
+
credentialType: "apiToken",
|
|
81
|
+
};
|
|
82
|
+
})), Match.when("pat", () => Effect.gen(function* () {
|
|
83
|
+
const apiToken = yield* Clank.password({
|
|
84
|
+
message: "Axiom Personal Access Token",
|
|
85
|
+
validate: (v) => (v.length === 0 ? "Required" : undefined),
|
|
86
|
+
}).pipe(retryOnce);
|
|
87
|
+
const orgId = yield* promptOrgId(true);
|
|
88
|
+
yield* store.write(profileName, STORAGE_KEY, { type: "pat", apiToken, apiBaseUrl, orgId });
|
|
89
|
+
yield* Clank.success("Axiom: credentials saved.");
|
|
90
|
+
return {
|
|
91
|
+
method: "stored",
|
|
92
|
+
credentialType: "pat",
|
|
93
|
+
};
|
|
94
|
+
})), Match.exhaustive);
|
|
95
|
+
});
|
|
96
|
+
const configureInteractive = (profileName) => Clank.select({
|
|
97
|
+
message: "Axiom authentication method",
|
|
98
|
+
options,
|
|
99
|
+
}).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when("env", () => Effect.succeed({ method: "env" })), Match.when("stored", () => loginStored(profileName)), Match.exhaustive)));
|
|
100
|
+
const configureCredentials = (profileName, ctx) => Effect.gen(function* () {
|
|
101
|
+
if (ctx.ci) {
|
|
102
|
+
return { method: "env" };
|
|
103
|
+
}
|
|
104
|
+
return yield* configureInteractive(profileName);
|
|
105
|
+
}).pipe(Effect.mapError((e) => new AuthError({
|
|
106
|
+
message: "failed to configure credentials",
|
|
107
|
+
cause: e,
|
|
108
|
+
})));
|
|
109
|
+
const resolveCredentials = (profileName, config) => Match.value(config).pipe(Match.when({ method: "env" }, Effect.fnUntraced(function* () {
|
|
110
|
+
const apiToken = (yield* getEnvRedacted("AXIOM_TOKEN")) ??
|
|
111
|
+
(yield* getEnvRedacted("AXIOM_API_KEY"));
|
|
112
|
+
if (!apiToken) {
|
|
113
|
+
return yield* new AuthError({
|
|
114
|
+
message: "Axiom env credentials not found. Set AXIOM_TOKEN (or AXIOM_API_KEY).",
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
const apiBaseUrl = (yield* getEnv("AXIOM_URL")) ?? DEFAULT_API_BASE_URL;
|
|
118
|
+
const orgId = yield* getEnv("AXIOM_ORG_ID");
|
|
119
|
+
if (orgId) {
|
|
120
|
+
return {
|
|
121
|
+
type: "pat",
|
|
122
|
+
apiToken,
|
|
123
|
+
apiBaseUrl,
|
|
124
|
+
orgId,
|
|
125
|
+
source: { type: "env" },
|
|
126
|
+
};
|
|
127
|
+
}
|
|
48
128
|
return {
|
|
49
|
-
type: "
|
|
129
|
+
type: "apiToken",
|
|
50
130
|
apiToken,
|
|
51
131
|
apiBaseUrl,
|
|
52
|
-
orgId,
|
|
53
132
|
source: { type: "env" },
|
|
54
133
|
};
|
|
55
|
-
}
|
|
134
|
+
})), Match.when({ method: "stored" }, () => store.read(profileName, STORAGE_KEY).pipe(Effect.flatMap((creds) => creds == null
|
|
135
|
+
? Effect.fail(new AuthError({
|
|
136
|
+
message: "Axiom stored credentials not found. Run: alchemy login --configure",
|
|
137
|
+
}))
|
|
138
|
+
: Effect.succeed(Match.value(creds).pipe(Match.when({ type: "apiToken" }, (c) => ({
|
|
139
|
+
type: "apiToken",
|
|
140
|
+
apiToken: Redacted.make(c.apiToken),
|
|
141
|
+
apiBaseUrl: c.apiBaseUrl ?? DEFAULT_API_BASE_URL,
|
|
142
|
+
orgId: c.orgId,
|
|
143
|
+
source: { type: "stored" },
|
|
144
|
+
})), Match.when({ type: "pat" }, (c) => ({
|
|
145
|
+
type: "pat",
|
|
146
|
+
apiToken: Redacted.make(c.apiToken),
|
|
147
|
+
apiBaseUrl: c.apiBaseUrl ?? DEFAULT_API_BASE_URL,
|
|
148
|
+
orgId: c.orgId,
|
|
149
|
+
source: { type: "stored" },
|
|
150
|
+
})), Match.exhaustive))))), Match.exhaustive);
|
|
151
|
+
const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: "env" }, () => Effect.void), Match.when({ method: "stored" }, () => store
|
|
152
|
+
.delete(profileName, STORAGE_KEY)
|
|
153
|
+
.pipe(Effect.andThen(Clank.success("Axiom: stored credentials removed")))), Match.exhaustive);
|
|
154
|
+
const login = (profileName, config) => Match.value(config)
|
|
155
|
+
.pipe(Match.when({ method: "env" }, () => Effect.void), Match.when({ method: "stored" }, () => store
|
|
156
|
+
.read(profileName, STORAGE_KEY)
|
|
157
|
+
.pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.exhaustive)
|
|
158
|
+
.pipe(Effect.mapError((e) => new AuthError({ message: "login failed", cause: e })));
|
|
159
|
+
const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {
|
|
160
|
+
const sourceStr = creds.source.details
|
|
161
|
+
? `${creds.source.type} - ${creds.source.details}`
|
|
162
|
+
: creds.source.type;
|
|
163
|
+
return Match.value(creds).pipe(Match.when({ type: "apiToken" }, (c) => Effect.all([
|
|
164
|
+
Console.log(` apiToken: ${displayRedacted(c.apiToken, 9)}`),
|
|
165
|
+
Console.log(` apiBaseUrl: ${c.apiBaseUrl}`),
|
|
166
|
+
Console.log(` orgId: ${c.orgId ?? "(none)"}`),
|
|
167
|
+
Console.log(` source: ${sourceStr}`),
|
|
168
|
+
])), Match.when({ type: "pat" }, (c) => Effect.all([
|
|
169
|
+
Console.log(` apiToken: ${displayRedacted(c.apiToken, 9)}`),
|
|
170
|
+
Console.log(` apiBaseUrl: ${c.apiBaseUrl}`),
|
|
171
|
+
Console.log(` orgId: ${c.orgId}`),
|
|
172
|
+
Console.log(` source: ${sourceStr}`),
|
|
173
|
+
])), Match.exhaustive);
|
|
174
|
+
}), Effect.catch((e) => Console.error(` Failed to retrieve credentials: ${e}`)));
|
|
56
175
|
return {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
176
|
+
configure: configureCredentials,
|
|
177
|
+
logout,
|
|
178
|
+
login,
|
|
179
|
+
prettyPrint,
|
|
180
|
+
read: resolveCredentials,
|
|
61
181
|
};
|
|
62
|
-
}))
|
|
63
|
-
? Effect.fail(new AuthError({
|
|
64
|
-
message: "Axiom stored credentials not found. Run: alchemy login --configure",
|
|
65
|
-
}))
|
|
66
|
-
: Effect.succeed(Match.value(creds).pipe(Match.when({ type: "apiToken" }, (c) => ({
|
|
67
|
-
type: "apiToken",
|
|
68
|
-
apiToken: Redacted.make(c.apiToken),
|
|
69
|
-
apiBaseUrl: c.apiBaseUrl ?? DEFAULT_API_BASE_URL,
|
|
70
|
-
orgId: c.orgId,
|
|
71
|
-
source: { type: "stored" },
|
|
72
|
-
})), Match.when({ type: "pat" }, (c) => ({
|
|
73
|
-
type: "pat",
|
|
74
|
-
apiToken: Redacted.make(c.apiToken),
|
|
75
|
-
apiBaseUrl: c.apiBaseUrl ?? DEFAULT_API_BASE_URL,
|
|
76
|
-
orgId: c.orgId,
|
|
77
|
-
source: { type: "stored" },
|
|
78
|
-
})), Match.exhaustive))))), Match.exhaustive);
|
|
79
|
-
const logout = (profileName, config) => Match.value(config).pipe(Match.when({ method: "env" }, () => Effect.void), Match.when({ method: "stored" }, () => deleteCredentials(profileName, STORAGE_KEY).pipe(Effect.andThen(Clank.success("Axiom: stored credentials removed")))), Match.exhaustive);
|
|
80
|
-
const login = (profileName, config) => Match.value(config)
|
|
81
|
-
.pipe(Match.when({ method: "env" }, () => Effect.void), Match.when({ method: "stored" }, () => readCredentials(profileName, STORAGE_KEY).pipe(Effect.flatMap((creds) => creds == null ? loginStored(profileName) : Effect.void))), Match.exhaustive)
|
|
82
|
-
.pipe(Effect.mapError((e) => new AuthError({ message: "login failed", cause: e })));
|
|
83
|
-
const configureCredentials = (profileName, ctx) => Effect.gen(function* () {
|
|
84
|
-
if (ctx.ci) {
|
|
85
|
-
return { method: "env" };
|
|
86
|
-
}
|
|
87
|
-
return yield* configureInteractive(profileName);
|
|
88
|
-
}).pipe(Effect.mapError((e) => new AuthError({
|
|
89
|
-
message: "failed to configure credentials",
|
|
90
|
-
cause: e,
|
|
91
|
-
})));
|
|
92
|
-
const configureInteractive = (profileName) => Clank.select({
|
|
93
|
-
message: "Axiom authentication method",
|
|
94
|
-
options,
|
|
95
|
-
}).pipe(Effect.flatMap((method) => Match.value(method).pipe(Match.when("env", () => Effect.succeed({ method: "env" })), Match.when("stored", () => loginStored(profileName)), Match.exhaustive)));
|
|
96
|
-
const loginStored = Effect.fnUntraced(function* (profileName) {
|
|
97
|
-
const credentialType = yield* Clank.select({
|
|
98
|
-
message: "Axiom credential type",
|
|
99
|
-
options: [
|
|
100
|
-
{
|
|
101
|
-
value: "apiToken",
|
|
102
|
-
label: "API Token",
|
|
103
|
-
hint: "recommended — scoped to specific datasets/actions",
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
value: "pat",
|
|
107
|
-
label: "Personal Access Token",
|
|
108
|
-
hint: "full account control, requires Org ID",
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
}).pipe(retryOnce);
|
|
112
|
-
const apiBaseUrlPrompt = yield* Clank.text({
|
|
113
|
-
message: "Axiom API Base URL (Enter for default)",
|
|
114
|
-
placeholder: DEFAULT_API_BASE_URL,
|
|
115
|
-
defaultValue: DEFAULT_API_BASE_URL,
|
|
116
|
-
}).pipe(retryOnce);
|
|
117
|
-
const apiBaseUrl = apiBaseUrlPrompt && apiBaseUrlPrompt.length > 0
|
|
118
|
-
? apiBaseUrlPrompt
|
|
119
|
-
: undefined;
|
|
120
|
-
return yield* Match.value(credentialType).pipe(Match.when("apiToken", () => Effect.gen(function* () {
|
|
121
|
-
const apiToken = yield* Clank.password({
|
|
122
|
-
message: "Axiom API Token",
|
|
123
|
-
validate: (v) => (v.length === 0 ? "Required" : undefined),
|
|
124
|
-
}).pipe(retryOnce);
|
|
125
|
-
const orgId = yield* promptOrgId(false);
|
|
126
|
-
yield* writeCredentials(profileName, STORAGE_KEY, {
|
|
127
|
-
type: "apiToken",
|
|
128
|
-
apiToken,
|
|
129
|
-
apiBaseUrl,
|
|
130
|
-
orgId: orgId && orgId.length > 0 ? orgId : undefined,
|
|
131
|
-
});
|
|
132
|
-
yield* Clank.success("Axiom: credentials saved.");
|
|
133
|
-
return {
|
|
134
|
-
method: "stored",
|
|
135
|
-
credentialType: "apiToken",
|
|
136
|
-
};
|
|
137
|
-
})), Match.when("pat", () => Effect.gen(function* () {
|
|
138
|
-
const apiToken = yield* Clank.password({
|
|
139
|
-
message: "Axiom Personal Access Token",
|
|
140
|
-
validate: (v) => (v.length === 0 ? "Required" : undefined),
|
|
141
|
-
}).pipe(retryOnce);
|
|
142
|
-
const orgId = yield* promptOrgId(true);
|
|
143
|
-
yield* writeCredentials(profileName, STORAGE_KEY, { type: "pat", apiToken, apiBaseUrl, orgId });
|
|
144
|
-
yield* Clank.success("Axiom: credentials saved.");
|
|
145
|
-
return {
|
|
146
|
-
method: "stored",
|
|
147
|
-
credentialType: "pat",
|
|
148
|
-
};
|
|
149
|
-
})), Match.exhaustive);
|
|
150
|
-
});
|
|
151
|
-
const promptOrgId = (required) => getEnv("AXIOM_ORG_ID").pipe(Effect.flatMap((envOrgId) => Clank.text({
|
|
152
|
-
message: required
|
|
153
|
-
? "Axiom Org ID (required for PAT)"
|
|
154
|
-
: "Axiom Org ID (Enter to skip)",
|
|
155
|
-
placeholder: envOrgId ?? "",
|
|
156
|
-
defaultValue: envOrgId ?? "",
|
|
157
|
-
validate: required
|
|
158
|
-
? (v) => (v.length === 0 ? "Required" : undefined)
|
|
159
|
-
: undefined,
|
|
160
|
-
}).pipe(retryOnce)));
|
|
161
|
-
const prettyPrint = (profileName, config) => resolveCredentials(profileName, config).pipe(Effect.tap((creds) => {
|
|
162
|
-
const sourceStr = creds.source.details
|
|
163
|
-
? `${creds.source.type} - ${creds.source.details}`
|
|
164
|
-
: creds.source.type;
|
|
165
|
-
return Match.value(creds).pipe(Match.when({ type: "apiToken" }, (c) => Effect.all([
|
|
166
|
-
Console.log(` apiToken: ${displayRedacted(c.apiToken, 9)}`),
|
|
167
|
-
Console.log(` apiBaseUrl: ${c.apiBaseUrl}`),
|
|
168
|
-
Console.log(` orgId: ${c.orgId ?? "(none)"}`),
|
|
169
|
-
Console.log(` source: ${sourceStr}`),
|
|
170
|
-
])), Match.when({ type: "pat" }, (c) => Effect.all([
|
|
171
|
-
Console.log(` apiToken: ${displayRedacted(c.apiToken, 9)}`),
|
|
172
|
-
Console.log(` apiBaseUrl: ${c.apiBaseUrl}`),
|
|
173
|
-
Console.log(` orgId: ${c.orgId}`),
|
|
174
|
-
Console.log(` source: ${sourceStr}`),
|
|
175
|
-
])), Match.exhaustive);
|
|
176
|
-
}), Effect.catch((e) => Console.error(` Failed to retrieve credentials: ${e}`)));
|
|
182
|
+
}));
|
|
177
183
|
//# sourceMappingURL=AuthProvider.js.map
|