alchemy-effect 0.7.0 → 0.7.1

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.
@@ -93,6 +93,11 @@ const yes = Flag.boolean("yes").pipe(
93
93
  Flag.withDefault(false),
94
94
  );
95
95
 
96
+ const force = Flag.boolean("force").pipe(
97
+ Flag.withDescription("Force updates for resources that would otherwise no-op"),
98
+ Flag.withDefault(false),
99
+ );
100
+
96
101
  const fileLogger = Effect.fnUntraced(function* (
97
102
  ...segments: ReadonlyArray<string>
98
103
  ) {
@@ -142,6 +147,7 @@ const deployCommand = Command.make(
142
147
  "deploy",
143
148
  {
144
149
  dryRun,
150
+ force,
145
151
  main,
146
152
  envFile,
147
153
  stage,
@@ -186,6 +192,7 @@ const execStack = Effect.fn(function* ({
186
192
  stage,
187
193
  envFile,
188
194
  dryRun = false,
195
+ force = false,
189
196
  yes = false,
190
197
  destroy = false,
191
198
  }: {
@@ -193,6 +200,7 @@ const execStack = Effect.fn(function* ({
193
200
  stage: string;
194
201
  envFile: Option.Option<string>;
195
202
  dryRun?: boolean;
203
+ force?: boolean;
196
204
  yes?: boolean;
197
205
  destroy?: boolean;
198
206
  }) {
@@ -244,6 +252,7 @@ const execStack = Effect.fn(function* ({
244
252
  output: {},
245
253
  }
246
254
  : stack,
255
+ { force },
247
256
  );
248
257
  if (dryRun) {
249
258
  yield* cli.displayPlan(updatePlan);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alchemy-effect",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "homepage": "https://alchemy.run",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Sam Goodwin <sam@alchemy.run>",
package/src/Plan.ts CHANGED
@@ -148,8 +148,13 @@ export type Plan<Output = any> = {
148
148
  output: Output;
149
149
  };
150
150
 
151
+ export interface MakePlanOptions {
152
+ force?: boolean;
153
+ }
154
+
151
155
  export const make = <A>(
152
156
  stack: StackSpec<A>,
157
+ options: MakePlanOptions = {},
153
158
  ): Effect.Effect<Plan<A>, never, State> =>
154
159
  // @ts-expect-error
155
160
  ensureArtifactStore(
@@ -486,6 +491,13 @@ export const make = <A>(
486
491
  : "noop",
487
492
  } as UpdateDiff | NoopDiff),
488
493
  ),
494
+ Effect.map((diff) =>
495
+ options.force && diff.action === "noop"
496
+ ? ({
497
+ action: "update",
498
+ } satisfies UpdateDiff)
499
+ : diff,
500
+ ),
489
501
  );
490
502
 
491
503
  if (oldState.status === "creating") {
@@ -148,7 +148,10 @@ const deriveStackName = (testPath: string, suffix: string) => {
148
148
  const runWithContext = <A, Err>(
149
149
  stackName: string,
150
150
  effect: Effect.Effect<A, Err, Provided>,
151
- options: { state?: Layer.Layer<State.State, never, Stack.Stack> } = {},
151
+ options: {
152
+ state?: Layer.Layer<State.State, never, Stack.Stack>;
153
+ providers?: boolean;
154
+ } = {},
152
155
  ): Effect.Effect<
153
156
  A,
154
157
  aws.Credentials.CredentialsError | Config.ConfigError | Err,
@@ -194,7 +197,9 @@ const runWithContext = <A, Err>(
194
197
  }).pipe(
195
198
  Effect.provide(
196
199
  Layer.provideMerge(
197
- Layer.mergeAll(awsProviders, cfProviders),
200
+ options.providers === false
201
+ ? Layer.empty
202
+ : Layer.mergeAll(awsProviders, cfProviders),
198
203
  Layer.provideMerge(alchemy, platform),
199
204
  ),
200
205
  ),
@@ -216,6 +221,7 @@ export function test(
216
221
  options: {
217
222
  timeout?: number;
218
223
  state?: Layer.Layer<State.State, never, Stack.Stack>;
224
+ providers?: boolean;
219
225
  },
220
226
  testCase: Effect.Effect<void, any, Provided>,
221
227
  ): void;
@@ -232,6 +238,7 @@ export function test(
232
238
  {
233
239
  timeout?: number;
234
240
  state?: Layer.Layer<State.State, never, Stack.Stack>;
241
+ providers?: boolean;
235
242
  },
236
243
  Effect.Effect<void, any, Provided>,
237
244
  ]
@@ -253,6 +260,7 @@ export namespace test {
253
260
  options: {
254
261
  timeout?: number;
255
262
  state?: Layer.Layer<State.State, never, Stack.Stack>;
263
+ providers?: boolean;
256
264
  },
257
265
  testCase: Effect.Effect<void, any, Provided>,
258
266
  ): void;
@@ -269,6 +277,7 @@ export namespace test {
269
277
  {
270
278
  timeout?: number;
271
279
  state?: Layer.Layer<State.State, never, Stack.Stack>;
280
+ providers?: boolean;
272
281
  },
273
282
  Effect.Effect<void, any, Provided>,
274
283
  ]
@@ -287,6 +296,7 @@ export namespace test {
287
296
  {
288
297
  timeout?: number;
289
298
  state?: Layer.Layer<State.State, never, Stack.Stack>;
299
+ providers?: boolean;
290
300
  },
291
301
  Effect.Effect<void, any, Provided>,
292
302
  ]
@@ -436,6 +446,7 @@ export function skip(
436
446
  options: {
437
447
  timeout?: number;
438
448
  state?: Layer.Layer<State.State, never, Stack.Stack>;
449
+ providers?: boolean;
439
450
  },
440
451
  testCase: Effect.Effect<void, any, Provided>,
441
452
  ): void;
@@ -452,6 +463,7 @@ export function skip(
452
463
  {
453
464
  timeout?: number;
454
465
  state?: Layer.Layer<State.State, never, Stack.Stack>;
466
+ providers?: boolean;
455
467
  },
456
468
  Effect.Effect<void, any, Provided>,
457
469
  ]
@@ -470,6 +482,7 @@ export function skipIf(condition: boolean) {
470
482
  {
471
483
  timeout?: number;
472
484
  state?: Layer.Layer<State.State, never, Stack.Stack>;
485
+ providers?: boolean;
473
486
  },
474
487
  Effect.Effect<void, any, Provided>,
475
488
  ]