alchemy 2.0.0-beta.14 → 2.0.0-beta.16
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.js +2243 -1359
- package/bin/alchemy.js.map +1 -1
- package/bin/alchemy.ts +4 -0
- package/bin/commands/deploy.ts +0 -1
- package/bin/commands/login.ts +6 -3
- package/bin/commands/profile.ts +86 -0
- package/bin/commands/state.ts +8 -5
- 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/Agent/lsp/client.d.ts +2 -2
- package/lib/Cli/InkCLI.d.ts +0 -1
- package/lib/Cli/InkCLI.d.ts.map +1 -1
- package/lib/Cli/InkCLI.js +0 -5
- package/lib/Cli/InkCLI.js.map +1 -1
- package/lib/Cli/index.d.ts +0 -1
- package/lib/Cli/index.d.ts.map +1 -1
- package/lib/Cli/index.js +4 -1
- package/lib/Cli/index.js.map +1 -1
- package/lib/Cloudflare/ApiToken/AccountApiToken.d.ts +57 -0
- package/lib/Cloudflare/ApiToken/AccountApiToken.d.ts.map +1 -0
- package/lib/Cloudflare/ApiToken/AccountApiToken.js +141 -0
- package/lib/Cloudflare/ApiToken/AccountApiToken.js.map +1 -0
- package/lib/Cloudflare/ApiToken/Common.d.ts +96 -0
- package/lib/Cloudflare/ApiToken/Common.d.ts.map +1 -0
- package/lib/Cloudflare/ApiToken/Common.js +61 -0
- package/lib/Cloudflare/ApiToken/Common.js.map +1 -0
- package/lib/Cloudflare/ApiToken/PermissionGroups.d.ts +1549 -0
- package/lib/Cloudflare/ApiToken/PermissionGroups.d.ts.map +1 -0
- package/lib/Cloudflare/ApiToken/PermissionGroups.js +1856 -0
- package/lib/Cloudflare/ApiToken/PermissionGroups.js.map +1 -0
- package/lib/Cloudflare/ApiToken/UserApiToken.d.ts +48 -0
- package/lib/Cloudflare/ApiToken/UserApiToken.d.ts.map +1 -0
- package/lib/Cloudflare/ApiToken/UserApiToken.js +113 -0
- package/lib/Cloudflare/ApiToken/UserApiToken.js.map +1 -0
- package/lib/Cloudflare/ApiToken/index.d.ts +5 -0
- package/lib/Cloudflare/ApiToken/index.d.ts.map +1 -0
- package/lib/Cloudflare/ApiToken/index.js +5 -0
- package/lib/Cloudflare/ApiToken/index.js.map +1 -0
- package/lib/Cloudflare/Artifacts/Artifacts.d.ts +101 -0
- package/lib/Cloudflare/Artifacts/Artifacts.d.ts.map +1 -0
- package/lib/Cloudflare/Artifacts/Artifacts.js +92 -0
- package/lib/Cloudflare/Artifacts/Artifacts.js.map +1 -0
- package/lib/Cloudflare/Artifacts/ArtifactsBinding.d.ts +83 -0
- package/lib/Cloudflare/Artifacts/ArtifactsBinding.d.ts.map +1 -0
- package/lib/Cloudflare/Artifacts/ArtifactsBinding.js +65 -0
- package/lib/Cloudflare/Artifacts/ArtifactsBinding.js.map +1 -0
- package/lib/Cloudflare/Artifacts/index.d.ts +3 -0
- package/lib/Cloudflare/Artifacts/index.d.ts.map +1 -0
- package/lib/Cloudflare/Artifacts/index.js +3 -0
- package/lib/Cloudflare/Artifacts/index.js.map +1 -0
- package/lib/Cloudflare/Auth/AuthProvider.js +2 -2
- package/lib/Cloudflare/Auth/AuthProvider.js.map +1 -1
- package/lib/Cloudflare/Container/ContainerBinding.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/StateStore/Api.d.ts +7 -8
- package/lib/Cloudflare/StateStore/Api.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/Api.js +6 -4
- package/lib/Cloudflare/StateStore/Api.js.map +1 -1
- package/lib/Cloudflare/StateStore/State.d.ts +1 -1
- package/lib/Cloudflare/StateStore/State.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/Store.d.ts +2 -2
- package/lib/Cloudflare/StateStore/Store.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/Store.js +6 -4
- package/lib/Cloudflare/StateStore/Store.js.map +1 -1
- package/lib/Cloudflare/StateStore/Token.d.ts +6 -4
- package/lib/Cloudflare/StateStore/Token.d.ts.map +1 -1
- package/lib/Cloudflare/StateStore/Token.js +8 -4
- package/lib/Cloudflare/StateStore/Token.js.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/InferEnv.js +0 -1
- package/lib/Cloudflare/Workers/InferEnv.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +2 -1
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +25 -18
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Cloudflare/index.d.ts +2 -0
- package/lib/Cloudflare/index.d.ts.map +1 -1
- package/lib/Cloudflare/index.js +2 -0
- package/lib/Cloudflare/index.js.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 +37 -0
- package/lib/GitHub/AuthProvider.d.ts.map +1 -0
- package/lib/GitHub/AuthProvider.js +154 -0
- package/lib/GitHub/AuthProvider.js.map +1 -0
- package/lib/GitHub/Credentials.d.ts +29 -0
- package/lib/GitHub/Credentials.d.ts.map +1 -0
- package/lib/GitHub/Credentials.js +54 -0
- package/lib/GitHub/Credentials.js.map +1 -0
- package/lib/GitHub/Providers.d.ts +14 -0
- package/lib/GitHub/Providers.d.ts.map +1 -0
- package/lib/GitHub/Providers.js +15 -0
- package/lib/GitHub/Providers.js.map +1 -0
- package/lib/GitHub/Secret.d.ts +8 -10
- package/lib/GitHub/Secret.d.ts.map +1 -1
- package/lib/GitHub/Secret.js +16 -14
- package/lib/GitHub/Secret.js.map +1 -1
- package/lib/GitHub/Variable.d.ts +8 -10
- package/lib/GitHub/Variable.d.ts.map +1 -1
- package/lib/GitHub/Variable.js +12 -13
- package/lib/GitHub/Variable.js.map +1 -1
- package/lib/GitHub/index.d.ts +3 -0
- package/lib/GitHub/index.d.ts.map +1 -1
- package/lib/GitHub/index.js +3 -0
- package/lib/GitHub/index.js.map +1 -1
- package/lib/Output.d.ts.map +1 -1
- package/lib/Output.js +4 -0
- package/lib/Output.js.map +1 -1
- package/lib/Plan.d.ts.map +1 -1
- package/lib/Plan.js +4 -0
- package/lib/Plan.js.map +1 -1
- package/lib/Stack.d.ts +5 -4
- package/lib/Stack.d.ts.map +1 -1
- package/lib/Stack.js +27 -8
- package/lib/Stack.js.map +1 -1
- package/lib/State/HttpStateStore.js +1 -1
- package/lib/State/HttpStateStore.js.map +1 -1
- package/lib/Test/Bun.d.ts +2 -2
- package/lib/Test/Bun.d.ts.map +1 -1
- package/lib/Test/Bun.js +2 -4
- package/lib/Test/Bun.js.map +1 -1
- package/lib/Test/Vitest.d.ts +1 -1
- package/lib/Test/Vitest.d.ts.map +1 -1
- package/lib/Test/Vitest.js +11 -7
- package/lib/Test/Vitest.js.map +1 -1
- package/lib/cli/index.d.ts +2 -6
- package/lib/cli/index.d.ts.map +1 -1
- package/lib/cli/index.js +2 -43050
- package/lib/cli/index.js.map +1 -1
- package/package.json +5 -5
- package/src/Cli/InkCLI.tsx +0 -10
- package/src/Cli/index.ts +4 -1
- package/src/Cloudflare/ApiToken/AccountApiToken.ts +207 -0
- package/src/Cloudflare/ApiToken/Common.ts +153 -0
- package/src/Cloudflare/ApiToken/PermissionGroups.ts +1910 -0
- package/src/Cloudflare/ApiToken/UserApiToken.ts +166 -0
- package/src/Cloudflare/ApiToken/index.ts +4 -0
- package/src/Cloudflare/Artifacts/Artifacts.ts +139 -0
- package/src/Cloudflare/Artifacts/ArtifactsBinding.ts +188 -0
- package/src/Cloudflare/Artifacts/index.ts +2 -0
- package/src/Cloudflare/Auth/AuthProvider.ts +2 -2
- package/src/Cloudflare/Providers.ts +8 -0
- package/src/Cloudflare/StateStore/Api.ts +6 -4
- package/src/Cloudflare/StateStore/Store.ts +6 -4
- package/src/Cloudflare/StateStore/Token.ts +10 -4
- package/src/Cloudflare/Workers/InferEnv.ts +5 -4
- package/src/Cloudflare/Workers/Worker.ts +12 -1
- package/src/Cloudflare/index.ts +2 -0
- package/src/GitHub/AuthProvider.ts +309 -0
- package/src/GitHub/Credentials.ts +99 -0
- package/src/GitHub/Providers.ts +26 -0
- package/src/GitHub/Secret.ts +22 -24
- package/src/GitHub/Variable.ts +16 -23
- package/src/GitHub/index.ts +3 -0
- package/src/Output.ts +3 -0
- package/src/Plan.ts +3 -0
- package/src/Stack.ts +33 -7
- package/src/State/HttpStateStore.ts +1 -0
- package/src/Test/Bun.ts +2 -2
- package/src/Test/Vitest.ts +11 -7
package/src/Plan.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Data from "effect/Data";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Option from "effect/Option";
|
|
4
|
+
import * as Redacted from "effect/Redacted";
|
|
4
5
|
import { asEffect } from ".//Util/types.ts";
|
|
5
6
|
import {
|
|
6
7
|
Artifacts,
|
|
@@ -271,6 +272,8 @@ export const make = <A>(
|
|
|
271
272
|
return input;
|
|
272
273
|
} else if (Output.isExpr(input)) {
|
|
273
274
|
return yield* resolveOutput(input);
|
|
275
|
+
} else if (Redacted.isRedacted(input)) {
|
|
276
|
+
return input;
|
|
274
277
|
} else if (Array.isArray(input)) {
|
|
275
278
|
return yield* Effect.all(input.map(resolveInput), {
|
|
276
279
|
concurrency: "unbounded",
|
package/src/Stack.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSp
|
|
|
13
13
|
import { AlchemyContext, AlchemyContextLive } from "./AlchemyContext.ts";
|
|
14
14
|
import { provideFreshArtifactStore } from "./Artifacts.ts";
|
|
15
15
|
import { AuthProviders } from "./Auth/AuthProvider.ts";
|
|
16
|
-
import {
|
|
16
|
+
import { Cli } from "./Cli/Cli.ts";
|
|
17
17
|
import type { Input, InputProps } from "./Input.ts";
|
|
18
18
|
import * as Output from "./Output.ts";
|
|
19
19
|
import { ref } from "./Ref.ts";
|
|
@@ -34,7 +34,8 @@ export type StackServices =
|
|
|
34
34
|
| AlchemyContext
|
|
35
35
|
| HttpClient
|
|
36
36
|
| ChildProcessSpawner
|
|
37
|
-
| AuthProviders
|
|
37
|
+
| AuthProviders
|
|
38
|
+
| Cli;
|
|
38
39
|
|
|
39
40
|
export type StackEffect<A, Err = never, Req = never> = Effect.Effect<
|
|
40
41
|
A,
|
|
@@ -44,6 +45,7 @@ export type StackEffect<A, Err = never, Req = never> = Effect.Effect<
|
|
|
44
45
|
| Scope
|
|
45
46
|
| AuthProviders
|
|
46
47
|
| AlchemyContext
|
|
48
|
+
| Cli
|
|
47
49
|
| State
|
|
48
50
|
| Req
|
|
49
51
|
>;
|
|
@@ -172,8 +174,33 @@ export const make =
|
|
|
172
174
|
effect: Effect.Effect<A, Err, Req>,
|
|
173
175
|
) =>
|
|
174
176
|
Effect.scope.pipe(
|
|
175
|
-
Effect.flatMap((scope) =>
|
|
176
|
-
options.
|
|
177
|
+
Effect.flatMap((scope) => {
|
|
178
|
+
if (options.state == null) {
|
|
179
|
+
return Effect.die(
|
|
180
|
+
new Error(
|
|
181
|
+
`Stack "${options.name}" is missing a state store. ` +
|
|
182
|
+
`Add a \`state\` layer to the stack options, e.g.:\n` +
|
|
183
|
+
` Alchemy.Stack("${options.name}", {\n` +
|
|
184
|
+
` providers: Cloudflare.providers(),\n` +
|
|
185
|
+
` state: Cloudflare.state(), // <-- required\n` +
|
|
186
|
+
` }, ...)\n` +
|
|
187
|
+
`See https://alchemy.run/concepts/state-store for available state stores.`,
|
|
188
|
+
),
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
if (options.providers == null) {
|
|
192
|
+
return Effect.die(
|
|
193
|
+
new Error(
|
|
194
|
+
`Stack "${options.name}" is missing a providers layer. ` +
|
|
195
|
+
`Add a \`providers\` layer to the stack options, e.g.:\n` +
|
|
196
|
+
` Alchemy.Stack("${options.name}", {\n` +
|
|
197
|
+
` providers: Cloudflare.providers(), // <-- required\n` +
|
|
198
|
+
` state: Cloudflare.state(),\n` +
|
|
199
|
+
` }, ...)`,
|
|
200
|
+
),
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
return options.providers.pipe(
|
|
177
204
|
Layer.provideMerge(options.state),
|
|
178
205
|
Layer.provideMerge(
|
|
179
206
|
Layer.effect(
|
|
@@ -192,8 +219,8 @@ export const make =
|
|
|
192
219
|
),
|
|
193
220
|
),
|
|
194
221
|
Layer.buildWithScope(scope),
|
|
195
|
-
)
|
|
196
|
-
),
|
|
222
|
+
);
|
|
223
|
+
}),
|
|
197
224
|
Effect.flatMap((context) =>
|
|
198
225
|
Effect.all([
|
|
199
226
|
effect,
|
|
@@ -257,7 +284,6 @@ export const evalStack = <A, B, Err, Req>(
|
|
|
257
284
|
),
|
|
258
285
|
),
|
|
259
286
|
Effect.provide(Layer.succeed(Stage, options.stage)),
|
|
260
|
-
Effect.provide(inkCLIAutoApprove()),
|
|
261
287
|
Effect.provide(Layer.provideMerge(alchemy, platform)),
|
|
262
288
|
Effect.scoped,
|
|
263
289
|
);
|
|
@@ -143,6 +143,7 @@ const retryTransient = <A, Err, Req>(eff: Effect.Effect<A, Err, Req>) =>
|
|
|
143
143
|
/** Collapse any client failure into a {@link StateStoreError}. */
|
|
144
144
|
const mapStateStoreError = <A, E, R>(eff: Effect.Effect<A, E, R>) =>
|
|
145
145
|
eff.pipe(
|
|
146
|
+
Effect.tapError(Effect.log),
|
|
146
147
|
retryTransient,
|
|
147
148
|
Effect.catch((e: E) =>
|
|
148
149
|
Effect.fail(
|
package/src/Test/Bun.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type { HookOptions } from "node:test";
|
|
|
9
9
|
import { AlchemyContext, AlchemyContextLive } from "../AlchemyContext.ts";
|
|
10
10
|
import { provideFreshArtifactStore } from "../Artifacts.ts";
|
|
11
11
|
import { AuthProviders } from "../Auth/AuthProvider.ts";
|
|
12
|
+
import { inkCLI } from "../Cli/InkCLI.tsx";
|
|
12
13
|
import { deploy as _deploy } from "../Deploy.ts";
|
|
13
14
|
import { destroy as _destroy } from "../Destroy.ts";
|
|
14
15
|
import {
|
|
@@ -28,8 +29,7 @@ const platform = Layer.mergeAll(PlatformServices, FetchHttpClient.layer);
|
|
|
28
29
|
|
|
29
30
|
// override alchemy state store, CLI/reporting, state, and dotAlchemy
|
|
30
31
|
const alchemy = Layer.mergeAll(
|
|
31
|
-
|
|
32
|
-
// optional
|
|
32
|
+
inkCLI(),
|
|
33
33
|
Logger.layer([Logger.consolePretty()]),
|
|
34
34
|
AlchemyContextLive,
|
|
35
35
|
);
|
package/src/Test/Vitest.ts
CHANGED
|
@@ -359,13 +359,17 @@ export namespace test {
|
|
|
359
359
|
): Effect.Effect<Input.Resolve<A>, Err, Req | Stack.Stack> =>
|
|
360
360
|
Stack.Stack.use((stack) =>
|
|
361
361
|
effect.pipe(
|
|
362
|
-
//
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
362
|
+
// @ts-expect-error - test harness reuses ambient runtime context
|
|
363
|
+
Stack.make({
|
|
364
|
+
name: stack.name,
|
|
365
|
+
providers: Layer.effectContext(Effect.context<never>()),
|
|
366
|
+
state: State.localState(),
|
|
367
|
+
stack: {
|
|
368
|
+
...stack,
|
|
369
|
+
resources: {},
|
|
370
|
+
bindings: {},
|
|
371
|
+
output: {},
|
|
372
|
+
},
|
|
369
373
|
}),
|
|
370
374
|
Effect.flatMap(Plan.make),
|
|
371
375
|
Effect.tap((plan) => Effect.logInfo(formatPlan(plan))),
|