@alchemy.run/test 0.0.0 → 2.0.0-beta.86

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.
Files changed (119) hide show
  1. package/LICENSE +201 -0
  2. package/bin/alchemy-test.ts +2 -0
  3. package/lib/Alchemy.d.ts +77 -0
  4. package/lib/Alchemy.d.ts.map +1 -0
  5. package/lib/Alchemy.js +195 -0
  6. package/lib/Alchemy.js.map +1 -0
  7. package/lib/Api.d.ts +135 -0
  8. package/lib/Api.d.ts.map +1 -0
  9. package/lib/Api.js +245 -0
  10. package/lib/Api.js.map +1 -0
  11. package/lib/Bun.d.ts +66 -0
  12. package/lib/Bun.d.ts.map +1 -0
  13. package/lib/Bun.js +142 -0
  14. package/lib/Bun.js.map +1 -0
  15. package/lib/Capture.d.ts +10 -0
  16. package/lib/Capture.d.ts.map +1 -0
  17. package/lib/Capture.js +68 -0
  18. package/lib/Capture.js.map +1 -0
  19. package/lib/Core.d.ts +301 -0
  20. package/lib/Core.d.ts.map +1 -0
  21. package/lib/Core.js +442 -0
  22. package/lib/Core.js.map +1 -0
  23. package/lib/DevCli.d.ts +47 -0
  24. package/lib/DevCli.d.ts.map +1 -0
  25. package/lib/DevCli.js +181 -0
  26. package/lib/DevCli.js.map +1 -0
  27. package/lib/Expect.d.ts +84 -0
  28. package/lib/Expect.d.ts.map +1 -0
  29. package/lib/Expect.js +518 -0
  30. package/lib/Expect.js.map +1 -0
  31. package/lib/FileLog.d.ts +27 -0
  32. package/lib/FileLog.d.ts.map +1 -0
  33. package/lib/FileLog.js +136 -0
  34. package/lib/FileLog.js.map +1 -0
  35. package/lib/Http.d.ts +109 -0
  36. package/lib/Http.d.ts.map +1 -0
  37. package/lib/Http.js +123 -0
  38. package/lib/Http.js.map +1 -0
  39. package/lib/Model.d.ts +111 -0
  40. package/lib/Model.d.ts.map +1 -0
  41. package/lib/Model.js +59 -0
  42. package/lib/Model.js.map +1 -0
  43. package/lib/PlainReporter.d.ts +18 -0
  44. package/lib/PlainReporter.d.ts.map +1 -0
  45. package/lib/PlainReporter.js +274 -0
  46. package/lib/PlainReporter.js.map +1 -0
  47. package/lib/Plan.d.ts +19 -0
  48. package/lib/Plan.d.ts.map +1 -0
  49. package/lib/Plan.js +32 -0
  50. package/lib/Plan.js.map +1 -0
  51. package/lib/Registry.d.ts +34 -0
  52. package/lib/Registry.d.ts.map +1 -0
  53. package/lib/Registry.js +80 -0
  54. package/lib/Registry.js.map +1 -0
  55. package/lib/Reporter.d.ts +160 -0
  56. package/lib/Reporter.d.ts.map +1 -0
  57. package/lib/Reporter.js +9 -0
  58. package/lib/Reporter.js.map +1 -0
  59. package/lib/Runner.d.ts +51 -0
  60. package/lib/Runner.d.ts.map +1 -0
  61. package/lib/Runner.js +1075 -0
  62. package/lib/Runner.js.map +1 -0
  63. package/lib/StrayOutput.d.ts +8 -0
  64. package/lib/StrayOutput.d.ts.map +1 -0
  65. package/lib/StrayOutput.js +259 -0
  66. package/lib/StrayOutput.js.map +1 -0
  67. package/lib/Tags.d.ts +17 -0
  68. package/lib/Tags.d.ts.map +1 -0
  69. package/lib/Tags.js +84 -0
  70. package/lib/Tags.js.map +1 -0
  71. package/lib/TestState.d.ts +12 -0
  72. package/lib/TestState.d.ts.map +1 -0
  73. package/lib/TestState.js +15 -0
  74. package/lib/TestState.js.map +1 -0
  75. package/lib/Tui.d.ts +4 -0
  76. package/lib/Tui.d.ts.map +1 -0
  77. package/lib/Tui.js +1137 -0
  78. package/lib/Tui.js.map +1 -0
  79. package/lib/Vitest.d.ts +58 -0
  80. package/lib/Vitest.d.ts.map +1 -0
  81. package/lib/Vitest.js +131 -0
  82. package/lib/Vitest.js.map +1 -0
  83. package/lib/WorktreeStage.d.ts +17 -0
  84. package/lib/WorktreeStage.d.ts.map +1 -0
  85. package/lib/WorktreeStage.js +48 -0
  86. package/lib/WorktreeStage.js.map +1 -0
  87. package/lib/cli.d.ts +2 -0
  88. package/lib/cli.d.ts.map +1 -0
  89. package/lib/cli.js +222 -0
  90. package/lib/cli.js.map +1 -0
  91. package/lib/index.d.ts +14 -0
  92. package/lib/index.d.ts.map +1 -0
  93. package/lib/index.js +12 -0
  94. package/lib/index.js.map +1 -0
  95. package/package.json +73 -3
  96. package/src/Alchemy.ts +337 -0
  97. package/src/Api.ts +522 -0
  98. package/src/Bun.ts +254 -0
  99. package/src/Capture.ts +72 -0
  100. package/src/Core.ts +906 -0
  101. package/src/DevCli.ts +229 -0
  102. package/src/Expect.ts +763 -0
  103. package/src/FileLog.ts +158 -0
  104. package/src/Http.ts +201 -0
  105. package/src/Model.ts +178 -0
  106. package/src/PlainReporter.ts +338 -0
  107. package/src/Plan.ts +45 -0
  108. package/src/Registry.ts +101 -0
  109. package/src/Reporter.ts +171 -0
  110. package/src/Runner.ts +1361 -0
  111. package/src/StrayOutput.ts +283 -0
  112. package/src/Tags.ts +100 -0
  113. package/src/TestState.ts +35 -0
  114. package/src/Tui.ts +1272 -0
  115. package/src/Vitest.ts +238 -0
  116. package/src/WorktreeStage.ts +45 -0
  117. package/src/cli.ts +330 -0
  118. package/src/index.ts +58 -0
  119. package/README.md +0 -9
