alchemy 2.0.0-beta.27 → 2.0.0-beta.28

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 CHANGED
@@ -1,4 +1,4 @@
1
- import { runMain } from "alchemy/Util";
1
+ import { runMain } from "alchemy/Util/PlatformServices";
2
2
  import { main } from "alchemy/Cli";
3
3
  main.pipe(runMain);
4
4
  //# sourceMappingURL=alchemy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alchemy.js","sourceRoot":"","sources":["alchemy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"alchemy.js","sourceRoot":"","sources":["alchemy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC"}
package/bin/alchemy.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { runMain } from "alchemy/Util";
1
+ import { runMain } from "alchemy/Util/PlatformServices";
2
2
 
3
3
  import { main } from "alchemy/Cli";
4
4
 
package/bin/exec.js CHANGED
@@ -1,26 +1,26 @@
1
- import * as EffectContext from "effect/Context";
1
+ import * as ConfigProvider from "effect/ConfigProvider";
2
2
  import * as Effect from "effect/Effect";
3
- import * as FileSystem from "effect/FileSystem";
4
3
  import * as Layer from "effect/Layer";
4
+ import * as S from "effect/Schema";
5
+ import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
6
+ import * as EffectContext from "effect/Context";
7
+ import * as FileSystem from "effect/FileSystem";
5
8
  import * as Path$1 from "effect/Path";
6
9
  import { Path } from "effect/Path";
10
+ import * as Console from "effect/Console";
11
+ import * as Logger from "effect/Logger";
12
+ import * as Option from "effect/Option";
13
+ import * as Command from "effect/unstable/cli/Command";
14
+ import * as Flag from "effect/unstable/cli/Flag";
15
+ import * as Deferred from "effect/Deferred";
7
16
  import * as Data from "effect/Data";
8
17
  import { pipe } from "effect/Function";
9
18
  import * as Redacted from "effect/Redacted";
10
19
  import { SingleShotGen } from "effect/Utils";
11
- import * as Option from "effect/Option";
12
20
  import { pipeArguments } from "effect/Pipeable";
13
- import * as ConfigProvider from "effect/ConfigProvider";
14
- import * as Logger from "effect/Logger";
15
- import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
16
- import * as Deferred from "effect/Deferred";
17
- import * as S from "effect/Schema";
18
21
  import path from "pathe";
19
22
  import * as Config from "effect/Config";
20
23
  import os from "node:os";
21
- import * as Console from "effect/Console";
22
- import * as Command from "effect/unstable/cli/Command";
23
- import * as Flag from "effect/unstable/cli/Flag";
24
24
  import * as Duration from "effect/Duration";
25
25
  import * as Exit from "effect/Exit";
26
26
  import * as Metric from "effect/Metric";
@@ -44,10 +44,6 @@ const AlchemyContextLive = Layer.effect(AlchemyContext, Effect.gen(function* ()
44
44
  };
45
45
  }));
46
46
 
47
- //#endregion
48
- //#region lib/Util/data.js
49
- const isPrimitive = (value) => value === void 0 || value === null || typeof value === "boolean" || typeof value === "number" || typeof value === "string" || typeof value === "symbol" || typeof value === "bigint";
50
-
51
47
  //#endregion
52
48
  //#region lib/Util/PlatformServices.js
53
49
  const isBun = typeof Bun !== "undefined";
@@ -65,6 +61,74 @@ const runMain = (effect, options) => {
65
61
  else import("@effect/platform-node/NodeRuntime").then((NodeRuntime) => NodeRuntime.runMain(effect, options));
66
62
  };
67
63
 
