fleetfizz 0.2.0 → 0.2.2

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 (2) hide show
  1. package/dist/fleetfizz.mjs +54 -7
  2. package/package.json +1 -1
@@ -6708,6 +6708,8 @@ const tapEffectCont = function(value) {
6708
6708
  return new ContImpl(this.payload, succeedPayload, value);
6709
6709
  };
6710
6710
  /** @internal */
6711
+ const asSome = (self) => map$7(self, some);
6712
+ /** @internal */
6711
6713
  const andThen$1 = /*#__PURE__*/ dual(2, (self, f) => new ContImpl(self, isEffect$1(f) ? returnPayload : andThenCont, f));
6712
6714
  /** @internal */
6713
6715
  const tap$1 = /*#__PURE__*/ dual(2, (self, f) => new ContImpl(self, isEffect$1(f) ? tapEffectCont : tapCont, f));
@@ -6959,6 +6961,10 @@ const exitPrimitive = /*#__PURE__*/ makePrimitive$1({
6959
6961
  }
6960
6962
  });
6961
6963
  /** @internal */
6964
+ const timeoutOrElse$1 = /*#__PURE__*/ dual(2, (self, options) => flatMap$2(timeoutOption(self, options.duration), (option) => isNone(option) ? options.orElse() : succeed$6(option.value)));
6965
+ /** @internal */
6966
+ const timeoutOption = /*#__PURE__*/ dual(2, (self, duration) => raceFirst$1(asSome(self), as$1(sleep$1(duration), none())));
6967
+ /** @internal */
6962
6968
  const ScopeTypeId = "~effect/Scope";
6963
6969
  /** @internal */
6964
6970
  const ScopeCloseableTypeId = "~effect/Scope/Closeable";
@@ -11106,6 +11112,35 @@ const ignore = ignore$1;
11106
11112
  */
11107
11113
  const orElseSucceed = orElseSucceed$1;