package/lib/Core.d.ts ADDED
@@ -0,0 +1,301 @@
1
+ import { AlchemyContext } from "alchemy/AlchemyContext";
2
+ import { ArtifactStore } from "alchemy/Artifacts";
3
+ import { AuthProviders } from "alchemy/Auth/AuthProvider";
4
+ import type { Input } from "alchemy/Input";
5
+ import * as Interaction from "alchemy/Interaction";
6
+ import * as RpcProviderProxy from "alchemy/Local/RpcProviderProxy";
7
+ import * as RpcSpawner from "alchemy/Local/RpcSpawner";
8
+ import * as Plan from "alchemy/Plan";
9
+ import type { ResourceSelection, SelectionOutput } from "alchemy/ResourceSelection";
10
+ import { type CompiledStack, Stack, type StackDefinition, type StackEffect, type StackServices } from "alchemy/Stack";
11
+ import { Stage } from "alchemy/Stage";
12
+ import * as State from "alchemy/State";
13
+ import * as Config from "effect/Config";
14
+ import * as Effect from "effect/Effect";
15
+ import * as HttpClient from "effect/http/HttpClient";
16
+ import * as Layer from "effect/Layer";
17
+ import * as Option from "effect/Option";
18
+ import * as Scope from "effect/Scope";
19
+ import type { Limit } from "./Model.ts";
20
+ /**
21
+ * Configuration shared by every test in a file. Pass to `Test.make(...)`.
22
+ */
23
+ export interface MakeOptions<ROut = any> {
24
+ /** Provider layer for the stack — e.g. `AWS.providers()`, `Cloudflare.providers()`. */
25
+ providers: Layer.Layer<ROut, never, StackServices>;
26
+ /** State store for top-level `deploy(Stack)` / `destroy(Stack)`; defaults to {@link State.localState}. */
27
+ state?: Layer.Layer<State.State, never, StackServices>;
28
+ /** Override the current profile; otherwise resolved from env or the built-in `default`. */
29
+ profile?: string;
30
+ /**
31
+ * A counted lock every test and `beforeAll`/`afterAll` hook of this file
32
+ * holds, on top of its own `exclusive`. Files that pass the same label
33
+ * share its permits, so a suite caps its load on a rate-limited cloud API
34
+ * in one place while every test stays independently schedulable.
35
+ */
36
+ limit?: Limit;
37
+ /**
38
+ * Default stage for deploy/destroy. Defaults to `test_$USER` (or
39
+ * `test_$USERNAME` on Windows, `test_unknown` if neither is set) so two
40
+ * people running the same suite against one account don't collide.
41
+ * Does **not** read `$ALCHEMY_STAGE` — that is the CLI deploy/dev stage.
42
+ */
43
+ stage?: string;
44
+ /**
45
+ * Engine-level adoption policy for this test run. When `true`, resources
46
+ * without prior state will be adopted from the cloud via `provider.read`
47
+ * (matching the CLI's `--adopt` flag). Defaults to `false`.
48
+ */
49
+ adopt?: boolean;
50
+ /**
51
+ * Run providers in local-dev mode (matching the CLI's `alchemy dev` flag).
52
+ * When `true`, resources like Cloudflare Workers run locally via workerd
53
+ * instead of being deployed to the cloud. When omitted, falls back to the
54
+ * `ALCHEMY_DEV` environment variable (`"1"` / `"true"` enable it).
55
+ *
56
+ * {@link ALCHEMY_TEST_DEV} (`ALCHEMY_TEST_DEV=1`) overrides this — use it
57
+ * to force an entire existing live suite through local providers without
58
+ * editing each `Test.make({ dev: true })`.
59
+ */
60
+ dev?: boolean;
61
+ /**
62
+ * Run local providers behind the RPC sidecar proxy, matching the process
63
+ * topology of the real `alchemy dev` command: an {@link RpcProviderProxy}
64
+ * is installed, so `RpcProvider.providerServicesEffect` layers (e.g.
65
+ * Cloudflare's `localRuntimeServices()`) are EMPTY in the test process and
66
+ * RPC-backed providers run their lifecycle in a spawned sidecar process.
67
+ *
68
+ * Defaults to the resolved `dev` flag — dev tests run the real `alchemy
69
+ * dev` topology unless they opt out. In-process dev (`sidecar: false`)
70
+ * masks missing main-process lifecycle dependencies (the class of bug
71
+ * behind #1007, where D1's local migrations only failed under `alchemy
72
+ * dev`); it remains available because it IS still a real production path —
73
+ * a plain `alchemy deploy` deleting a `providerMode: "local"` state row
74
+ * runs the local provider in-process — and because in-process runs are
75
+ * easier to debug.
76
+ *
77
+ * Fully lazy: only the proxy facade is installed up front. The spawner
78
+ * HTTP server starts — and a sidecar child process is forked — on the
79
+ * first provider session request (a deploy/destroy building an RPC-backed
80
+ * local provider); a dev file that never does starts no processes at all.
81
+ * Once started, the sidecar lives for the whole test file (its own scope,
82
+ * closed by the adapter's final cleanup hook), so `beforeAll(deploy(Stack))`
83
+ * + per-test requests work the same way they do under a real `alchemy dev`
84
+ * session.
85
+ *
86
+ * Pass an object to run the sidecar with options: `omitEnv` lists prefixes
87
+ * of environment variables the sidecar must not inherit (e.g.
88
+ * `["CLOUDFLARE_"]` to exercise credential-free dev while the shell
89
+ * exports credentials).
90
+ */
91
+ sidecar?: boolean | SidecarOptions;
92
+ /**
93
+ * Directory for Alchemy's runtime data (logs, local state) for every
94
+ * deploy in the file, sidecar included — the `.alchemy` the CLI uses.
95
+ * Set it to put `.alchemy` somewhere a test controls, e.g. inside a
96
+ * container build context. Defaults to `.alchemy` under the cwd.
97
+ */
98
+ dotAlchemy?: string;
99
+ }
100
+ /** Options for the dev sidecar process — see {@link MakeOptions.sidecar}. */
101
+ export interface SidecarOptions {
102
+ /** Prefixes of environment variables withheld from the sidecar. */
103
+ readonly omitEnv?: ReadonlyArray<string>;
104
+ }
105
+ /**
106
+ * The RPC sidecar topology used by the real `alchemy dev` command, in one
107
+ * process-local layer: an {@link RpcSpawner} HTTP server that forks sidecar
108
+ * processes on demand, and an {@link RpcProviderProxy} pointed at it.
109
+ */
110
+ export declare const sidecarProxy: (options: {
111
+ profile?: string;
112
+ omitEnv?: ReadonlyArray<string>;
113
+ }) => Layer.Layer<RpcProviderProxy.RpcProviderProxy | RpcSpawner.RpcSpawner, import("effect/http/HttpServerError").ServeError, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | HttpClient.HttpClient>;
114
+ /**
115
+ * Force every `Test.make` into (or out of) local-dev mode, regardless of
116
+ * the file's `dev` option. Unset leaves the option / `ALCHEMY_DEV` fallback
117
+ * in place. Accepts the usual truthy/falsey strings (`true`/`1`/`yes`/`on`,
118
+ * `false`/`0`/`no`/`off`).
119
+ */
120
+ export declare const ALCHEMY_TEST_DEV: Config.Config<Option.Option<boolean>>;
121
+ /** The `ALCHEMY_TEST_DEV` override, if the env var is set. */
122
+ export declare const alchemyTestDevOverride: () => Option.Option<boolean>;
123
+ /** Resolve the effective `dev` flag: `ALCHEMY_TEST_DEV`, then options, then `ALCHEMY_DEV`. */
124
+ export declare const resolveDev: (options: {
125
+ dev?: boolean;
126
+ }) => boolean;
127
+ /** Resolve the effective `sidecar` flag: defaults to the resolved `dev` flag. */
128
+ export declare const resolveSidecar: (options: MakeOptions) => boolean;
129
+ /**
130
+ * Default test stage: `ALCHEMY_TEST_STAGE`, then `test_$USER` (or
131
+ * `test_$USERNAME` / `test_unknown`). The runner sets ALCHEMY_TEST_STAGE to
132
+ * `test_$USER_<worktree>` in a linked git worktree, so concurrent worktrees
133
+ * sharing a cloud account stay isolated.
134
+ * Matches the CLI's `live_$USER` / `dev_$USER` per-developer isolation.
135
+ */
136
+ export declare const defaultStage: () => string;
137
+ /** File-level stage: a string override, otherwise {@link defaultStage}. */
138
+ export declare const resolveStage: (options: {
139
+ stage?: string;
140
+ }) => string;
141
+ /**
142
+ * The sidecar runtime handed to each adapter's `make(...)`.
143
+ *
144
+ * `provide` installs a lazy {@link RpcProviderProxy} facade into an effect.
145
+ * Installing the facade is free: the spawner HTTP server only starts (and,
146
+ * downstream of it, a sidecar child process is only forked) when a provider
147
+ * actually requests a session — i.e. when a deploy/destroy builds an
148
+ * RPC-backed local provider. A dev file that never does starts nothing.
149
+ *
150
+ * The spawner (and the sidecar children it forks) is a PROCESS-WIDE
151
+ * SINGLETON shared by every test file, refcounted per handle: all files run
152
+ * in one bun process, and a per-file sidecar means a per-file bun child that
153
+ * imports the entire alchemy + distilled module graph — dozens of concurrent
154
+ * files at hundreds of MB each OOMs the machine. Stack isolation is
155
+ * preserved because each RPC session carries its own stack environment (see
156
+ * `SESSION_ENV_PARAM` in Local/RpcServerEnvironment.ts) and the child builds
157
+ * a provider context per stack. The singleton's scope closes when the LAST
158
+ * handle closes; `Test.make` runs at collection time (before any test), so
159
+ * the refcount cannot dip to zero while later files still need it. Adapters
160
+ * run `close` from the same final cleanup hook that closes the shared scope.
161
+ */
162
+ export interface SidecarHandle {
163
+ readonly provide: <A, E, R>(eff: Effect.Effect<A, E, R>) => Effect.Effect<A, any, any>;
164
+ readonly close: Effect.Effect<void>;
165
+ }
166
+ /** Payload-free counts; observing them never starts the singleton. */
167
+ export declare const sidecarDiagnostics: Effect.Effect<{
168
+ sessions: number;
169
+ testSessions: number;
170
+ owners: number;
171
+ connections: number;
172
+ singletons: number;
173
+ reservations: number;
174
+ started: number;
175
+ }, never, never>;
176
+ export declare const makeSidecarHandle: <ROut = any>(options: MakeOptions<ROut>) => SidecarHandle | undefined;
177
+ export type TestEffect<A, Req = never> = StackEffect<A, any, Req>;
178
+ /**
179
+ * Start capturing what the resource `fqn` logs — its processes' output (a dev
180
+ * Worker's console, a Vite dev server) and alchemy's lines about it — whether
181
+ * its provider runs in the dev sidecar or in-process. Start it before the
182
+ * deploy; the returned effect reads every line since, without ANSI styling.
183
+ * The capture ends with the enclosing scope.
184
+ */
185
+ export declare const captureResourceLog: (fqn: string) => Effect.Effect<Effect.Effect<string>, never, Scope.Scope>;
186
+ /**
187
+ * Build the per-test runtime and return a self-contained Effect.
188
+ *
189
+ * Mirrors {@link "../bin/alchemy.js"} composition: ConfigProvider via
190
+ * `loadConfigProvider` + `withProfileOverride`, an empty `AuthProviders`
191
+ * registry that the user's `providers` layer populates, the platform layers,
192
+ * and the configured state store. Adapters wrap this into runner-specific
193
+ * thunks (`bun.test` -> `runPromise`, `it.live` -> as-is).
194
+ *
195
+ * When `scope` is provided, scoped resources (like the Cloudflare dev
196
+ * sidecar) survive past this effect and are tied to the lifetime of the
197
+ * provided scope instead. The runner is responsible for closing it.
198
+ *
199
+ * When `scope` is omitted, the effect runs with `Effect.scoped` and any
200
+ * scoped resources are torn down as soon as it resolves.
201
+ */
202
+ export declare const toEffect: <A, ROut = any>(effect: TestEffect<A>, options: MakeOptions<ROut>, scope?: Scope.Scope, sidecar?: SidecarHandle) => Effect.Effect<A, any, never>;
203
+ /** Promise wrapper around {@link toEffect} for `bun.test`-style runners. */
204
+ export declare const run: <A, ROut = any>(effect: TestEffect<A>, options: MakeOptions<ROut>, scope?: Scope.Scope, sidecar?: SidecarHandle) => Promise<A>;
205
+ /**
206
+ * Wrap an effect so it runs with `options.providers` + a placeholder Stack +
207
+ * Stage in scope. Used by `test.provider` so user code can call provider SDK
208
+ * APIs (e.g. `DynamoDB.describeTable`) directly inside the test body.
209
+ */
210
+ export declare const withProviders: <A, E, R, ROut>(effect: Effect.Effect<A, E, R>, options: MakeOptions<ROut>, stackName: string) => Effect.Effect<A, E, Exclude<R, ROut | Stack | Stage>>;
211
+ /**
212
+ * Curried `deploy` for the test factory: bakes in the configured stage and
213
+ * adds the telemetry layer the CLI uses, so `beforeAll(deploy(Stack))` works
214
+ * the same way as `alchemy deploy`.
215
+ *
216
+ * `scope`, when supplied, is forwarded down so the dev sidecar (and other
217
+ * scoped resources) lives until the caller closes it instead of dying as
218
+ * soon as `deploy` resolves. The test harness uses this to keep workerd
219
+ * alive across `beforeAll` → tests → `afterAll`.
220
+ */
221
+ export interface DeployCallOptions extends Plan.MakePlanOptions {
222
+ stage?: string;
223
+ scope?: Scope.Scope;
224
+ }
225
+ export type DeployResult<A> = Effect.Effect<Input.Resolve<A>, Effect.Error<ReturnType<typeof deployStack<A>>>, Effect.Services<ReturnType<typeof deployStack<A>>>>;
226
+ export interface FilteredDeployCallOptions extends Omit<DeployCallOptions, keyof ResourceSelection>, ResourceSelection {
227
+ }
228
+ type FullDeployCall = [options?: DeployCallOptions];
229
+ /**
230
+ * Filtered deploys return void; the whole declaration still evaluates.
231
+ * With an explicit output type, filtering also requires the Call tuple type.
232
+ */
233
+ export interface Deploy {
234
+ <A, Call extends [options?: FilteredDeployCallOptions] = FullDeployCall>(stack: TestEffect<CompiledStack<A>, Stage | AlchemyContext>, ...call: Call): DeployResult<SelectionOutput<A, Call[0]>>;
235
+ }
236
+ export declare function deploy<A, Call extends [options?: FilteredDeployCallOptions] = FullDeployCall>(options: MakeOptions, stack: TestEffect<CompiledStack<A>, Stage | AlchemyContext>, ...call: Call): DeployResult<SelectionOutput<A, Call[0]>>;
237
+ declare const deployStack: <A>(options: MakeOptions, stack: TestEffect<CompiledStack<A>, Stage | AlchemyContext>, callOptions?: FilteredDeployCallOptions) => Effect.Effect<Input.Resolve<A> | undefined, import("alchemy/Auth/AuthProvider").AuthError | Config.ConfigError | import("alchemy/Auth/Demand").CredentialsRequired | import("alchemy").DestroyError | import("alchemy/Output").InvalidReferenceError | import("alchemy/Output").MissingSourceError | import("alchemy/Auth/AuthProvider").NeedsReauth | import("effect/PlatformError").PlatformError | State.StateStoreError, ArtifactStore | AuthProviders | Interaction.Interaction | State.State>;
238
+ /** Bind test-file options and the shared runtime scope without erasing output types. */
239
+ export declare const makeDeploy: (options: MakeOptions, scope: Scope.Scope) => Deploy;
240
+ export declare const destroy: <ROut>(options: MakeOptions, stack: StackDefinition<ROut>, callOptions?: {
241
+ stage?: string;
242
+ scope?: Scope.Scope;
243
+ include?: never;
244
+ exclude?: never;
245
+ }) => Effect.Effect<undefined, import("alchemy/Auth/AuthProvider").AuthError | Config.ConfigError | import("alchemy/Auth/Demand").CredentialsRequired | import("alchemy").DestroyError | import("alchemy/Output").InvalidReferenceError | import("alchemy/Output").MissingSourceError | import("alchemy/Auth/AuthProvider").NeedsReauth | import("effect/PlatformError").PlatformError | State.StateStoreError, ArtifactStore | AuthProviders | Interaction.Interaction | State.State>;
246
+ /**
247
+ * In-test scratch stack handed to `test.provider(name, (stack) => ...)`.
248
+ *
249
+ * Each scratch stack owns a private state store that is shared between
250
+ * successive `deploy`/`destroy` calls AND visible to the user's test body
251
+ * (so `yield* State` / `state.get(...)` see the same store the deploys
252
+ * mutated). This makes create / update / replace / delete paths exercisable
253
+ * without polluting other tests in the same file.
254
+ *
255
+ * When the adapter can name the test file (the alchemy-test runner), the
256
+ * store is DURABLE — rows live under `.alchemy/state/{file}-{test}/{stage}`
257
+ * on disk. Durability is what makes an interrupted destroy recoverable: the
258
+ * engine persists a `deleting` row before every `provider.delete` and only
259
+ * drops it on success, so a run killed mid-delete (e.g. the runner's
260
+ * teardown-abandonment after a test timeout) leaves resumable rows that the
261
+ * NEXT run's leading `stack.destroy()` (or the `Effect.ensuring` teardown)
262
+ * picks up and drains. An in-memory scratch dies with the process, silently
263
+ * orphaning every cloud resource whose delete was still in flight.
264
+ */
265
+ export interface ScratchStack<ROut = any> {
266
+ readonly name: string;
267
+ /** Stage this scratch deploys to ({@link resolveStage} of the file options). */
268
+ readonly stage: string;
269
+ /** The shared in-memory state Layer for this scratch. @internal */
270
+ readonly state: Layer.Layer<State.State, never, never>;
271
+ /** Filters leave other rows and stack outputs untouched; declaration still runs. */
272
+ deploy<A, E, R, Call extends [options?: Plan.FilteredPlanOptions] = []>(effect: Effect.Effect<A, E, R>, ...call: Call): Effect.Effect<SelectionOutput<Input.Resolve<A>, Call[0]>, any, Exclude<R, ROut | StackServices>>;
273
+ /**
274
+ * Build a plan against the scratch's shared state WITHOUT applying it.
275
+ *
276
+ * Use this to assert on the planned action for a resource (e.g. that a
277
+ * downstream dependency stays `noop` when only an upstream resource
278
+ * changes) without mutating the cloud. Plans run against whatever state
279
+ * prior `deploy(...)` calls persisted.
280
+ */
281
+ plan<A, E, R, Call extends [options?: Plan.FilteredPlanOptions] = []>(effect: Effect.Effect<A, E, R>, ...call: Call): Effect.Effect<Plan.Plan<SelectionOutput<A, Call[0]>>, any, Exclude<R, ROut | StackServices>>;
282
+ destroy(options?: {
283
+ include?: never;
284
+ exclude?: never;
285
+ }): Effect.Effect<void, any, never>;
286
+ }
287
+ /**
288
+ * Build a fresh `ScratchStack` for `test.provider`.
289
+ *
290
+ * With `file` (the registration-time test file, supplied by the
291
+ * alchemy-test adapter): the store is the durable `.alchemy/state` local
292
+ * store and the stack name is namespaced by file so interrupted destroys
293
+ * leave resumable rows for the next run (see {@link ScratchStack}).
294
+ *
295
+ * Without `file` (bun/vitest adapters, which cannot name their file at
296
+ * registration time): falls back to a private in-memory store — isolated,
297
+ * but discarded with the process.
298
+ */
299
+ export declare const scratchStack: <ROut>(options: MakeOptions<ROut>, name: string, file?: string) => ScratchStack<ROut>;
300
+ export {};
301
+ //# sourceMappingURL=Core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Core.d.ts","sources":["../src/Core.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAsB,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAA6B,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAS1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,WAAW,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,gBAAgB,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,UAAU,MAAM,0BAA0B,CAAC;AAEvD,OAAO,KAAK,IA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