64
+ //#endregion
65
+ //#region lib/AdoptPolicy.js
66
+ var AdoptPolicy = class extends EffectContext.Service()("AdoptPolicy") {};
67
+
68
+ //#endregion
69
+ //#region lib/Artifacts.js
70
+ /**
71
+ * Per-resource in-memory artifacts shared across a single `Plan.make -> apply`
72
+ * execution.
73
+ *
74
+ * The engine scopes this service by resource `FQN` before invoking lifecycle
75
+ * handlers, so providers should treat it as a resource-local bag for expensive,
76
+ * deterministic intermediate results that can be reused across phases.
77
+ *
78
+ * Expected usage:
79
+ *
80
+ * - `diff` computes an expensive artifact once and stores it
81
+ * - `create` / `update` reads the same artifact and skips recomputing it
82
+ * - artifacts are ephemeral and must never be required for correctness on a
83
+ * later deploy because the bag is reset between runs
84
+ *
85
+ * Example:
86
+ *
87
+ * ```ts
88
+ * const artifacts = yield* Artifacts;
89
+ * const cached = yield* artifacts.get<PreparedBundle>("bundle");
90
+ * if (cached) return cached;
91
+ *
92
+ * const bundle = yield* prepareBundle();
93
+ * yield* artifacts.set("bundle", bundle);
94
+ * return bundle;
95
+ * ```
96
+ */
97
+ var Artifacts = class extends EffectContext.Service()("Artifacts") {};
98
+ var ArtifactStore = class extends EffectContext.Service()("Artifacts/Store") {};
99
+ /**
100
+ * Create a fresh root store for one deploy/test run.
101
+ */
102
+ const createArtifactStore = () => /* @__PURE__ */ new Map();
103
+ const getOrCreateBag = (store, fqn) => {
104
+ const existing = store.get(fqn);
105
+ if (existing) return existing;
106
+ const bag = /* @__PURE__ */ new Map();
107
+ store.set(fqn, bag);
108
+ return bag;
109
+ };
110
+ const makeScopedArtifacts = (store, fqn) => {
111
+ const bag = getOrCreateBag(store, fqn);
112
+ return {
113
+ get: (key) => Effect.sync(() => bag.get(key)),
114
+ set: (key, value) => Effect.sync(() => {
115
+ bag.set(key, value);
116
+ }),
117
+ delete: (key) => Effect.sync(() => {
118
+ bag.delete(key);
119
+ })
120
+ };
121
+ };
122
+ /**
123
+ * Ensure an artifact root exists, reusing the ambient store when one is already
124
+ * present. This lets nested helpers participate in the same run-scoped cache.
125
+ */
126
+ const ensureArtifactStore = (effect) => Effect.serviceOption(ArtifactStore).pipe(Effect.map(Option.getOrUndefined), Effect.flatMap((existing) => effect.pipe(Effect.provideService(ArtifactStore, existing ?? createArtifactStore()))));
127
+
128
+ //#endregion
129
+ //#region lib/Cli/Cli.js
130
+ var Cli = class extends EffectContext.Service()("CLI") {};
131
+
68
132
  //#endregion
69
133
  //#region lib/Util/service.js