11108
11114
  /**
11115
+ * Applies a timeout to an effect, lazily evaluating `orElse` after interrupting
11116
+ * the source if the timeout is reached.
11117
+ *
11118
+ * **Example** (Falling back on timeout)
11119
+ *
11120
+ * ```ts import.meta.vitest
11121
+ * import { Effect } from "effect"
11122
+ * const output: Array<unknown> = []
11123
+ *
11124
+ * const program = Effect.timeoutOrElse(Effect.never, {
11125
+ * duration: 0,
11126
+ * orElse: () => Effect.sync(() => { output.push("Query timed out, using cached data") }).pipe(
11127
+ * Effect.as("Cached result")
11128
+ * )
11129
+ * })
11130
+ *
11131
+ * void output.push(await Effect.runPromise(program))
11132
+ * output // => ["Query timed out, using cached data", "Cached result"]
11133
+ * ```
11134
+ *
11135
+ * @see {@link timeout} for failing with a `TimeoutError`.
11136
+ * @see {@link timeoutOption} for returning `Option.none` on timeout.
11137
+ *
11138
+ * @stability stable
11139
+ * @category delays & timeouts
11140
+ * @since 4.0.0
11141
+ */
11142
+ const timeoutOrElse = timeoutOrElse$1;
11143
+ /**
11109
11144
  * Returns an effect that suspends the current fiber for the specified duration
11110
11145
  * without blocking a JavaScript thread.
11111
11146
  *
@@ -31684,7 +31719,7 @@ const runWith = (command, config) => {
31684
31719
  };
31685
31720
  //#endregion
31686
31721
  //#region package.json
31687
- var version = "0.2.0";
31722
+ var version = "0.2.2";
31688
31723
  //#endregion
31689
31724
  //#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Ref.js
31690
31725
  /**
@@ -35095,7 +35130,16 @@ const quotePath = (path) => {
35095
35130
  if (path.startsWith("~/")) return `"$HOME"${quote(path.slice(1))}`;
35096
35131
  return quote(path);
35097
35132
  };
35098
- const prelude = [`ff_json() { printf '%s' "$1" | sed -e 's/\\\\/\\\\\\\\/g' -e 's/"/\\\\"/g' | tr -d '\\n'; }`, `ff_state() { printf 'ff-state %s\\n' "$1"; }`].join("\n");
35133
+ const vpEnv = [
35134
+ `ff_env="\${XDG_CONFIG_HOME:-$HOME/.config}/vite-plus/env"`,
35135
+ `{ [ ! -f "$ff_env" ] || . "$ff_env"; }`,
35136
+ `export PATH="\${VP_HOME:-$HOME/.vite-plus}/bin:\${XDG_DATA_HOME:-$HOME/.local/share}/vite-plus/bin:$PATH"`
35137
+ ].join("\n");
35138
+ const prelude = [
35139
+ vpEnv,
35140
+ `ff_json() { printf '%s' "$1" | sed -e 's/\\\\/\\\\\\\\/g' -e 's/"/\\\\"/g' | tr -d '\\n'; }`,
35141
+ `ff_state() { printf 'ff-state %s\\n' "$1"; }`
35142
+ ].join("\n");
35099
35143
  const fingerprintFn = [
35100
35144
  "ff_fp() {",
35101
35145
  " if [ -L \"$1\" ]; then printf 'link:%s' \"$(readlink \"$1\")\";",
@@ -35188,9 +35232,7 @@ const vpStepId = (step) => step.kind === "reinstall" ? `vp:reinstall:${step.name
35188
35232
  const CONFIG_STEP = "config";
35189
35233
  const VP_INSTALL = [
35190
35234
  "curl -fsSL https://vite.plus | bash",
35191
- `ff_env="\${XDG_CONFIG_HOME:-$HOME/.config}/vite-plus/env"`,
35192
- `{ [ ! -f "$ff_env" ] || . "$ff_env"; }`,
35193
- `export PATH="\${VP_HOME:-$HOME/.vite-plus}/bin:\${XDG_DATA_HOME:-$HOME/.local/share}/vite-plus/bin:$PATH"`,
35235
+ ...vpEnv.split("\n"),
35194
35236
  "{ hash -r 2>/dev/null || true; }"
35195
35237
  ].join(" && ");
35196
35238
  const vpStep = (step) => {
@@ -35404,7 +35446,8 @@ const command = (target, script, secrets) => {
35404
35446
  const options = {
35405
35447
  stdin: encodeText(make$18(secrets.map((s) => `${s}\n`).join(""))),
35406
35448
  stdout: "pipe",
35407
- stderr: "pipe"
35449
+ stderr: "pipe",
35450
+ forceKillAfter: "5 seconds"
35408
35451
  };
35409
35452
  return target.local ? make$13(process.env.SHELL ?? "/bin/sh", ["-lc", script], options) : make$13("tailscale", [
35410
35453
  "ssh",
@@ -35512,13 +35555,17 @@ const runOn = fn("runOn")(function* (target, script, secrets, onLine, ledger) {
35512
35555
  }
35513
35556
  return run;
35514
35557
  });
35558
+ const GATHER_TIMEOUT = "2 minutes";
35515
35559
  const gather = fn("gather")(function* (target, script, ledger) {
35516
35560
  const facts = [];
35517
35561
  const output = [];
35518
35562
  const run = yield* runOn(target, script, [], (line) => sync(() => {
35519
35563
  if (line.kind === "state") facts.push(line.fact);
35520
35564
  else if (line.kind === "text" && line.text.trim() !== "") output.push(line.text.trimEnd());
35521
- }), ledger);
35565
+ }), ledger).pipe(timeoutOrElse({
35566
+ duration: GATHER_TIMEOUT,
35567
+ orElse: () => ledger.fail(target.name, [`gather took more than ${GATHER_TIMEOUT}; something on that Machine is blocking`, ...output]).pipe(as({ kind: "failed" }))
35568
+ }));
35522
35569
  if (run.kind !== "ran") return { kind: run.kind };
35523
35570
  const state = assembleState(facts);
35524
35571
  if (!state.complete) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetfizz",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Keep every Machine on your tailnet in line with one config.",
5
5
  "license": "MIT",
6
6
  "repository": {