alchemy 2.0.0-beta.25 → 2.0.0-beta.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/alchemy.d.ts +2 -0
- package/bin/alchemy.d.ts.map +1 -0
- package/bin/alchemy.js +3 -57288
- package/bin/alchemy.js.map +1 -1
- package/bin/alchemy.ts +3 -59
- package/bin/exec.d.ts +2 -0
- package/bin/exec.d.ts.map +1 -0
- package/bin/exec.js +2360 -0
- package/bin/exec.js.map +1 -0
- package/bin/exec.ts +3 -21
- package/lib/AWS/AuthProvider.d.ts +1 -1
- package/lib/AWS/AuthProvider.d.ts.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/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Auth/AuthProvider.js +20 -3
- package/lib/Auth/AuthProvider.js.map +1 -1
- package/lib/Auth/Lock.d.ts +12 -0
- package/lib/Auth/Lock.d.ts.map +1 -0
- package/lib/Auth/Lock.js +27 -0
- package/lib/Auth/Lock.js.map +1 -0
- package/lib/Axiom/AuthProvider.d.ts +1 -1
- package/lib/Axiom/AuthProvider.d.ts.map +1 -1
- package/lib/Axiom/Credentials.d.ts +1 -1
- package/lib/Axiom/Credentials.d.ts.map +1 -1
- package/lib/Bundle/Bundle.d.ts +3 -3
- package/lib/Cli/commands/_shared.d.ts +51 -0
- package/lib/Cli/commands/_shared.d.ts.map +1 -0
- package/lib/Cli/commands/_shared.js +176 -0
- package/lib/Cli/commands/_shared.js.map +1 -0
- package/lib/Cli/commands/bootstrap.d.ts +6 -0
- package/lib/Cli/commands/bootstrap.d.ts.map +1 -0
- package/lib/Cli/commands/bootstrap.js +106 -0
- package/lib/Cli/commands/bootstrap.js.map +1 -0
- package/lib/Cli/commands/deploy.d.ts +56 -0
- package/lib/Cli/commands/deploy.d.ts.map +1 -0
- package/lib/Cli/commands/deploy.js +128 -0
- package/lib/Cli/commands/deploy.js.map +1 -0
- package/lib/Cli/commands/dev.d.ts +10 -0
- package/lib/Cli/commands/dev.d.ts.map +1 -0
- package/lib/Cli/commands/dev.js +45 -0
- package/lib/Cli/commands/dev.js.map +1 -0
- package/lib/Cli/commands/login.d.ts +10 -0
- package/lib/Cli/commands/login.d.ts.map +1 -0
- package/lib/Cli/commands/login.js +59 -0
- package/lib/Cli/commands/login.js.map +1 -0
- package/lib/Cli/commands/logs.d.ts +12 -0
- package/lib/Cli/commands/logs.d.ts.map +1 -0
- package/lib/Cli/commands/logs.js +99 -0
- package/lib/Cli/commands/logs.js.map +1 -0
- package/lib/Cli/commands/profile.d.ts +3 -0
- package/lib/Cli/commands/profile.d.ts.map +1 -0
- package/lib/Cli/commands/profile.js +76 -0
- package/lib/Cli/commands/profile.js.map +1 -0
- package/lib/Cli/commands/state.d.ts +3 -0
- package/lib/Cli/commands/state.d.ts.map +1 -0
- package/lib/Cli/commands/state.js +221 -0
- package/lib/Cli/commands/state.js.map +1 -0
- package/lib/Cli/commands/tail.d.ts +9 -0
- package/lib/Cli/commands/tail.d.ts.map +1 -0
- package/lib/Cli/commands/tail.js +93 -0
- package/lib/Cli/commands/tail.js.map +1 -0
- package/lib/Cli/exec.d.ts +3 -0
- package/lib/Cli/exec.d.ts.map +1 -0
- package/lib/Cli/exec.js +12 -0
- package/lib/Cli/exec.js.map +1 -0
- package/lib/Cli/index.d.ts +2 -1
- package/lib/Cli/index.d.ts.map +1 -1
- package/lib/Cli/index.js +2 -5
- package/lib/Cli/index.js.map +1 -1
- package/lib/Cli/main.d.ts +3 -0
- package/lib/Cli/main.d.ts.map +1 -0
- package/lib/Cli/main.js +40 -0
- package/lib/Cli/main.js.map +1 -0
- package/lib/Cli/{InkCLI.d.ts → tui/InkCLI.d.ts} +1 -1
- package/lib/Cli/tui/InkCLI.d.ts.map +1 -0
- package/lib/Cli/{InkCLI.js → tui/InkCLI.js} +1 -1
- package/lib/Cli/tui/InkCLI.js.map +1 -0
- package/lib/Cli/{components → tui/components}/ApprovePlan.d.ts +1 -1
- package/lib/Cli/tui/components/ApprovePlan.d.ts.map +1 -0
- package/lib/Cli/tui/components/ApprovePlan.js.map +1 -0
- package/lib/Cli/{components → tui/components}/Plan.d.ts +1 -1
- package/lib/Cli/tui/components/Plan.d.ts.map +1 -0
- package/lib/Cli/{components → tui/components}/Plan.js +1 -1
- package/lib/Cli/tui/components/Plan.js.map +1 -0
- package/lib/Cli/{components → tui/components}/PlanProgress.d.ts +3 -3
- package/lib/Cli/tui/components/PlanProgress.d.ts.map +1 -0
- package/lib/Cli/{components → tui/components}/PlanProgress.js +1 -1
- package/lib/Cli/tui/components/PlanProgress.js.map +1 -0
- package/lib/Cloudflare/ApiToken/AccountApiToken.d.ts +1 -1
- package/lib/Cloudflare/ApiToken/AccountApiToken.d.ts.map +1 -1
- package/lib/Cloudflare/ApiToken/UserApiToken.d.ts +1 -1
- package/lib/Cloudflare/ApiToken/UserApiToken.d.ts.map +1 -1
- package/lib/Cloudflare/Auth/AuthProvider.d.ts +1 -1
- package/lib/Cloudflare/Auth/AuthProvider.d.ts.map +1 -1
- package/lib/Cloudflare/Auth/AuthProvider.js +0 -4
- package/lib/Cloudflare/Auth/AuthProvider.js.map +1 -1
- package/lib/Cloudflare/CloudflareEnvironment.d.ts +1 -1
- package/lib/Cloudflare/CloudflareEnvironment.d.ts.map +1 -1
- package/lib/Cloudflare/Container/ContainerApplication.d.ts +1 -1
- package/lib/Cloudflare/Container/ContainerApplication.d.ts.map +1 -1
- package/lib/Cloudflare/Credentials.d.ts +1 -1
- package/lib/Cloudflare/Credentials.d.ts.map +1 -1
- package/lib/Cloudflare/D1/D1Clone.d.ts +1 -1
- package/lib/Cloudflare/D1/D1Clone.d.ts.map +1 -1
- package/lib/Cloudflare/D1/D1Import.d.ts +1 -1
- package/lib/Cloudflare/D1/D1Import.d.ts.map +1 -1
- package/lib/Cloudflare/D1/D1Migrations.d.ts +1 -1
- package/lib/Cloudflare/D1/D1Migrations.d.ts.map +1 -1
- package/lib/Cloudflare/KV/KVNamespace.d.ts +1 -1
- package/lib/Cloudflare/KV/KVNamespace.d.ts.map +1 -1
- package/lib/Cloudflare/Logs.d.ts +1 -1
- package/lib/Cloudflare/Logs.d.ts.map +1 -1
- package/lib/Cloudflare/Queue/Queue.d.ts +1 -1
- package/lib/Cloudflare/Queue/Queue.d.ts.map +1 -1
- package/lib/Cloudflare/Queue/QueueConsumer.d.ts +1 -1
- package/lib/Cloudflare/Queue/QueueConsumer.d.ts.map +1 -1
- package/lib/Cloudflare/SecretsStore/Secret.d.ts +1 -1
- package/lib/Cloudflare/SecretsStore/Secret.d.ts.map +1 -1
- package/lib/Cloudflare/SecretsStore/SecretsStore.d.ts +1 -1
- package/lib/Cloudflare/SecretsStore/SecretsStore.d.ts.map +1 -1
- package/lib/Cloudflare/SecretsStore/SecretsStore.js +5 -5
- package/lib/Cloudflare/SecretsStore/SecretsStore.js.map +1 -1
- package/lib/Cloudflare/StateStore/Api.d.ts +13 -0
- package/lib/Cloudflare/StateStore/Api.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/Api.js +15 -2
- package/lib/Cloudflare/StateStore/Api.js.map +1 -1
- package/lib/Cloudflare/StateStore/State.d.ts +3 -3
- package/lib/Cloudflare/StateStore/State.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/State.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/Worker.d.ts +2 -2
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +14 -12
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/Workers/Workflow.d.ts +1 -1
- package/lib/Cloudflare/Workers/Workflow.d.ts.map +1 -1
- package/lib/Deploy.d.ts +1 -1
- package/lib/Deploy.d.ts.map +1 -1
- package/lib/Destroy.d.ts +1 -1
- package/lib/Destroy.d.ts.map +1 -1
- package/lib/GitHub/AuthProvider.d.ts +1 -1
- package/lib/GitHub/AuthProvider.d.ts.map +1 -1
- package/lib/GitHub/Credentials.d.ts +1 -1
- package/lib/GitHub/Credentials.d.ts.map +1 -1
- package/lib/GitHub/Providers.d.ts +1 -1
- package/lib/GitHub/Providers.d.ts.map +1 -1
- package/lib/Output.d.ts.map +1 -1
- package/lib/Output.js +13 -2
- package/lib/Output.js.map +1 -1
- package/lib/Provider.d.ts +1 -1
- package/lib/Provider.d.ts.map +1 -1
- package/lib/Stack.js +2 -2
- package/lib/Stack.js.map +1 -1
- package/lib/Telemetry/Layer.d.ts.map +1 -1
- package/lib/Telemetry/Layer.js +13 -1
- package/lib/Telemetry/Layer.js.map +1 -1
- package/lib/Test/Bun.d.ts +59 -28
- package/lib/Test/Bun.d.ts.map +1 -1
- package/lib/Test/Bun.js +77 -81
- package/lib/Test/Bun.js.map +1 -1
- package/lib/Test/Core.d.ts +73 -0
- package/lib/Test/Core.d.ts.map +1 -0
- package/lib/Test/Core.js +98 -0
- package/lib/Test/Core.js.map +1 -0
- package/lib/Test/Vitest.d.ts +53 -72
- package/lib/Test/Vitest.d.ts.map +1 -1
- package/lib/Test/Vitest.js +73 -232
- package/lib/Test/Vitest.js.map +1 -1
- package/lib/Test/index.d.ts +0 -1
- package/lib/Test/index.d.ts.map +1 -1
- package/lib/Test/index.js +0 -1
- package/lib/Test/index.js.map +1 -1
- package/lib/Util/index.d.ts +1 -0
- package/lib/Util/index.d.ts.map +1 -1
- package/lib/Util/index.js +1 -0
- package/lib/Util/index.js.map +1 -1
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.test.tsbuildinfo +1 -0
- package/package.json +68 -52
- package/src/Auth/AuthProvider.ts +22 -4
- package/src/Auth/Lock.ts +35 -0
- package/{bin → src/Cli}/commands/_shared.ts +5 -5
- package/{bin → src/Cli}/commands/bootstrap.ts +18 -14
- package/{bin → src/Cli}/commands/deploy.ts +16 -16
- package/{bin → src/Cli}/commands/dev.ts +13 -3
- package/{bin → src/Cli}/commands/login.ts +9 -9
- package/{bin → src/Cli}/commands/logs.ts +11 -11
- package/{bin → src/Cli}/commands/profile.ts +8 -8
- package/{bin → src/Cli}/commands/state.ts +47 -26
- package/{bin → src/Cli}/commands/tail.ts +11 -11
- package/src/Cli/exec.ts +23 -0
- package/src/Cli/index.ts +2 -5
- package/src/Cli/main.ts +60 -0
- package/src/Cli/{InkCLI.tsx → tui/InkCLI.tsx} +3 -3
- package/src/Cli/{components → tui/components}/ApprovePlan.tsx +1 -1
- package/src/Cli/{components → tui/components}/Plan.tsx +6 -2
- package/src/Cli/{components → tui/components}/PlanProgress.tsx +7 -3
- package/src/Cloudflare/Auth/AuthProvider.ts +0 -5
- package/src/Cloudflare/SecretsStore/SecretsStore.ts +5 -5
- package/src/Cloudflare/StateStore/Api.ts +15 -2
- package/src/Cloudflare/StateStore/State.ts +3 -9
- package/src/Cloudflare/Workers/Worker.ts +29 -44
- package/src/Output.ts +10 -2
- package/src/Provider.ts +1 -1
- package/src/Stack.ts +2 -2
- package/src/Telemetry/Layer.ts +13 -1
- package/src/Test/Bun.ts +164 -140
- package/src/Test/Core.ts +225 -0
- package/src/Test/Vitest.ts +157 -509
- package/src/Test/index.ts +0 -1
- package/src/Util/index.ts +1 -0
- package/src/index.ts +14 -0
- package/lib/Cli/InkCLI.d.ts.map +0 -1
- package/lib/Cli/InkCLI.js.map +0 -1
- package/lib/Cli/components/ApprovePlan.d.ts.map +0 -1
- package/lib/Cli/components/ApprovePlan.js.map +0 -1
- package/lib/Cli/components/Plan.d.ts.map +0 -1
- package/lib/Cli/components/Plan.js.map +0 -1
- package/lib/Cli/components/PlanProgress.d.ts.map +0 -1
- package/lib/Cli/components/PlanProgress.js.map +0 -1
- package/lib/cli/index.d.ts +0 -413
- package/lib/cli/index.d.ts.map +0 -1
- package/lib/cli/index.js +0 -10
- package/lib/cli/index.js.map +0 -1
- /package/lib/Cli/{components → tui/components}/ApprovePlan.js +0 -0
|
@@ -7,23 +7,23 @@ import * as Layer from "effect/Layer";
|
|
|
7
7
|
import * as Logger from "effect/Logger";
|
|
8
8
|
import { Command, Flag } from "effect/unstable/cli";
|
|
9
9
|
|
|
10
|
-
import { AuthProviders } from "
|
|
10
|
+
import { AuthProviders } from "../..//Auth/AuthProvider";
|
|
11
11
|
import {
|
|
12
12
|
getProfile,
|
|
13
13
|
setProfile,
|
|
14
14
|
withProfileOverride,
|
|
15
|
-
} from "
|
|
16
|
-
import { Stage } from "
|
|
17
|
-
import * as State from "
|
|
18
|
-
import { loadConfigProvider } from "
|
|
19
|
-
import { fileLogger } from "
|
|
15
|
+
} from "../..//Auth/Profile";
|
|
16
|
+
import { Stage } from "../..//Stage";
|
|
17
|
+
import * as State from "../..//State/index";
|
|
18
|
+
import { loadConfigProvider } from "../..//Util/ConfigProvider";
|
|
19
|
+
import { fileLogger } from "../..//Util/FileLogger";
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
22
|
envFile,
|
|
23
23
|
importStack,
|
|
24
24
|
instrumentCommand,
|
|
25
|
-
main,
|
|
26
25
|
profile,
|
|
26
|
+
script,
|
|
27
27
|
stage,
|
|
28
28
|
} from "./_shared.ts";
|
|
29
29
|
|
|
@@ -37,7 +37,7 @@ const loginConfigure = Flag.boolean("configure").pipe(
|
|
|
37
37
|
export const loginCommand = Command.make(
|
|
38
38
|
"login",
|
|
39
39
|
{
|
|
40
|
-
main,
|
|
40
|
+
main: script,
|
|
41
41
|
envFile,
|
|
42
42
|
stage,
|
|
43
43
|
profile,
|
|
@@ -67,7 +67,7 @@ export const loginCommand = Command.make(
|
|
|
67
67
|
ConfigProvider.layer(
|
|
68
68
|
withProfileOverride(yield* loadConfigProvider(envFile), profile),
|
|
69
69
|
),
|
|
70
|
-
Logger.layer([fileLogger("out")]),
|
|
70
|
+
Logger.layer([fileLogger("out")], { mergeWithExisting: true }),
|
|
71
71
|
Layer.succeed(Stage, stage),
|
|
72
72
|
State.localState(),
|
|
73
73
|
);
|
|
@@ -6,24 +6,24 @@ import * as Logger from "effect/Logger";
|
|
|
6
6
|
import * as Option from "effect/Option";
|
|
7
7
|
import { Command, Flag } from "effect/unstable/cli";
|
|
8
8
|
|
|
9
|
-
import { findProviderByType, type LogLine } from "
|
|
10
|
-
import { Stage } from "
|
|
11
|
-
import * as State from "
|
|
12
|
-
import { loadConfigProvider } from "
|
|
13
|
-
import { fileLogger } from "
|
|
14
|
-
|
|
15
|
-
import { AuthProviders } from "
|
|
16
|
-
import { withProfileOverride } from "
|
|
9
|
+
import { findProviderByType, type LogLine } from "../..//Provider";
|
|
10
|
+
import { Stage } from "../..//Stage";
|
|
11
|
+
import * as State from "../..//State/index";
|
|
12
|
+
import { loadConfigProvider } from "../..//Util/ConfigProvider";
|
|
13
|
+
import { fileLogger } from "../..//Util/FileLogger";
|
|
14
|
+
|
|
15
|
+
import { AuthProviders } from "../..//Auth/AuthProvider";
|
|
16
|
+
import { withProfileOverride } from "../..//Auth/Profile";
|
|
17
17
|
import {
|
|
18
18
|
envFile,
|
|
19
19
|
formatLocalTimestamp,
|
|
20
20
|
importStack,
|
|
21
21
|
instrumentCommand,
|
|
22
|
-
main,
|
|
23
22
|
parseResourceFilter,
|
|
24
23
|
parseSince,
|
|
25
24
|
profile,
|
|
26
25
|
resourceFilter,
|
|
26
|
+
script,
|
|
27
27
|
stage,
|
|
28
28
|
TAIL_COLORS,
|
|
29
29
|
TAIL_RESET,
|
|
@@ -45,7 +45,7 @@ const logsSince = Flag.string("since").pipe(
|
|
|
45
45
|
export const logsCommand = Command.make(
|
|
46
46
|
"logs",
|
|
47
47
|
{
|
|
48
|
-
main,
|
|
48
|
+
main: script,
|
|
49
49
|
envFile,
|
|
50
50
|
stage,
|
|
51
51
|
profile,
|
|
@@ -79,7 +79,7 @@ export const logsCommand = Command.make(
|
|
|
79
79
|
),
|
|
80
80
|
Layer.succeed(AuthProviders, {}),
|
|
81
81
|
Layer.succeed(Stage, stage),
|
|
82
|
-
Logger.layer([fileLogger("out")]),
|
|
82
|
+
Logger.layer([fileLogger("out")], { mergeWithExisting: true }),
|
|
83
83
|
State.localState(),
|
|
84
84
|
);
|
|
85
85
|
|
|
@@ -5,18 +5,18 @@ import * as Layer from "effect/Layer";
|
|
|
5
5
|
import * as Logger from "effect/Logger";
|
|
6
6
|
import { Command } from "effect/unstable/cli";
|
|
7
7
|
|
|
8
|
-
import { AuthProviders } from "
|
|
9
|
-
import { deleteProfileCredentials } from "
|
|
8
|
+
import { AuthProviders } from "../..//Auth/AuthProvider";
|
|
9
|
+
import { deleteProfileCredentials } from "../..//Auth/Credentials";
|
|
10
10
|
import {
|
|
11
11
|
deleteProfile,
|
|
12
12
|
getProfile,
|
|
13
13
|
readConfig,
|
|
14
14
|
withProfileOverride,
|
|
15
|
-
} from "
|
|
16
|
-
import { AwsAuth } from "
|
|
17
|
-
import { CloudflareAuth } from "
|
|
18
|
-
import { loadConfigProvider } from "
|
|
19
|
-
import { fileLogger } from "../../
|
|
15
|
+
} from "../..//Auth/Profile";
|
|
16
|
+
import { AwsAuth } from "../..//AWS/AuthProvider";
|
|
17
|
+
import { CloudflareAuth } from "../..//Cloudflare/Auth/AuthProvider";
|
|
18
|
+
import { loadConfigProvider } from "../..//Util/ConfigProvider";
|
|
19
|
+
import { fileLogger } from "../../Util/FileLogger";
|
|
20
20
|
|
|
21
21
|
import { envFile, instrumentCommand, profile } from "./_shared.ts";
|
|
22
22
|
|
|
@@ -55,7 +55,7 @@ const showCommand = Command.make(
|
|
|
55
55
|
ConfigProvider.layer(
|
|
56
56
|
withProfileOverride(yield* loadConfigProvider(envFile), profile),
|
|
57
57
|
),
|
|
58
|
-
Logger.layer([fileLogger("out")]),
|
|
58
|
+
Logger.layer([fileLogger("out")], { mergeWithExisting: true }),
|
|
59
59
|
// Building these layers triggers their AuthProviderLayer effect, which
|
|
60
60
|
// registers the provider into the shared `authProviders` registry.
|
|
61
61
|
Layer.provide(Layer.mergeAll(CloudflareAuth, AwsAuth), authRegistry),
|
|
@@ -6,21 +6,21 @@ import * as Logger from "effect/Logger";
|
|
|
6
6
|
import * as Option from "effect/Option";
|
|
7
7
|
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
8
8
|
|
|
9
|
-
import { AuthProviders } from "../../
|
|
10
|
-
import { withProfileOverride } from "../../
|
|
11
|
-
import { Stage } from "../../
|
|
12
|
-
import * as State from "../../
|
|
13
|
-
import { encodeState } from "../../
|
|
14
|
-
import * as Clank from "../../
|
|
15
|
-
import { loadConfigProvider } from "../../
|
|
16
|
-
import { fileLogger } from "../../
|
|
9
|
+
import { AuthProviders } from "../../Auth/AuthProvider";
|
|
10
|
+
import { withProfileOverride } from "../../Auth/Profile";
|
|
11
|
+
import { Stage } from "../../Stage";
|
|
12
|
+
import * as State from "../../State/index";
|
|
13
|
+
import { encodeState } from "../../State/StateEncoding";
|
|
14
|
+
import * as Clank from "../../Util/Clank";
|
|
15
|
+
import { loadConfigProvider } from "../../Util/ConfigProvider";
|
|
16
|
+
import { fileLogger } from "../../Util/FileLogger";
|
|
17
17
|
|
|
18
18
|
import {
|
|
19
19
|
envFile,
|
|
20
20
|
importStack,
|
|
21
21
|
instrumentCommand,
|
|
22
|
-
main,
|
|
23
22
|
profile,
|
|
23
|
+
script,
|
|
24
24
|
stage,
|
|
25
25
|
yes,
|
|
26
26
|
} from "./_shared.ts";
|
|
@@ -79,7 +79,7 @@ const withStateService = <A, E>(
|
|
|
79
79
|
args.profile,
|
|
80
80
|
),
|
|
81
81
|
),
|
|
82
|
-
Logger.layer([fileLogger("out")]),
|
|
82
|
+
Logger.layer([fileLogger("out")], { mergeWithExisting: true }),
|
|
83
83
|
Layer.succeed(Stage, args.stage),
|
|
84
84
|
// When --local is set we still build the stack to get its other
|
|
85
85
|
// services, but force State to be LocalState. Without --local the
|
|
@@ -98,7 +98,7 @@ const withStateService = <A, E>(
|
|
|
98
98
|
|
|
99
99
|
const stacksCommand = Command.make(
|
|
100
100
|
"stacks",
|
|
101
|
-
{ main, envFile, stage, profile, local: localFlag },
|
|
101
|
+
{ main: script, envFile, stage, profile, local: localFlag },
|
|
102
102
|
instrumentCommand("state.stacks")(
|
|
103
103
|
Effect.fnUntraced(function* (args) {
|
|
104
104
|
yield* withStateService(args, (state) =>
|
|
@@ -119,7 +119,7 @@ const stacksCommand = Command.make(
|
|
|
119
119
|
|
|
120
120
|
const stagesCommand = Command.make(
|
|
121
121
|
"stages",
|
|
122
|
-
{ stack: stackArg, main, envFile, stage, profile, local: localFlag },
|
|
122
|
+
{ stack: stackArg, main: script, envFile, stage, profile, local: localFlag },
|
|
123
123
|
instrumentCommand("state.stages")(
|
|
124
124
|
Effect.fnUntraced(function* ({ stack: stackName, ...rest }) {
|
|
125
125
|
yield* withStateService(rest, (state) =>
|
|
@@ -145,7 +145,7 @@ const resourcesCommand = Command.make(
|
|
|
145
145
|
stageName: Argument.string("stage").pipe(
|
|
146
146
|
Argument.withDescription("Stage to list resources from"),
|
|
147
147
|
),
|
|
148
|
-
main,
|
|
148
|
+
main: script,
|
|
149
149
|
envFile,
|
|
150
150
|
stage,
|
|
151
151
|
profile,
|
|
@@ -180,7 +180,7 @@ const getCommand = Command.make(
|
|
|
180
180
|
Argument.withDescription("Stage the resource lives in"),
|
|
181
181
|
),
|
|
182
182
|
fqn: fqnArg,
|
|
183
|
-
main,
|
|
183
|
+
main: script,
|
|
184
184
|
envFile,
|
|
185
185
|
stage,
|
|
186
186
|
profile,
|
|
@@ -216,7 +216,7 @@ const getCommand = Command.make(
|
|
|
216
216
|
|
|
217
217
|
const treeCommand = Command.make(
|
|
218
218
|
"tree",
|
|
219
|
-
{ main, envFile, stage, profile, local: localFlag },
|
|
219
|
+
{ main: script, envFile, stage, profile, local: localFlag },
|
|
220
220
|
instrumentCommand("state.tree")(
|
|
221
221
|
Effect.fnUntraced(function* (args) {
|
|
222
222
|
yield* withStateService(args, (state) =>
|
|
@@ -226,24 +226,45 @@ const treeCommand = Command.make(
|
|
|
226
226
|
yield* Console.log("(empty state store)");
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
|
-
for
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
// Fetch the entire tree in parallel: for each stack, list its
|
|
230
|
+
// stages; for each (stack, stage), list its resources. All
|
|
231
|
+
// network round-trips happen concurrently; output is rendered
|
|
232
|
+
// once at the end so the user doesn't see stuttered partial
|
|
233
|
+
// output.
|
|
234
|
+
const tree = yield* Effect.forEach(
|
|
235
|
+
stacks,
|
|
236
|
+
(stk) =>
|
|
237
|
+
Effect.gen(function* () {
|
|
238
|
+
const stages = [...(yield* state.listStages(stk))].sort();
|
|
239
|
+
const stageEntries = yield* Effect.forEach(
|
|
240
|
+
stages,
|
|
241
|
+
(stg) =>
|
|
242
|
+
Effect.map(
|
|
243
|
+
state.list({ stack: stk, stage: stg }),
|
|
244
|
+
(fqns) => ({ stage: stg, fqns: [...fqns].sort() }),
|
|
245
|
+
),
|
|
246
|
+
{ concurrency: "unbounded" },
|
|
247
|
+
);
|
|
248
|
+
return { stack: stk, stages: stageEntries };
|
|
249
|
+
}),
|
|
250
|
+
{ concurrency: "unbounded" },
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
const lines: string[] = [];
|
|
254
|
+
for (const { stack: stk, stages } of tree) {
|
|
255
|
+
lines.push(stk);
|
|
232
256
|
for (let i = 0; i < stages.length; i++) {
|
|
233
|
-
const stg = stages[i]!;
|
|
257
|
+
const { stage: stg, fqns } = stages[i]!;
|
|
234
258
|
const stageBranch = i === stages.length - 1 ? "└─" : "├─";
|
|
235
|
-
|
|
259
|
+
lines.push(`${stageBranch} ${stg}`);
|
|
236
260
|
const indent = i === stages.length - 1 ? " " : "│ ";
|
|
237
|
-
const fqns = [
|
|
238
|
-
...(yield* state.list({ stack: stk, stage: stg })),
|
|
239
|
-
].sort();
|
|
240
261
|
for (let j = 0; j < fqns.length; j++) {
|
|
241
|
-
const fqn = fqns[j]!;
|
|
242
262
|
const leaf = j === fqns.length - 1 ? "└─" : "├─";
|
|
243
|
-
|
|
263
|
+
lines.push(`${indent}${leaf} ${fqns[j]}`);
|
|
244
264
|
}
|
|
245
265
|
}
|
|
246
266
|
}
|
|
267
|
+
yield* Console.log(lines.join("\n"));
|
|
247
268
|
}),
|
|
248
269
|
);
|
|
249
270
|
}),
|
|
@@ -274,7 +295,7 @@ const clearCommand = Command.make(
|
|
|
274
295
|
{
|
|
275
296
|
stack: clearStackArg,
|
|
276
297
|
stageName: clearStageArg,
|
|
277
|
-
main,
|
|
298
|
+
main: script,
|
|
278
299
|
envFile,
|
|
279
300
|
stage,
|
|
280
301
|
profile,
|
|
@@ -6,23 +6,23 @@ import * as Logger from "effect/Logger";
|
|
|
6
6
|
import * as Stream from "effect/Stream";
|
|
7
7
|
import * as Command from "effect/unstable/cli/Command";
|
|
8
8
|
|
|
9
|
-
import { findProviderByType, type LogLine } from "
|
|
10
|
-
import { Stage } from "
|
|
11
|
-
import * as State from "
|
|
12
|
-
import { loadConfigProvider } from "
|
|
13
|
-
import { fileLogger } from "
|
|
14
|
-
|
|
15
|
-
import { AuthProviders } from "
|
|
16
|
-
import { withProfileOverride } from "
|
|
9
|
+
import { findProviderByType, type LogLine } from "../..//Provider";
|
|
10
|
+
import { Stage } from "../..//Stage";
|
|
11
|
+
import * as State from "../..//State/index";
|
|
12
|
+
import { loadConfigProvider } from "../..//Util/ConfigProvider";
|
|
13
|
+
import { fileLogger } from "../..//Util/FileLogger";
|
|
14
|
+
|
|
15
|
+
import { AuthProviders } from "../..//Auth/AuthProvider";
|
|
16
|
+
import { withProfileOverride } from "../..//Auth/Profile";
|
|
17
17
|
import {
|
|
18
18
|
envFile,
|
|
19
19
|
formatLocalTimestamp,
|
|
20
20
|
importStack,
|
|
21
21
|
instrumentCommand,
|
|
22
|
-
main,
|
|
23
22
|
parseResourceFilter,
|
|
24
23
|
profile,
|
|
25
24
|
resourceFilter,
|
|
25
|
+
script,
|
|
26
26
|
stage,
|
|
27
27
|
TAIL_COLORS,
|
|
28
28
|
TAIL_RESET,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
export const tailCommand = Command.make(
|
|
32
32
|
"tail",
|
|
33
33
|
{
|
|
34
|
-
main,
|
|
34
|
+
main: script,
|
|
35
35
|
envFile,
|
|
36
36
|
stage,
|
|
37
37
|
profile,
|
|
@@ -54,7 +54,7 @@ export const tailCommand = Command.make(
|
|
|
54
54
|
),
|
|
55
55
|
Layer.succeed(AuthProviders, {}),
|
|
56
56
|
Layer.succeed(Stage, stage),
|
|
57
|
-
Logger.layer([fileLogger("out")]),
|
|
57
|
+
Logger.layer([fileLogger("out")], { mergeWithExisting: true }),
|
|
58
58
|
State.localState(),
|
|
59
59
|
);
|
|
60
60
|
|
package/src/Cli/exec.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AlchemyContextLive } from "alchemy/AlchemyContext";
|
|
2
|
+
import { PlatformServices } from "alchemy/Util";
|
|
3
|
+
import * as ConfigProvider from "effect/ConfigProvider";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Layer from "effect/Layer";
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
|
|
8
|
+
import { execStack, ExecStackOptions } from "./commands/deploy.ts";
|
|
9
|
+
import { inkCLI } from "./tui/InkCLI.tsx";
|
|
10
|
+
|
|
11
|
+
const services = Layer.mergeAll(
|
|
12
|
+
Layer.provideMerge(AlchemyContextLive, PlatformServices),
|
|
13
|
+
FetchHttpClient.layer,
|
|
14
|
+
ConfigProvider.layer(ConfigProvider.fromEnv()),
|
|
15
|
+
inkCLI(),
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export const exec = () =>
|
|
19
|
+
execStack(
|
|
20
|
+
Schema.decodeSync(ExecStackOptions)(
|
|
21
|
+
JSON.parse(process.env.ALCHEMY_EXEC_OPTIONS!),
|
|
22
|
+
),
|
|
23
|
+
).pipe(Effect.provide(services), Effect.scoped);
|
package/src/Cli/index.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
|
|
3
|
-
// `react`/`ink`, which we do not want consumers of `alchemy/Cli` to
|
|
4
|
-
// transitively depend on. Import `alchemy/Cli/InkCLI` directly when needed
|
|
5
|
-
// (currently only from `bin/alchemy.ts`, which is bundled).
|
|
1
|
+
export * from "./exec.ts";
|
|
2
|
+
export * from "./main.ts";
|
package/src/Cli/main.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as ConfigProvider from "effect/ConfigProvider";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Command from "effect/unstable/cli/Command";
|
|
5
|
+
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
|
|
6
|
+
|
|
7
|
+
import { AlchemyContextLive } from "alchemy/AlchemyContext";
|
|
8
|
+
import { TelemetryLive } from "alchemy/Telemetry/Layer";
|
|
9
|
+
import { PlatformServices } from "alchemy/Util/PlatformServices";
|
|
10
|
+
import packageJson from "../../package.json" with { type: "json" };
|
|
11
|
+
|
|
12
|
+
import { handleCancellation } from "./commands/_shared.ts";
|
|
13
|
+
import { bootstrapCommand } from "./commands/bootstrap.ts";
|
|
14
|
+
import {
|
|
15
|
+
deployCommand,
|
|
16
|
+
destroyCommand,
|
|
17
|
+
planCommand,
|
|
18
|
+
} from "./commands/deploy.ts";
|
|
19
|
+
import { devCommand } from "./commands/dev.ts";
|
|
20
|
+
import { loginCommand } from "./commands/login.ts";
|
|
21
|
+
import { logsCommand } from "./commands/logs.ts";
|
|
22
|
+
import { profileCommand } from "./commands/profile.ts";
|
|
23
|
+
import { stateCommand } from "./commands/state.ts";
|
|
24
|
+
import { tailCommand } from "./commands/tail.ts";
|
|
25
|
+
import { inkCLI } from "./tui/InkCLI.tsx";
|
|
26
|
+
|
|
27
|
+
const root = Command.make("alchemy", {}).pipe(
|
|
28
|
+
Command.withSubcommands([
|
|
29
|
+
bootstrapCommand,
|
|
30
|
+
deployCommand,
|
|
31
|
+
devCommand,
|
|
32
|
+
destroyCommand,
|
|
33
|
+
planCommand,
|
|
34
|
+
tailCommand,
|
|
35
|
+
logsCommand,
|
|
36
|
+
loginCommand,
|
|
37
|
+
profileCommand,
|
|
38
|
+
stateCommand,
|
|
39
|
+
]),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const cli = Command.run(root, {
|
|
43
|
+
// name: "Alchemy Effect CLI",
|
|
44
|
+
version: packageJson.version,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const services = Layer.mergeAll(
|
|
48
|
+
Layer.provideMerge(AlchemyContextLive, PlatformServices),
|
|
49
|
+
FetchHttpClient.layer,
|
|
50
|
+
ConfigProvider.layer(ConfigProvider.fromEnv()),
|
|
51
|
+
TelemetryLive,
|
|
52
|
+
inkCLI(),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
export const main = cli.pipe(
|
|
56
|
+
// $USER and $STAGE are set by the environment
|
|
57
|
+
Effect.provide(services),
|
|
58
|
+
Effect.scoped,
|
|
59
|
+
handleCancellation,
|
|
60
|
+
);
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import { render } from "ink";
|
|
5
|
-
import type { Plan } from "
|
|
6
|
-
import { type PlanStatusSession, Cli } from "
|
|
7
|
-
import type { ApplyEvent } from "
|
|
5
|
+
import type { Plan } from "../../Plan.ts";
|
|
6
|
+
import { type PlanStatusSession, Cli } from "../Cli.ts";
|
|
7
|
+
import type { ApplyEvent } from "../Event.ts";
|
|
8
8
|
import { ApprovePlan } from "./components/ApprovePlan.tsx";
|
|
9
9
|
import { Plan as PlanComponent } from "./components/Plan.tsx";
|
|
10
10
|
import { PlanProgress } from "./components/PlanProgress.tsx";
|
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
import { useMemo, type JSX } from "react";
|
|
3
3
|
|
|
4
4
|
import { Box, Text } from "ink";
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
Plan as AlchemyPlan,
|
|
7
|
+
BindingAction,
|
|
8
|
+
CRUD,
|
|
9
|
+
} from "../../../Plan.ts";
|
|
6
10
|
import {
|
|
7
11
|
buildNamespaceTree,
|
|
8
12
|
flattenTree,
|
|
9
13
|
type DerivedAction,
|
|
10
|
-
} from "
|
|
14
|
+
} from "../../NamespaceTree.ts";
|
|
11
15
|
|
|
12
16
|
export interface PlanProps {
|
|
13
17
|
plan: AlchemyPlan;
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
import { useEffect, useMemo, useRef, useState, type JSX } from "react";
|
|
3
3
|
|
|
4
4
|
import { Box, Text } from "ink";
|
|
5
|
-
import type { CRUD, Plan } from "
|
|
5
|
+
import type { CRUD, Plan } from "../../../Plan.ts";
|
|
6
6
|
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
ApplyEvent,
|
|
9
|
+
ApplyStatus,
|
|
10
|
+
StatusChangeEvent,
|
|
11
|
+
} from "../../Event.ts";
|
|
8
12
|
import {
|
|
9
13
|
buildNamespaceTree,
|
|
10
14
|
flattenTree,
|
|
11
15
|
type FlattenedItem,
|
|
12
|
-
} from "
|
|
16
|
+
} from "../../NamespaceTree.ts";
|
|
13
17
|
|
|
14
18
|
interface ProgressEventSource {
|
|
15
19
|
subscribe(listener: (event: ApplyEvent) => void): () => void;
|
|
@@ -271,11 +271,6 @@ const login = (profileName: string, config: CloudflareAuthConfig) =>
|
|
|
271
271
|
"cf-oauth",
|
|
272
272
|
);
|
|
273
273
|
|
|
274
|
-
if (creds?.type === "oauth" && creds.expires > Date.now() + 10_000) {
|
|
275
|
-
yield* Clank.info("Cloudflare: OAuth credentials are still valid.");
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
274
|
if (creds?.type === "oauth") {
|
|
280
275
|
yield* Clank.info("Cloudflare: refreshing OAuth credentials...");
|
|
281
276
|
yield* OAuthClient.refresh(creds).pipe(
|
|
@@ -83,8 +83,9 @@ export const SecretsStoreProvider = () =>
|
|
|
83
83
|
|
|
84
84
|
const create = createStore({
|
|
85
85
|
accountId,
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
// `default_secrets_store` is the name Cloudflare uses for an
|
|
87
|
+
// account's default Secrets Store.
|
|
88
|
+
name: "default_secrets_store",
|
|
88
89
|
});
|
|
89
90
|
const response = adoptEnabled
|
|
90
91
|
? yield* create.pipe(
|
|
@@ -97,10 +98,9 @@ export const SecretsStoreProvider = () =>
|
|
|
97
98
|
: yield* create;
|
|
98
99
|
|
|
99
100
|
if (response) {
|
|
100
|
-
const store = response.result[0]!;
|
|
101
101
|
return {
|
|
102
|
-
storeId:
|
|
103
|
-
storeName:
|
|
102
|
+
storeId: response.id,
|
|
103
|
+
storeName: response.name,
|
|
104
104
|
accountId,
|
|
105
105
|
};
|
|
106
106
|
}
|
|
@@ -12,19 +12,32 @@ import * as HttpRouter from "effect/unstable/http/HttpRouter";
|
|
|
12
12
|
import * as HttpApiBuilder from "effect/unstable/httpapi/HttpApiBuilder";
|
|
13
13
|
import * as HttpApiError from "effect/unstable/httpapi/HttpApiError";
|
|
14
14
|
import crypto from "node:crypto";
|
|
15
|
-
import { SecretBindingLive } from "../SecretsStore/SecretBinding.ts";
|
|
16
15
|
import * as Secret from "../SecretsStore/Secret.ts";
|
|
16
|
+
import { SecretBindingLive } from "../SecretsStore/SecretBinding.ts";
|
|
17
17
|
import { Worker } from "../Workers/Worker.ts";
|
|
18
18
|
import Store from "./Store.ts";
|
|
19
19
|
import { AuthToken } from "./Token.ts";
|
|
20
20
|
|
|
21
21
|
export const STATE_STORE_SCRIPT_NAME = "alchemy-state-store" as const;
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Path on disk to *this* file, used as the worker's bundling entry.
|
|
25
|
+
*
|
|
26
|
+
* When running from source (e.g. dev / monorepo), `import.meta.url` points
|
|
27
|
+
* at `Api.ts` and we can use it directly. When the alchemy CLI is run from
|
|
28
|
+
* its published `bin/alchemy.js` bundle, this module is inlined into the
|
|
29
|
+
* CLI bundle and `import.meta.url` resolves to `bin/alchemy.js` — which
|
|
30
|
+
* has no `default` export and breaks the worker bundler with
|
|
31
|
+
* `[MISSING_EXPORT] "default" is not exported by "bin/alchemy.js"`.
|
|
32
|
+
*
|
|
33
|
+
* In the bundled case, fall back to the published source file shipped
|
|
34
|
+
* alongside the CLI under `../src/Cloudflare/StateStore/Api.ts`.
|
|
35
|
+
*/
|
|
23
36
|
export default Worker(
|
|
24
37
|
"Api",
|
|
25
38
|
{
|
|
26
39
|
name: STATE_STORE_SCRIPT_NAME,
|
|
27
|
-
main: import.meta.
|
|
40
|
+
main: import.meta.filename,
|
|
28
41
|
url: true,
|
|
29
42
|
compatibility: {
|
|
30
43
|
flags: ["nodejs_compat"],
|
|
@@ -86,9 +86,7 @@ export const bootstrap = (options: BootstrapOptions = {}) =>
|
|
|
86
86
|
`Resuming Cloudflare State Store '${scriptName}' deployment...`,
|
|
87
87
|
);
|
|
88
88
|
yield* finishBootstrap({ scriptName, profileName, localState, isCI });
|
|
89
|
-
yield* Clank.success(
|
|
90
|
-
`Cloudflare State Store '${scriptName}' is ready.`,
|
|
91
|
-
);
|
|
89
|
+
yield* Clank.success(`Cloudflare State Store '${scriptName}' is ready.`);
|
|
92
90
|
return;
|
|
93
91
|
}
|
|
94
92
|
|
|
@@ -113,9 +111,7 @@ export const bootstrap = (options: BootstrapOptions = {}) =>
|
|
|
113
111
|
credentials,
|
|
114
112
|
);
|
|
115
113
|
}
|
|
116
|
-
yield* Clank.success(
|
|
117
|
-
`Cloudflare State Store '${scriptName}' is ready.`,
|
|
118
|
-
);
|
|
114
|
+
yield* Clank.success(`Cloudflare State Store '${scriptName}' is ready.`);
|
|
119
115
|
return;
|
|
120
116
|
}
|
|
121
117
|
|
|
@@ -124,9 +120,7 @@ export const bootstrap = (options: BootstrapOptions = {}) =>
|
|
|
124
120
|
`Forcing redeploy of Cloudflare State Store '${scriptName}'...`,
|
|
125
121
|
);
|
|
126
122
|
} else {
|
|
127
|
-
yield* Clank.info(
|
|
128
|
-
`Deploying Cloudflare State Store '${scriptName}'...`,
|
|
129
|
-
);
|
|
123
|
+
yield* Clank.info(`Deploying Cloudflare State Store '${scriptName}'...`);
|
|
130
124
|
}
|
|
131
125
|
|
|
132
126
|
yield* finishBootstrap({ scriptName, profileName, localState, isCI });
|