70
134
  const GenericService = () => (Kind) => {
@@ -73,10 +137,6 @@ const GenericService = () => (Kind) => {
73
137
  return Object.assign(Object.setPrototypeOf(make$2, service), service);
74
138
  };
75
139
 
76
- //#endregion
77
- //#region lib/Util/types.js
78
- const asEffect = (effect) => Effect.isEffect(effect) ? effect : Effect.succeed(effect);
79
-
80
140
  //#endregion
81
141
  //#region lib/ExecutionContext.js
82
142
  const ExecutionContext = GenericService()("Alchemy::ExecutionContext");
@@ -179,66 +239,6 @@ const tryFindProviderByType = Effect.fnUntraced(function* (resourceType) {
179
239
  return Option.none();
180
240
  });
181
241
 
182
- //#endregion
183
- //#region lib/Artifacts.js
184
- /**
185
- * Per-resource in-memory artifacts shared across a single `Plan.make -> apply`
186
- * execution.
187
- *
188
- * The engine scopes this service by resource `FQN` before invoking lifecycle
189
- * handlers, so providers should treat it as a resource-local bag for expensive,
190
- * deterministic intermediate results that can be reused across phases.
191
- *
192
- * Expected usage:
193
- *
194
- * - `diff` computes an expensive artifact once and stores it
195
- * - `create` / `update` reads the same artifact and skips recomputing it
196
- * - artifacts are ephemeral and must never be required for correctness on a
197
- * later deploy because the bag is reset between runs
198
- *
199
- * Example:
200
- *
201
- * ```ts
202
- * const artifacts = yield* Artifacts;
203
- * const cached = yield* artifacts.get<PreparedBundle>("bundle");
204
- * if (cached) return cached;
205
- *
206
- * const bundle = yield* prepareBundle();
207
- * yield* artifacts.set("bundle", bundle);
208
- * return bundle;
209
- * ```
210
- */
211
- var Artifacts = class extends EffectContext.Service()("Artifacts") {};
212
- var ArtifactStore = class extends EffectContext.Service()("Artifacts/Store") {};
213
- /**
214
- * Create a fresh root store for one deploy/test run.
215
- */
216
- const createArtifactStore = () => /* @__PURE__ */ new Map();
217
- const getOrCreateBag = (store, fqn) => {
218
- const existing = store.get(fqn);
219
- if (existing) return existing;
220
- const bag = /* @__PURE__ */ new Map();
221
- store.set(fqn, bag);
222
- return bag;
223
- };
224
- const makeScopedArtifacts = (store, fqn) => {
225
- const bag = getOrCreateBag(store, fqn);
226
- return {
227
- get: (key) => Effect.sync(() => bag.get(key)),
228
- set: (key, value) => Effect.sync(() => {
229
- bag.set(key, value);
230
- }),
231
- delete: (key) => Effect.sync(() => {
232
- bag.delete(key);
233
- })
234
- };
235
- };
236
- /**
237
- * Ensure an artifact root exists, reusing the ambient store when one is already
238
- * present. This lets nested helpers participate in the same run-scoped cache.
239
- */
240
- const ensureArtifactStore = (effect) => Effect.serviceOption(ArtifactStore).pipe(Effect.map(Option.getOrUndefined), Effect.flatMap((existing) => effect.pipe(Effect.provideService(ArtifactStore, existing ?? createArtifactStore()))));
241
-
242
242
  //#endregion
243
243
  //#region lib/Auth/Profile.js
244
244
  const rootDir = path.join(os.homedir(), ".alchemy");
@@ -281,10 +281,6 @@ const withProfileOverride = (base, profile$1) => {
281
281
  //#region lib/Auth/AuthProvider.js
282
282
  var AuthProviders = class extends EffectContext.Service()("AuthProviders") {};
283
283
 
284
- //#endregion
285
- //#region lib/Cli/Cli.js
286
- var Cli = class extends EffectContext.Service()("CLI") {};
287
-
288
284
  //#endregion
289
285
  //#region lib/Stage.js
290
286
  var Stage = class extends EffectContext.Service()("Stage") {};
@@ -368,6 +364,10 @@ const isResource = (value) => {
368
364
  //#region lib/State/State.js
369
365
  var State = class extends EffectContext.Service()("alchemy/State") {};
370
366
 
367
+ //#endregion
368
+ //#region lib/Util/data.js
369
+ const isPrimitive = (value) => value === void 0 || value === null || typeof value === "boolean" || typeof value === "number" || typeof value === "string" || typeof value === "symbol" || typeof value === "bigint";
370
+
371
371
  //#endregion
372
372
  //#region lib/Output.js
373
373
  const inspect = Symbol.for("nodejs.util.inspect.custom");
@@ -603,10 +603,6 @@ const toObject = (acc, v) => ({
603
603
  ...v
604
604
  });
605
605
 
606
- //#endregion
607
- //#region lib/AdoptPolicy.js
608
- var AdoptPolicy = class extends EffectContext.Service()("AdoptPolicy") {};
609
-
610
606
  //#endregion
611
607
  //#region lib/Diff.js
612
608
  const havePropsChanged = (oldProps, newProps) => hasOutputs(newProps) || JSON.stringify(canonicalize(oldProps ?? {})) !== JSON.stringify(canonicalize(newProps ?? {}));
@@ -645,6 +641,10 @@ const generateInstanceId = () => Effect.sync(() => {
645
641
  return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
646
642
  });
647
643
 
644
+ //#endregion
645
+ //#region lib/Util/types.js
646
+ const asEffect = (effect) => Effect.isEffect(effect) ? effect : Effect.succeed(effect);
647
+
648
648
  //#endregion
649
649
  //#region lib/Plan.js
650
650
  const make = (stack, options = {}) => Effect.gen(function* () {