fleetfizz 0.8.1 → 0.9.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.
- package/dist/fleetfizz.mjs +1210 -352
- package/package.json +1 -1
package/dist/fleetfizz.mjs
CHANGED
|
@@ -2750,9 +2750,9 @@ const Prototype = (options) => makePrimitiveProto({
|
|
|
2750
2750
|
/**
|
|
2751
2751
|
* @since 2.0.0
|
|
2752
2752
|
*/
|
|
2753
|
-
const TypeId$
|
|
2753
|
+
const TypeId$35 = "~effect/Option";
|
|
2754
2754
|
const CommonProto$1 = {
|
|
2755
|
-
[TypeId$
|
|
2755
|
+
[TypeId$35]: { _A: (_) => _ },
|
|
2756
2756
|
...PipeInspectableProto,
|
|
2757
2757
|
[Symbol.iterator]() {
|
|
2758
2758
|
return new SingleShotGen(this);
|
|
@@ -2802,7 +2802,7 @@ const NoneProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Common
|
|
|
2802
2802
|
}
|
|
2803
2803
|
});
|
|
2804
2804
|
/** @internal */
|
|
2805
|
-
const isOption = (input) => hasProperty(input, TypeId$
|
|
2805
|
+
const isOption = (input) => hasProperty(input, TypeId$35);
|
|
2806
2806
|
/** @internal */
|
|
2807
2807
|
const isNone$1 = (fa) => fa._tag === "None";
|
|
2808
2808
|
/** @internal */
|
|
@@ -2818,9 +2818,9 @@ SomeImpl.prototype = SomeProto;
|
|
|
2818
2818
|
const some$1 = (value) => new SomeImpl(value);
|
|
2819
2819
|
//#endregion
|
|
2820
2820
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/result.js
|
|
2821
|
-
const TypeId$
|
|
2821
|
+
const TypeId$34 = "~effect/Result";
|
|
2822
2822
|
const CommonProto = {
|
|
2823
|
-
[TypeId$
|
|
2823
|
+
[TypeId$34]: {
|
|
2824
2824
|
/* v8 ignore next 2 */
|
|
2825
2825
|
_A: (_) => _,
|
|
2826
2826
|
_E: (_) => _
|
|
@@ -2871,7 +2871,7 @@ const FailureProto = /*#__PURE__*/ Object.assign(/*#__PURE__*/ Object.create(Com
|
|
|
2871
2871
|
}
|
|
2872
2872
|
});
|
|
2873
2873
|
/** @internal */
|
|
2874
|
-
const isResult = (input) => hasProperty(input, TypeId$
|
|
2874
|
+
const isResult = (input) => hasProperty(input, TypeId$34);
|
|
2875
2875
|
/** @internal */
|
|
2876
2876
|
const isFailure$2 = (result) => result._tag === "Failure";
|
|
2877
2877
|
/** @internal */
|
|
@@ -2941,7 +2941,7 @@ const succeed$8 = (success) => new SuccessImpl(success);
|
|
|
2941
2941
|
* @category constructors
|
|
2942
2942
|
* @since 2.0.0
|
|
2943
2943
|
*/
|
|
2944
|
-
function make$
|
|
2944
|
+
function make$29(compare) {
|
|
2945
2945
|
return (self, that) => self === that ? 0 : compare(self, that);
|
|
2946
2946
|
}
|
|
2947
2947
|
/**
|
|
@@ -2972,7 +2972,7 @@ function make$28(compare) {
|
|
|
2972
2972
|
* @category instances
|
|
2973
2973
|
* @since 4.0.0
|
|
2974
2974
|
*/
|
|
2975
|
-
const String$
|
|
2975
|
+
const String$9 = /*#__PURE__*/ make$29((self, that) => self < that ? -1 : 1);
|
|
2976
2976
|
/**
|
|
2977
2977
|
* Order instance for numbers that compares them numerically.
|
|
2978
2978
|
*
|
|
@@ -3005,7 +3005,7 @@ const String$8 = /*#__PURE__*/ make$28((self, that) => self < that ? -1 : 1);
|
|
|
3005
3005
|
* @category instances
|
|
3006
3006
|
* @since 4.0.0
|
|
3007
3007
|
*/
|
|
3008
|
-
const Number$6 = /*#__PURE__*/ make$
|
|
3008
|
+
const Number$6 = /*#__PURE__*/ make$29((self, that) => {
|
|
3009
3009
|
if (globalThis.Number.isNaN(self) && globalThis.Number.isNaN(that)) return 0;
|
|
3010
3010
|
if (globalThis.Number.isNaN(self)) return -1;
|
|
3011
3011
|
if (globalThis.Number.isNaN(that)) return 1;
|
|
@@ -3044,7 +3044,7 @@ const Number$6 = /*#__PURE__*/ make$28((self, that) => {
|
|
|
3044
3044
|
* @category mapping
|
|
3045
3045
|
* @since 2.0.0
|
|
3046
3046
|
*/
|
|
3047
|
-
const mapInput = /*#__PURE__*/ dual(2, (self, f) => make$
|
|
3047
|
+
const mapInput = /*#__PURE__*/ dual(2, (self, f) => make$29((b1, b2) => self(f(b1), f(b2))));
|
|
3048
3048
|
/**
|
|
3049
3049
|
* Checks whether one value is strictly greater than another according to the given order.
|
|
3050
3050
|
*
|
|
@@ -3555,7 +3555,7 @@ const ServiceProto = {
|
|
|
3555
3555
|
return self;
|
|
3556
3556
|
},
|
|
3557
3557
|
context(self) {
|
|
3558
|
-
return make$
|
|
3558
|
+
return make$28(this, self);
|
|
3559
3559
|
},
|
|
3560
3560
|
use(f) {
|
|
3561
3561
|
return withFiber$1((fiber) => f(get$2(fiber.context, this)));
|
|
@@ -3566,7 +3566,7 @@ const ServiceProto = {
|
|
|
3566
3566
|
};
|
|
3567
3567
|
const cacheKeys = /*#__PURE__*/ new Set();
|
|
3568
3568
|
const ReferenceTypeId = "~effect/Context/Reference";
|
|
3569
|
-
const TypeId$
|
|
3569
|
+
const TypeId$33 = "~effect/Context";
|
|
3570
3570
|
const MaxDepth = 8;
|
|
3571
3571
|
const FlattenAfterBaseHits = 8;
|
|
3572
3572
|
const makeImpl = (cacheRoot, base, overlay, depth) => {
|
|
@@ -3647,7 +3647,7 @@ const Proto$8 = {
|
|
|
3647
3647
|
return flatten(this);
|
|
3648
3648
|
},
|
|
3649
3649
|
...PipeInspectableProto,
|
|
3650
|
-
[TypeId$
|
|
3650
|
+
[TypeId$33]: { _Services: (_) => _ },
|
|
3651
3651
|
toJSON() {
|
|
3652
3652
|
return {
|
|
3653
3653
|
_id: "Context",
|
|
@@ -3703,7 +3703,7 @@ const hasSameCache = (self, that) => self.cacheRoot === that.cacheRoot;
|
|
|
3703
3703
|
* @category guards
|
|
3704
3704
|
* @since 2.0.0
|
|
3705
3705
|
*/
|
|
3706
|
-
const isContext = (u) => hasProperty(u, TypeId$
|
|
3706
|
+
const isContext = (u) => hasProperty(u, TypeId$33);
|
|
3707
3707
|
/**
|
|
3708
3708
|
* Checks whether the provided argument is a `Reference`.
|
|
3709
3709
|
*
|
|
@@ -3760,7 +3760,7 @@ const emptyContext = /*#__PURE__*/ makeUnsafe$5(/*#__PURE__*/ new Map());
|
|
|
3760
3760
|
* @category constructors
|
|
3761
3761
|
* @since 2.0.0
|
|
3762
3762
|
*/
|
|
3763
|
-
const make$
|
|
3763
|
+
const make$28 = (key, service) => makeUnsafe$5(/* @__PURE__ */ new Map([[key.key, service]]));
|
|
3764
3764
|
/**
|
|
3765
3765
|
* Adds a service to a given `Context`.
|
|
3766
3766
|
*
|
|
@@ -4715,7 +4715,7 @@ const dedupe = (self) => {
|
|
|
4715
4715
|
};
|
|
4716
4716
|
//#endregion
|
|
4717
4717
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Duration.js
|
|
4718
|
-
const TypeId$
|
|
4718
|
+
const TypeId$32 = "~effect/Duration";
|
|
4719
4719
|
const bigint0$3 = /*#__PURE__*/ BigInt(0);
|
|
4720
4720
|
const bigint1$2 = /*#__PURE__*/ BigInt(1);
|
|
4721
4721
|
const bigint2 = /*#__PURE__*/ BigInt(2);
|
|
@@ -4792,13 +4792,13 @@ const fromInputUnsafe$1 = (input) => {
|
|
|
4792
4792
|
}
|
|
4793
4793
|
case "object": {
|
|
4794
4794
|
if (input === null) break;
|
|
4795
|
-
if (TypeId$
|
|
4795
|
+
if (TypeId$32 in input) return input;
|
|
4796
4796
|
if (Array.isArray(input)) {
|
|
4797
4797
|
if (input.length !== 2 || !input.every(isNumber)) return invalid$2(input);
|
|
4798
4798
|
if (Number.isNaN(input[0]) || Number.isNaN(input[1])) return zero$1;
|
|
4799
4799
|
if (input[0] === -Infinity || input[1] === -Infinity) return negativeInfinity;
|
|
4800
4800
|
if (input[0] === Infinity || input[1] === Infinity) return infinity;
|
|
4801
|
-
return make$
|
|
4801
|
+
return make$27(roundTiesAwayFromZero(input[0] * 1e9 + input[1]));
|
|
4802
4802
|
}
|
|
4803
4803
|
const obj = input;
|
|
4804
4804
|
let millis = 0;
|
|
@@ -4808,8 +4808,8 @@ const fromInputUnsafe$1 = (input) => {
|
|
|
4808
4808
|
if (obj.minutes) millis += obj.minutes * 6e4;
|
|
4809
4809
|
if (obj.seconds) millis += obj.seconds * 1e3;
|
|
4810
4810
|
if (obj.milliseconds) millis += obj.milliseconds;
|
|
4811
|
-
if (!obj.microseconds && !obj.nanoseconds) return make$
|
|
4812
|
-
return make$
|
|
4811
|
+
if (!obj.microseconds && !obj.nanoseconds) return make$27(millis);
|
|
4812
|
+
return make$27(roundTiesAwayFromZero(millis * 1e6 + (obj.microseconds ?? 0) * 1e3 + (obj.nanoseconds ?? 0)));
|
|
4813
4813
|
}
|
|
4814
4814
|
}
|
|
4815
4815
|
return invalid$2(input);
|
|
@@ -4824,7 +4824,7 @@ const zeroDurationValue = {
|
|
|
4824
4824
|
const infinityDurationValue = { _tag: "Infinity" };
|
|
4825
4825
|
const negativeInfinityDurationValue = { _tag: "NegativeInfinity" };
|
|
4826
4826
|
const DurationProto = {
|
|
4827
|
-
[TypeId$
|
|
4827
|
+
[TypeId$32]: TypeId$32,
|
|
4828
4828
|
[symbol$1]() {
|
|
4829
4829
|
switch (this.value._tag) {
|
|
4830
4830
|
case "Millis": {
|
|
@@ -4875,7 +4875,7 @@ const DurationProto = {
|
|
|
4875
4875
|
return pipeArguments(this, arguments);
|
|
4876
4876
|
}
|
|
4877
4877
|
};
|
|
4878
|
-
const make$
|
|
4878
|
+
const make$27 = (input) => {
|
|
4879
4879
|
const duration = Object.create(DurationProto);
|
|
4880
4880
|
if (typeof input === "number") {
|
|
4881
4881
|
if (isNaN(input) || input === 0 || Object.is(input, -0)) duration.value = zeroDurationValue;
|
|
@@ -4911,7 +4911,7 @@ const make$26 = (input) => {
|
|
|
4911
4911
|
* @category guards
|
|
4912
4912
|
* @since 2.0.0
|
|
4913
4913
|
*/
|
|
4914
|
-
const isDuration = (u) => hasProperty(u, TypeId$
|
|
4914
|
+
const isDuration = (u) => hasProperty(u, TypeId$32);
|
|
4915
4915
|
/**
|
|
4916
4916
|
* Checks whether a Duration is finite (not infinite).
|
|
4917
4917
|
*
|
|
@@ -4944,7 +4944,7 @@ const isFinite$1 = (self) => self.value._tag !== "Infinity" && self.value._tag !
|
|
|
4944
4944
|
* @category constructors
|
|
4945
4945
|
* @since 2.0.0
|
|
4946
4946
|
*/
|
|
4947
|
-
const zero$1 = /*#__PURE__*/ make$
|
|
4947
|
+
const zero$1 = /*#__PURE__*/ make$27(0);
|
|
4948
4948
|
/**
|
|
4949
4949
|
* A Duration representing infinite time.
|
|
4950
4950
|
*
|
|
@@ -4960,7 +4960,7 @@ const zero$1 = /*#__PURE__*/ make$26(0);
|
|
|
4960
4960
|
* @category constructors
|
|
4961
4961
|
* @since 2.0.0
|
|
4962
4962
|
*/
|
|
4963
|
-
const infinity = /*#__PURE__*/ make$
|
|
4963
|
+
const infinity = /*#__PURE__*/ make$27(Infinity);
|
|
4964
4964
|
/**
|
|
4965
4965
|
* A Duration representing negative infinite time.
|
|
4966
4966
|
*
|
|
@@ -4976,7 +4976,7 @@ const infinity = /*#__PURE__*/ make$26(Infinity);
|
|
|
4976
4976
|
* @category constructors
|
|
4977
4977
|
* @since 4.0.0
|
|
4978
4978
|
*/
|
|
4979
|
-
const negativeInfinity = /*#__PURE__*/ make$
|
|
4979
|
+
const negativeInfinity = /*#__PURE__*/ make$27(-Infinity);
|
|
4980
4980
|
/**
|
|
4981
4981
|
* Creates a Duration from nanoseconds.
|
|
4982
4982
|
*
|
|
@@ -4992,7 +4992,7 @@ const negativeInfinity = /*#__PURE__*/ make$26(-Infinity);
|
|
|
4992
4992
|
* @category constructors
|
|
4993
4993
|
* @since 2.0.0
|
|
4994
4994
|
*/
|
|
4995
|
-
const nanos = (nanos) => make$
|
|
4995
|
+
const nanos = (nanos) => make$27(nanos);
|
|
4996
4996
|
/**
|
|
4997
4997
|
* Creates a Duration from milliseconds.
|
|
4998
4998
|
*
|
|
@@ -5008,7 +5008,7 @@ const nanos = (nanos) => make$26(nanos);
|
|
|
5008
5008
|
* @category constructors
|
|
5009
5009
|
* @since 2.0.0
|
|
5010
5010
|
*/
|
|
5011
|
-
const millis = (millis) => make$
|
|
5011
|
+
const millis = (millis) => make$27(millis);
|
|
5012
5012
|
/**
|
|
5013
5013
|
* Creates a Duration from seconds.
|
|
5014
5014
|
*
|
|
@@ -5024,7 +5024,7 @@ const millis = (millis) => make$26(millis);
|
|
|
5024
5024
|
* @category constructors
|
|
5025
5025
|
* @since 2.0.0
|
|
5026
5026
|
*/
|
|
5027
|
-
const seconds = (seconds) => make$
|
|
5027
|
+
const seconds = (seconds) => make$27(seconds * 1e3);
|
|
5028
5028
|
/**
|
|
5029
5029
|
* Creates a Duration from minutes.
|
|
5030
5030
|
*
|
|
@@ -5040,7 +5040,7 @@ const seconds = (seconds) => make$26(seconds * 1e3);
|
|
|
5040
5040
|
* @category constructors
|
|
5041
5041
|
* @since 2.0.0
|
|
5042
5042
|
*/
|
|
5043
|
-
const minutes = (minutes) => make$
|
|
5043
|
+
const minutes = (minutes) => make$27(minutes * 6e4);
|
|
5044
5044
|
/**
|
|
5045
5045
|
* Creates a Duration from hours.
|
|
5046
5046
|
*
|
|
@@ -5056,7 +5056,7 @@ const minutes = (minutes) => make$26(minutes * 6e4);
|
|
|
5056
5056
|
* @category constructors
|
|
5057
5057
|
* @since 2.0.0
|
|
5058
5058
|
*/
|
|
5059
|
-
const hours = (hours) => make$
|
|
5059
|
+
const hours = (hours) => make$27(hours * 36e5);
|
|
5060
5060
|
/**
|
|
5061
5061
|
* Creates a Duration from days.
|
|
5062
5062
|
*
|
|
@@ -5072,7 +5072,7 @@ const hours = (hours) => make$26(hours * 36e5);
|
|
|
5072
5072
|
* @category constructors
|
|
5073
5073
|
* @since 2.0.0
|
|
5074
5074
|
*/
|
|
5075
|
-
const days = (days) => make$
|
|
5075
|
+
const days = (days) => make$27(days * 864e5);
|
|
5076
5076
|
/**
|
|
5077
5077
|
* Creates a Duration from weeks.
|
|
5078
5078
|
*
|
|
@@ -5088,7 +5088,7 @@ const days = (days) => make$26(days * 864e5);
|
|
|
5088
5088
|
* @category constructors
|
|
5089
5089
|
* @since 2.0.0
|
|
5090
5090
|
*/
|
|
5091
|
-
const weeks = (weeks) => make$
|
|
5091
|
+
const weeks = (weeks) => make$27(weeks * 6048e5);
|
|
5092
5092
|
/**
|
|
5093
5093
|
* Converts a Duration to milliseconds.
|
|
5094
5094
|
*
|
|
@@ -5779,7 +5779,7 @@ var ParentSpan = class extends (/*#__PURE__*/ Service()(ParentSpanKey, { fiberCa
|
|
|
5779
5779
|
* @category constructors
|
|
5780
5780
|
* @since 2.0.0
|
|
5781
5781
|
*/
|
|
5782
|
-
const make$
|
|
5782
|
+
const make$26 = (options) => options;
|
|
5783
5783
|
/**
|
|
5784
5784
|
* Context reference for disabling trace propagation.
|
|
5785
5785
|
*
|
|
@@ -5884,7 +5884,7 @@ const TracerKey = "effect/Tracer";
|
|
|
5884
5884
|
* @category references
|
|
5885
5885
|
* @since 4.0.0
|
|
5886
5886
|
*/
|
|
5887
|
-
const nativeTracer = /*#__PURE__*/ make$
|
|
5887
|
+
const nativeTracer = /*#__PURE__*/ make$26({ span: (options) => new NativeSpan(options) });
|
|
5888
5888
|
/**
|
|
5889
5889
|
* Default in-memory `Span` implementation used by the native tracer. It
|
|
5890
5890
|
* generates span and trace identifiers, stores attributes, events, and links,
|
|
@@ -5988,7 +5988,7 @@ const TracerSpanAnnotations = /*#__PURE__*/ Reference("effect/References/TracerS
|
|
|
5988
5988
|
/** @internal */
|
|
5989
5989
|
const TracerSpanLinks = /*#__PURE__*/ Reference("effect/References/TracerSpanLinks", { defaultValue: () => [] });
|
|
5990
5990
|
/** @internal */
|
|
5991
|
-
const CurrentLogAnnotations = /*#__PURE__*/ Reference("effect/References/CurrentLogAnnotations", { defaultValue: () => ({}) });
|
|
5991
|
+
const CurrentLogAnnotations$1 = /*#__PURE__*/ Reference("effect/References/CurrentLogAnnotations", { defaultValue: () => ({}) });
|
|
5992
5992
|
/** @internal */
|
|
5993
5993
|
const CurrentLogLevel = /*#__PURE__*/ Reference("effect/References/CurrentLogLevel", {
|
|
5994
5994
|
fiberCached: true,
|
|
@@ -6258,7 +6258,7 @@ var FiberImpl = class {
|
|
|
6258
6258
|
interruptUnsafe(fiberId, annotations) {
|
|
6259
6259
|
if (this._exit) return;
|
|
6260
6260
|
let cause = causeInterrupt(fiberId);
|
|
6261
|
-
if (this.cache.stackFrame) cause = causeAnnotate(cause, make$
|
|
6261
|
+
if (this.cache.stackFrame) cause = causeAnnotate(cause, make$28(StackTraceKey, this.cache.stackFrame));
|
|
6262
6262
|
if (annotations) cause = causeAnnotate(cause, annotations);
|
|
6263
6263
|
this._interruptedCause = this._interruptedCause ? causeCombine(this._interruptedCause, cause) : cause;
|
|
6264
6264
|
if (this.interruptible) {
|
|
@@ -6852,6 +6852,8 @@ const exitIsFailure = (self) => self._tag === "Failure";
|
|
|
6852
6852
|
/** @internal */
|
|
6853
6853
|
const exitFilterCause = (self) => self._tag === "Failure" ? succeed$7(self.cause) : fail$5(self);
|
|
6854
6854
|
/** @internal */
|
|
6855
|
+
const exitHasInterrupts = (self) => self._tag === "Failure" && hasInterrupts(self.cause);
|
|
6856
|
+
/** @internal */
|
|
6855
6857
|
const exitVoid = /*#__PURE__*/ exitSucceed(void 0);
|
|
6856
6858
|
/** @internal */
|
|
6857
6859
|
const exitMap = /*#__PURE__*/ dual(2, (self, f) => self._tag === "Success" ? exitSucceed(f(self.value)) : self);
|
|
@@ -7247,6 +7249,45 @@ const onExitFilter = /*#__PURE__*/ dual(3, (self, filter, f) => onExit$1(self, (
|
|
|
7247
7249
|
}));
|
|
7248
7250
|
/** @internal */
|
|
7249
7251
|
const onError$1 = /*#__PURE__*/ dual(2, (self, f) => onExitFilter(self, exitFilterCause, f));
|
|
7252
|
+
const infiniteTTL = /*#__PURE__*/ constant(Infinity);
|
|
7253
|
+
const makeCachedUnsafe = (self, ttlMillis) => {
|
|
7254
|
+
let expiresAt = 0;
|
|
7255
|
+
let exit;
|
|
7256
|
+
let current;
|
|
7257
|
+
const join = (fiber, run) => {
|
|
7258
|
+
run.awaiters++;
|
|
7259
|
+
onExitUnsafe(fiber, () => {
|
|
7260
|
+
if (--run.awaiters > 0 || current !== run) return;
|
|
7261
|
+
current = void 0;
|
|
7262
|
+
return fiberInterrupt(run.fiber);
|
|
7263
|
+
});
|
|
7264
|
+
return fiberJoin(run.fiber);
|
|
7265
|
+
};
|
|
7266
|
+
return [withFiber$1((fiber) => {
|
|
7267
|
+
if (current !== void 0) return join(fiber, current);
|
|
7268
|
+
if (exit !== void 0 && (expiresAt === Infinity || fiber.getRef(ClockRef).currentTimeMillisUnsafe() < expiresAt)) return exit;
|
|
7269
|
+
exit = void 0;
|
|
7270
|
+
const clock = fiber.getRef(ClockRef);
|
|
7271
|
+
const run = {
|
|
7272
|
+
fiber: void 0,
|
|
7273
|
+
awaiters: 0
|
|
7274
|
+
};
|
|
7275
|
+
current = run;
|
|
7276
|
+
run.fiber = forkUnsafe$1(fiber, onExitPrimitive$1(self, (exit_) => {
|
|
7277
|
+
if (current !== run) return;
|
|
7278
|
+
current = void 0;
|
|
7279
|
+
if (exitHasInterrupts(exit_)) return;
|
|
7280
|
+
const duration = ttlMillis(exit_);
|
|
7281
|
+
expiresAt = duration === Infinity ? Infinity : clock.currentTimeMillisUnsafe() + duration;
|
|
7282
|
+
exit = exit_;
|
|
7283
|
+
}), true, true);
|
|
7284
|
+
return run.fiber._exit ?? join(fiber, run);
|
|
7285
|
+
}), sync$1(() => {
|
|
7286
|
+
exit = void 0;
|
|
7287
|
+
})];
|
|
7288
|
+
};
|
|
7289
|
+
/** @internal */
|
|
7290
|
+
const cached$1 = (self) => sync$1(() => makeCachedUnsafe(self, infiniteTTL)[0]);
|
|
7250
7291
|
/** @internal */
|
|
7251
7292
|
const interrupt$2 = /*#__PURE__*/ withFiber$1((fiber) => failCause$3(causeInterrupt(fiber.id)));
|
|
7252
7293
|
/** @internal */
|
|
@@ -7503,6 +7544,8 @@ const forkUnsafe$1 = (parent, effect, immediate = false, daemon = false, uninter
|
|
|
7503
7544
|
return child;
|
|
7504
7545
|
};
|
|
7505
7546
|
/** @internal */
|
|
7547
|
+
const forkDetach = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, options) => withFiber$1((fiber) => succeed$6(forkUnsafe$1(fiber, self, options?.startImmediately, true, options?.uninterruptible))));
|
|
7548
|
+
/** @internal */
|
|
7506
7549
|
const forkIn$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, scope, options) => withFiber$1((parent) => {
|
|
7507
7550
|
const fiber = forkUnsafe$1(parent, self, options?.startImmediately, true, options?.uninterruptible);
|
|
7508
7551
|
if (!fiber._exit) {
|
|
@@ -7816,7 +7859,7 @@ const logLevelToOrder = (level) => {
|
|
|
7816
7859
|
/** @internal */
|
|
7817
7860
|
const isLogLevelGreaterThan = /*#__PURE__*/ isGreaterThan$1(/* @__PURE__ */ mapInput(Number$6, logLevelToOrder));
|
|
7818
7861
|
/** @internal */
|
|
7819
|
-
const CurrentLoggers = /*#__PURE__*/ Reference("effect/Logger/CurrentLoggers", { defaultValue: () => /* @__PURE__ */ new Set([defaultLogger, tracerLogger]) });
|
|
7862
|
+
const CurrentLoggers$1 = /*#__PURE__*/ Reference("effect/Logger/CurrentLoggers", { defaultValue: () => /* @__PURE__ */ new Set([defaultLogger, tracerLogger]) });
|
|
7820
7863
|
/** @internal */
|
|
7821
7864
|
const LogToStderr = /*#__PURE__*/ Reference("effect/Logger/LogToStderr", { defaultValue: constFalse });
|
|
7822
7865
|
const LoggerProto = {
|
|
@@ -7866,7 +7909,7 @@ const logWithLevel = (level) => (...message) => {
|
|
|
7866
7909
|
const logLevel = level ?? fiber.cache.logLevel;
|
|
7867
7910
|
if (isLogLevelGreaterThan(fiber.cache.minimumLogLevel, logLevel)) return void_$2;
|
|
7868
7911
|
const clock = fiber.getRef(ClockRef);
|
|
7869
|
-
const loggers = fiber.getRef(CurrentLoggers);
|
|
7912
|
+
const loggers = fiber.getRef(CurrentLoggers$1);
|
|
7870
7913
|
if (loggers.size > 0) {
|
|
7871
7914
|
const date = new Date(clock.currentTimeMillisUnsafe());
|
|
7872
7915
|
for (const logger of loggers) logger.log({
|
|
@@ -7902,7 +7945,7 @@ const defaultLogger = /*#__PURE__*/ loggerMake(({ cause, date, fiber, logLevel,
|
|
|
7902
7945
|
const spans = fiber.getRef(CurrentLogSpans);
|
|
7903
7946
|
let spanString = "";
|
|
7904
7947
|
for (const span of spans) spanString += ` ${formatLogSpan(span, now)}`;
|
|
7905
|
-
const annotations = fiber.getRef(CurrentLogAnnotations);
|
|
7948
|
+
const annotations = fiber.getRef(CurrentLogAnnotations$1);
|
|
7906
7949
|
if (Object.keys(annotations).length > 0) message_.push(annotations);
|
|
7907
7950
|
const console = fiber.getRef(ConsoleRef);
|
|
7908
7951
|
(fiber.getRef(LogToStderr) ? console.error : console.log)(`[${defaultDateFormat(date)}] ${logLevel.toUpperCase()} (#${fiber.id})${spanString}:`, ...message_);
|
|
@@ -7910,7 +7953,7 @@ const defaultLogger = /*#__PURE__*/ loggerMake(({ cause, date, fiber, logLevel,
|
|
|
7910
7953
|
/** @internal */
|
|
7911
7954
|
const tracerLogger = /*#__PURE__*/ loggerMake(({ cause, fiber, logLevel, message }) => {
|
|
7912
7955
|
const clock = fiber.getRef(ClockRef);
|
|
7913
|
-
const annotations = fiber.getRef(CurrentLogAnnotations);
|
|
7956
|
+
const annotations = fiber.getRef(CurrentLogAnnotations$1);
|
|
7914
7957
|
const span = fiber.cache.span;
|
|
7915
7958
|
if (span === void 0 || span._tag === "ExternalSpan") return;
|
|
7916
7959
|
const attributes = {};
|
|
@@ -8135,6 +8178,51 @@ const map$6 = causeMap;
|
|
|
8135
8178
|
*/
|
|
8136
8179
|
const squash = causeSquash;
|
|
8137
8180
|
/**
|
|
8181
|
+
* Formats a `Cause` as a human-readable string for logging or debugging.
|
|
8182
|
+
*
|
|
8183
|
+
* **When to use**
|
|
8184
|
+
*
|
|
8185
|
+
* Use to render a whole cause as one human-readable string for logs or
|
|
8186
|
+
* diagnostics.
|
|
8187
|
+
*
|
|
8188
|
+
* **Details**
|
|
8189
|
+
*
|
|
8190
|
+
* Delegates to {@link prettyErrors} to convert each reason to an `Error`,
|
|
8191
|
+
* then joins their stack traces with newlines. Nested `Error.cause` chains
|
|
8192
|
+
* are rendered inline with indentation:
|
|
8193
|
+
*
|
|
8194
|
+
* ```text
|
|
8195
|
+
* ErrorName: message
|
|
8196
|
+
* at ...
|
|
8197
|
+
* at ... {
|
|
8198
|
+
* [cause]: NestedError: message
|
|
8199
|
+
* at ...
|
|
8200
|
+
* }
|
|
8201
|
+
* ```
|
|
8202
|
+
*
|
|
8203
|
+
* Span annotations are appended to the relevant stack frames when available.
|
|
8204
|
+
*
|
|
8205
|
+
* **Gotchas**
|
|
8206
|
+
*
|
|
8207
|
+
* Rendering an empty cause produces an empty string because there are no
|
|
8208
|
+
* errors to render.
|
|
8209
|
+
*
|
|
8210
|
+
* **Example** (Rendering a cause)
|
|
8211
|
+
*
|
|
8212
|
+
* ```ts import.meta.vitest
|
|
8213
|
+
* import { Cause } from "effect"
|
|
8214
|
+
*
|
|
8215
|
+
* Cause.pretty(Cause.fail("something went wrong")).includes("something went wrong") // => true
|
|
8216
|
+
* ```
|
|
8217
|
+
*
|
|
8218
|
+
* @see {@link prettyErrors} — get the individual `Error` instances
|
|
8219
|
+
*
|
|
8220
|
+
* @stability stable
|
|
8221
|
+
* @category formatting
|
|
8222
|
+
* @since 2.0.0
|
|
8223
|
+
*/
|
|
8224
|
+
const pretty = causePretty;
|
|
8225
|
+
/**
|
|
8138
8226
|
* Checks whether an arbitrary value is a `Done` signal.
|
|
8139
8227
|
*
|
|
8140
8228
|
* **Example** (Checking the runtime type)
|
|
@@ -8504,6 +8592,66 @@ const doneUnsafe = (self, effect) => {
|
|
|
8504
8592
|
//#endregion
|
|
8505
8593
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/References.js
|
|
8506
8594
|
/**
|
|
8595
|
+
* Context reference for managing log annotations that are automatically added to all log entries.
|
|
8596
|
+
* These annotations provide contextual metadata that appears in every log message.
|
|
8597
|
+
*
|
|
8598
|
+
* **When to use**
|
|
8599
|
+
*
|
|
8600
|
+
* Use to attach shared contextual metadata to every log entry emitted in the
|
|
8601
|
+
* current context.
|
|
8602
|
+
*
|
|
8603
|
+
* **Example** (Managing log annotations)
|
|
8604
|
+
*
|
|
8605
|
+
* ```ts import.meta.vitest
|
|
8606
|
+
* import { Effect, References } from "effect"
|
|
8607
|
+
*
|
|
8608
|
+
* const logAnnotationExample = Effect.gen(function*() {
|
|
8609
|
+
* // Get current annotations (empty by default)
|
|
8610
|
+
* const current = yield* References.CurrentLogAnnotations
|
|
8611
|
+
* const defaultCount = Object.keys(current).length
|
|
8612
|
+
*
|
|
8613
|
+
* // Run with custom log annotations
|
|
8614
|
+
* const custom = yield* Effect.provideService(
|
|
8615
|
+
* Effect.gen(function*() {
|
|
8616
|
+
* const annotations = yield* References.CurrentLogAnnotations
|
|
8617
|
+
* return [annotations.requestId, annotations.userId, annotations.version]
|
|
8618
|
+
* }),
|
|
8619
|
+
* References.CurrentLogAnnotations,
|
|
8620
|
+
* {
|
|
8621
|
+
* requestId: "req-123",
|
|
8622
|
+
* userId: "user-456",
|
|
8623
|
+
* version: "1.0.0"
|
|
8624
|
+
* }
|
|
8625
|
+
* )
|
|
8626
|
+
*
|
|
8627
|
+
* // Run with extended annotations
|
|
8628
|
+
* const extended = yield* Effect.provideService(
|
|
8629
|
+
* Effect.gen(function*() {
|
|
8630
|
+
* const annotations = yield* References.CurrentLogAnnotations
|
|
8631
|
+
* return [annotations.operation, annotations.timestamp]
|
|
8632
|
+
* }),
|
|
8633
|
+
* References.CurrentLogAnnotations,
|
|
8634
|
+
* {
|
|
8635
|
+
* requestId: "req-123",
|
|
8636
|
+
* userId: "user-456",
|
|
8637
|
+
* version: "1.0.0",
|
|
8638
|
+
* operation: "data-sync",
|
|
8639
|
+
* timestamp: 1234567890
|
|
8640
|
+
* }
|
|
8641
|
+
* )
|
|
8642
|
+
*
|
|
8643
|
+
* return [defaultCount, custom, extended]
|
|
8644
|
+
* })
|
|
8645
|
+
*
|
|
8646
|
+
* await Effect.runPromise(logAnnotationExample) // => [0, ["req-123", "user-456", "1.0.0"], ["data-sync", 1234567890]]
|
|
8647
|
+
* ```
|
|
8648
|
+
*
|
|
8649
|
+
* @stability stable
|
|
8650
|
+
* @category references
|
|
8651
|
+
* @since 4.0.0
|
|
8652
|
+
*/
|
|
8653
|
+
const CurrentLogAnnotations = CurrentLogAnnotations$1;
|
|
8654
|
+
/**
|
|
8507
8655
|
* Context reference for setting the minimum log level threshold. Log entries below this
|
|
8508
8656
|
* level will be filtered out completely.
|
|
8509
8657
|
*
|
|
@@ -8797,7 +8945,7 @@ const forkUnsafe = scopeForkUnsafe;
|
|
|
8797
8945
|
const close = scopeClose;
|
|
8798
8946
|
//#endregion
|
|
8799
8947
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Layer.js
|
|
8800
|
-
const TypeId$
|
|
8948
|
+
const TypeId$30 = "~effect/Layer";
|
|
8801
8949
|
const MemoMapTypeId = "~effect/Layer/MemoMap";
|
|
8802
8950
|
const makeMemoMapEntry = (memoMap, layer) => {
|
|
8803
8951
|
const entry = {
|
|
@@ -8819,7 +8967,7 @@ const memoMapObserve = (entry, scope) => {
|
|
|
8819
8967
|
return true;
|
|
8820
8968
|
};
|
|
8821
8969
|
const LayerProto = {
|
|
8822
|
-
[TypeId$
|
|
8970
|
+
[TypeId$30]: {
|
|
8823
8971
|
_ROut: identity,
|
|
8824
8972
|
_E: identity,
|
|
8825
8973
|
_RIn: identity
|
|
@@ -9163,8 +9311,8 @@ const buildWithScope = /*#__PURE__*/ dual(2, (self, scope) => withFiber$1((fiber
|
|
|
9163
9311
|
* @since 2.0.0
|
|
9164
9312
|
*/
|
|
9165
9313
|
const succeed$4 = function() {
|
|
9166
|
-
if (arguments.length === 1) return (resource) => succeedContext(make$
|
|
9167
|
-
return succeedContext(make$
|
|
9314
|
+
if (arguments.length === 1) return (resource) => succeedContext(make$28(arguments[0], resource));
|
|
9315
|
+
return succeedContext(make$28(arguments[0], arguments[1]));
|
|
9168
9316
|
};
|
|
9169
9317
|
/**
|
|
9170
9318
|
* Constructs a layer that provides all services in an already available
|
|
@@ -9258,7 +9406,7 @@ const effect = function() {
|
|
|
9258
9406
|
if (arguments.length === 1) return (effect) => effectImpl(arguments[0], effect);
|
|
9259
9407
|
return effectImpl(arguments[0], arguments[1]);
|
|
9260
9408
|
};
|
|
9261
|
-
const effectImpl = (service, effect) => effectContext(map$7(effect, (value) => make$
|
|
9409
|
+
const effectImpl = (service, effect) => effectContext(map$7(effect, (value) => make$28(service, value)));
|
|
9262
9410
|
/**
|
|
9263
9411
|
* Constructs a layer from an effect that produces all services in a `Context`.
|
|
9264
9412
|
*
|
|
@@ -9487,11 +9635,11 @@ const currentTimeMillis = currentTimeMillis$1;
|
|
|
9487
9635
|
//#endregion
|
|
9488
9636
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/dateTime.js
|
|
9489
9637
|
/** @internal */
|
|
9490
|
-
const TypeId$
|
|
9638
|
+
const TypeId$29 = "~effect/DateTime";
|
|
9491
9639
|
/** @internal */
|
|
9492
9640
|
const TimeZoneTypeId = "~effect/DateTime/TimeZone";
|
|
9493
9641
|
const Proto$7 = {
|
|
9494
|
-
[TypeId$
|
|
9642
|
+
[TypeId$29]: TypeId$29,
|
|
9495
9643
|
pipe() {
|
|
9496
9644
|
return pipeArguments(this, arguments);
|
|
9497
9645
|
},
|
|
@@ -9525,7 +9673,7 @@ const ProtoTimeZone = {
|
|
|
9525
9673
|
({ ...ProtoTimeZone });
|
|
9526
9674
|
({ ...ProtoTimeZone });
|
|
9527
9675
|
/** @internal */
|
|
9528
|
-
const isDateTime$1 = (u) => hasProperty(u, TypeId$
|
|
9676
|
+
const isDateTime$1 = (u) => hasProperty(u, TypeId$29);
|
|
9529
9677
|
const isDateTimeArgs = (args) => isDateTime$1(args[0]);
|
|
9530
9678
|
const makeUtc = (epochMillis) => {
|
|
9531
9679
|
const self = Object.create(ProtoUtc);
|
|
@@ -9800,7 +9948,7 @@ const matchEffect$1 = /*#__PURE__*/ dual(2, (self, options) => matchCauseEffect$
|
|
|
9800
9948
|
}));
|
|
9801
9949
|
//#endregion
|
|
9802
9950
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Schedule.js
|
|
9803
|
-
const TypeId$
|
|
9951
|
+
const TypeId$28 = "~effect/Schedule";
|
|
9804
9952
|
/**
|
|
9805
9953
|
* Context reference containing metadata for the currently running schedule step.
|
|
9806
9954
|
*
|
|
@@ -9826,7 +9974,7 @@ const CurrentMetadata = /*#__PURE__*/ Reference("effect/Schedule/CurrentMetadata
|
|
|
9826
9974
|
elapsedSincePrevious: 0
|
|
9827
9975
|
}) });
|
|
9828
9976
|
const ScheduleProto = {
|
|
9829
|
-
[TypeId$
|
|
9977
|
+
[TypeId$28]: {
|
|
9830
9978
|
_Out: identity,
|
|
9831
9979
|
_In: identity,
|
|
9832
9980
|
_Env: identity
|
|
@@ -9856,7 +10004,7 @@ const ScheduleProto = {
|
|
|
9856
10004
|
* @category guards
|
|
9857
10005
|
* @since 2.0.0
|
|
9858
10006
|
*/
|
|
9859
|
-
const isSchedule = (u) => hasProperty(u, TypeId$
|
|
10007
|
+
const isSchedule = (u) => hasProperty(u, TypeId$28);
|
|
9860
10008
|
/**
|
|
9861
10009
|
* Creates a Schedule from a step function that returns a Pull.
|
|
9862
10010
|
*
|
|
@@ -12482,6 +12630,63 @@ const onExitPrimitive = onExitPrimitive$1;
|
|
|
12482
12630
|
*/
|
|
12483
12631
|
const onExit = onExit$1;
|
|
12484
12632
|
/**
|
|
12633
|
+
* Returns an effect that lazily computes a result and caches it for subsequent
|
|
12634
|
+
* evaluations.
|
|
12635
|
+
*
|
|
12636
|
+
* **When to use**
|
|
12637
|
+
*
|
|
12638
|
+
* Use when you need an expensive or time-consuming operation to be evaluated
|
|
12639
|
+
* once and reused by later callers.
|
|
12640
|
+
*
|
|
12641
|
+
* **Details**
|
|
12642
|
+
*
|
|
12643
|
+
* This function wraps an effect and ensures that its result is computed only
|
|
12644
|
+
* once. Once the result is computed, it is cached, meaning that subsequent
|
|
12645
|
+
* evaluations of the same effect will return the cached result without
|
|
12646
|
+
* re-executing the logic.
|
|
12647
|
+
*
|
|
12648
|
+
* Concurrent callers share the pending computation, which is interrupted only
|
|
12649
|
+
* once every caller waiting on it has been interrupted. Interrupted
|
|
12650
|
+
* computations are never cached, so the next evaluation starts a fresh
|
|
12651
|
+
* computation.
|
|
12652
|
+
*
|
|
12653
|
+
* **Example** (Memoizing an effect until invalidated)
|
|
12654
|
+
*
|
|
12655
|
+
* ```ts import.meta.vitest
|
|
12656
|
+
* import { Effect } from "effect"
|
|
12657
|
+
* const output: Array<unknown> = []
|
|
12658
|
+
* const record = (value: unknown) => Effect.sync(() => { output.push(value) })
|
|
12659
|
+
*
|
|
12660
|
+
* let i = 1
|
|
12661
|
+
* const expensiveTask = Effect.sync(() => {
|
|
12662
|
+
* void output.push("expensive task...")
|
|
12663
|
+
* return `result ${i++}`
|
|
12664
|
+
* })
|
|
12665
|
+
*
|
|
12666
|
+
* const program = Effect.gen(function*() {
|
|
12667
|
+
* void output.push("non-cached version:")
|
|
12668
|
+
* yield* expensiveTask.pipe(Effect.andThen(record))
|
|
12669
|
+
* yield* expensiveTask.pipe(Effect.andThen(record))
|
|
12670
|
+
* void output.push("cached version:")
|
|
12671
|
+
* const cached = yield* Effect.cached(expensiveTask)
|
|
12672
|
+
* yield* cached.pipe(Effect.andThen(record))
|
|
12673
|
+
* yield* cached.pipe(Effect.andThen(record))
|
|
12674
|
+
* })
|
|
12675
|
+
*
|
|
12676
|
+
* await Effect.runPromise(program)
|
|
12677
|
+
* output // => ["non-cached version:", "expensive task...", "result 1", "expensive task...", "result 2", "cached version:", "expensive task...", "result 3", "result 3"]
|
|
12678
|
+
* ```
|
|
12679
|
+
*
|
|
12680
|
+
* @see {@link cachedWithTTL} for a similar function that includes a
|
|
12681
|
+
* time-to-live duration for the cached value.
|
|
12682
|
+
* @see {@link cachedInvalidateWithTTL} for a similar function that includes an
|
|
12683
|
+
* additional effect for manually invalidating the cached value.
|
|
12684
|
+
* @stability stable
|
|
12685
|
+
* @category caching
|
|
12686
|
+
* @since 2.0.0
|
|
12687
|
+
*/
|
|
12688
|
+
const cached = cached$1;
|
|
12689
|
+
/**
|
|
12485
12690
|
* Returns an effect that is immediately interrupted.
|
|
12486
12691
|
*
|
|
12487
12692
|
* **Example** (Creating an interrupted effect)
|
|
@@ -13078,6 +13283,31 @@ const fn = fn$1;
|
|
|
13078
13283
|
*/
|
|
13079
13284
|
const clockWith = clockWith$1;
|
|
13080
13285
|
/**
|
|
13286
|
+
* Logs one or more messages at the WARNING level.
|
|
13287
|
+
*
|
|
13288
|
+
* **Example** (Logging warnings)
|
|
13289
|
+
*
|
|
13290
|
+
* ```ts import.meta.vitest
|
|
13291
|
+
* import { Effect, Logger } from "effect"
|
|
13292
|
+
* const output: Array<unknown> = []
|
|
13293
|
+
*
|
|
13294
|
+
* const program = Effect.gen(function*() {
|
|
13295
|
+
* yield* Effect.logWarning("API rate limit approaching")
|
|
13296
|
+
* })
|
|
13297
|
+
*
|
|
13298
|
+
* const logger = Logger.make<unknown, void>(({ logLevel, message }) => {
|
|
13299
|
+
* void output.push(`${logLevel}: ${Array.isArray(message) ? message.map(String).join(" ") : String(message)}`)
|
|
13300
|
+
* })
|
|
13301
|
+
* Effect.runSync(Effect.provide(program, Logger.layer([logger])))
|
|
13302
|
+
* output // => ["Warn: API rate limit approaching"]
|
|
13303
|
+
* ```
|
|
13304
|
+
*
|
|
13305
|
+
* @stability stable
|
|
13306
|
+
* @category logging
|
|
13307
|
+
* @since 2.0.0
|
|
13308
|
+
*/
|
|
13309
|
+
const logWarning = /*#__PURE__*/ logWithLevel("Warn");
|
|
13310
|
+
/**
|
|
13081
13311
|
* Logs one or more messages at the ERROR level.
|
|
13082
13312
|
*
|
|
13083
13313
|
* **Example** (Logging errors)
|
|
@@ -13103,6 +13333,105 @@ const clockWith = clockWith$1;
|
|
|
13103
13333
|
*/
|
|
13104
13334
|
const logError = /*#__PURE__*/ logWithLevel("Error");
|
|
13105
13335
|
/**
|
|
13336
|
+
* Logs one or more messages at the INFO level.
|
|
13337
|
+
*
|
|
13338
|
+
* **Example** (Logging information)
|
|
13339
|
+
*
|
|
13340
|
+
* ```ts import.meta.vitest
|
|
13341
|
+
* import { Effect, Logger } from "effect"
|
|
13342
|
+
* const output: Array<unknown> = []
|
|
13343
|
+
*
|
|
13344
|
+
* const program = Effect.gen(function*() {
|
|
13345
|
+
* yield* Effect.logInfo("Application starting up")
|
|
13346
|
+
* })
|
|
13347
|
+
*
|
|
13348
|
+
* const logger = Logger.make<unknown, void>(({ logLevel, message }) => {
|
|
13349
|
+
* void output.push(`${logLevel}: ${Array.isArray(message) ? message.map(String).join(" ") : String(message)}`)
|
|
13350
|
+
* })
|
|
13351
|
+
* Effect.runSync(Effect.provide(program, Logger.layer([logger])))
|
|
13352
|
+
* output // => ["Info: Application starting up"]
|
|
13353
|
+
* ```
|
|
13354
|
+
*
|
|
13355
|
+
* @stability stable
|
|
13356
|
+
* @category logging
|
|
13357
|
+
* @since 2.0.0
|
|
13358
|
+
*/
|
|
13359
|
+
const logInfo = /*#__PURE__*/ logWithLevel("Info");
|
|
13360
|
+
/**
|
|
13361
|
+
* Logs one or more messages at the DEBUG level.
|
|
13362
|
+
*
|
|
13363
|
+
* **Example** (Logging debug messages)
|
|
13364
|
+
*
|
|
13365
|
+
* ```ts import.meta.vitest
|
|
13366
|
+
* import { Effect, Logger, References } from "effect"
|
|
13367
|
+
* const output: Array<unknown> = []
|
|
13368
|
+
*
|
|
13369
|
+
* const program = Effect.gen(function*() {
|
|
13370
|
+
* yield* Effect.logDebug("Debug mode enabled")
|
|
13371
|
+
* })
|
|
13372
|
+
*
|
|
13373
|
+
* const logger = Logger.make<unknown, void>(({ logLevel, message }) => {
|
|
13374
|
+
* void output.push(`${logLevel}: ${Array.isArray(message) ? message.map(String).join(" ") : String(message)}`)
|
|
13375
|
+
* })
|
|
13376
|
+
* const runnable = program.pipe(
|
|
13377
|
+
* Effect.provideService(References.MinimumLogLevel, "Debug"),
|
|
13378
|
+
* Effect.provide(Logger.layer([logger]))
|
|
13379
|
+
* )
|
|
13380
|
+
* Effect.runSync(runnable)
|
|
13381
|
+
* output // => ["Debug: Debug mode enabled"]
|
|
13382
|
+
* ```
|
|
13383
|
+
*
|
|
13384
|
+
* @stability stable
|
|
13385
|
+
* @category logging
|
|
13386
|
+
* @since 2.0.0
|
|
13387
|
+
*/
|
|
13388
|
+
const logDebug = /*#__PURE__*/ logWithLevel("Debug");
|
|
13389
|
+
/**
|
|
13390
|
+
* Adds an annotation to each log line in this effect.
|
|
13391
|
+
*
|
|
13392
|
+
* **Example** (Adding log annotations)
|
|
13393
|
+
*
|
|
13394
|
+
* ```ts import.meta.vitest
|
|
13395
|
+
* import { Effect, Logger } from "effect"
|
|
13396
|
+
* const output: Array<unknown> = []
|
|
13397
|
+
*
|
|
13398
|
+
* const program = Effect.gen(function*() {
|
|
13399
|
+
* yield* Effect.log("Starting operation")
|
|
13400
|
+
* })
|
|
13401
|
+
*
|
|
13402
|
+
* // Add annotations to all log messages
|
|
13403
|
+
* const annotatedProgram = Effect.annotateLogs(program, {
|
|
13404
|
+
* userId: "user123",
|
|
13405
|
+
* operation: "data-processing"
|
|
13406
|
+
* })
|
|
13407
|
+
*
|
|
13408
|
+
* // Also supports single key-value annotations
|
|
13409
|
+
* const singleAnnotated = Effect.annotateLogs(program, "requestId", "req-456")
|
|
13410
|
+
*
|
|
13411
|
+
* const logger = Logger.make<unknown, void>(({ message }) =>
|
|
13412
|
+
* void output.push(Array.isArray(message) ? message.join(" ") : String(message))
|
|
13413
|
+
* )
|
|
13414
|
+
* const run = (effect: Effect.Effect<void>) =>
|
|
13415
|
+
* Effect.runSync(Effect.provide(effect, Logger.layer([logger])))
|
|
13416
|
+
* run(annotatedProgram)
|
|
13417
|
+
* run(singleAnnotated)
|
|
13418
|
+
* output // => ["Starting operation", "Starting operation"]
|
|
13419
|
+
* ```
|
|
13420
|
+
*
|
|
13421
|
+
* @stability stable
|
|
13422
|
+
* @category logging
|
|
13423
|
+
* @since 2.0.0
|
|
13424
|
+
*/
|
|
13425
|
+
const annotateLogs = /*#__PURE__*/ dual((args) => isEffect(args[0]), (effect, ...args) => updateService(effect, CurrentLogAnnotations, (annotations) => {
|
|
13426
|
+
const newAnnotations = args.length === 1 ? {
|
|
13427
|
+
...annotations,
|
|
13428
|
+
...args[0]
|
|
13429
|
+
} : { ...annotations };
|
|
13430
|
+
if (args.length === 1) return newAnnotations;
|
|
13431
|
+
else assignProperty(newAnnotations, args[0], args[1]);
|
|
13432
|
+
return newAnnotations;
|
|
13433
|
+
}));
|
|
13434
|
+
/**
|
|
13106
13435
|
* Converts an error-first callback API into a function that returns an
|
|
13107
13436
|
* `Effect`.
|
|
13108
13437
|
*
|
|
@@ -13859,13 +14188,13 @@ const binaryUnits = [
|
|
|
13859
14188
|
];
|
|
13860
14189
|
const allUnits = [...decimalUnits, .../*#__PURE__*/ binaryUnits.slice(1)];
|
|
13861
14190
|
const unitsByName = /*#__PURE__*/ new Map(/*#__PURE__*/ allUnits.flatMap((unit) => unit.names.map((name) => [name, unit])));
|
|
13862
|
-
const make$
|
|
14191
|
+
const make$24 = (value) => value;
|
|
13863
14192
|
const invalid$1 = (message) => {
|
|
13864
14193
|
throw new Error(`Invalid ByteSize: ${message}`);
|
|
13865
14194
|
};
|
|
13866
14195
|
const fromNumber = (input) => {
|
|
13867
14196
|
if (!Number.isSafeInteger(input) || input < 0) return invalid$1(`expected a non-negative safe integer, received ${input}`);
|
|
13868
|
-
return make$
|
|
14197
|
+
return make$24(BigInt(input));
|
|
13869
14198
|
};
|
|
13870
14199
|
/**
|
|
13871
14200
|
* Parses a byte-size string and throws for invalid syntax, unsupported units,
|
|
@@ -13891,7 +14220,7 @@ const fromStringUnsafe = (input) => {
|
|
|
13891
14220
|
const scale = BigInt(10) ** BigInt(fraction.length);
|
|
13892
14221
|
const numerator = BigInt(match[1] + fraction) * unit.factor;
|
|
13893
14222
|
if (numerator % scale !== bigint0$1) return invalid$1(`${JSON.stringify(input)} does not represent an integral number of bytes`);
|
|
13894
|
-
return make$
|
|
14223
|
+
return make$24(numerator / scale);
|
|
13895
14224
|
};
|
|
13896
14225
|
/**
|
|
13897
14226
|
* Decodes a trusted input into a byte size and throws for invalid input.
|
|
@@ -13904,7 +14233,7 @@ const fromInputUnsafe = (input) => {
|
|
|
13904
14233
|
switch (typeof input) {
|
|
13905
14234
|
case "bigint":
|
|
13906
14235
|
if (input < bigint0$1) return invalid$1(`expected a non-negative bigint, received ${input}`);
|
|
13907
|
-
return make$
|
|
14236
|
+
return make$24(input);
|
|
13908
14237
|
case "number": return fromNumber(input);
|
|
13909
14238
|
case "string": return fromStringUnsafe(input);
|
|
13910
14239
|
}
|
|
@@ -13932,7 +14261,7 @@ const bytes = (value) => typeof value === "bigint" ? fromInputUnsafe(value) : fr
|
|
|
13932
14261
|
* @stability unstable
|
|
13933
14262
|
* @since 4.0.0
|
|
13934
14263
|
*/
|
|
13935
|
-
const TypeId$
|
|
14264
|
+
const TypeId$27 = "~effect/PlatformError";
|
|
13936
14265
|
/**
|
|
13937
14266
|
* Error data for an invalid argument passed to a platform API.
|
|
13938
14267
|
*
|
|
@@ -14045,7 +14374,7 @@ var PlatformError = class extends (/*#__PURE__*/ TaggedError$1("PlatformError"))
|
|
|
14045
14374
|
*
|
|
14046
14375
|
* @since 4.0.0
|
|
14047
14376
|
*/
|
|
14048
|
-
[TypeId$
|
|
14377
|
+
[TypeId$27] = TypeId$27;
|
|
14049
14378
|
get message() {
|
|
14050
14379
|
return this.reason.message;
|
|
14051
14380
|
}
|
|
@@ -14251,9 +14580,9 @@ const runIn = fiberRunIn;
|
|
|
14251
14580
|
const makeUnsafe$1 = makeLatchUnsafe;
|
|
14252
14581
|
//#endregion
|
|
14253
14582
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/MutableRef.js
|
|
14254
|
-
const TypeId$
|
|
14583
|
+
const TypeId$26 = "~effect/MutableRef";
|
|
14255
14584
|
const MutableRefProto = {
|
|
14256
|
-
[TypeId$
|
|
14585
|
+
[TypeId$26]: TypeId$26,
|
|
14257
14586
|
...PipeInspectableProto,
|
|
14258
14587
|
toJSON() {
|
|
14259
14588
|
return {
|
|
@@ -14295,7 +14624,7 @@ const MutableRefProto = {
|
|
|
14295
14624
|
* @category constructors
|
|
14296
14625
|
* @since 2.0.0
|
|
14297
14626
|
*/
|
|
14298
|
-
const make$
|
|
14627
|
+
const make$23 = (value) => {
|
|
14299
14628
|
const ref = Object.create(MutableRefProto);
|
|
14300
14629
|
ref.current = value;
|
|
14301
14630
|
return ref;
|
|
@@ -14346,7 +14675,7 @@ const Empty = /*#__PURE__*/ Symbol.for("effect/MutableList/Empty");
|
|
|
14346
14675
|
* @category constructors
|
|
14347
14676
|
* @since 2.0.0
|
|
14348
14677
|
*/
|
|
14349
|
-
const make$
|
|
14678
|
+
const make$22 = () => ({
|
|
14350
14679
|
head: void 0,
|
|
14351
14680
|
tail: void 0,
|
|
14352
14681
|
length: 0
|
|
@@ -14517,7 +14846,7 @@ const take$1 = (self) => {
|
|
|
14517
14846
|
};
|
|
14518
14847
|
//#endregion
|
|
14519
14848
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Queue.js
|
|
14520
|
-
const TypeId$
|
|
14849
|
+
const TypeId$25 = "~effect/Queue";
|
|
14521
14850
|
const EnqueueTypeId = "~effect/Queue/Enqueue";
|
|
14522
14851
|
const DequeueTypeId = "~effect/Queue/Dequeue";
|
|
14523
14852
|
const variance$1 = {
|
|
@@ -14525,7 +14854,7 @@ const variance$1 = {
|
|
|
14525
14854
|
_E: identity
|
|
14526
14855
|
};
|
|
14527
14856
|
const QueueProto = {
|
|
14528
|
-
[TypeId$
|
|
14857
|
+
[TypeId$25]: variance$1,
|
|
14529
14858
|
[EnqueueTypeId]: variance$1,
|
|
14530
14859
|
[DequeueTypeId]: variance$1,
|
|
14531
14860
|
...PipeInspectableProto,
|
|
@@ -14580,12 +14909,12 @@ const QueueProto = {
|
|
|
14580
14909
|
* @category constructors
|
|
14581
14910
|
* @since 4.0.0
|
|
14582
14911
|
*/
|
|
14583
|
-
const make$
|
|
14912
|
+
const make$21 = (options) => withFiber$1((fiber) => {
|
|
14584
14913
|
const self = Object.create(QueueProto);
|
|
14585
14914
|
self.dispatcher = fiber.currentDispatcher;
|
|
14586
14915
|
self.capacity = options?.capacity ?? Number.POSITIVE_INFINITY;
|
|
14587
14916
|
self.strategy = options?.strategy ?? "suspend";
|
|
14588
|
-
self.messages = make$
|
|
14917
|
+
self.messages = make$22();
|
|
14589
14918
|
self.scheduleRunning = false;
|
|
14590
14919
|
self.state = {
|
|
14591
14920
|
_tag: "Open",
|
|
@@ -14626,7 +14955,7 @@ const make$20 = (options) => withFiber$1((fiber) => {
|
|
|
14626
14955
|
* @category constructors
|
|
14627
14956
|
* @since 2.0.0
|
|
14628
14957
|
*/
|
|
14629
|
-
const bounded = (capacity) => make$
|
|
14958
|
+
const bounded = (capacity) => make$21({ capacity });
|
|
14630
14959
|
/**
|
|
14631
14960
|
* Adds a message to the queue. Returns `false` if the queue is done.
|
|
14632
14961
|
*
|
|
@@ -15333,7 +15662,7 @@ const finalize = (self, exit) => {
|
|
|
15333
15662
|
* @category type IDs
|
|
15334
15663
|
* @since 4.0.0
|
|
15335
15664
|
*/
|
|
15336
|
-
const TypeId$
|
|
15665
|
+
const TypeId$24 = "~effect/Channel";
|
|
15337
15666
|
/**
|
|
15338
15667
|
* Checks whether a value is a `Channel`.
|
|
15339
15668
|
*
|
|
@@ -15351,9 +15680,9 @@ const TypeId$23 = "~effect/Channel";
|
|
|
15351
15680
|
* @category guards
|
|
15352
15681
|
* @since 3.5.4
|
|
15353
15682
|
*/
|
|
15354
|
-
const isChannel = (u) => hasProperty(u, TypeId$
|
|
15683
|
+
const isChannel = (u) => hasProperty(u, TypeId$24);
|
|
15355
15684
|
const ChannelProto = {
|
|
15356
|
-
[TypeId$
|
|
15685
|
+
[TypeId$24]: {
|
|
15357
15686
|
_Env: identity,
|
|
15358
15687
|
_InErr: identity,
|
|
15359
15688
|
_InElem: identity,
|
|
@@ -15478,7 +15807,7 @@ const fromTransformBracket = (f) => fromTransform$1(fnUntraced(function* (upstre
|
|
|
15478
15807
|
* @since 4.0.0
|
|
15479
15808
|
*/
|
|
15480
15809
|
const toTransform = (channel) => channel.transform;
|
|
15481
|
-
const asyncQueue = (scope, f, options) => make$
|
|
15810
|
+
const asyncQueue = (scope, f, options) => make$21({
|
|
15482
15811
|
capacity: options?.bufferSize,
|
|
15483
15812
|
strategy: options?.strategy
|
|
15484
15813
|
}).pipe(tap((queue) => addFinalizer$1(scope, shutdown(queue))), tap((queue) => provide$2(f(queue), scope).pipe(catchCause((cause) => failCause(queue, cause)), forkIn(scope))));
|
|
@@ -15994,7 +16323,7 @@ const runFold = /*#__PURE__*/ dual(3, (self, initial, f) => suspend$2(() => {
|
|
|
15994
16323
|
const toPullScoped = (self, scope) => toTransform(self)(done(), scope);
|
|
15995
16324
|
//#endregion
|
|
15996
16325
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/stream.js
|
|
15997
|
-
const TypeId$
|
|
16326
|
+
const TypeId$23 = "~effect/Stream";
|
|
15998
16327
|
const streamVariance = {
|
|
15999
16328
|
_R: identity,
|
|
16000
16329
|
_E: identity,
|
|
@@ -16004,7 +16333,7 @@ const Stream$1 = function(channel) {
|
|
|
16004
16333
|
this.channel = channel;
|
|
16005
16334
|
};
|
|
16006
16335
|
Stream$1.prototype = {
|
|
16007
|
-
[TypeId$
|
|
16336
|
+
[TypeId$23]: streamVariance,
|
|
16008
16337
|
pipe() {
|
|
16009
16338
|
return pipeArguments(this, arguments);
|
|
16010
16339
|
}
|
|
@@ -16013,7 +16342,7 @@ Stream$1.prototype = {
|
|
|
16013
16342
|
const fromChannel$2 = (channel) => new Stream$1(channel);
|
|
16014
16343
|
//#endregion
|
|
16015
16344
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Sink.js
|
|
16016
|
-
const TypeId$
|
|
16345
|
+
const TypeId$22 = "~effect/Sink";
|
|
16017
16346
|
const endVoid = /*#__PURE__*/ succeed$3([void 0]);
|
|
16018
16347
|
const sinkVariance = {
|
|
16019
16348
|
_A: identity,
|
|
@@ -16023,7 +16352,7 @@ const sinkVariance = {
|
|
|
16023
16352
|
_R: identity
|
|
16024
16353
|
};
|
|
16025
16354
|
const SinkProto = {
|
|
16026
|
-
[TypeId$
|
|
16355
|
+
[TypeId$22]: sinkVariance,
|
|
16027
16356
|
pipe() {
|
|
16028
16357
|
return pipeArguments(this, arguments);
|
|
16029
16358
|
}
|
|
@@ -16047,7 +16376,7 @@ const SinkProto = {
|
|
|
16047
16376
|
* @category guards
|
|
16048
16377
|
* @since 4.0.0
|
|
16049
16378
|
*/
|
|
16050
|
-
const isSink = (u) => hasProperty(u, TypeId$
|
|
16379
|
+
const isSink = (u) => hasProperty(u, TypeId$22);
|
|
16051
16380
|
/**
|
|
16052
16381
|
* Creates a sink from a `Channel`.
|
|
16053
16382
|
*
|
|
@@ -16204,7 +16533,7 @@ const forEachArray = (f) => fromTransform((upstream) => upstream.pipe(flatMap$1(
|
|
|
16204
16533
|
const unwrap$1 = (effect) => fromChannel$1(unwrap$2(map$5(effect, toChannel$1)));
|
|
16205
16534
|
//#endregion
|
|
16206
16535
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/rcRef.js
|
|
16207
|
-
const TypeId$
|
|
16536
|
+
const TypeId$21 = "~effect/RcRef";
|
|
16208
16537
|
const stateEmpty = { _tag: "Empty" };
|
|
16209
16538
|
const stateClosed = { _tag: "Closed" };
|
|
16210
16539
|
const variance = {
|
|
@@ -16212,7 +16541,7 @@ const variance = {
|
|
|
16212
16541
|
_E: identity
|
|
16213
16542
|
};
|
|
16214
16543
|
var RcRefImpl = class {
|
|
16215
|
-
[TypeId$
|
|
16544
|
+
[TypeId$21] = variance;
|
|
16216
16545
|
pipe() {
|
|
16217
16546
|
return pipeArguments(this, arguments);
|
|
16218
16547
|
}
|
|
@@ -16229,7 +16558,7 @@ var RcRefImpl = class {
|
|
|
16229
16558
|
}
|
|
16230
16559
|
};
|
|
16231
16560
|
/** @internal */
|
|
16232
|
-
const make$
|
|
16561
|
+
const make$20 = (options) => withFiber((fiber) => {
|
|
16233
16562
|
const context = fiber.context;
|
|
16234
16563
|
const scope = get$2(context, Scope);
|
|
16235
16564
|
const ref = new RcRefImpl(options.acquire, context, scope, options.idleTimeToLive !== void 0 ? fromInputUnsafe$1(options.idleTimeToLive) : void 0);
|
|
@@ -16366,7 +16695,7 @@ const release = (self, state) => {
|
|
|
16366
16695
|
* @category constructors
|
|
16367
16696
|
* @since 3.5.0
|
|
16368
16697
|
*/
|
|
16369
|
-
const make$
|
|
16698
|
+
const make$19 = make$20;
|
|
16370
16699
|
/**
|
|
16371
16700
|
* Gets the value from an `RcRef`, acquiring it first if needed.
|
|
16372
16701
|
*
|
|
@@ -16443,7 +16772,7 @@ const get = get$1;
|
|
|
16443
16772
|
* @category type IDs
|
|
16444
16773
|
* @since 4.0.0
|
|
16445
16774
|
*/
|
|
16446
|
-
const TypeId$
|
|
16775
|
+
const TypeId$20 = "~effect/Stream";
|
|
16447
16776
|
/**
|
|
16448
16777
|
* Checks whether a value is a Stream.
|
|
16449
16778
|
*
|
|
@@ -16460,7 +16789,7 @@ const TypeId$19 = "~effect/Stream";
|
|
|
16460
16789
|
* @category guards
|
|
16461
16790
|
* @since 4.0.0
|
|
16462
16791
|
*/
|
|
16463
|
-
const isStream = (u) => hasProperty(u, TypeId$
|
|
16792
|
+
const isStream = (u) => hasProperty(u, TypeId$20);
|
|
16464
16793
|
/**
|
|
16465
16794
|
* Creates a stream from a array-emitting `Channel`.
|
|
16466
16795
|
*
|
|
@@ -16616,7 +16945,7 @@ const empty = /*#__PURE__*/ fromChannel(empty$1);
|
|
|
16616
16945
|
* @category constructors
|
|
16617
16946
|
* @since 2.0.0
|
|
16618
16947
|
*/
|
|
16619
|
-
const make$
|
|
16948
|
+
const make$18 = (...values) => fromArray(values);
|
|
16620
16949
|
/**
|
|
16621
16950
|
* Creates a lazily constructed stream.
|
|
16622
16951
|
*
|
|
@@ -16994,7 +17323,7 @@ const mkString = (self) => runFold(self.channel, () => "", (acc, chunk) => acc +
|
|
|
16994
17323
|
* @stability unstable
|
|
16995
17324
|
* @since 4.0.0
|
|
16996
17325
|
*/
|
|
16997
|
-
const TypeId$
|
|
17326
|
+
const TypeId$19 = "~effect/FileSystem";
|
|
16998
17327
|
/**
|
|
16999
17328
|
* Service tag for platform file-system operations.
|
|
17000
17329
|
*
|
|
@@ -17060,9 +17389,9 @@ const FileSystem = /*#__PURE__*/ Service("effect/FileSystem");
|
|
|
17060
17389
|
* @category constructors
|
|
17061
17390
|
* @since 4.0.0
|
|
17062
17391
|
*/
|
|
17063
|
-
const make$
|
|
17392
|
+
const make$17 = (impl) => FileSystem.of({
|
|
17064
17393
|
...impl,
|
|
17065
|
-
[TypeId$
|
|
17394
|
+
[TypeId$19]: TypeId$19,
|
|
17066
17395
|
exists: (path) => pipe$1(impl.access(path), as(true), catchTag("PlatformError", (e) => e.reason._tag === "NotFound" ? succeed$3(false) : fail$1(e))),
|
|
17067
17396
|
readFileString: (path, encoding) => flatMap$1(impl.readFile(path), (_) => try_({
|
|
17068
17397
|
try: () => new TextDecoder(encoding).decode(_),
|
|
@@ -17194,7 +17523,7 @@ var WatchBackend = class extends (/*#__PURE__*/ Service()("effect/FileSystem/Wat
|
|
|
17194
17523
|
* @category type IDs
|
|
17195
17524
|
* @since 4.0.0
|
|
17196
17525
|
*/
|
|
17197
|
-
const TypeId$
|
|
17526
|
+
const TypeId$18 = "~effect/Path";
|
|
17198
17527
|
/**
|
|
17199
17528
|
* Service tag for accessing the current `Path` implementation.
|
|
17200
17529
|
*
|
|
@@ -17347,7 +17676,7 @@ const fromOptionExit = (option) => option._tag === "None" ? missingExit : succee
|
|
|
17347
17676
|
* @stability stable
|
|
17348
17677
|
* @since 4.0.0
|
|
17349
17678
|
*/
|
|
17350
|
-
const TypeId$
|
|
17679
|
+
const TypeId$17 = "~effect/SchemaIssue/Issue";
|
|
17351
17680
|
/**
|
|
17352
17681
|
* Returns `true` if the given value is an {@link Issue}.
|
|
17353
17682
|
*
|
|
@@ -17378,7 +17707,7 @@ const TypeId$16 = "~effect/SchemaIssue/Issue";
|
|
|
17378
17707
|
* @since 4.0.0
|
|
17379
17708
|
*/
|
|
17380
17709
|
function isIssue(u) {
|
|
17381
|
-
return hasProperty(u, TypeId$
|
|
17710
|
+
return hasProperty(u, TypeId$17) && u[TypeId$17] === TypeId$17;
|
|
17382
17711
|
}
|
|
17383
17712
|
/**
|
|
17384
17713
|
* Returns `true` when an issue contains an input reported by the schema parser.
|
|
@@ -17414,7 +17743,7 @@ function hasInput(issue) {
|
|
|
17414
17743
|
return Object.hasOwn(issue, "input");
|
|
17415
17744
|
}
|
|
17416
17745
|
var IssueNodeImpl = class {
|
|
17417
|
-
[TypeId$
|
|
17746
|
+
[TypeId$17] = TypeId$17;
|
|
17418
17747
|
constructor(input, options) {
|
|
17419
17748
|
if (options?.reportInput === true && input !== missing) this.input = input;
|
|
17420
17749
|
}
|
|
@@ -18076,7 +18405,7 @@ function transformEffect$1(f) {
|
|
|
18076
18405
|
* @category converting
|
|
18077
18406
|
* @since 4.0.0
|
|
18078
18407
|
*/
|
|
18079
|
-
function String$
|
|
18408
|
+
function String$8() {
|
|
18080
18409
|
return transform$2(globalThis.String);
|
|
18081
18410
|
}
|
|
18082
18411
|
/**
|
|
@@ -18170,9 +18499,9 @@ function stringifyJson(options) {
|
|
|
18170
18499
|
* @stability stable
|
|
18171
18500
|
* @since 2.0.0
|
|
18172
18501
|
*/
|
|
18173
|
-
const TypeId$
|
|
18502
|
+
const TypeId$16 = "~effect/BigDecimal";
|
|
18174
18503
|
const BigDecimalProto = {
|
|
18175
|
-
[TypeId$
|
|
18504
|
+
[TypeId$16]: TypeId$16,
|
|
18176
18505
|
[symbol$1]() {
|
|
18177
18506
|
const normalized = normalize(this);
|
|
18178
18507
|
return combine$1(string$1(String(normalized.value)), number$1(normalized.scale));
|
|
@@ -18220,7 +18549,7 @@ const BigDecimalProto = {
|
|
|
18220
18549
|
* @category guards
|
|
18221
18550
|
* @since 2.0.0
|
|
18222
18551
|
*/
|
|
18223
|
-
const isBigDecimal = (u) => hasProperty(u, TypeId$
|
|
18552
|
+
const isBigDecimal = (u) => hasProperty(u, TypeId$16);
|
|
18224
18553
|
/**
|
|
18225
18554
|
* Creates a `BigDecimal` from a `bigint` value and a safe integer scale.
|
|
18226
18555
|
*
|
|
@@ -18253,7 +18582,7 @@ const isBigDecimal = (u) => hasProperty(u, TypeId$15);
|
|
|
18253
18582
|
* @category constructors
|
|
18254
18583
|
* @since 2.0.0
|
|
18255
18584
|
*/
|
|
18256
|
-
const make$
|
|
18585
|
+
const make$15 = (value, scale) => {
|
|
18257
18586
|
if (!Number.isSafeInteger(scale)) throw new RangeError(`Scale must be a safe integer, got ${scale}`);
|
|
18258
18587
|
const o = Object.create(BigDecimalProto);
|
|
18259
18588
|
o.value = value;
|
|
@@ -18261,7 +18590,7 @@ const make$14 = (value, scale) => {
|
|
|
18261
18590
|
return o;
|
|
18262
18591
|
};
|
|
18263
18592
|
const makeNormalized = (value, scale) => {
|
|
18264
|
-
const o = make$
|
|
18593
|
+
const o = make$15(value, scale);
|
|
18265
18594
|
o.normalized = o;
|
|
18266
18595
|
return o;
|
|
18267
18596
|
};
|
|
@@ -18316,7 +18645,7 @@ const compareMagnitude = (self, that) => {
|
|
|
18316
18645
|
const exponentDifference = BigInt(selfDigits.length - thatDigits.length) - BigInt(self.scale) + BigInt(that.scale);
|
|
18317
18646
|
if (exponentDifference !== bigint0) return exponentDifference < bigint0 ? -1 : 1;
|
|
18318
18647
|
const length = Math.max(selfDigits.length, thatDigits.length);
|
|
18319
|
-
return String$
|
|
18648
|
+
return String$9(selfDigits.padEnd(length, "0"), thatDigits.padEnd(length, "0"));
|
|
18320
18649
|
};
|
|
18321
18650
|
const compare = (self, that) => {
|
|
18322
18651
|
if (self.scale === that.scale) return compareBigInt(self.value, that.value);
|
|
@@ -18465,7 +18794,7 @@ const Middleware = class extends Class$1 {
|
|
|
18465
18794
|
return new Middleware(this.encode, this.decode);
|
|
18466
18795
|
}
|
|
18467
18796
|
};
|
|
18468
|
-
const TypeId$
|
|
18797
|
+
const TypeId$15 = "~effect/SchemaTransformation/Transformation";
|
|
18469
18798
|
/**
|
|
18470
18799
|
* Constructs a bidirectional schema transformation from its decode and encode getters.
|
|
18471
18800
|
*
|
|
@@ -18474,7 +18803,7 @@ const TypeId$14 = "~effect/SchemaTransformation/Transformation";
|
|
|
18474
18803
|
* @since 4.0.0
|
|
18475
18804
|
*/
|
|
18476
18805
|
const Transformation = class extends Class$1 {
|
|
18477
|
-
[TypeId$
|
|
18806
|
+
[TypeId$15] = TypeId$15;
|
|
18478
18807
|
_tag = "Transformation";
|
|
18479
18808
|
decode;
|
|
18480
18809
|
encode;
|
|
@@ -18517,7 +18846,7 @@ const Transformation = class extends Class$1 {
|
|
|
18517
18846
|
* @since 4.0.0
|
|
18518
18847
|
*/
|
|
18519
18848
|
function isTransformation(u) {
|
|
18520
|
-
return hasProperty(u, TypeId$
|
|
18849
|
+
return hasProperty(u, TypeId$15) && u[TypeId$15] === TypeId$15;
|
|
18521
18850
|
}
|
|
18522
18851
|
/**
|
|
18523
18852
|
* Constructs a `Transformation` from an object with `decode` and `encode`
|
|
@@ -18638,7 +18967,7 @@ function passthrough() {
|
|
|
18638
18967
|
* @category converting
|
|
18639
18968
|
* @since 4.0.0
|
|
18640
18969
|
*/
|
|
18641
|
-
const numberFromString = /*#__PURE__*/ new Transformation(/*#__PURE__*/ Number$4(), /*#__PURE__*/ String$
|
|
18970
|
+
const numberFromString = /*#__PURE__*/ new Transformation(/*#__PURE__*/ Number$4(), /*#__PURE__*/ String$8());
|
|
18642
18971
|
const isJsonError = (input) => isObject(input) && typeof input["message"] === "string";
|
|
18643
18972
|
const decodeJsonError = (input) => {
|
|
18644
18973
|
const err = Object.hasOwn(input, "cause") ? new Error(input.message, { cause: decodeDefect(input.cause) }) : new Error(input.message);
|
|
@@ -18861,9 +19190,9 @@ const Context = class {
|
|
|
18861
19190
|
this.annotations = annotations;
|
|
18862
19191
|
}
|
|
18863
19192
|
};
|
|
18864
|
-
const TypeId$
|
|
19193
|
+
const TypeId$14 = "~effect/Schema";
|
|
18865
19194
|
var ASTNodeImpl = class {
|
|
18866
|
-
[TypeId$
|
|
19195
|
+
[TypeId$14] = TypeId$14;
|
|
18867
19196
|
annotations;
|
|
18868
19197
|
checks;
|
|
18869
19198
|
encoding;
|
|
@@ -19052,7 +19381,7 @@ function literalToString(ast) {
|
|
|
19052
19381
|
* @category constructors
|
|
19053
19382
|
* @since 4.0.0
|
|
19054
19383
|
*/
|
|
19055
|
-
const String$
|
|
19384
|
+
const String$7 = class extends ASTNodeImpl {
|
|
19056
19385
|
_tag = "String";
|
|
19057
19386
|
/** @internal */
|
|
19058
19387
|
getParser() {
|
|
@@ -19082,7 +19411,7 @@ const String$6 = class extends ASTNodeImpl {
|
|
|
19082
19411
|
* @category constructors
|
|
19083
19412
|
* @since 4.0.0
|
|
19084
19413
|
*/
|
|
19085
|
-
const string = /*#__PURE__*/ new String$
|
|
19414
|
+
const string = /*#__PURE__*/ new String$7();
|
|
19086
19415
|
/**
|
|
19087
19416
|
* Constructs a {@link Number}.
|
|
19088
19417
|
*
|
|
@@ -20272,7 +20601,7 @@ const optionalKey$1 = /*#__PURE__*/ memoizeIdempotent((ast) => {
|
|
|
20272
20601
|
});
|
|
20273
20602
|
const optionalKeyLastLink = /*#__PURE__*/ applyToLastLink(optionalKey$1);
|
|
20274
20603
|
/** @internal */
|
|
20275
|
-
const optional$
|
|
20604
|
+
const optional$4 = /*#__PURE__*/ memoize((ast) => optionalKey$1(new Union$1([ast, undefined_])));
|
|
20276
20605
|
/** @internal */
|
|
20277
20606
|
function withConstructorDefault$1(ast, defaultValue) {
|
|
20278
20607
|
return replaceContext(ast, ast.context ? new Context(ast.context.isOptional, ast.context.isMutable, defaultValue, ast.context.annotations) : new Context(false, false, defaultValue));
|
|
@@ -20735,7 +21064,7 @@ const makeHandle = (params) => Object.setPrototypeOf({ ...params }, HandleProto)
|
|
|
20735
21064
|
* @category constructors
|
|
20736
21065
|
* @since 4.0.0
|
|
20737
21066
|
*/
|
|
20738
|
-
const make$
|
|
21067
|
+
const make$14 = (spawn) => {
|
|
20739
21068
|
const streamString = (command, options) => spawn(command).pipe(map$5((handle) => decodeText(options?.includeStderr === true ? handle.all : handle.stdout)), unwrap);
|
|
20740
21069
|
const streamLines = (command, options) => splitLines(streamString(command, options));
|
|
20741
21070
|
return ChildProcessSpawner.of({
|
|
@@ -20769,7 +21098,7 @@ var ChildProcessSpawner = class extends (/*#__PURE__*/ Service()("effect/process
|
|
|
20769
21098
|
* @stability unstable
|
|
20770
21099
|
* @since 4.0.0
|
|
20771
21100
|
*/
|
|
20772
|
-
const TypeId$
|
|
21101
|
+
const TypeId$13 = "~effect/process/ChildProcess";
|
|
20773
21102
|
const Proto$6 = {
|
|
20774
21103
|
.../*#__PURE__*/ Prototype({
|
|
20775
21104
|
label: "Command",
|
|
@@ -20777,7 +21106,7 @@ const Proto$6 = {
|
|
|
20777
21106
|
return getUnsafe(fiber.context, ChildProcessSpawner).spawn(this);
|
|
20778
21107
|
}
|
|
20779
21108
|
}),
|
|
20780
|
-
[TypeId$
|
|
21109
|
+
[TypeId$13]: TypeId$13
|
|
20781
21110
|
};
|
|
20782
21111
|
const makeStandardCommand = (command, args, options) => Object.assign(Object.create(Proto$6), {
|
|
20783
21112
|
_tag: "StandardCommand",
|
|
@@ -20819,7 +21148,7 @@ const makeStandardCommand = (command, args, options) => Object.assign(Object.cre
|
|
|
20819
21148
|
* @category constructors
|
|
20820
21149
|
* @since 4.0.0
|
|
20821
21150
|
*/
|
|
20822
|
-
const make$
|
|
21151
|
+
const make$13 = function make(...args) {
|
|
20823
21152
|
if (isTemplateString(args[0])) {
|
|
20824
21153
|
const [templates, ...expressions] = args;
|
|
20825
21154
|
const tokens = parseTemplates(templates, expressions);
|
|
@@ -21143,7 +21472,7 @@ const fromReadableChannel = (options) => fromTransform$1((_, scope) => readableT
|
|
|
21143
21472
|
const readableToPullUnsafe = (options) => {
|
|
21144
21473
|
const readable = options.readable;
|
|
21145
21474
|
const closeOnDone = options.closeOnDone ?? true;
|
|
21146
|
-
const exit = options.exit ?? make$
|
|
21475
|
+
const exit = options.exit ?? make$23(void 0);
|
|
21147
21476
|
const latch = options.latch ?? makeUnsafe$1(false);
|
|
21148
21477
|
function onReadable() {
|
|
21149
21478
|
latch.openUnsafe();
|
|
@@ -21220,7 +21549,7 @@ const taskkill = (childProcess, onExit = () => {}) => NodeChildProcess.execFile(
|
|
|
21220
21549
|
* @category layers
|
|
21221
21550
|
* @since 4.0.0
|
|
21222
21551
|
*/
|
|
21223
|
-
const layer$
|
|
21552
|
+
const layer$13 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(function* () {
|
|
21224
21553
|
const fs = yield* FileSystem;
|
|
21225
21554
|
const path = yield* Path$1;
|
|
21226
21555
|
const resolveWorkingDirectory = fnUntraced(function* (options) {
|
|
@@ -21542,7 +21871,7 @@ const layer$12 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
21542
21871
|
const stdinConfig = resolveStdinOption(command.options);
|
|
21543
21872
|
const sourceStream = unwrap(succeed$3(getSourceStream(handles[handles.length - 1], options.from)));
|
|
21544
21873
|
const toOption = options.to ?? "stdin";
|
|
21545
|
-
if (toOption === "stdin") handles.push(yield* spawnCommand(make$
|
|
21874
|
+
if (toOption === "stdin") handles.push(yield* spawnCommand(make$13(command.command, command.args, {
|
|
21546
21875
|
...command.options,
|
|
21547
21876
|
stdin: {
|
|
21548
21877
|
...stdinConfig,
|
|
@@ -21554,7 +21883,7 @@ const layer$12 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
21554
21883
|
if (isNotUndefined(fd)) {
|
|
21555
21884
|
const fdName$1 = fdName(fd);
|
|
21556
21885
|
const existingFds = command.options.additionalFds ?? {};
|
|
21557
|
-
handles.push(yield* spawnCommand(make$
|
|
21886
|
+
handles.push(yield* spawnCommand(make$13(command.command, command.args, {
|
|
21558
21887
|
...command.options,
|
|
21559
21888
|
additionalFds: {
|
|
21560
21889
|
...existingFds,
|
|
@@ -21564,7 +21893,7 @@ const layer$12 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
21564
21893
|
}
|
|
21565
21894
|
}
|
|
21566
21895
|
})));
|
|
21567
|
-
} else handles.push(yield* spawnCommand(make$
|
|
21896
|
+
} else handles.push(yield* spawnCommand(make$13(command.command, command.args, {
|
|
21568
21897
|
...command.options,
|
|
21569
21898
|
stdin: {
|
|
21570
21899
|
...stdinConfig,
|
|
@@ -21596,7 +21925,7 @@ const layer$12 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
21596
21925
|
}
|
|
21597
21926
|
}
|
|
21598
21927
|
});
|
|
21599
|
-
return make$
|
|
21928
|
+
return make$14(spawnCommand);
|
|
21600
21929
|
}));
|
|
21601
21930
|
/**
|
|
21602
21931
|
* Flattens a `Command` into an array of `StandardCommand`s along with pipe
|
|
@@ -21703,7 +22032,7 @@ const v7String = (timestampMillis, bytes) => stringify(bytes === void 0 ? v7Byte
|
|
|
21703
22032
|
* @stability unstable
|
|
21704
22033
|
* @since 4.0.0
|
|
21705
22034
|
*/
|
|
21706
|
-
const TypeId$
|
|
22035
|
+
const TypeId$12 = "~effect/Crypto";
|
|
21707
22036
|
/**
|
|
21708
22037
|
* Service tag for platform cryptography.
|
|
21709
22038
|
*
|
|
@@ -21762,7 +22091,7 @@ const Crypto = /*#__PURE__*/ Service("effect/Crypto");
|
|
|
21762
22091
|
* @category constructors
|
|
21763
22092
|
* @since 4.0.0
|
|
21764
22093
|
*/
|
|
21765
|
-
const make$
|
|
22094
|
+
const make$11 = (impl) => {
|
|
21766
22095
|
const randomBytesUnsafe = impl.randomBytes;
|
|
21767
22096
|
const randomBytes = (size) => map$5(validateSize("randomBytes", size), randomBytesUnsafe);
|
|
21768
22097
|
const readUint53 = (bytes) => (bytes[0] & 31) * 2 ** 48 + bytes[1] * 2 ** 40 + bytes[2] * 2 ** 32 + bytes[3] * 2 ** 24 + bytes[4] * 2 ** 16 + bytes[5] * 256 + bytes[6];
|
|
@@ -21776,7 +22105,7 @@ const make$10 = (impl) => {
|
|
|
21776
22105
|
}
|
|
21777
22106
|
};
|
|
21778
22107
|
return Crypto.of({
|
|
21779
|
-
[TypeId$
|
|
22108
|
+
[TypeId$12]: TypeId$12,
|
|
21780
22109
|
randomBytes,
|
|
21781
22110
|
nextDoubleUnsafe,
|
|
21782
22111
|
nextIntUnsafe,
|
|
@@ -21867,7 +22196,7 @@ const digest = (algorithm, data) => try_({
|
|
|
21867
22196
|
* @category layers
|
|
21868
22197
|
* @since 1.0.0
|
|
21869
22198
|
*/
|
|
21870
|
-
const layer$
|
|
22199
|
+
const layer$11 = /* @__PURE__ */ succeed$4(Crypto, /* @__PURE__ */ make$11({
|
|
21871
22200
|
randomBytes: NodeCrypto.randomBytes,
|
|
21872
22201
|
digest
|
|
21873
22202
|
}));
|
|
@@ -22217,7 +22546,7 @@ const writeFile = (path, data, options) => callback$1((resume, signal) => {
|
|
|
22217
22546
|
resume(fail$1(handleBadArgument("writeFile")(err)));
|
|
22218
22547
|
}
|
|
22219
22548
|
});
|
|
22220
|
-
const makeFileSystem = /*#__PURE__*/ map$5(/*#__PURE__*/ serviceOption(WatchBackend), (backend) => make$
|
|
22549
|
+
const makeFileSystem = /*#__PURE__*/ map$5(/*#__PURE__*/ serviceOption(WatchBackend), (backend) => make$17({
|
|
22221
22550
|
access,
|
|
22222
22551
|
chmod,
|
|
22223
22552
|
chown,
|
|
@@ -22266,7 +22595,7 @@ const makeFileSystem = /*#__PURE__*/ map$5(/*#__PURE__*/ serviceOption(WatchBack
|
|
|
22266
22595
|
* @category layers
|
|
22267
22596
|
* @since 4.0.0
|
|
22268
22597
|
*/
|
|
22269
|
-
const layer$
|
|
22598
|
+
const layer$9 = /* @__PURE__ */ effect(FileSystem)(makeFileSystem);
|
|
22270
22599
|
//#endregion
|
|
22271
22600
|
//#region ../../node_modules/.pnpm/@effect+platform-node-shared@4.0.2_effect@4.0.2/node_modules/@effect/platform-node-shared/dist/NodePath.js
|
|
22272
22601
|
/**
|
|
@@ -22327,8 +22656,8 @@ const fileUrlOps = (windows) => ({
|
|
|
22327
22656
|
* @category layers
|
|
22328
22657
|
* @since 4.0.0
|
|
22329
22658
|
*/
|
|
22330
|
-
const layer$
|
|
22331
|
-
[TypeId$
|
|
22659
|
+
const layer$7 = /* @__PURE__ */ succeed$4(Path$1)({
|
|
22660
|
+
[TypeId$18]: TypeId$18,
|
|
22332
22661
|
...Path,
|
|
22333
22662
|
.../*#__PURE__*/ fileUrlOps(void 0)
|
|
22334
22663
|
});
|
|
@@ -22360,7 +22689,7 @@ const layer$6 = /* @__PURE__ */ succeed$4(Path$1)({
|
|
|
22360
22689
|
* @category type IDs
|
|
22361
22690
|
* @since 4.0.0
|
|
22362
22691
|
*/
|
|
22363
|
-
const TypeId$
|
|
22692
|
+
const TypeId$11 = "~effect/Stdio";
|
|
22364
22693
|
/**
|
|
22365
22694
|
* Service tag for process standard I/O.
|
|
22366
22695
|
*
|
|
@@ -22376,7 +22705,7 @@ const TypeId$10 = "~effect/Stdio";
|
|
|
22376
22705
|
* @category services
|
|
22377
22706
|
* @since 4.0.0
|
|
22378
22707
|
*/
|
|
22379
|
-
const Stdio = /*#__PURE__*/ Service(TypeId$
|
|
22708
|
+
const Stdio = /*#__PURE__*/ Service(TypeId$11);
|
|
22380
22709
|
/**
|
|
22381
22710
|
* Creates a `Stdio` service implementation from the provided fields and
|
|
22382
22711
|
* attaches the `Stdio` type identifier.
|
|
@@ -22398,8 +22727,8 @@ const Stdio = /*#__PURE__*/ Service(TypeId$10);
|
|
|
22398
22727
|
* @category constructors
|
|
22399
22728
|
* @since 4.0.0
|
|
22400
22729
|
*/
|
|
22401
|
-
const make$
|
|
22402
|
-
[TypeId$
|
|
22730
|
+
const make$9 = (options) => ({
|
|
22731
|
+
[TypeId$11]: TypeId$11,
|
|
22403
22732
|
stdinIsTerminal: succeed$3(false),
|
|
22404
22733
|
stdoutIsTerminal: succeed$3(false),
|
|
22405
22734
|
...options
|
|
@@ -22425,7 +22754,7 @@ const make$8 = (options) => ({
|
|
|
22425
22754
|
* @category layers
|
|
22426
22755
|
* @since 4.0.0
|
|
22427
22756
|
*/
|
|
22428
|
-
const layer$
|
|
22757
|
+
const layer$5 = /* @__PURE__ */ succeed$4(Stdio, /*#__PURE__*/ make$9({
|
|
22429
22758
|
args: /*#__PURE__*/ sync(() => process.argv.slice(2)),
|
|
22430
22759
|
stdinIsTerminal: /*#__PURE__*/ sync(() => process.stdin.isTTY === true),
|
|
22431
22760
|
stdoutIsTerminal: /*#__PURE__*/ sync(() => process.stdout.isTTY === true),
|
|
@@ -22486,7 +22815,7 @@ const value$2 = (self) => {
|
|
|
22486
22815
|
* @stability stable
|
|
22487
22816
|
* @since 3.3.0
|
|
22488
22817
|
*/
|
|
22489
|
-
const TypeId$
|
|
22818
|
+
const TypeId$9 = "~effect/Redacted";
|
|
22490
22819
|
/**
|
|
22491
22820
|
* Returns `true` if a value is a `Redacted` wrapper.
|
|
22492
22821
|
*
|
|
@@ -22515,7 +22844,7 @@ const TypeId$8 = "~effect/Redacted";
|
|
|
22515
22844
|
* @category guards
|
|
22516
22845
|
* @since 3.3.0
|
|
22517
22846
|
*/
|
|
22518
|
-
const isRedacted = (u) => hasProperty(u, TypeId$
|
|
22847
|
+
const isRedacted = (u) => hasProperty(u, TypeId$9);
|
|
22519
22848
|
/**
|
|
22520
22849
|
* Creates a `Redacted` wrapper for a sensitive value.
|
|
22521
22850
|
*
|
|
@@ -22543,14 +22872,14 @@ const isRedacted = (u) => hasProperty(u, TypeId$8);
|
|
|
22543
22872
|
* @category constructors
|
|
22544
22873
|
* @since 3.3.0
|
|
22545
22874
|
*/
|
|
22546
|
-
const make$
|
|
22875
|
+
const make$8 = (value, options) => {
|
|
22547
22876
|
const self = Object.create(Proto$4);
|
|
22548
22877
|
if (options?.label) self.label = options.label;
|
|
22549
22878
|
redactedRegistry.set(self, value);
|
|
22550
22879
|
return self;
|
|
22551
22880
|
};
|
|
22552
22881
|
const Proto$4 = {
|
|
22553
|
-
[TypeId$
|
|
22882
|
+
[TypeId$9]: { _A: (_) => _ },
|
|
22554
22883
|
label: void 0,
|
|
22555
22884
|
...PipeInspectableProto,
|
|
22556
22885
|
toJSON() {
|
|
@@ -22853,7 +23182,7 @@ function makeOption(schema) {
|
|
|
22853
23182
|
* @category constructors
|
|
22854
23183
|
* @since 4.0.0
|
|
22855
23184
|
*/
|
|
22856
|
-
function make$
|
|
23185
|
+
function make$6(schema) {
|
|
22857
23186
|
return makeConstructorSync(toType$1(schema.ast));
|
|
22858
23187
|
}
|
|
22859
23188
|
/**
|
|
@@ -23072,12 +23401,12 @@ const constructorCompiler = (ast) => resolve(ast).makeEffect;
|
|
|
23072
23401
|
//#endregion
|
|
23073
23402
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/make.js
|
|
23074
23403
|
/** @internal */
|
|
23075
|
-
const TypeId$
|
|
23404
|
+
const TypeId$7 = "~effect/Schema/Schema";
|
|
23076
23405
|
const RebuildOptions = /*#__PURE__*/ Symbol();
|
|
23077
23406
|
const SchemaProto = {
|
|
23078
|
-
[TypeId$
|
|
23407
|
+
[TypeId$7]: TypeId$7,
|
|
23079
23408
|
get make() {
|
|
23080
|
-
const value = make$
|
|
23409
|
+
const value = make$6(this);
|
|
23081
23410
|
Object.defineProperty(this, "make", {
|
|
23082
23411
|
value,
|
|
23083
23412
|
enumerable: true
|
|
@@ -23113,11 +23442,11 @@ const SchemaProto = {
|
|
|
23113
23442
|
return this.rebuild(appendChecks(this.ast, checks));
|
|
23114
23443
|
},
|
|
23115
23444
|
rebuild(ast) {
|
|
23116
|
-
return make$
|
|
23445
|
+
return make$5(ast, this[RebuildOptions]);
|
|
23117
23446
|
}
|
|
23118
23447
|
};
|
|
23119
23448
|
/** @internal */
|
|
23120
|
-
function make$
|
|
23449
|
+
function make$5(ast, options) {
|
|
23121
23450
|
function Schema() {}
|
|
23122
23451
|
const self = Object.setPrototypeOf(Schema, SchemaProto);
|
|
23123
23452
|
if (options && (Object.hasOwn(options, "name") || Object.hasOwn(options, "length") || Object.hasOwn(options, "__proto__"))) Object.defineProperties(self, Object.getOwnPropertyDescriptors({ ...options }));
|
|
@@ -23370,7 +23699,7 @@ function toCodecJsonASTStep(ast, recur) {
|
|
|
23370
23699
|
case "Declaration": {
|
|
23371
23700
|
const getLink = ast.annotations?.toCodecJson ?? ast.annotations?.toCodec;
|
|
23372
23701
|
if (!isFunction(getLink)) return replaceEncoding(ast, [unknownToJson]);
|
|
23373
|
-
const link = getLink(ast.typeParameters.map((tp) => make$
|
|
23702
|
+
const link = getLink(ast.typeParameters.map((tp) => make$5(toEncoded(tp))));
|
|
23374
23703
|
return link === void 0 ? ast : replaceEncoding(ast, [mapLink(link, recur)]);
|
|
23375
23704
|
}
|
|
23376
23705
|
case "Unknown": return replaceEncoding(ast, [unknownToJson]);
|
|
@@ -23397,7 +23726,7 @@ function toCodecJsonASTStep(ast, recur) {
|
|
|
23397
23726
|
}
|
|
23398
23727
|
/** @internal */
|
|
23399
23728
|
function toCodecStringTree$1(schema) {
|
|
23400
|
-
return make$
|
|
23729
|
+
return make$5(toCodecStringTreeAST(schema.ast), { schema });
|
|
23401
23730
|
}
|
|
23402
23731
|
const toStringTreeReorder = /*#__PURE__*/ makeReorder((ast) => {
|
|
23403
23732
|
switch (ast._tag) {
|
|
@@ -23413,7 +23742,7 @@ const toStringTreeReorder = /*#__PURE__*/ makeReorder((ast) => {
|
|
|
23413
23742
|
function toCodecStringTreeASTStep(ast, recur, onMissingAnnotation) {
|
|
23414
23743
|
switch (ast._tag) {
|
|
23415
23744
|
case "Declaration": {
|
|
23416
|
-
const typeParameters = ast.typeParameters.map((tp) => make$
|
|
23745
|
+
const typeParameters = ast.typeParameters.map((tp) => make$5(recur(toEncoded(tp))));
|
|
23417
23746
|
const getStringTreeLink = ast.annotations?.toCodecStringTree;
|
|
23418
23747
|
if (isFunction(getStringTreeLink)) {
|
|
23419
23748
|
const link = getStringTreeLink(typeParameters);
|
|
@@ -23450,7 +23779,7 @@ function toCodecStringTreeASTStep(ast, recur, onMissingAnnotation) {
|
|
|
23450
23779
|
return ast;
|
|
23451
23780
|
}
|
|
23452
23781
|
const nullToString = /*#__PURE__*/ new Link(/*#__PURE__*/ new Literal$1("null"), /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$2(() => null), /*#__PURE__*/ transform$2(() => "null")));
|
|
23453
|
-
const booleanToString = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([/*#__PURE__*/ new Literal$1("true"), /*#__PURE__*/ new Literal$1("false")]), /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$2((s) => s === "true"), /*#__PURE__*/ String$
|
|
23782
|
+
const booleanToString = /*#__PURE__*/ new Link(/*#__PURE__*/ new Union$1([/*#__PURE__*/ new Literal$1("true"), /*#__PURE__*/ new Literal$1("false")]), /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$2((s) => s === "true"), /*#__PURE__*/ String$8()));
|
|
23454
23783
|
const arrayFromSingleTransformation = /*#__PURE__*/ new Transformation(/*#__PURE__*/ transform$2((input) => typeof input === "string" ? [input] : input), /*#__PURE__*/ passthrough$1());
|
|
23455
23784
|
const isCodecArrayFromSingleLink = (link) => link.transformation === arrayFromSingleTransformation;
|
|
23456
23785
|
const toCodecStringTreeAST = /*#__PURE__*/ applyToSelfOrLastLinkEncodingIdempotent((ast) => {
|
|
@@ -24365,7 +24694,7 @@ function isSchemaError$1(u) {
|
|
|
24365
24694
|
* @stability stable
|
|
24366
24695
|
* @since 4.0.0
|
|
24367
24696
|
*/
|
|
24368
|
-
const TypeId$
|
|
24697
|
+
const TypeId$6 = TypeId$7;
|
|
24369
24698
|
/**
|
|
24370
24699
|
* Error thrown or returned when schema decoding or encoding fails.
|
|
24371
24700
|
*
|
|
@@ -24752,7 +25081,7 @@ const encodeSync = encodeUnknownSync;
|
|
|
24752
25081
|
* @category constructors
|
|
24753
25082
|
* @since 3.10.0
|
|
24754
25083
|
*/
|
|
24755
|
-
const make$
|
|
25084
|
+
const make$4 = make$5;
|
|
24756
25085
|
/**
|
|
24757
25086
|
* Checks whether a value is a `Schema`.
|
|
24758
25087
|
*
|
|
@@ -24761,7 +25090,7 @@ const make$3 = make$4;
|
|
|
24761
25090
|
* @since 3.10.0
|
|
24762
25091
|
*/
|
|
24763
25092
|
function isSchema(u) {
|
|
24764
|
-
return hasProperty(u, TypeId$
|
|
25093
|
+
return hasProperty(u, TypeId$6) && u[TypeId$6] === TypeId$6;
|
|
24765
25094
|
}
|
|
24766
25095
|
/**
|
|
24767
25096
|
* Creates an exact optional key schema for struct fields. Unlike `optional`,
|
|
@@ -24786,7 +25115,7 @@ function isSchema(u) {
|
|
|
24786
25115
|
* @category combinators
|
|
24787
25116
|
* @since 4.0.0
|
|
24788
25117
|
*/
|
|
24789
|
-
const optionalKey = /*#__PURE__*/ lambda((schema) => make$
|
|
25118
|
+
const optionalKey = /*#__PURE__*/ lambda((schema) => make$4(optionalKey$1(schema.ast), { schema }));
|
|
24790
25119
|
/**
|
|
24791
25120
|
* Marks a struct field as optional, allowing the key to be absent or
|
|
24792
25121
|
* `undefined`.
|
|
@@ -24817,9 +25146,9 @@ const optionalKey = /*#__PURE__*/ lambda((schema) => make$3(optionalKey$1(schema
|
|
|
24817
25146
|
* @category combinators
|
|
24818
25147
|
* @since 3.10.0
|
|
24819
25148
|
*/
|
|
24820
|
-
const optional$
|
|
25149
|
+
const optional$3 = /*#__PURE__*/ lambda((self) => {
|
|
24821
25150
|
const schema = UndefinedOr(self);
|
|
24822
|
-
return make$
|
|
25151
|
+
return make$4(optional$4(self.ast), { schema });
|
|
24823
25152
|
});
|
|
24824
25153
|
/**
|
|
24825
25154
|
* Extracts the type-side schema: sets `Encoded` to equal the decoded `Type`,
|
|
@@ -24829,7 +25158,7 @@ const optional$2 = /*#__PURE__*/ lambda((self) => {
|
|
|
24829
25158
|
* @category transforming
|
|
24830
25159
|
* @since 4.0.0
|
|
24831
25160
|
*/
|
|
24832
|
-
const toType = /*#__PURE__*/ lambda((schema) => make$
|
|
25161
|
+
const toType = /*#__PURE__*/ lambda((schema) => make$4(toType$1(schema.ast), { schema }));
|
|
24833
25162
|
/**
|
|
24834
25163
|
* Creates a schema for a single literal value (string, number, bigint, boolean, or null).
|
|
24835
25164
|
*
|
|
@@ -24851,7 +25180,7 @@ const toType = /*#__PURE__*/ lambda((schema) => make$3(toType$1(schema.ast), { s
|
|
|
24851
25180
|
* @since 3.10.0
|
|
24852
25181
|
*/
|
|
24853
25182
|
function Literal(literal) {
|
|
24854
|
-
const out = make$
|
|
25183
|
+
const out = make$4(new Literal$1(literal), {
|
|
24855
25184
|
literal,
|
|
24856
25185
|
transform(to) {
|
|
24857
25186
|
return out.pipe(decodeTo(Literal(to), {
|
|
@@ -24875,7 +25204,7 @@ function Literal(literal) {
|
|
|
24875
25204
|
* @category schemas
|
|
24876
25205
|
* @since 3.10.0
|
|
24877
25206
|
*/
|
|
24878
|
-
const Unknown = /*#__PURE__*/ make$
|
|
25207
|
+
const Unknown = /*#__PURE__*/ make$4(unknown);
|
|
24879
25208
|
/**
|
|
24880
25209
|
* Schema for the `null` literal. Validates that the input is strictly `null`.
|
|
24881
25210
|
*
|
|
@@ -24884,7 +25213,7 @@ const Unknown = /*#__PURE__*/ make$3(unknown);
|
|
|
24884
25213
|
* @category schemas
|
|
24885
25214
|
* @since 3.10.0
|
|
24886
25215
|
*/
|
|
24887
|
-
const Null = /*#__PURE__*/ make$
|
|
25216
|
+
const Null = /*#__PURE__*/ make$4(null_);
|
|
24888
25217
|
/**
|
|
24889
25218
|
* Schema for the `undefined` literal. Validates that the input is strictly `undefined`.
|
|
24890
25219
|
*
|
|
@@ -24893,7 +25222,7 @@ const Null = /*#__PURE__*/ make$3(null_);
|
|
|
24893
25222
|
* @category schemas
|
|
24894
25223
|
* @since 3.10.0
|
|
24895
25224
|
*/
|
|
24896
|
-
const Undefined = /*#__PURE__*/ make$
|
|
25225
|
+
const Undefined = /*#__PURE__*/ make$4(undefined_);
|
|
24897
25226
|
/**
|
|
24898
25227
|
* Schema for `string` values. Validates that the input is `typeof` `"string"`.
|
|
24899
25228
|
*
|
|
@@ -24901,7 +25230,7 @@ const Undefined = /*#__PURE__*/ make$3(undefined_);
|
|
|
24901
25230
|
* @category schemas
|
|
24902
25231
|
* @since 4.0.0
|
|
24903
25232
|
*/
|
|
24904
|
-
const String$
|
|
25233
|
+
const String$6 = /*#__PURE__*/ make$4(string);
|
|
24905
25234
|
/**
|
|
24906
25235
|
* Schema for `number` values, including `NaN`, `Infinity`, and `-Infinity`.
|
|
24907
25236
|
*
|
|
@@ -24917,7 +25246,7 @@ const String$5 = /*#__PURE__*/ make$3(string);
|
|
|
24917
25246
|
* @category schemas
|
|
24918
25247
|
* @since 4.0.0
|
|
24919
25248
|
*/
|
|
24920
|
-
const Number$2 = /*#__PURE__*/ make$
|
|
25249
|
+
const Number$2 = /*#__PURE__*/ make$4(number);
|
|
24921
25250
|
/**
|
|
24922
25251
|
* Schema for `boolean` values. Validates that the input is `typeof` `"boolean"`.
|
|
24923
25252
|
*
|
|
@@ -24931,9 +25260,9 @@ const Number$2 = /*#__PURE__*/ make$3(number);
|
|
|
24931
25260
|
* @category schemas
|
|
24932
25261
|
* @since 4.0.0
|
|
24933
25262
|
*/
|
|
24934
|
-
const Boolean$4 = /*#__PURE__*/ make$
|
|
25263
|
+
const Boolean$4 = /*#__PURE__*/ make$4(boolean);
|
|
24935
25264
|
function makeStruct(ast, fields) {
|
|
24936
|
-
return make$
|
|
25265
|
+
return make$4(ast, {
|
|
24937
25266
|
fields,
|
|
24938
25267
|
mapFields(f, options) {
|
|
24939
25268
|
const fields = f(this.fields);
|
|
@@ -25019,7 +25348,7 @@ function Struct(fields) {
|
|
|
25019
25348
|
* @since 3.10.0
|
|
25020
25349
|
*/
|
|
25021
25350
|
function Record(key, value) {
|
|
25022
|
-
return make$
|
|
25351
|
+
return make$4(record(key.ast, value.ast), {
|
|
25023
25352
|
key,
|
|
25024
25353
|
value
|
|
25025
25354
|
});
|
|
@@ -25028,7 +25357,7 @@ function Record(key, value) {
|
|
|
25028
25357
|
* @category constructors
|
|
25029
25358
|
* @since 4.0.0
|
|
25030
25359
|
*/
|
|
25031
|
-
const ArraySchema = /*#__PURE__*/ lambda((schema) => make$
|
|
25360
|
+
const ArraySchema = /*#__PURE__*/ lambda((schema) => make$4(new Arrays(false, [], [schema.ast]), { value: schema }));
|
|
25032
25361
|
/**
|
|
25033
25362
|
* Defines a non-empty `ReadonlyArray` schema — at least one element required.
|
|
25034
25363
|
* Type is `readonly [T, ...T[]]`.
|
|
@@ -25047,9 +25376,9 @@ const ArraySchema = /*#__PURE__*/ lambda((schema) => make$3(new Arrays(false, []
|
|
|
25047
25376
|
* @category constructors
|
|
25048
25377
|
* @since 3.10.0
|
|
25049
25378
|
*/
|
|
25050
|
-
const NonEmptyArray = /*#__PURE__*/ lambda((schema) => make$
|
|
25379
|
+
const NonEmptyArray = /*#__PURE__*/ lambda((schema) => make$4(new Arrays(false, [schema.ast], [schema.ast]), { value: schema }));
|
|
25051
25380
|
function makeUnion(ast, members) {
|
|
25052
|
-
return make$
|
|
25381
|
+
return make$4(ast, {
|
|
25053
25382
|
members,
|
|
25054
25383
|
mapMembers(f, options) {
|
|
25055
25384
|
const members = f(this.members);
|
|
@@ -25104,7 +25433,7 @@ function Union(members, options) {
|
|
|
25104
25433
|
*/
|
|
25105
25434
|
function Literals$2(literals) {
|
|
25106
25435
|
const members = literals.map(Literal);
|
|
25107
|
-
return make$
|
|
25436
|
+
return make$4(union(members, void 0, void 0), {
|
|
25108
25437
|
literals,
|
|
25109
25438
|
members,
|
|
25110
25439
|
mapMembers(f) {
|
|
@@ -25136,7 +25465,7 @@ const NullOr = /*#__PURE__*/ lambda((self) => Union([self, Null]));
|
|
|
25136
25465
|
const UndefinedOr = /*#__PURE__*/ lambda((self) => Union([self, Undefined]));
|
|
25137
25466
|
function decodeTo(to, transformation) {
|
|
25138
25467
|
return (from) => {
|
|
25139
|
-
return make$
|
|
25468
|
+
return make$4(decodeTo$1(from.ast, to.ast, transformation ? makeTransformation(transformation) : passthrough()), {
|
|
25140
25469
|
from,
|
|
25141
25470
|
to
|
|
25142
25471
|
});
|
|
@@ -25191,7 +25520,7 @@ const BooleanLiterals = /*#__PURE__*/ Literals$2([...TrueLiterals.literals, ...F
|
|
|
25191
25520
|
* @since 3.10.0
|
|
25192
25521
|
*/
|
|
25193
25522
|
function withConstructorDefault(defaultValue) {
|
|
25194
|
-
return (schema) => make$
|
|
25523
|
+
return (schema) => make$4(withConstructorDefault$1(schema.ast, defaultValue), { schema });
|
|
25195
25524
|
}
|
|
25196
25525
|
/**
|
|
25197
25526
|
* Combines a {@link Literal} schema with {@link withConstructorDefault}, making it ideal
|
|
@@ -25484,7 +25813,7 @@ function isUnique(annotations) {
|
|
|
25484
25813
|
* @category schemas
|
|
25485
25814
|
* @since 3.10.0
|
|
25486
25815
|
*/
|
|
25487
|
-
const NonEmptyString = /*#__PURE__*/ String$
|
|
25816
|
+
const NonEmptyString = /*#__PURE__*/ String$6.check(/*#__PURE__*/ isNonEmpty());
|
|
25488
25817
|
const getErrorOptionsKey = (options) => (options?.includeStack === true ? 1 : 0) | (options?.excludeCause === true ? 2 : 0);
|
|
25489
25818
|
const getErrorOptions = (key) => {
|
|
25490
25819
|
switch (key) {
|
|
@@ -25550,7 +25879,7 @@ function Defect(options) {
|
|
|
25550
25879
|
}
|
|
25551
25880
|
globalThis.RegExp;
|
|
25552
25881
|
globalThis.URL;
|
|
25553
|
-
const JsonString = /*#__PURE__*/ String$
|
|
25882
|
+
const JsonString = /*#__PURE__*/ String$6.annotate({
|
|
25554
25883
|
expected: "a string that will be decoded as JSON",
|
|
25555
25884
|
contentMediaType: "application/json"
|
|
25556
25885
|
});
|
|
@@ -25609,7 +25938,7 @@ function makeClass(Inherited, identifier, struct$1, annotations, proto) {
|
|
|
25609
25938
|
}
|
|
25610
25939
|
});
|
|
25611
25940
|
}
|
|
25612
|
-
static [TypeId$
|
|
25941
|
+
static [TypeId$6] = TypeId$6;
|
|
25613
25942
|
get [ClassTypeId]() {
|
|
25614
25943
|
return ClassTypeId;
|
|
25615
25944
|
}
|
|
@@ -25626,7 +25955,7 @@ function makeClass(Inherited, identifier, struct$1, annotations, proto) {
|
|
|
25626
25955
|
return getClassSchema(this).rebuild(ast);
|
|
25627
25956
|
}
|
|
25628
25957
|
static make(input, options) {
|
|
25629
|
-
return make$
|
|
25958
|
+
return make$6(getClassSchema(this))(input ?? {}, options);
|
|
25630
25959
|
}
|
|
25631
25960
|
static makeOption(input, options) {
|
|
25632
25961
|
return makeOption(getClassSchema(this))(input ?? {}, options);
|
|
@@ -25677,7 +26006,7 @@ function getClassSchemaFactory(from, identifier, annotations) {
|
|
|
25677
26006
|
const ClassTypeId = getClassTypeId(identifier);
|
|
25678
26007
|
const isClassValue = (input) => input instanceof self || hasProperty(input, ClassTypeId);
|
|
25679
26008
|
const transformation = getClassTransformation(self);
|
|
25680
|
-
return memo = decodeTo(make$
|
|
26009
|
+
return memo = decodeTo(make$4(new Declaration([from.ast], () => (input, ast, options) => {
|
|
25681
26010
|
return isClassValue(input) ? succeed$3(input) : fail$1(new InvalidType(ast, input, options));
|
|
25682
26011
|
}, {
|
|
25683
26012
|
identifier,
|
|
@@ -25877,13 +26206,13 @@ const toCodecStringTree = toCodecStringTree$1;
|
|
|
25877
26206
|
* @category schemas
|
|
25878
26207
|
* @since 4.0.0
|
|
25879
26208
|
*/
|
|
25880
|
-
const Json = /*#__PURE__*/ make$
|
|
26209
|
+
const Json = /*#__PURE__*/ make$4(/*#__PURE__*/ annotate$1(Json$1, { toCode: () => ({
|
|
25881
26210
|
runtime: "Schema.Json",
|
|
25882
26211
|
Type: "Schema.Json"
|
|
25883
26212
|
}) }));
|
|
25884
26213
|
//#endregion
|
|
25885
26214
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Terminal.js
|
|
25886
|
-
const TypeId$
|
|
26215
|
+
const TypeId$5 = "~effect/Terminal";
|
|
25887
26216
|
const QuitErrorTypeId = "~effect/Terminal/QuitError";
|
|
25888
26217
|
/**
|
|
25889
26218
|
* Represents an error that occurs when a user attempts to
|
|
@@ -25960,9 +26289,9 @@ const Terminal = /*#__PURE__*/ Service("effect/Terminal");
|
|
|
25960
26289
|
* @category constructors
|
|
25961
26290
|
* @since 4.0.0
|
|
25962
26291
|
*/
|
|
25963
|
-
const make$
|
|
26292
|
+
const make$3 = (impl) => Terminal.of({
|
|
25964
26293
|
...impl,
|
|
25965
|
-
[TypeId$
|
|
26294
|
+
[TypeId$5]: TypeId$5
|
|
25966
26295
|
});
|
|
25967
26296
|
/**
|
|
25968
26297
|
* Provides the default process-backed `Terminal` service, ending key input on
|
|
@@ -25972,10 +26301,10 @@ const make$2 = (impl) => Terminal.of({
|
|
|
25972
26301
|
* @category layers
|
|
25973
26302
|
* @since 4.0.0
|
|
25974
26303
|
*/
|
|
25975
|
-
const layer$
|
|
26304
|
+
const layer$4 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit) {
|
|
25976
26305
|
const stdin = process.stdin;
|
|
25977
26306
|
const stdout = process.stdout;
|
|
25978
|
-
const lines = yield* make$
|
|
26307
|
+
const lines = yield* make$21();
|
|
25979
26308
|
let inputEnded = stdin.readableEnded;
|
|
25980
26309
|
let readlineActive = false;
|
|
25981
26310
|
const onStdinEnd = () => {
|
|
@@ -25984,7 +26313,7 @@ const layer$3 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
|
|
|
25984
26313
|
};
|
|
25985
26314
|
stdin.once("end", onStdinEnd);
|
|
25986
26315
|
yield* addFinalizer(() => sync(() => stdin.off("end", onStdinEnd)));
|
|
25987
|
-
const rlRef = yield* make$
|
|
26316
|
+
const rlRef = yield* make$19({
|
|
25988
26317
|
acquire: acquireRelease(sync(() => {
|
|
25989
26318
|
const rl = readline.createInterface({
|
|
25990
26319
|
input: stdin,
|
|
@@ -26018,7 +26347,7 @@ const layer$3 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
|
|
|
26018
26347
|
const columns = sync(() => stdout.columns ?? 0);
|
|
26019
26348
|
const rows = sync(() => stdout.rows ?? 0);
|
|
26020
26349
|
const readInput = gen(function* () {
|
|
26021
|
-
const queue = yield* make$
|
|
26350
|
+
const queue = yield* make$21();
|
|
26022
26351
|
const handleKeypress = (s, k) => {
|
|
26023
26352
|
const userInput = {
|
|
26024
26353
|
input: fromUndefinedOr(s),
|
|
@@ -26062,7 +26391,7 @@ const layer$3 = /*#__PURE__*/ effect(Terminal, /*#__PURE__*/ (/* @__PURE__ */ fn
|
|
|
26062
26391
|
cause: err
|
|
26063
26392
|
}))));
|
|
26064
26393
|
}));
|
|
26065
|
-
return make$
|
|
26394
|
+
return make$3({
|
|
26066
26395
|
columns,
|
|
26067
26396
|
rows,
|
|
26068
26397
|
readInput,
|
|
@@ -26083,7 +26412,7 @@ function defaultShouldQuit(input) {
|
|
|
26083
26412
|
* @category layers
|
|
26084
26413
|
* @since 4.0.0
|
|
26085
26414
|
*/
|
|
26086
|
-
const layer$
|
|
26415
|
+
const layer$2 = /*#__PURE__*/ provideMerge(layer$13, /*#__PURE__*/ mergeAll(layer$9, layer$11, layer$7, layer$5, layer$4));
|
|
26087
26416
|
//#endregion
|
|
26088
26417
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/cli/CliError.js
|
|
26089
26418
|
/**
|
|
@@ -26104,7 +26433,7 @@ const layer$1 = /*#__PURE__*/ provideMerge(layer$12, /*#__PURE__*/ mergeAll(laye
|
|
|
26104
26433
|
* @category type IDs
|
|
26105
26434
|
* @since 4.0.0
|
|
26106
26435
|
*/
|
|
26107
|
-
const TypeId$
|
|
26436
|
+
const TypeId$4 = "~effect/cli/CliError";
|
|
26108
26437
|
/**
|
|
26109
26438
|
* Type guard to check if a value is a CLI error.
|
|
26110
26439
|
*
|
|
@@ -26126,7 +26455,7 @@ const TypeId$3 = "~effect/cli/CliError";
|
|
|
26126
26455
|
* @category guards
|
|
26127
26456
|
* @since 4.0.0
|
|
26128
26457
|
*/
|
|
26129
|
-
const isCliError = (u) => hasProperty(u, TypeId$
|
|
26458
|
+
const isCliError = (u) => hasProperty(u, TypeId$4);
|
|
26130
26459
|
/**
|
|
26131
26460
|
* Error thrown when an unrecognized option is encountered.
|
|
26132
26461
|
*
|
|
@@ -26161,10 +26490,10 @@ const isCliError = (u) => hasProperty(u, TypeId$3);
|
|
|
26161
26490
|
* @category errors
|
|
26162
26491
|
* @since 4.0.0
|
|
26163
26492
|
*/
|
|
26164
|
-
var UnrecognizedOption = class extends (/*#__PURE__*/ TaggedError(`${TypeId$
|
|
26165
|
-
option: String$
|
|
26166
|
-
command: /*#__PURE__*/ optional$
|
|
26167
|
-
suggestions: /*#__PURE__*/ ArraySchema(String$
|
|
26493
|
+
var UnrecognizedOption = class extends (/*#__PURE__*/ TaggedError(`${TypeId$4}/UnrecognizedOption`)("UnrecognizedOption", {
|
|
26494
|
+
option: String$6,
|
|
26495
|
+
command: /*#__PURE__*/ optional$3(/*#__PURE__*/ ArraySchema(String$6)),
|
|
26496
|
+
suggestions: /*#__PURE__*/ ArraySchema(String$6)
|
|
26168
26497
|
})) {
|
|
26169
26498
|
/**
|
|
26170
26499
|
* Marks this value as a CLI parsing error for runtime guards.
|
|
@@ -26172,7 +26501,7 @@ var UnrecognizedOption = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/U
|
|
|
26172
26501
|
* @stability unstable
|
|
26173
26502
|
* @since 4.0.0
|
|
26174
26503
|
*/
|
|
26175
|
-
[TypeId$
|
|
26504
|
+
[TypeId$4] = TypeId$4;
|
|
26176
26505
|
/**
|
|
26177
26506
|
* Formats the unrecognized option with command context and suggestions.
|
|
26178
26507
|
*
|
|
@@ -26208,10 +26537,10 @@ var UnrecognizedOption = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/U
|
|
|
26208
26537
|
* @category errors
|
|
26209
26538
|
* @since 4.0.0
|
|
26210
26539
|
*/
|
|
26211
|
-
var DuplicateOption = class extends (/*#__PURE__*/ TaggedError(`${TypeId$
|
|
26212
|
-
option: String$
|
|
26213
|
-
parentCommand: String$
|
|
26214
|
-
childCommand: String$
|
|
26540
|
+
var DuplicateOption = class extends (/*#__PURE__*/ TaggedError(`${TypeId$4}/DuplicateOption`)("DuplicateOption", {
|
|
26541
|
+
option: String$6,
|
|
26542
|
+
parentCommand: String$6,
|
|
26543
|
+
childCommand: String$6
|
|
26215
26544
|
})) {
|
|
26216
26545
|
/**
|
|
26217
26546
|
* Marks this value as a CLI configuration error for runtime guards.
|
|
@@ -26219,7 +26548,7 @@ var DuplicateOption = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/Dupl
|
|
|
26219
26548
|
* @stability unstable
|
|
26220
26549
|
* @since 4.0.0
|
|
26221
26550
|
*/
|
|
26222
|
-
[TypeId$
|
|
26551
|
+
[TypeId$4] = TypeId$4;
|
|
26223
26552
|
/**
|
|
26224
26553
|
* Explains which parent and child commands define the duplicate option.
|
|
26225
26554
|
*
|
|
@@ -26263,14 +26592,14 @@ var DuplicateOption = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/Dupl
|
|
|
26263
26592
|
* @category errors
|
|
26264
26593
|
* @since 4.0.0
|
|
26265
26594
|
*/
|
|
26266
|
-
var MissingOption = class extends (/*#__PURE__*/ TaggedError(`${TypeId$
|
|
26595
|
+
var MissingOption = class extends (/*#__PURE__*/ TaggedError(`${TypeId$4}/MissingOption`)("MissingOption", { option: String$6 })) {
|
|
26267
26596
|
/**
|
|
26268
26597
|
* Marks this value as a missing CLI option error for runtime guards.
|
|
26269
26598
|
*
|
|
26270
26599
|
* @stability unstable
|
|
26271
26600
|
* @since 4.0.0
|
|
26272
26601
|
*/
|
|
26273
|
-
[TypeId$
|
|
26602
|
+
[TypeId$4] = TypeId$4;
|
|
26274
26603
|
/**
|
|
26275
26604
|
* Formats the missing required flag for display.
|
|
26276
26605
|
*
|
|
@@ -26313,14 +26642,14 @@ var MissingOption = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/Missin
|
|
|
26313
26642
|
* @category errors
|
|
26314
26643
|
* @since 4.0.0
|
|
26315
26644
|
*/
|
|
26316
|
-
var MissingArgument = class extends (/*#__PURE__*/ TaggedError(`${TypeId$
|
|
26645
|
+
var MissingArgument = class extends (/*#__PURE__*/ TaggedError(`${TypeId$4}/MissingArgument`)("MissingArgument", { argument: String$6 })) {
|
|
26317
26646
|
/**
|
|
26318
26647
|
* Marks this value as a missing CLI argument error for runtime guards.
|
|
26319
26648
|
*
|
|
26320
26649
|
* @stability unstable
|
|
26321
26650
|
* @since 4.0.0
|
|
26322
26651
|
*/
|
|
26323
|
-
[TypeId$
|
|
26652
|
+
[TypeId$4] = TypeId$4;
|
|
26324
26653
|
/**
|
|
26325
26654
|
* Formats the missing required positional argument for display.
|
|
26326
26655
|
*
|
|
@@ -26351,14 +26680,14 @@ var MissingArgument = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/Miss
|
|
|
26351
26680
|
* @category errors
|
|
26352
26681
|
* @since 4.0.0
|
|
26353
26682
|
*/
|
|
26354
|
-
var UnexpectedArgument = class extends (/*#__PURE__*/ TaggedError(`${TypeId$
|
|
26683
|
+
var UnexpectedArgument = class extends (/*#__PURE__*/ TaggedError(`${TypeId$4}/UnexpectedArgument`)("UnexpectedArgument", { arguments: /*#__PURE__*/ ArraySchema(String$6) })) {
|
|
26355
26684
|
/**
|
|
26356
26685
|
* Marks this value as an unexpected CLI argument error for runtime guards.
|
|
26357
26686
|
*
|
|
26358
26687
|
* @stability unstable
|
|
26359
26688
|
* @since 4.0.0
|
|
26360
26689
|
*/
|
|
26361
|
-
[TypeId$
|
|
26690
|
+
[TypeId$4] = TypeId$4;
|
|
26362
26691
|
/**
|
|
26363
26692
|
* Formats the unexpected positional arguments for display.
|
|
26364
26693
|
*
|
|
@@ -26404,10 +26733,10 @@ var UnexpectedArgument = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/U
|
|
|
26404
26733
|
* @category errors
|
|
26405
26734
|
* @since 4.0.0
|
|
26406
26735
|
*/
|
|
26407
|
-
var InvalidValue = class extends (/*#__PURE__*/ TaggedError(`${TypeId$
|
|
26408
|
-
option: String$
|
|
26409
|
-
value: String$
|
|
26410
|
-
expected: String$
|
|
26736
|
+
var InvalidValue = class extends (/*#__PURE__*/ TaggedError(`${TypeId$4}/InvalidValue`)("InvalidValue", {
|
|
26737
|
+
option: String$6,
|
|
26738
|
+
value: String$6,
|
|
26739
|
+
expected: String$6,
|
|
26411
26740
|
kind: /*#__PURE__*/ Union([/*#__PURE__*/ Literal("flag"), /*#__PURE__*/ Literal("argument")])
|
|
26412
26741
|
})) {
|
|
26413
26742
|
/**
|
|
@@ -26416,7 +26745,7 @@ var InvalidValue = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/Invalid
|
|
|
26416
26745
|
* @stability unstable
|
|
26417
26746
|
* @since 4.0.0
|
|
26418
26747
|
*/
|
|
26419
|
-
[TypeId$
|
|
26748
|
+
[TypeId$4] = TypeId$4;
|
|
26420
26749
|
/**
|
|
26421
26750
|
* Formats the invalid flag or argument value with the expected input.
|
|
26422
26751
|
*
|
|
@@ -26467,10 +26796,10 @@ var InvalidValue = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/Invalid
|
|
|
26467
26796
|
* @category errors
|
|
26468
26797
|
* @since 4.0.0
|
|
26469
26798
|
*/
|
|
26470
|
-
var UnknownSubcommand = class extends (/*#__PURE__*/ TaggedError(`${TypeId$
|
|
26471
|
-
subcommand: String$
|
|
26472
|
-
parent: /*#__PURE__*/ optional$
|
|
26473
|
-
suggestions: /*#__PURE__*/ ArraySchema(String$
|
|
26799
|
+
var UnknownSubcommand = class extends (/*#__PURE__*/ TaggedError(`${TypeId$4}/UnknownSubcommand`)("UnknownSubcommand", {
|
|
26800
|
+
subcommand: String$6,
|
|
26801
|
+
parent: /*#__PURE__*/ optional$3(/*#__PURE__*/ ArraySchema(String$6)),
|
|
26802
|
+
suggestions: /*#__PURE__*/ ArraySchema(String$6)
|
|
26474
26803
|
})) {
|
|
26475
26804
|
/**
|
|
26476
26805
|
* Marks this value as an unknown CLI subcommand error for runtime guards.
|
|
@@ -26478,7 +26807,7 @@ var UnknownSubcommand = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/Un
|
|
|
26478
26807
|
* @stability unstable
|
|
26479
26808
|
* @since 4.0.0
|
|
26480
26809
|
*/
|
|
26481
|
-
[TypeId$
|
|
26810
|
+
[TypeId$4] = TypeId$4;
|
|
26482
26811
|
/**
|
|
26483
26812
|
* Formats the unknown subcommand with parent command context and suggestions.
|
|
26484
26813
|
*
|
|
@@ -26536,9 +26865,9 @@ var UnknownSubcommand = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/Un
|
|
|
26536
26865
|
* @category errors
|
|
26537
26866
|
* @since 4.0.0
|
|
26538
26867
|
*/
|
|
26539
|
-
var UserError = class extends (/*#__PURE__*/ TaggedError(`${TypeId$
|
|
26868
|
+
var UserError = class extends (/*#__PURE__*/ TaggedError(`${TypeId$4}/UserError`)("UserError", {
|
|
26540
26869
|
cause: /*#__PURE__*/ Defect(),
|
|
26541
|
-
userMessage: /*#__PURE__*/ optionalKey(String$
|
|
26870
|
+
userMessage: /*#__PURE__*/ optionalKey(String$6)
|
|
26542
26871
|
})) {
|
|
26543
26872
|
/**
|
|
26544
26873
|
* Marks this value as a user handler error for runtime guards.
|
|
@@ -26546,7 +26875,7 @@ var UserError = class extends (/*#__PURE__*/ TaggedError(`${TypeId$3}/UserError`
|
|
|
26546
26875
|
* @stability unstable
|
|
26547
26876
|
* @since 4.0.0
|
|
26548
26877
|
*/
|
|
26549
|
-
[TypeId$
|
|
26878
|
+
[TypeId$4] = TypeId$4;
|
|
26550
26879
|
/**
|
|
26551
26880
|
* Controls whether the runtime logger should report this error. The CLI
|
|
26552
26881
|
* runner sets this to `false` after rendering the error itself.
|
|
@@ -26603,11 +26932,11 @@ const NonShowHelpErrors = /*#__PURE__*/ Union([
|
|
|
26603
26932
|
* @category errors
|
|
26604
26933
|
* @since 4.0.0
|
|
26605
26934
|
*/
|
|
26606
|
-
var ShowHelp = class extends (/*#__PURE__*/ TaggedError(`${TypeId$
|
|
26607
|
-
commandPath: /*#__PURE__*/ ArraySchema(String$
|
|
26935
|
+
var ShowHelp = class extends (/*#__PURE__*/ TaggedError(`${TypeId$4}/ShowHelp`)("ShowHelp", {
|
|
26936
|
+
commandPath: /*#__PURE__*/ ArraySchema(String$6),
|
|
26608
26937
|
errors: /*#__PURE__*/ ArraySchema(NonShowHelpErrors)
|
|
26609
26938
|
})) {
|
|
26610
|
-
[TypeId$
|
|
26939
|
+
[TypeId$4] = TypeId$4;
|
|
26611
26940
|
[errorExitCode] = this.errors.length ? 1 : 0;
|
|
26612
26941
|
[errorReported] = false;
|
|
26613
26942
|
get message() {
|
|
@@ -26738,7 +27067,7 @@ const Boolean$3 = /*#__PURE__*/ makeSchemaPrimitive("Boolean", BooleanLiterals);
|
|
|
26738
27067
|
* @category constructors
|
|
26739
27068
|
* @since 4.0.0
|
|
26740
27069
|
*/
|
|
26741
|
-
const String$
|
|
27070
|
+
const String$5 = /*#__PURE__*/ makePrimitive("String", (value) => succeed$3(value));
|
|
26742
27071
|
/**
|
|
26743
27072
|
* Creates a primitive that accepts only specific choice values mapped to custom types.
|
|
26744
27073
|
*
|
|
@@ -26989,7 +27318,7 @@ const eraseLines$1 = (rows) => {
|
|
|
26989
27318
|
* @stability unstable
|
|
26990
27319
|
* @since 4.0.0
|
|
26991
27320
|
*/
|
|
26992
|
-
const TypeId$
|
|
27321
|
+
const TypeId$3 = "~effect/cli/Prompt";
|
|
26993
27322
|
const defaultTheme = {
|
|
26994
27323
|
prefix: "?",
|
|
26995
27324
|
arrowUp: "↑",
|
|
@@ -27285,7 +27614,7 @@ const map$2 = /*#__PURE__*/ dual(2, (self, f) => flatMap(self, (a) => succeed(f(
|
|
|
27285
27614
|
* @category constructors
|
|
27286
27615
|
* @since 4.0.0
|
|
27287
27616
|
*/
|
|
27288
|
-
const Password = (options) => basePrompt(options, "password").pipe(map$2(make$
|
|
27617
|
+
const Password = (options) => basePrompt(options, "password").pipe(map$2(make$8));
|
|
27289
27618
|
/**
|
|
27290
27619
|
* Runs a prompt by reading terminal input and rendering prompt frames until the
|
|
27291
27620
|
* prompt submits a value.
|
|
@@ -27364,7 +27693,7 @@ const succeed = (value) => {
|
|
|
27364
27693
|
* @category constructors
|
|
27365
27694
|
* @since 4.0.0
|
|
27366
27695
|
*/
|
|
27367
|
-
const String$
|
|
27696
|
+
const String$4 = (options) => basePrompt(options, "text");
|
|
27368
27697
|
/**
|
|
27369
27698
|
* Creates a toggle prompt that lets the user switch between active and inactive
|
|
27370
27699
|
* states and returns the selected boolean value.
|
|
@@ -27393,7 +27722,7 @@ const proto$1 = {
|
|
|
27393
27722
|
return run$2(this);
|
|
27394
27723
|
}
|
|
27395
27724
|
}),
|
|
27396
|
-
[TypeId$
|
|
27725
|
+
[TypeId$3]: { _Output: (_) => _ }
|
|
27397
27726
|
};
|
|
27398
27727
|
const runWithInput = (prompt, terminal, input) => suspend$2(() => {
|
|
27399
27728
|
const op = prompt;
|
|
@@ -28478,7 +28807,23 @@ const entriesToDisplay = (cursor, total, maxVisible) => {
|
|
|
28478
28807
|
};
|
|
28479
28808
|
//#endregion
|
|
28480
28809
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/cli/Param.js
|
|
28481
|
-
const TypeId$
|
|
28810
|
+
const TypeId$2 = "~effect/cli/Param";
|
|
28811
|
+
/**
|
|
28812
|
+
* Defines the kind discriminator for positional argument parameters.
|
|
28813
|
+
*
|
|
28814
|
+
* **When to use**
|
|
28815
|
+
*
|
|
28816
|
+
* Use to build low-level `Param` constructors or type positions for positional
|
|
28817
|
+
* argument parameters.
|
|
28818
|
+
*
|
|
28819
|
+
* @see {@link flagKind} for the named flag parameter discriminator
|
|
28820
|
+
* @see {@link ParamKind} for the full parameter kind union
|
|
28821
|
+
*
|
|
28822
|
+
* @stability unstable
|
|
28823
|
+
* @category constants
|
|
28824
|
+
* @since 4.0.0
|
|
28825
|
+
*/
|
|
28826
|
+
const argumentKind = "argument";
|
|
28482
28827
|
/**
|
|
28483
28828
|
* Defines the kind discriminator for flag parameters.
|
|
28484
28829
|
*
|
|
@@ -28495,7 +28840,7 @@ const TypeId$1 = "~effect/cli/Param";
|
|
|
28495
28840
|
*/
|
|
28496
28841
|
const flagKind = "flag";
|
|
28497
28842
|
const Proto$1 = {
|
|
28498
|
-
[TypeId$
|
|
28843
|
+
[TypeId$2]: { _A: identity },
|
|
28499
28844
|
pipe() {
|
|
28500
28845
|
return pipeArguments(this, arguments);
|
|
28501
28846
|
}
|
|
@@ -28517,7 +28862,7 @@ const Proto$1 = {
|
|
|
28517
28862
|
* @category guards
|
|
28518
28863
|
* @since 4.0.0
|
|
28519
28864
|
*/
|
|
28520
|
-
const isParam = (u) => hasProperty(u, TypeId$
|
|
28865
|
+
const isParam = (u) => hasProperty(u, TypeId$2);
|
|
28521
28866
|
/**
|
|
28522
28867
|
* Type guard to check if a Single param is a flag (not an argument).
|
|
28523
28868
|
*
|
|
@@ -28570,9 +28915,9 @@ const makeSingle = (params) => {
|
|
|
28570
28915
|
* @category constructors
|
|
28571
28916
|
* @since 4.0.0
|
|
28572
28917
|
*/
|
|
28573
|
-
const String$
|
|
28918
|
+
const String$3 = (kind, name) => makeSingle({
|
|
28574
28919
|
name,
|
|
28575
|
-
primitiveType: String$
|
|
28920
|
+
primitiveType: String$5,
|
|
28576
28921
|
kind
|
|
28577
28922
|
});
|
|
28578
28923
|
/**
|
|
@@ -28731,7 +29076,7 @@ const withAlias$1 = /*#__PURE__*/ dual(2, (self, alias) => {
|
|
|
28731
29076
|
* @category combinators
|
|
28732
29077
|
* @since 4.0.0
|
|
28733
29078
|
*/
|
|
28734
|
-
const withDescription$
|
|
29079
|
+
const withDescription$3 = /*#__PURE__*/ dual(2, (self, description) => {
|
|
28735
29080
|
return transformSingle(self, (single) => makeSingle({
|
|
28736
29081
|
...single,
|
|
28737
29082
|
description: some(description)
|
|
@@ -28857,7 +29202,7 @@ const mapEffect = /*#__PURE__*/ dual(2, (self, f) => transform(self, (parse) =>
|
|
|
28857
29202
|
* @category combinators
|
|
28858
29203
|
* @since 4.0.0
|
|
28859
29204
|
*/
|
|
28860
|
-
const optional$
|
|
29205
|
+
const optional$2 = (param) => {
|
|
28861
29206
|
const parse = (args) => param.parse(args).pipe(map$5(([leftover, value]) => [leftover, some(value)]), catchTags({
|
|
28862
29207
|
MissingOption: () => succeed$3([args.arguments, none()]),
|
|
28863
29208
|
MissingArgument: () => succeed$3([args.arguments, none()])
|
|
@@ -28901,8 +29246,8 @@ const optional$1 = (param) => {
|
|
|
28901
29246
|
* @since 4.0.0
|
|
28902
29247
|
*/
|
|
28903
29248
|
const withDefault$1 = /*#__PURE__*/ dual(2, (self, defaultValue) => {
|
|
28904
|
-
if (!isEffect(defaultValue)) return map$1(optional$
|
|
28905
|
-
return mapEffect(optional$
|
|
29249
|
+
if (!isEffect(defaultValue)) return map$1(optional$2(self), getOrElse(() => defaultValue));
|
|
29250
|
+
return mapEffect(optional$2(self), match$5({
|
|
28906
29251
|
onNone: () => defaultValue,
|
|
28907
29252
|
onSome: succeed$3
|
|
28908
29253
|
}));
|
|
@@ -29115,7 +29460,7 @@ const transformSingle = (param, f) => {
|
|
|
29115
29460
|
Single: (single) => f(single),
|
|
29116
29461
|
Map: (mapped) => map$1(transformSingle(mapped.param, f), mapped.f),
|
|
29117
29462
|
Transform: (mapped) => transform(transformSingle(mapped.param, f), mapped.f, mapped.alternatives.map((alternative) => () => transformSingle(alternative(), f))),
|
|
29118
|
-
Optional: (p) => optional$
|
|
29463
|
+
Optional: (p) => optional$2(transformSingle(p.param, f)),
|
|
29119
29464
|
Variadic: (p) => variadic(transformSingle(p.param, f), {
|
|
29120
29465
|
min: getOrUndefined$1(p.min),
|
|
29121
29466
|
max: getOrUndefined$1(p.max)
|
|
@@ -29177,6 +29522,61 @@ const getParamMetadata = (param) => {
|
|
|
29177
29522
|
});
|
|
29178
29523
|
};
|
|
29179
29524
|
//#endregion
|
|
29525
|
+
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/cli/Argument.js
|
|
29526
|
+
/**
|
|
29527
|
+
* Creates a positional string argument.
|
|
29528
|
+
*
|
|
29529
|
+
* **Example** (Creating a string argument)
|
|
29530
|
+
*
|
|
29531
|
+
* ```ts import.meta.vitest
|
|
29532
|
+
* import { Argument } from "effect/cli"
|
|
29533
|
+
*
|
|
29534
|
+
* const filename = Argument.String("filename")
|
|
29535
|
+
* filename.kind // => "argument"
|
|
29536
|
+
* ```
|
|
29537
|
+
*
|
|
29538
|
+
* @stability unstable
|
|
29539
|
+
* @category constructors
|
|
29540
|
+
* @since 4.0.0
|
|
29541
|
+
*/
|
|
29542
|
+
const String$2 = (name) => String$3(argumentKind, name);
|
|
29543
|
+
/**
|
|
29544
|
+
* Makes a positional argument optional.
|
|
29545
|
+
*
|
|
29546
|
+
* **Example** (Making an argument optional)
|
|
29547
|
+
*
|
|
29548
|
+
* ```ts import.meta.vitest
|
|
29549
|
+
* import { Argument } from "effect/cli"
|
|
29550
|
+
*
|
|
29551
|
+
* const optionalVersion = Argument.String("version").pipe(Argument.optional)
|
|
29552
|
+
* optionalVersion.kind // => "argument"
|
|
29553
|
+
* ```
|
|
29554
|
+
*
|
|
29555
|
+
* @stability unstable
|
|
29556
|
+
* @category combinators
|
|
29557
|
+
* @since 4.0.0
|
|
29558
|
+
*/
|
|
29559
|
+
const optional$1 = (arg) => optional$2(arg);
|
|
29560
|
+
/**
|
|
29561
|
+
* Adds a description to a positional argument.
|
|
29562
|
+
*
|
|
29563
|
+
* **Example** (Adding an argument description)
|
|
29564
|
+
*
|
|
29565
|
+
* ```ts import.meta.vitest
|
|
29566
|
+
* import { Argument } from "effect/cli"
|
|
29567
|
+
*
|
|
29568
|
+
* const filename = Argument.String("filename").pipe(
|
|
29569
|
+
* Argument.withDescription("The input file to process")
|
|
29570
|
+
* )
|
|
29571
|
+
* filename.kind // => "argument"
|
|
29572
|
+
* ```
|
|
29573
|
+
*
|
|
29574
|
+
* @stability unstable
|
|
29575
|
+
* @category combinators
|
|
29576
|
+
* @since 4.0.0
|
|
29577
|
+
*/
|
|
29578
|
+
const withDescription$2 = /*#__PURE__*/ dual(2, (self, description) => withDescription$3(self, description));
|
|
29579
|
+
//#endregion
|
|
29180
29580
|
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Console.js
|
|
29181
29581
|
/**
|
|
29182
29582
|
* Context reference for the current console service in the Effect system, allowing access to the active console implementation from within the Effect context.
|
|
@@ -30207,7 +30607,7 @@ const generate = (executableName, shell, descriptor) => {
|
|
|
30207
30607
|
* @category constructors
|
|
30208
30608
|
* @since 4.0.0
|
|
30209
30609
|
*/
|
|
30210
|
-
const String$1 = (name) => String$
|
|
30610
|
+
const String$1 = (name) => String$3(flagKind, name);
|
|
30211
30611
|
/**
|
|
30212
30612
|
* Creates a boolean flag that can be enabled or disabled.
|
|
30213
30613
|
*
|
|
@@ -30311,7 +30711,7 @@ const withAlias = /*#__PURE__*/ dual(2, (self, alias) => withAlias$1(self, alias
|
|
|
30311
30711
|
* @category metadata
|
|
30312
30712
|
* @since 4.0.0
|
|
30313
30713
|
*/
|
|
30314
|
-
const withDescription$1 = /*#__PURE__*/ dual(2, (self, description) => withDescription$
|
|
30714
|
+
const withDescription$1 = /*#__PURE__*/ dual(2, (self, description) => withDescription$3(self, description));
|
|
30315
30715
|
/**
|
|
30316
30716
|
* Sets a custom metavar (placeholder name) for the flag in help documentation.
|
|
30317
30717
|
*
|
|
@@ -30387,7 +30787,7 @@ const withMetavar = /*#__PURE__*/ dual(2, (self, metavar) => withMetavar$1(self,
|
|
|
30387
30787
|
* @category optionality
|
|
30388
30788
|
* @since 4.0.0
|
|
30389
30789
|
*/
|
|
30390
|
-
const optional = (param) => optional$
|
|
30790
|
+
const optional = (param) => optional$2(param);
|
|
30391
30791
|
/**
|
|
30392
30792
|
* Provides a default value for a flag when it's not specified.
|
|
30393
30793
|
*
|
|
@@ -30592,7 +30992,7 @@ const reconstructTree = (tree, results) => {
|
|
|
30592
30992
|
* Internal implementation details for CLI commands.
|
|
30593
30993
|
* Public API is in ../Command.ts
|
|
30594
30994
|
*/
|
|
30595
|
-
const TypeId = "~effect/cli/Command";
|
|
30995
|
+
const TypeId$1 = "~effect/cli/Command";
|
|
30596
30996
|
/**
|
|
30597
30997
|
* Casts a Command to its internal implementation.
|
|
30598
30998
|
* For use by internal modules that need access to config, parse, handle, etc.
|
|
@@ -30675,7 +31075,7 @@ const makeCommand = (options) => {
|
|
|
30675
31075
|
};
|
|
30676
31076
|
};
|
|
30677
31077
|
return Object.assign(Object.create(Proto), {
|
|
30678
|
-
[TypeId]: TypeId,
|
|
31078
|
+
[TypeId$1]: TypeId$1,
|
|
30679
31079
|
name: options.name,
|
|
30680
31080
|
examples: options.examples ?? [],
|
|
30681
31081
|
annotations,
|
|
@@ -31943,7 +32343,7 @@ const promptSingle = (single) => {
|
|
|
31943
32343
|
case "Finite": return map$5(run$2(Number$1({ message })), (value) => commandLineArg(String(value)));
|
|
31944
32344
|
case "Int": return map$5(run$2(Int({ message })), (value) => commandLineArg(String(value)));
|
|
31945
32345
|
case "Redacted": return map$5(run$2(Password({ message })), (value) => commandLineArg(value$1(value), "<redacted>"));
|
|
31946
|
-
default: return map$5(run$2(String$
|
|
32346
|
+
default: return map$5(run$2(String$4({ message })), commandLineArg);
|
|
31947
32347
|
}
|
|
31948
32348
|
};
|
|
31949
32349
|
const commandLineArg = (value, displayValue = value) => ({
|
|
@@ -32014,7 +32414,7 @@ const formatShellArg = (arg) => /^[A-Za-z0-9_./:@%+=,-]+$/.test(arg) ? arg : `'$
|
|
|
32014
32414
|
* @category guards
|
|
32015
32415
|
* @since 4.0.0
|
|
32016
32416
|
*/
|
|
32017
|
-
const isCommand = (u) => hasProperty(u, TypeId);
|
|
32417
|
+
const isCommand = (u) => hasProperty(u, TypeId$1);
|
|
32018
32418
|
/**
|
|
32019
32419
|
* Creates a `Command` from a name, an optional configuration, and an optional
|
|
32020
32420
|
* handler.
|
|
@@ -32104,7 +32504,7 @@ const isCommand = (u) => hasProperty(u, TypeId);
|
|
|
32104
32504
|
* @category constructors
|
|
32105
32505
|
* @since 4.0.0
|
|
32106
32506
|
*/
|
|
32107
|
-
const make = (name, config, handler) => {
|
|
32507
|
+
const make$1 = (name, config, handler) => {
|
|
32108
32508
|
const parsedConfig = parseConfig$1(config ?? {});
|
|
32109
32509
|
return makeCommand({
|
|
32110
32510
|
name,
|
|
@@ -32625,14 +33025,264 @@ const runWith = (command, config) => {
|
|
|
32625
33025
|
}
|
|
32626
33026
|
const services = match$5(logLevel, {
|
|
32627
33027
|
onNone: () => empty$3(),
|
|
32628
|
-
onSome: (level) => make$
|
|
33028
|
+
onSome: (level) => make$28(MinimumLogLevel, level)
|
|
32629
33029
|
});
|
|
32630
33030
|
yield* provideContext(program, services);
|
|
32631
33031
|
}, catchFilter((error) => isCliError(error) && error._tag === "ShowHelp" ? succeed$7(error) : fail$5(error), (error) => andThen(showHelp(command, error, config.renderErrors !== false), fail$1(error))), catchFilter((error) => config.renderErrors !== false && isCliError(error) && error._tag === "UserError" ? succeed$7(error) : fail$5(error), (error) => andThen(showUserError(error), fail$1(error))), catchFilter((e) => isQuitError(e) ? succeed$7(e) : fail$5(e), (_) => interrupt$1));
|
|
32632
33032
|
};
|
|
32633
33033
|
//#endregion
|
|
32634
33034
|
//#region package.json
|
|
32635
|
-
var version = "0.
|
|
33035
|
+
var version = "0.9.1";
|
|
33036
|
+
//#endregion
|
|
33037
|
+
//#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Logger.js
|
|
33038
|
+
const TypeId = "~effect/Logger";
|
|
33039
|
+
/**
|
|
33040
|
+
* Returns `true` if the specified value is a `Logger`, otherwise returns `false`.
|
|
33041
|
+
*
|
|
33042
|
+
* **Example** (Checking logger values)
|
|
33043
|
+
*
|
|
33044
|
+
* ```ts import.meta.vitest
|
|
33045
|
+
* import { Logger } from "effect"
|
|
33046
|
+
*
|
|
33047
|
+
* const myLogger = Logger.make(() => undefined)
|
|
33048
|
+
*
|
|
33049
|
+
* Logger.isLogger(myLogger) // => true
|
|
33050
|
+
* Logger.isLogger("not a logger") // => false
|
|
33051
|
+
* Logger.isLogger({ log: () => {} }) // => false
|
|
33052
|
+
* ```
|
|
33053
|
+
*
|
|
33054
|
+
* @stability stable
|
|
33055
|
+
* @category guards
|
|
33056
|
+
* @since 4.0.0
|
|
33057
|
+
*/
|
|
33058
|
+
const isLogger = (u) => hasProperty(u, TypeId);
|
|
33059
|
+
/**
|
|
33060
|
+
* Context reference containing the active loggers for the current fiber.
|
|
33061
|
+
*
|
|
33062
|
+
* **Details**
|
|
33063
|
+
*
|
|
33064
|
+
* By default this set includes the default logger and the tracer logger.
|
|
33065
|
+
* Providing `Logger.layer` replaces or merges with this set depending on its
|
|
33066
|
+
* options.
|
|
33067
|
+
*
|
|
33068
|
+
* **Example** (Accessing current loggers)
|
|
33069
|
+
*
|
|
33070
|
+
* ```ts import.meta.vitest
|
|
33071
|
+
* import { Effect, Logger } from "effect"
|
|
33072
|
+
*
|
|
33073
|
+
* const messages: Array<unknown> = []
|
|
33074
|
+
* const customLogger = Logger.make((options) => {
|
|
33075
|
+
* messages.push(options.message)
|
|
33076
|
+
* })
|
|
33077
|
+
* const program = Effect.gen(function*() {
|
|
33078
|
+
* const currentLoggers = yield* Effect.service(Logger.CurrentLoggers)
|
|
33079
|
+
* yield* Effect.log("Hello from custom logger").pipe(
|
|
33080
|
+
* Effect.provide(Logger.layer([customLogger]))
|
|
33081
|
+
* )
|
|
33082
|
+
* return currentLoggers.has(Logger.defaultLogger)
|
|
33083
|
+
* })
|
|
33084
|
+
*
|
|
33085
|
+
* Effect.runSync(program) // => true
|
|
33086
|
+
* messages // => [["Hello from custom logger"]]
|
|
33087
|
+
* ```
|
|
33088
|
+
*
|
|
33089
|
+
* @stability stable
|
|
33090
|
+
* @category services
|
|
33091
|
+
* @since 4.0.0
|
|
33092
|
+
*/
|
|
33093
|
+
const CurrentLoggers = CurrentLoggers$1;
|
|
33094
|
+
/**
|
|
33095
|
+
* Creates a new `Logger` from a log function.
|
|
33096
|
+
*
|
|
33097
|
+
* **Details**
|
|
33098
|
+
*
|
|
33099
|
+
* The log function receives an options object containing the message, log level,
|
|
33100
|
+
* cause, fiber information, and timestamp, and should return the desired output.
|
|
33101
|
+
*
|
|
33102
|
+
* **Example** (Creating loggers from functions)
|
|
33103
|
+
*
|
|
33104
|
+
* ```ts import.meta.vitest
|
|
33105
|
+
* import { Effect, Logger } from "effect"
|
|
33106
|
+
*
|
|
33107
|
+
* const outputs: Array<string> = []
|
|
33108
|
+
* const textLogger = Logger.make((options) =>
|
|
33109
|
+
* `${options.logLevel}: ${options.message}`
|
|
33110
|
+
* )
|
|
33111
|
+
* const collector = Logger.make((options) => outputs.push(textLogger.log(options)))
|
|
33112
|
+
*
|
|
33113
|
+
* const program = Effect.log("Hello World").pipe(
|
|
33114
|
+
* Effect.provide(Logger.layer([collector]))
|
|
33115
|
+
* )
|
|
33116
|
+
* Effect.runSync(program)
|
|
33117
|
+
* outputs // => ["Info: Hello World"]
|
|
33118
|
+
* ```
|
|
33119
|
+
*
|
|
33120
|
+
* @stability stable
|
|
33121
|
+
* @category constructors
|
|
33122
|
+
* @since 2.0.0
|
|
33123
|
+
*/
|
|
33124
|
+
const make = loggerMake;
|
|
33125
|
+
/**
|
|
33126
|
+
* Creates a scoped logger that batches the output of another logger.
|
|
33127
|
+
*
|
|
33128
|
+
* **Details**
|
|
33129
|
+
*
|
|
33130
|
+
* The returned effect starts a scoped background process that periodically
|
|
33131
|
+
* passes buffered outputs to `flush`. When the scope closes, the background
|
|
33132
|
+
* process is interrupted and any remaining buffered entries are flushed.
|
|
33133
|
+
*
|
|
33134
|
+
* **Example** (Batching logger output)
|
|
33135
|
+
*
|
|
33136
|
+
* ```ts import.meta.vitest
|
|
33137
|
+
* import { Effect, Logger } from "effect"
|
|
33138
|
+
*
|
|
33139
|
+
* const flushed: Array<ReadonlyArray<string>> = []
|
|
33140
|
+
* const messageLogger = Logger.make((options) => String(options.message))
|
|
33141
|
+
* const batchedLogger = Logger.batched(messageLogger, {
|
|
33142
|
+
* window: "1 hour",
|
|
33143
|
+
* flush: (messages) =>
|
|
33144
|
+
* Effect.sync(() => {
|
|
33145
|
+
* flushed.push(messages)
|
|
33146
|
+
* })
|
|
33147
|
+
* })
|
|
33148
|
+
*
|
|
33149
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
33150
|
+
* const logger = yield* batchedLogger
|
|
33151
|
+
* yield* Effect.log("Event 1").pipe(Effect.provide(Logger.layer([logger])))
|
|
33152
|
+
* yield* Effect.log("Event 2").pipe(Effect.provide(Logger.layer([logger])))
|
|
33153
|
+
* }))
|
|
33154
|
+
* await Effect.runPromise(program)
|
|
33155
|
+
* flushed // => [["Event 1", "Event 2"]]
|
|
33156
|
+
* ```
|
|
33157
|
+
*
|
|
33158
|
+
* @stability stable
|
|
33159
|
+
* @category constructors
|
|
33160
|
+
* @since 2.0.0
|
|
33161
|
+
*/
|
|
33162
|
+
const batched = /*#__PURE__*/ dual(2, (self, options) => suspend$3(() => {
|
|
33163
|
+
let buffer = [];
|
|
33164
|
+
const flush = uninterruptible$1(suspend$3(() => {
|
|
33165
|
+
if (buffer.length === 0) return void_$2;
|
|
33166
|
+
const arr = buffer;
|
|
33167
|
+
buffer = [];
|
|
33168
|
+
return options.flush(arr);
|
|
33169
|
+
}));
|
|
33170
|
+
return uninterruptibleMask$1((restore) => restore(sleep$1(options.window).pipe(andThen$1(flush), forever$2)).pipe(forkDetach, flatMap$2((fiber) => addFinalizer$2(() => andThen$1(fiberInterrupt(fiber), flush))), as$1(loggerMake((options) => {
|
|
33171
|
+
buffer.push(self.log(options));
|
|
33172
|
+
}))));
|
|
33173
|
+
}));
|
|
33174
|
+
/**
|
|
33175
|
+
* Creates a `Layer` which will overwrite the current set of loggers with the
|
|
33176
|
+
* specified array of `loggers`.
|
|
33177
|
+
*
|
|
33178
|
+
* **Details**
|
|
33179
|
+
*
|
|
33180
|
+
* If the specified array of `loggers` should be _merged_ with the current set
|
|
33181
|
+
* of loggers (instead of overwriting them), set `mergeWithExisting` to `true`.
|
|
33182
|
+
*
|
|
33183
|
+
* **Example** (Providing logger layers)
|
|
33184
|
+
*
|
|
33185
|
+
* ```ts import.meta.vitest
|
|
33186
|
+
* import { Effect, Logger } from "effect"
|
|
33187
|
+
*
|
|
33188
|
+
* const messages: Array<unknown> = []
|
|
33189
|
+
* const customLogger = Logger.make((options) => {
|
|
33190
|
+
* messages.push(options.message)
|
|
33191
|
+
* })
|
|
33192
|
+
* const CustomLoggerLayer = Logger.layer([customLogger])
|
|
33193
|
+
*
|
|
33194
|
+
* const program = Effect.log("Application started").pipe(
|
|
33195
|
+
* Effect.provide(CustomLoggerLayer)
|
|
33196
|
+
* )
|
|
33197
|
+
* Effect.runSync(program)
|
|
33198
|
+
* messages // => [["Application started"]]
|
|
33199
|
+
* ```
|
|
33200
|
+
*
|
|
33201
|
+
* @stability stable
|
|
33202
|
+
* @category layers
|
|
33203
|
+
* @since 4.0.0
|
|
33204
|
+
*/
|
|
33205
|
+
const layer$1 = (loggers, options) => effect(CurrentLoggers, withFiber$1(fnUntraced$1(function* (fiber) {
|
|
33206
|
+
const currentLoggers = new Set(options?.mergeWithExisting === true ? fiber.getRef(CurrentLoggers$1) : []);
|
|
33207
|
+
for (const logger of loggers) currentLoggers.add(isEffect$1(logger) ? yield* logger : logger);
|
|
33208
|
+
return currentLoggers;
|
|
33209
|
+
})));
|
|
33210
|
+
/**
|
|
33211
|
+
* Creates a scoped logger that writes string logger output to a file.
|
|
33212
|
+
*
|
|
33213
|
+
* **Details**
|
|
33214
|
+
*
|
|
33215
|
+
* The returned effect requires `FileSystem` and `Scope`. The file logger batches
|
|
33216
|
+
* string output, writes each batch to the specified path, and flushes remaining
|
|
33217
|
+
* entries when the scope closes.
|
|
33218
|
+
*
|
|
33219
|
+
* **Example** (Writing JSON logs to a file)
|
|
33220
|
+
*
|
|
33221
|
+
* ```ts import.meta.vitest
|
|
33222
|
+
* import { Effect, FileSystem, Logger } from "effect"
|
|
33223
|
+
*
|
|
33224
|
+
* const writes: Array<string> = []
|
|
33225
|
+
* const file = {
|
|
33226
|
+
* writeAll: (buffer: Uint8Array) => Effect.sync(() => {
|
|
33227
|
+
* writes.push(new TextDecoder().decode(buffer).trim())
|
|
33228
|
+
* })
|
|
33229
|
+
* } as unknown as FileSystem.File
|
|
33230
|
+
* const fileSystem = FileSystem.makeNoop({ open: () => Effect.succeed(file) })
|
|
33231
|
+
* const messageLogger = Logger.make((options) => String(options.message))
|
|
33232
|
+
*
|
|
33233
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
33234
|
+
* const fileLogger = yield* Logger.toFile(messageLogger, "/tmp/log.txt")
|
|
33235
|
+
* yield* Effect.log("a").pipe(Effect.provide(Logger.layer([fileLogger])))
|
|
33236
|
+
* yield* Effect.log("b").pipe(Effect.provide(Logger.layer([fileLogger])))
|
|
33237
|
+
* yield* Effect.log("c").pipe(Effect.provide(Logger.layer([fileLogger])))
|
|
33238
|
+
* })).pipe(Effect.provideService(FileSystem.FileSystem, fileSystem))
|
|
33239
|
+
*
|
|
33240
|
+
* await Effect.runPromise(program)
|
|
33241
|
+
* writes // => ["a\nb\nc"]
|
|
33242
|
+
* ```
|
|
33243
|
+
*
|
|
33244
|
+
* **Example** (Writing logs to files)
|
|
33245
|
+
*
|
|
33246
|
+
* ```ts import.meta.vitest
|
|
33247
|
+
* import { Effect, FileSystem, Logger } from "effect"
|
|
33248
|
+
*
|
|
33249
|
+
* const writes: Array<string> = []
|
|
33250
|
+
* const file = {
|
|
33251
|
+
* writeAll: (buffer: Uint8Array) => Effect.sync(() => {
|
|
33252
|
+
* writes.push(new TextDecoder().decode(buffer).trim())
|
|
33253
|
+
* })
|
|
33254
|
+
* } as unknown as FileSystem.File
|
|
33255
|
+
* const fileSystem = FileSystem.makeNoop({ open: () => Effect.succeed(file) })
|
|
33256
|
+
* const messageLogger = Logger.make((options) => String(options.message))
|
|
33257
|
+
*
|
|
33258
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
33259
|
+
* const fileLogger = yield* Logger.toFile(messageLogger, "/tmp/app.log", {
|
|
33260
|
+
* batchWindow: "1 hour"
|
|
33261
|
+
* })
|
|
33262
|
+
* yield* Effect.log("Application started").pipe(
|
|
33263
|
+
* Effect.provide(Logger.layer([fileLogger]))
|
|
33264
|
+
* )
|
|
33265
|
+
* })).pipe(Effect.provideService(FileSystem.FileSystem, fileSystem))
|
|
33266
|
+
*
|
|
33267
|
+
* await Effect.runPromise(program)
|
|
33268
|
+
* writes // => ["Application started"]
|
|
33269
|
+
* ```
|
|
33270
|
+
*
|
|
33271
|
+
* @stability unstable
|
|
33272
|
+
* @category logging
|
|
33273
|
+
* @since 4.0.0
|
|
33274
|
+
*/
|
|
33275
|
+
const toFile = /*#__PURE__*/ dual((args) => isLogger(args[0]), (self, path, options) => gen$1(function* () {
|
|
33276
|
+
const logFile = yield* (yield* FileSystem).open(path, {
|
|
33277
|
+
flag: "a+",
|
|
33278
|
+
...options
|
|
33279
|
+
});
|
|
33280
|
+
const encoder = new TextEncoder();
|
|
33281
|
+
return yield* batched(self, {
|
|
33282
|
+
window: options?.batchWindow ?? 1e3,
|
|
33283
|
+
flush: (output) => ignore$1(logFile.writeAll(encoder.encode(output.join("\n") + "\n")))
|
|
33284
|
+
});
|
|
33285
|
+
}));
|
|
32636
33286
|
//#endregion
|
|
32637
33287
|
//#region ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
32638
33288
|
/**
|
|
@@ -35288,9 +35938,9 @@ var import_semver = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exp
|
|
|
35288
35938
|
};
|
|
35289
35939
|
})))(), 1);
|
|
35290
35940
|
var BumpError = class extends TaggedError()("BumpError", {
|
|
35291
|
-
path: String$
|
|
35292
|
-
at: String$
|
|
35293
|
-
reason: String$
|
|
35941
|
+
path: String$6,
|
|
35942
|
+
at: String$6,
|
|
35943
|
+
reason: String$6
|
|
35294
35944
|
}) {
|
|
35295
35945
|
get message() {
|
|
35296
35946
|
return `${this.path}: cannot bump ${this.at}: ${this.reason}`;
|
|
@@ -35332,7 +35982,7 @@ const Targeting = {
|
|
|
35332
35982
|
platforms: optionalKey(NonEmptyArray(Literals$2(["darwin", "linux"]))).annotateKey({ description: "`darwin`, `linux`, or both." }),
|
|
35333
35983
|
machines: optionalKey(NonEmptyArray(NonEmptyString)).annotateKey({ description: "Machine names from `machines`." })
|
|
35334
35984
|
};
|
|
35335
|
-
const Origin = String$
|
|
35985
|
+
const Origin = String$6.check(isPattern(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/, {
|
|
35336
35986
|
title: "GitHub origin",
|
|
35337
35987
|
description: "a GitHub \"owner/repo\""
|
|
35338
35988
|
}));
|
|
@@ -35423,10 +36073,10 @@ const ReposSection = section({ cloneRoot: optionalKey(variants(withShorthand(Str
|
|
|
35423
36073
|
encode: (root) => root.path
|
|
35424
36074
|
}))).annotateKey({ description: `Where a Machine keeps its Managed Clones: a path, or a list of \`{ path, platforms?, machines? }\` where a Machine gets the first that targets it. \`~\` expands on that Machine. Default: \`${DEFAULT_CLONE_ROOT}\`.` }) }, Record(NonEmptyString, variants(TrackedRepo)), `Tracked Repos, keyed by name, which names the Managed Clone and the \`repos:<name>\` Item. Each is \`{ origin, ref, install, ... }\`, ${VARIANTS}.`);
|
|
35425
36075
|
const FleetConfig = Struct({
|
|
35426
|
-
$schema: optionalKey(String$
|
|
35427
|
-
shippedAt: optionalKey(String$
|
|
36076
|
+
$schema: optionalKey(String$6),
|
|
36077
|
+
shippedAt: optionalKey(String$6),
|
|
35428
36078
|
shippedFrom: optionalKey(NonEmptyString),
|
|
35429
|
-
shippedTo: optionalKey(Record(NonEmptyString, String$
|
|
36079
|
+
shippedTo: optionalKey(Record(NonEmptyString, String$6)),
|
|
35430
36080
|
machines: ArraySchema(NonEmptyString).check(isMinLength(1, { message: "list at least one Machine" }), isUnique({ message: "list each Machine once" })).annotateKey({ description: "The Fleet: each Machine's tailnet name. A tailnet member that is not listed is not part of the Fleet." }),
|
|
35431
36081
|
repos: optionalKey(ReposSection).annotateKey({ description: "Each Tracked Repo is cloned on every targeted Machine and installed from its origin ref." }),
|
|
35432
36082
|
vp: optionalKey(VpSection).annotateKey({ description: "The vite-plus toolchain." }),
|
|
@@ -35452,14 +36102,14 @@ const SCHEMA_FILE = "schema.json";
|
|
|
35452
36102
|
const configDir = (env) => `${env.XDG_CONFIG_HOME || `${env.HOME ?? "~"}/.config`}/fleetfizz`;
|
|
35453
36103
|
const configPath = (env) => `${configDir(env)}/${CONFIG_FILE}`;
|
|
35454
36104
|
var ConfigError = class extends TaggedError()("ConfigError", {
|
|
35455
|
-
path: String$
|
|
35456
|
-
problems: ArraySchema(String$
|
|
36105
|
+
path: String$6,
|
|
36106
|
+
problems: ArraySchema(String$6)
|
|
35457
36107
|
}) {
|
|
35458
36108
|
get message() {
|
|
35459
36109
|
return [`${this.path}:`, ...this.problems.map((p) => ` ${p}`)].join("\n");
|
|
35460
36110
|
}
|
|
35461
36111
|
};
|
|
35462
|
-
var ConfigNotFound = class extends TaggedError()("ConfigNotFound", { path: String$
|
|
36112
|
+
var ConfigNotFound = class extends TaggedError()("ConfigNotFound", { path: String$6 }) {
|
|
35463
36113
|
get message() {
|
|
35464
36114
|
return `no config at ${this.path}; write one there (the README has an example) or pass --config`;
|
|
35465
36115
|
}
|
|
@@ -35596,6 +36246,7 @@ const fingerprintFn = [
|
|
|
35596
36246
|
//#region ../../packages/remote/src/check.ts
|
|
35597
36247
|
const STATE_DIR = "~/.local/state/fleetfizz";
|
|
35598
36248
|
const RECORDS_DIR = `${STATE_DIR}/records`;
|
|
36249
|
+
const LOGS_DIR = `${STATE_DIR}/logs`;
|
|
35599
36250
|
const CONFIG_DIR_SH = "\"${XDG_CONFIG_HOME:-$HOME/.config}/fleetfizz\"";
|
|
35600
36251
|
const recordDir = (provider) => `${quotePath(RECORDS_DIR)}/${quote(provider)}`;
|
|
35601
36252
|
const recordFile = (provider, item) => `${recordDir(provider)}/${quote(`${item}.json`)}`;
|
|
@@ -35621,16 +36272,16 @@ const checkScript = (input) => {
|
|
|
35621
36272
|
};
|
|
35622
36273
|
//#endregion
|
|
35623
36274
|
//#region ../../packages/remote/src/protocol.ts
|
|
35624
|
-
const Fact = Record(String$
|
|
35625
|
-
const StepStart = Struct({ id: String$
|
|
36275
|
+
const Fact = Record(String$6, Unknown);
|
|
36276
|
+
const StepStart = Struct({ id: String$6 });
|
|
35626
36277
|
const StepDone = Struct({
|
|
35627
|
-
id: String$
|
|
36278
|
+
id: String$6,
|
|
35628
36279
|
ok: Boolean$4,
|
|
35629
36280
|
code: optionalKey(Number$2)
|
|
35630
36281
|
});
|
|
35631
36282
|
const StepSkip = Struct({
|
|
35632
|
-
id: String$
|
|
35633
|
-
reason: String$
|
|
36283
|
+
id: String$6,
|
|
36284
|
+
reason: String$6
|
|
35634
36285
|
});
|
|
35635
36286
|
const decodeFact$3 = decodeUnknownResult(fromJsonString(Fact));
|
|
35636
36287
|
const decodeStart = decodeUnknownResult(fromJsonString(StepStart));
|
|
@@ -35743,16 +36394,16 @@ const applyScript = (plan) => [
|
|
|
35743
36394
|
//#endregion
|
|
35744
36395
|
//#region ../../packages/remote/src/tailnet.ts
|
|
35745
36396
|
const StatusNode = Struct({
|
|
35746
|
-
DNSName: String$
|
|
35747
|
-
OS: String$
|
|
36397
|
+
DNSName: String$6,
|
|
36398
|
+
OS: String$6,
|
|
35748
36399
|
Online: optionalKey(Boolean$4),
|
|
35749
|
-
sshHostKeys: optionalKey(NullOr(ArraySchema(String$
|
|
36400
|
+
sshHostKeys: optionalKey(NullOr(ArraySchema(String$6)))
|
|
35750
36401
|
});
|
|
35751
36402
|
const TailscaleStatus = Struct({
|
|
35752
36403
|
Self: StatusNode,
|
|
35753
|
-
Peer: optionalKey(NullOr(Record(String$
|
|
36404
|
+
Peer: optionalKey(NullOr(Record(String$6, StatusNode)))
|
|
35754
36405
|
});
|
|
35755
|
-
var TailnetError = class extends TaggedError()("TailnetError", { reason: String$
|
|
36406
|
+
var TailnetError = class extends TaggedError()("TailnetError", { reason: String$6 }) {
|
|
35756
36407
|
get message() {
|
|
35757
36408
|
return `tailscale: ${this.reason}`;
|
|
35758
36409
|
}
|
|
@@ -35788,7 +36439,7 @@ const parseTailnet = fn("parseTailnet")(function* (status) {
|
|
|
35788
36439
|
const readTailnet = fn("readTailnet")(function* () {
|
|
35789
36440
|
const spawner = yield* ChildProcessSpawner;
|
|
35790
36441
|
const output = yield* scoped(gen(function* () {
|
|
35791
|
-
const handle = yield* spawner.spawn(make$
|
|
36442
|
+
const handle = yield* spawner.spawn(make$13("tailscale", ["status", "--json"], {
|
|
35792
36443
|
stdout: "pipe",
|
|
35793
36444
|
stderr: "pipe"
|
|
35794
36445
|
}));
|
|
@@ -35808,7 +36459,7 @@ const readTailnet = fn("readTailnet")(function* () {
|
|
|
35808
36459
|
const readLentToken = fn("readLentToken")(function* () {
|
|
35809
36460
|
const spawner = yield* ChildProcessSpawner;
|
|
35810
36461
|
return yield* scoped(gen(function* () {
|
|
35811
|
-
const handle = yield* spawner.spawn(make$
|
|
36462
|
+
const handle = yield* spawner.spawn(make$13("gh", ["auth", "token"], {
|
|
35812
36463
|
stdout: "pipe",
|
|
35813
36464
|
stderr: "pipe"
|
|
35814
36465
|
}));
|
|
@@ -35831,8 +36482,8 @@ const readLentToken = fn("readLentToken")(function* () {
|
|
|
35831
36482
|
//#endregion
|
|
35832
36483
|
//#region ../../packages/remote/src/transport.ts
|
|
35833
36484
|
var SpawnError = class extends TaggedError()("SpawnError", {
|
|
35834
|
-
machine: String$
|
|
35835
|
-
reason: String$
|
|
36485
|
+
machine: String$6,
|
|
36486
|
+
reason: String$6
|
|
35836
36487
|
}) {
|
|
35837
36488
|
get message() {
|
|
35838
36489
|
return `${this.machine}: could not start ${this.reason}`;
|
|
@@ -35840,12 +36491,12 @@ var SpawnError = class extends TaggedError()("SpawnError", {
|
|
|
35840
36491
|
};
|
|
35841
36492
|
const command = (target, script, secrets) => {
|
|
35842
36493
|
const options = {
|
|
35843
|
-
stdin: encodeText(make$
|
|
36494
|
+
stdin: encodeText(make$18(secrets.map((s) => `${s}\n`).join(""))),
|
|
35844
36495
|
stdout: "pipe",
|
|
35845
36496
|
stderr: "pipe",
|
|
35846
36497
|
forceKillAfter: "5 seconds"
|
|
35847
36498
|
};
|
|
35848
|
-
return target.local ? make$
|
|
36499
|
+
return target.local ? make$13(process.env.SHELL ?? "/bin/sh", ["-lc", script], options) : make$13("tailscale", [
|
|
35849
36500
|
"ssh",
|
|
35850
36501
|
target.name,
|
|
35851
36502
|
script
|
|
@@ -35864,11 +36515,11 @@ const runScript = fn("runScript")(function* (target, script, secrets, onLine) {
|
|
|
35864
36515
|
});
|
|
35865
36516
|
//#endregion
|
|
35866
36517
|
//#region ../../packages/remote/src/versions.ts
|
|
35867
|
-
const Versions = fromJsonString(Union([ArraySchema(String$
|
|
36518
|
+
const Versions = fromJsonString(Union([ArraySchema(String$6), String$6]));
|
|
35868
36519
|
const resolveOne = fn("resolveOne")(function* (pkg) {
|
|
35869
36520
|
const spawner = yield* ChildProcessSpawner;
|
|
35870
36521
|
const output = yield* scoped(gen(function* () {
|
|
35871
|
-
const handle = yield* spawner.spawn(make$
|
|
36522
|
+
const handle = yield* spawner.spawn(make$13("npm", [
|
|
35872
36523
|
"view",
|
|
35873
36524
|
pkg,
|
|
35874
36525
|
"versions",
|
|
@@ -35893,6 +36544,103 @@ const resolveVersions = fn("resolveVersions")(function* (packages) {
|
|
|
35893
36544
|
const entries = yield* forEach$1(unique, (pkg) => resolveOne(pkg).pipe(map$5((v) => [pkg, v])), { concurrency: 8 });
|
|
35894
36545
|
return Object.fromEntries(entries);
|
|
35895
36546
|
});
|
|
36547
|
+
var LogsError = class extends Error {
|
|
36548
|
+
name = "LogsError";
|
|
36549
|
+
};
|
|
36550
|
+
const shipId = (started, from) => `${formatIso(started).slice(0, 19).replaceAll(":", "-")}Z-${from}`;
|
|
36551
|
+
const parseShipId = (id) => {
|
|
36552
|
+
const [, day, h, m, s, from] = /^(\d{4}-\d{2}-\d{2})T(\d{2})-(\d{2})-(\d{2})Z-(.+)$/.exec(id) ?? [];
|
|
36553
|
+
if (from === void 0) return void 0;
|
|
36554
|
+
return {
|
|
36555
|
+
started: Date.parse(`${day}T${h}:${m}:${s}Z`),
|
|
36556
|
+
from
|
|
36557
|
+
};
|
|
36558
|
+
};
|
|
36559
|
+
const lineFormat = (hidden) => make(({ message, logLevel, date, cause, fiber }) => {
|
|
36560
|
+
const { machine, phase } = fiber.getRef(CurrentLogAnnotations);
|
|
36561
|
+
const scope = [machine, phase].filter((s) => typeof s === "string").join(" ");
|
|
36562
|
+
const prefix = `${date.toISOString()} ${logLevel.toUpperCase().padEnd(5)}${scope === "" ? "" : ` [${scope}]`}`;
|
|
36563
|
+
const parts = (Array.isArray(message) ? message : [message]).map((m) => typeof m === "string" ? m : JSON.stringify(m));
|
|
36564
|
+
if (cause.reasons.length > 0) parts.push(pretty(cause));
|
|
36565
|
+
let text = parts.join(" ");
|
|
36566
|
+
for (const secret of hidden) text = text.replaceAll(secret, "[hidden]");
|
|
36567
|
+
return text.split("\n").map((line) => `${prefix} ${line}`).join("\n");
|
|
36568
|
+
});
|
|
36569
|
+
const machineOf = (line) => /^\S+ +\S+ +\[([^\] ]+)/.exec(line)?.[1];
|
|
36570
|
+
const toPrune = (names) => {
|
|
36571
|
+
const logs = names.filter((name) => name.endsWith(".log")).toSorted();
|
|
36572
|
+
return logs.slice(0, Math.max(0, logs.length - 19));
|
|
36573
|
+
};
|
|
36574
|
+
const logsDir = () => LOGS_DIR.replace(/^~/, process.env.HOME ?? "~");
|
|
36575
|
+
const openShipLog = fn("openShipLog")(function* (id, hidden) {
|
|
36576
|
+
const fs = yield* FileSystem;
|
|
36577
|
+
const dir = logsDir();
|
|
36578
|
+
yield* fs.makeDirectory(dir, { recursive: true });
|
|
36579
|
+
for (const name of toPrune(yield* fs.readDirectory(dir))) yield* fs.remove(`${dir}/${name}`);
|
|
36580
|
+
return yield* toFile(lineFormat(hidden), `${dir}/${id}.log`);
|
|
36581
|
+
});
|
|
36582
|
+
const read = fn("read")(function* (target, script, onLine) {
|
|
36583
|
+
const code = yield* runScript(target, script, [], onLine);
|
|
36584
|
+
if (!target.local && code === 255) return yield* fail$1(new LogsError(`could not reach ${target.name} over tailscale ssh`));
|
|
36585
|
+
});
|
|
36586
|
+
const shipIds = fn("shipIds")(function* (target) {
|
|
36587
|
+
const ids = [];
|
|
36588
|
+
yield* read(target, `ls -1 ${quotePath(LOGS_DIR)} 2>/dev/null`, (line) => sync(() => {
|
|
36589
|
+
if (line.endsWith(".log")) ids.push(line.slice(0, -4));
|
|
36590
|
+
}));
|
|
36591
|
+
return ids.toSorted();
|
|
36592
|
+
});
|
|
36593
|
+
const MISSING = "ff-missing";
|
|
36594
|
+
const logs = fn("logs")(function* (flags) {
|
|
36595
|
+
const here = {
|
|
36596
|
+
name: "this Machine",
|
|
36597
|
+
local: true
|
|
36598
|
+
};
|
|
36599
|
+
const local = yield* shipIds(here);
|
|
36600
|
+
const self = parseShipId(local.at(-1) ?? "")?.from;
|
|
36601
|
+
const tailnet = yield* cached(readTailnet());
|
|
36602
|
+
const targetOf = fn("targetOf")(function* (name) {
|
|
36603
|
+
if (name === self) return here;
|
|
36604
|
+
const { self: me, fleet } = yield* tailnet;
|
|
36605
|
+
if (name === me.name) return here;
|
|
36606
|
+
const machine = fleet.find((m) => m.name === name);
|
|
36607
|
+
if (machine === void 0) return yield* fail$1(new LogsError(`no Machine ${name} on the tailnet`));
|
|
36608
|
+
if (!machine.online) return yield* fail$1(new LogsError(`${name} is offline; its logs are there`));
|
|
36609
|
+
return {
|
|
36610
|
+
name,
|
|
36611
|
+
local: false
|
|
36612
|
+
};
|
|
36613
|
+
});
|
|
36614
|
+
if (flags.list) {
|
|
36615
|
+
if (local.length === 0) return yield* log("no Ship Log on this Machine yet");
|
|
36616
|
+
for (const id of local.toReversed()) yield* log(id);
|
|
36617
|
+
return;
|
|
36618
|
+
}
|
|
36619
|
+
const id = flags.id ?? (yield* latestShip(local, self, targetOf));
|
|
36620
|
+
const ship = parseShipId(id);
|
|
36621
|
+
if (ship === void 0) return yield* fail$1(new LogsError(`not a Ship id: ${id} (fizz logs --list shows them)`));
|
|
36622
|
+
let missing = false;
|
|
36623
|
+
yield* read(local.includes(id) ? here : yield* targetOf(ship.from), `ff_log=${quotePath(LOGS_DIR)}/${quote(`${id}.log`)}\nif [ -f "$ff_log" ]; then cat "$ff_log"; else echo ${MISSING}; fi`, (line) => {
|
|
36624
|
+
if (line === MISSING) return sync(() => void (missing = true));
|
|
36625
|
+
if (flags.machine !== void 0 && machineOf(line) !== flags.machine) return void_;
|
|
36626
|
+
return log(line);
|
|
36627
|
+
});
|
|
36628
|
+
if (missing) return yield* fail$1(new LogsError(`no log for ${id} on ${ship.from}; a Machine keeps its last 20`));
|
|
36629
|
+
});
|
|
36630
|
+
const latestShip = fn("latestShip")(function* (local, self, targetOf) {
|
|
36631
|
+
const newest = local.at(-1);
|
|
36632
|
+
const config = getOrUndefined$1(yield* loadConfig(configPath(process.env)).pipe(option));
|
|
36633
|
+
const from = config?.shippedFrom;
|
|
36634
|
+
const at = Date.parse(config?.shippedAt ?? "");
|
|
36635
|
+
const newestStarted = parseShipId(newest ?? "")?.started ?? -Infinity;
|
|
36636
|
+
if (from !== void 0 && from !== self && at > newestStarted) {
|
|
36637
|
+
const there = (yield* shipIds(yield* targetOf(from))).filter((id) => (parseShipId(id)?.started ?? Infinity) <= at).at(-1);
|
|
36638
|
+
if (there === void 0) return yield* fail$1(new LogsError(`the last Ship to reach this Machine (from ${from} at ${config?.shippedAt}) has no log there`));
|
|
36639
|
+
return there;
|
|
36640
|
+
}
|
|
36641
|
+
if (newest === void 0) return yield* fail$1(new LogsError("no Ship Log on this Machine yet"));
|
|
36642
|
+
return newest;
|
|
36643
|
+
});
|
|
35896
36644
|
//#endregion
|
|
35897
36645
|
//#region ../../node_modules/.pnpm/react@19.3.0/node_modules/react/cjs/react.production.js
|
|
35898
36646
|
/**
|
|
@@ -64268,27 +65016,27 @@ const decideInstall = (record, now, rebuild) => {
|
|
|
64268
65016
|
const EngineFact = Union([
|
|
64269
65017
|
Struct({
|
|
64270
65018
|
fact: Literal("home"),
|
|
64271
|
-
path: String$
|
|
65019
|
+
path: String$6
|
|
64272
65020
|
}),
|
|
64273
65021
|
Struct({ fact: Literal("end") }),
|
|
64274
65022
|
Struct({
|
|
64275
65023
|
fact: Literal("config"),
|
|
64276
65024
|
present: Boolean$4,
|
|
64277
|
-
base64: optionalKey(String$
|
|
65025
|
+
base64: optionalKey(String$6)
|
|
64278
65026
|
}),
|
|
64279
65027
|
Struct({
|
|
64280
65028
|
fact: Literal("record"),
|
|
64281
|
-
provider: String$
|
|
64282
|
-
item: String$
|
|
65029
|
+
provider: String$6,
|
|
65030
|
+
item: String$6,
|
|
64283
65031
|
record: Unknown
|
|
64284
65032
|
})
|
|
64285
65033
|
]);
|
|
64286
|
-
const ProviderFact = Struct({ provider: String$
|
|
65034
|
+
const ProviderFact = Struct({ provider: String$6 });
|
|
64287
65035
|
const AtFact = Struct({
|
|
64288
|
-
provider: String$
|
|
65036
|
+
provider: String$6,
|
|
64289
65037
|
fact: Literal("at"),
|
|
64290
|
-
item: String$
|
|
64291
|
-
at: String$
|
|
65038
|
+
item: String$6,
|
|
65039
|
+
at: String$6
|
|
64292
65040
|
});
|
|
64293
65041
|
const decodeEngineFact = decodeUnknownOption(EngineFact);
|
|
64294
65042
|
const decodeProviderFact = decodeUnknownOption(ProviderFact);
|
|
@@ -64358,18 +65106,18 @@ const Note = Struct({
|
|
|
64358
65106
|
"answer",
|
|
64359
65107
|
"info"
|
|
64360
65108
|
]),
|
|
64361
|
-
text: String$
|
|
65109
|
+
text: String$6
|
|
64362
65110
|
});
|
|
64363
65111
|
const Item = Struct({
|
|
64364
|
-
name: String$
|
|
65112
|
+
name: String$6,
|
|
64365
65113
|
kind: Literals$2([
|
|
64366
65114
|
"range",
|
|
64367
65115
|
"record",
|
|
64368
65116
|
"config"
|
|
64369
65117
|
]),
|
|
64370
|
-
from: optionalKey(String$
|
|
64371
|
-
to: optionalKey(String$
|
|
64372
|
-
reason: optionalKey(String$
|
|
65118
|
+
from: optionalKey(String$6),
|
|
65119
|
+
to: optionalKey(String$6),
|
|
65120
|
+
reason: optionalKey(String$6),
|
|
64373
65121
|
changes: Boolean$4,
|
|
64374
65122
|
status: Literals$2([
|
|
64375
65123
|
"idle",
|
|
@@ -64378,18 +65126,18 @@ const Item = Struct({
|
|
|
64378
65126
|
"failed",
|
|
64379
65127
|
"skipped"
|
|
64380
65128
|
]),
|
|
64381
|
-
doing: optionalKey(String$
|
|
64382
|
-
detail: optionalKey(String$
|
|
64383
|
-
output: optionalKey(ArraySchema(String$
|
|
65129
|
+
doing: optionalKey(String$6),
|
|
65130
|
+
detail: optionalKey(String$6),
|
|
65131
|
+
output: optionalKey(ArraySchema(String$6)),
|
|
64384
65132
|
steps: ArraySchema(Struct({
|
|
64385
|
-
id: String$
|
|
64386
|
-
doing: String$
|
|
65133
|
+
id: String$6,
|
|
65134
|
+
doing: String$6
|
|
64387
65135
|
})),
|
|
64388
65136
|
started: optionalKey(Number$2),
|
|
64389
65137
|
ended: optionalKey(Number$2)
|
|
64390
65138
|
});
|
|
64391
65139
|
const MachineEntry = Struct({
|
|
64392
|
-
name: String$
|
|
65140
|
+
name: String$6,
|
|
64393
65141
|
status: Literals$2([
|
|
64394
65142
|
"checking",
|
|
64395
65143
|
"waiting",
|
|
@@ -64399,17 +65147,23 @@ const MachineEntry = Struct({
|
|
|
64399
65147
|
"skipped",
|
|
64400
65148
|
"failed"
|
|
64401
65149
|
]),
|
|
64402
|
-
detail: optionalKey(String$
|
|
64403
|
-
output: optionalKey(ArraySchema(String$
|
|
65150
|
+
detail: optionalKey(String$6),
|
|
65151
|
+
output: optionalKey(ArraySchema(String$6)),
|
|
64404
65152
|
items: ArraySchema(Item),
|
|
65153
|
+
connected: optionalKey(Boolean$4),
|
|
65154
|
+
checked: optionalKey(Number$2),
|
|
64405
65155
|
started: optionalKey(Number$2),
|
|
64406
65156
|
ended: optionalKey(Number$2)
|
|
64407
65157
|
});
|
|
64408
65158
|
const LedgerState = Struct({
|
|
64409
|
-
from: String$
|
|
65159
|
+
from: String$6,
|
|
64410
65160
|
dryRun: Boolean$4,
|
|
64411
65161
|
notes: ArraySchema(Note),
|
|
64412
65162
|
machines: ArraySchema(MachineEntry),
|
|
65163
|
+
resolving: optionalKey(Struct({
|
|
65164
|
+
started: Number$2,
|
|
65165
|
+
items: Number$2
|
|
65166
|
+
})),
|
|
64413
65167
|
started: Number$2,
|
|
64414
65168
|
ended: optionalKey(Number$2)
|
|
64415
65169
|
});
|
|
@@ -64506,6 +65260,7 @@ const makeLedger = fn("makeLedger")(function* (input) {
|
|
|
64506
65260
|
},
|
|
64507
65261
|
tick: update((state) => state)
|
|
64508
65262
|
};
|
|
65263
|
+
const log = (name, entry) => annotateLogs(entry, { machine: name });
|
|
64509
65264
|
return {
|
|
64510
65265
|
ledger: {
|
|
64511
65266
|
note: fn("ledger.note")(function* (kind, text) {
|
|
@@ -64520,39 +65275,57 @@ const makeLedger = fn("makeLedger")(function* (input) {
|
|
|
64520
65275
|
kind,
|
|
64521
65276
|
text
|
|
64522
65277
|
});
|
|
65278
|
+
yield* logInfo(`${kind}: ${text}`);
|
|
64523
65279
|
}),
|
|
64524
|
-
|
|
65280
|
+
connected: (name) => machine(name, (m) => ({
|
|
64525
65281
|
...m,
|
|
64526
|
-
|
|
64527
|
-
})),
|
|
65282
|
+
connected: true
|
|
65283
|
+
})).pipe(andThen(log(name, logInfo("connected")))),
|
|
65284
|
+
checked: (name) => machine(name, (m, now) => ({
|
|
65285
|
+
...m,
|
|
65286
|
+
status: "waiting",
|
|
65287
|
+
checked: now
|
|
65288
|
+
})).pipe(andThen(log(name, logInfo("checked")))),
|
|
64528
65289
|
skip: (name, reason) => machine(name, (m) => ({
|
|
64529
65290
|
...m,
|
|
64530
65291
|
status: "skipped",
|
|
64531
65292
|
detail: reason
|
|
64532
|
-
})),
|
|
65293
|
+
})).pipe(andThen(log(name, logWarning(`skipped: ${reason}`)))),
|
|
64533
65294
|
fail: (name, [reason = "failed", ...output]) => machine(name, (m, now) => ({
|
|
64534
65295
|
...m,
|
|
64535
65296
|
status: "failed",
|
|
64536
65297
|
detail: reason,
|
|
64537
65298
|
...output.length === 0 ? {} : { output },
|
|
64538
65299
|
ended: now
|
|
64539
|
-
})),
|
|
65300
|
+
})).pipe(andThen(log(name, logError(`failed: ${reason}`)))),
|
|
65301
|
+
resolving: (n) => update((state, now) => ({
|
|
65302
|
+
...state,
|
|
65303
|
+
resolving: {
|
|
65304
|
+
started: now,
|
|
65305
|
+
items: n
|
|
65306
|
+
}
|
|
65307
|
+
})).pipe(andThen(logInfo(`resolving ${n} items`))),
|
|
65308
|
+
resolved: update(({ resolving: _, ...state }) => state).pipe(andThen(logInfo("resolved"))),
|
|
64540
65309
|
plan: (name, p) => machine(name, (m) => ({
|
|
64541
65310
|
...m,
|
|
64542
65311
|
status: "planned",
|
|
64543
65312
|
items: itemsOf(p)
|
|
64544
|
-
}))
|
|
65313
|
+
})).pipe(andThen(forEach$1(p.providers.flatMap((pp) => pp.decisions.map((d) => ({
|
|
65314
|
+
pp,
|
|
65315
|
+
d
|
|
65316
|
+
}))), ({ pp, d }) => log(name, logInfo(`plan ${address(pp.name, d.item)}:`, d)), { discard: true }))),
|
|
64545
65317
|
start: (name) => machine(name, (m, now) => ({
|
|
64546
65318
|
...m,
|
|
64547
65319
|
status: "running",
|
|
65320
|
+
connected: false,
|
|
64548
65321
|
started: now
|
|
64549
|
-
})),
|
|
65322
|
+
})).pipe(andThen(log(name, logInfo("applying")))),
|
|
64550
65323
|
stepStarted: (name, id) => items(name, id, (item, now) => item.status === "failed" || item.status === "skipped" ? item : {
|
|
64551
65324
|
...item,
|
|
64552
65325
|
status: "running",
|
|
64553
65326
|
doing: item.steps.find((step) => step.id === id)?.doing ?? "running",
|
|
64554
65327
|
started: item.started ?? now
|
|
64555
|
-
}),
|
|
65328
|
+
}).pipe(andThen(log(name, logInfo(`step ${id}`)))),
|
|
64556
65329
|
stepDone: (name, id, result) => items(name, id, (item, now) => {
|
|
64557
65330
|
if (item.status === "failed" || item.status === "skipped") return item;
|
|
64558
65331
|
if (!result.ok) return {
|
|
@@ -64570,7 +65343,7 @@ const makeLedger = fn("makeLedger")(function* (input) {
|
|
|
64570
65343
|
status: "ok",
|
|
64571
65344
|
ended: now
|
|
64572
65345
|
};
|
|
64573
|
-
}),
|
|
65346
|
+
}).pipe(andThen(log(name, result.ok ? logInfo(`step ${id}: done`) : logWarning(`step ${id}: ${result.detail}`)))),
|
|
64574
65347
|
stepSkipped: (name, id, reason) => items(name, id, (item, now) => {
|
|
64575
65348
|
if (item.status === "failed") return item;
|
|
64576
65349
|
const { doing: _, ...rest } = item;
|
|
@@ -64580,7 +65353,7 @@ const makeLedger = fn("makeLedger")(function* (input) {
|
|
|
64580
65353
|
detail: reason,
|
|
64581
65354
|
ended: now
|
|
64582
65355
|
};
|
|
64583
|
-
}),
|
|
65356
|
+
}).pipe(andThen(log(name, logInfo(`step ${id}: skipped, ${reason}`)))),
|
|
64584
65357
|
reached: (name, item, at) => machine(name, (m) => ({
|
|
64585
65358
|
...m,
|
|
64586
65359
|
items: m.items.map((i) => i.name !== item ? i : {
|
|
@@ -64588,14 +65361,14 @@ const makeLedger = fn("makeLedger")(function* (input) {
|
|
|
64588
65361
|
to: at,
|
|
64589
65362
|
changes: i.status === "failed" || i.from !== at
|
|
64590
65363
|
})
|
|
64591
|
-
})),
|
|
65364
|
+
})).pipe(andThen(log(name, logInfo(`${item} reached ${at}`)))),
|
|
64592
65365
|
finish: (name, outcome) => machine(name, (m, now) => ({
|
|
64593
65366
|
...m,
|
|
64594
65367
|
status: m.status === "failed" ? "failed" : outcome,
|
|
64595
65368
|
ended: m.ended ?? now
|
|
64596
|
-
})),
|
|
65369
|
+
})).pipe(andThen(log(name, logInfo(`finished: ${outcome}`)))),
|
|
64597
65370
|
end: gen(function* () {
|
|
64598
|
-
yield* update((state, now) => ({
|
|
65371
|
+
yield* update(({ resolving: _, ...state }, now) => ({
|
|
64599
65372
|
...state,
|
|
64600
65373
|
ended: now,
|
|
64601
65374
|
machines: state.machines.map((m) => m.status === "running" || m.status === "checking" ? {
|
|
@@ -66649,15 +67422,23 @@ const countsOf = (m) => {
|
|
|
66649
67422
|
skipped: m.items.filter((i) => i.status === "skipped").length
|
|
66650
67423
|
};
|
|
66651
67424
|
};
|
|
66652
|
-
const settled = (m, dryRun) => dryRun || m.status === "ok" || m.status === "failed";
|
|
67425
|
+
const settled = (m, dryRun) => dryRun && m.status === "planned" || m.status === "ok" || m.status === "failed";
|
|
66653
67426
|
const upToDate = (m, dryRun) => {
|
|
66654
67427
|
const c = countsOf(m);
|
|
66655
67428
|
return c.changes === 0 && c.skipped === 0 && settled(m, dryRun);
|
|
66656
67429
|
};
|
|
66657
|
-
const summaryOf = (m, dryRun) => {
|
|
66658
|
-
if (m.status === "checking"
|
|
66659
|
-
text: m.
|
|
66660
|
-
tone: "
|
|
67430
|
+
const summaryOf = (m, dryRun, glyph) => {
|
|
67431
|
+
if (m.status === "checking") return [{
|
|
67432
|
+
text: `${glyph} ${m.connected === true ? "checking" : "connecting"}`,
|
|
67433
|
+
tone: "run"
|
|
67434
|
+
}];
|
|
67435
|
+
if (m.status === "waiting") return [{
|
|
67436
|
+
text: "✓ checked",
|
|
67437
|
+
tone: "ok"
|
|
67438
|
+
}];
|
|
67439
|
+
if (m.status === "running" && m.connected !== true) return [{
|
|
67440
|
+
text: `${glyph} connecting`,
|
|
67441
|
+
tone: "run"
|
|
66661
67442
|
}];
|
|
66662
67443
|
if (m.status === "skipped") return [{
|
|
66663
67444
|
text: "– skipped",
|
|
@@ -66668,6 +67449,10 @@ const summaryOf = (m, dryRun) => {
|
|
|
66668
67449
|
tone: "fail"
|
|
66669
67450
|
}, { text: ` ${m.detail}` }];
|
|
66670
67451
|
const { changes, done, failed, skipped } = countsOf(m);
|
|
67452
|
+
if (changes === 0 && skipped === 0 && m.status === "running") return [{
|
|
67453
|
+
text: "applying",
|
|
67454
|
+
tone: "dim"
|
|
67455
|
+
}];
|
|
66671
67456
|
if (changes === 0 && skipped === 0) return [{
|
|
66672
67457
|
text: "up to date",
|
|
66673
67458
|
tone: settled(m, dryRun) ? "ok" : "dim"
|
|
@@ -66725,6 +67510,7 @@ const shipSummary = (state) => {
|
|
|
66725
67510
|
}] : parts;
|
|
66726
67511
|
};
|
|
66727
67512
|
const elapsed = (started, ended, now) => started === void 0 ? "" : duration((ended ?? now) - started);
|
|
67513
|
+
const machineTime = (m, shipStarted, now) => m.status === "checking" || m.status === "waiting" ? elapsed(shipStarted, m.checked, now) : elapsed(m.started, m.ended, now);
|
|
66728
67514
|
const Parts = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Line, { children: props.parts.map((part, n) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T, {
|
|
66729
67515
|
tone: part.tone,
|
|
66730
67516
|
children: part.text
|
|
@@ -66765,9 +67551,9 @@ const MachineLine = (props) => {
|
|
|
66765
67551
|
width: w.time,
|
|
66766
67552
|
right: true,
|
|
66767
67553
|
tone: "dim",
|
|
66768
|
-
children: upToDate(m, props.dryRun) ? "" :
|
|
67554
|
+
children: upToDate(m, props.dryRun) ? "" : machineTime(m, props.shipStarted, props.now)
|
|
66769
67555
|
}),
|
|
66770
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Parts, { parts: summaryOf(m, props.dryRun) })
|
|
67556
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Parts, { parts: summaryOf(m, props.dryRun, props.glyph) })
|
|
66771
67557
|
]
|
|
66772
67558
|
});
|
|
66773
67559
|
};
|
|
@@ -66812,8 +67598,18 @@ const LedgerView = (props) => {
|
|
|
66812
67598
|
const { live } = (0, import_react.useContext)(ModeContext);
|
|
66813
67599
|
const running = live && state.ended === void 0;
|
|
66814
67600
|
const glyph = runGlyph(live, now);
|
|
66815
|
-
const shownItems = (m) => m.items.filter((i) => full || i.changes || i.status === "failed" || i.status === "skipped");
|
|
66816
|
-
const
|
|
67601
|
+
const shownItems = (m) => m.items.filter((i) => full || i.changes || i.status === "failed" || i.status === "skipped" || i.status === "running");
|
|
67602
|
+
const resolve = state.resolving === void 0 || state.ended !== void 0 ? void 0 : {
|
|
67603
|
+
name: "versions and commits",
|
|
67604
|
+
kind: "range",
|
|
67605
|
+
from: `${state.resolving.items} items`,
|
|
67606
|
+
changes: false,
|
|
67607
|
+
status: "running",
|
|
67608
|
+
doing: "resolving",
|
|
67609
|
+
steps: [],
|
|
67610
|
+
started: state.resolving.started
|
|
67611
|
+
};
|
|
67612
|
+
const visible = [...state.machines.flatMap(shownItems), ...resolve === void 0 ? [] : [resolve]];
|
|
66817
67613
|
const width = (texts) => Math.max(0, ...texts.map((t) => t.length));
|
|
66818
67614
|
const item = width(visible.map((i) => i.name));
|
|
66819
67615
|
const status = width(visible.map((i) => statusOf(i, dryRun, glyph).text));
|
|
@@ -66821,7 +67617,7 @@ const LedgerView = (props) => {
|
|
|
66821
67617
|
status,
|
|
66822
67618
|
item,
|
|
66823
67619
|
value: Math.max(width(visible.map(value)), width(state.machines.map((m) => m.name)) - (status + GAP + INDENT + item + GAP)),
|
|
66824
|
-
time: width([...visible.map((i) => elapsed(i.started, i.ended, now)), ...state.machines.map((m) =>
|
|
67620
|
+
time: width([...visible.map((i) => elapsed(i.started, i.ended, now)), ...state.machines.map((m) => machineTime(m, state.started, now))])
|
|
66825
67621
|
};
|
|
66826
67622
|
const blocks = state.machines.map((m) => ({
|
|
66827
67623
|
m,
|
|
@@ -66829,7 +67625,9 @@ const LedgerView = (props) => {
|
|
|
66829
67625
|
m,
|
|
66830
67626
|
w,
|
|
66831
67627
|
dryRun,
|
|
66832
|
-
|
|
67628
|
+
shipStarted: state.started,
|
|
67629
|
+
now,
|
|
67630
|
+
glyph
|
|
66833
67631
|
}, m.name),
|
|
66834
67632
|
body: [...m.output === void 0 ? [] : outputLines(m.name, m.output, nameAt(w), running), ...shownItems(m).flatMap((i) => [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemLine, {
|
|
66835
67633
|
i,
|
|
@@ -66840,7 +67638,7 @@ const LedgerView = (props) => {
|
|
|
66840
67638
|
}, `${m.name}/${i.kind}:${i.name}`), ...i.output === void 0 ? [] : outputLines(`${m.name}/${i.kind}:${i.name}`, i.output, nameAt(w), running)])]
|
|
66841
67639
|
}));
|
|
66842
67640
|
const legend = state.ended === void 0 ? `f ${full ? "changes only" : "full list"} · ctrl-c stop` : void 0;
|
|
66843
|
-
const room = height === void 0 ? Infinity : height - (legend === void 0 ? 1 : 3);
|
|
67641
|
+
const room = height === void 0 ? Infinity : height - (legend === void 0 ? 1 : 3) - (resolve === void 0 ? 0 : 2);
|
|
66844
67642
|
const count = (bs) => bs.reduce((n, b) => n + 1 + b.body.length, Math.max(0, bs.length - 1));
|
|
66845
67643
|
const fits = count(blocks) <= room;
|
|
66846
67644
|
let spare = room - count(blocks.map((b) => ({
|
|
@@ -66889,6 +67687,16 @@ const LedgerView = (props) => {
|
|
|
66889
67687
|
tone: "dim",
|
|
66890
67688
|
children: "…"
|
|
66891
67689
|
}),
|
|
67690
|
+
resolve !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
67691
|
+
marginTop: 1,
|
|
67692
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemLine, {
|
|
67693
|
+
i: resolve,
|
|
67694
|
+
w,
|
|
67695
|
+
dryRun,
|
|
67696
|
+
now,
|
|
67697
|
+
glyph
|
|
67698
|
+
})
|
|
67699
|
+
}),
|
|
66892
67700
|
state.ended !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
66893
67701
|
marginTop: 1,
|
|
66894
67702
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Parts, { parts: [...shipSummary(state), ...dryRun ? [] : [{
|
|
@@ -66943,6 +67751,10 @@ const ledgerText = (state, options, color) => toText(/* @__PURE__ */ (0, import_
|
|
|
66943
67751
|
...options
|
|
66944
67752
|
}), color);
|
|
66945
67753
|
const noteText = (note, color) => toText(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NoteLine, { note }), color);
|
|
67754
|
+
const hintText = (text, color) => toText(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(T, {
|
|
67755
|
+
tone: "dim",
|
|
67756
|
+
children: text
|
|
67757
|
+
}), color);
|
|
66946
67758
|
//#endregion
|
|
66947
67759
|
//#region src/report.tsx
|
|
66948
67760
|
const reportPath = () => `${STATE_DIR.replace(/^~/, process.env.HOME ?? "~")}/last-ship.json`;
|
|
@@ -66984,7 +67796,7 @@ const report = fn("report")(function* () {
|
|
|
66984
67796
|
});
|
|
66985
67797
|
const decodeFact$2 = decodeUnknownOption(Union([Struct({
|
|
66986
67798
|
fact: Literal("brew"),
|
|
66987
|
-
version: NullOr(String$
|
|
67799
|
+
version: NullOr(String$6)
|
|
66988
67800
|
}), AtFact]));
|
|
66989
67801
|
const NO_BREW = "Homebrew is not installed; install it first";
|
|
66990
67802
|
function homebrew(name) {
|
|
@@ -67114,28 +67926,28 @@ const cask = homebrew("cask");
|
|
|
67114
67926
|
const decodeFact$1 = decodeUnknownOption(Union([
|
|
67115
67927
|
Struct({
|
|
67116
67928
|
fact: Literal("cloneRoot"),
|
|
67117
|
-
path: String$
|
|
67929
|
+
path: String$6,
|
|
67118
67930
|
present: Boolean$4
|
|
67119
67931
|
}),
|
|
67120
67932
|
Struct({
|
|
67121
67933
|
fact: Literal("repo"),
|
|
67122
|
-
name: String$
|
|
67934
|
+
name: String$6,
|
|
67123
67935
|
present: Boolean$4,
|
|
67124
|
-
head: optionalKey(String$
|
|
67125
|
-
origin: optionalKey(String$
|
|
67936
|
+
head: optionalKey(String$6),
|
|
67937
|
+
origin: optionalKey(String$6)
|
|
67126
67938
|
}),
|
|
67127
67939
|
Struct({
|
|
67128
67940
|
fact: Literal("output"),
|
|
67129
|
-
repo: String$
|
|
67130
|
-
path: String$
|
|
67131
|
-
fingerprint: NullOr(String$
|
|
67941
|
+
repo: String$6,
|
|
67942
|
+
path: String$6,
|
|
67943
|
+
fingerprint: NullOr(String$6)
|
|
67132
67944
|
})
|
|
67133
67945
|
]));
|
|
67134
67946
|
const decodeRecord = decodeUnknownOption(Struct({
|
|
67135
|
-
commit: String$
|
|
67136
|
-
path: String$
|
|
67137
|
-
install: String$
|
|
67138
|
-
outputs: Record(String$
|
|
67947
|
+
commit: String$6,
|
|
67948
|
+
path: String$6,
|
|
67949
|
+
install: String$6,
|
|
67950
|
+
outputs: Record(String$6, String$6)
|
|
67139
67951
|
}));
|
|
67140
67952
|
const branchKey = (repo) => `${repo.origin}#${repo.ref}`;
|
|
67141
67953
|
const cloneRoot = (config, machine) => {
|
|
@@ -67145,7 +67957,7 @@ const cloneRoot = (config, machine) => {
|
|
|
67145
67957
|
const originUrl = (origin) => `https://github.com/${origin}.git`;
|
|
67146
67958
|
const short = (commit) => commit.slice(0, 7);
|
|
67147
67959
|
const expandHome = (path, home) => path === "~" ? home : path.startsWith("~/") ? `${home}${path.slice(1)}` : path;
|
|
67148
|
-
const jsonString = encodeSync(fromJsonString(String$
|
|
67960
|
+
const jsonString = encodeSync(fromJsonString(String$6));
|
|
67149
67961
|
const lsRemote = fn("lsRemote")(function* (repo, token) {
|
|
67150
67962
|
const spawner = yield* ChildProcessSpawner;
|
|
67151
67963
|
const auth = token === void 0 ? [] : [
|
|
@@ -67155,7 +67967,7 @@ const lsRemote = fn("lsRemote")(function* (repo, token) {
|
|
|
67155
67967
|
"credential.helper=!f() { echo username=x-access-token; echo \"password=$FF_TOKEN\"; }; f"
|
|
67156
67968
|
];
|
|
67157
67969
|
return yield* scoped(gen(function* () {
|
|
67158
|
-
const handle = yield* spawner.spawn(make$
|
|
67970
|
+
const handle = yield* spawner.spawn(make$13("git", [
|
|
67159
67971
|
...auth,
|
|
67160
67972
|
"ls-remote",
|
|
67161
67973
|
originUrl(repo.origin),
|
|
@@ -67244,11 +68056,12 @@ const decideRepo = (repo, root, observed, resolved, ctx) => {
|
|
|
67244
68056
|
};
|
|
67245
68057
|
const fetchStep = ({ item, root, commit }) => {
|
|
67246
68058
|
const url = originUrl(item.origin);
|
|
68059
|
+
const fetch = (what) => `if [ "$(git -C "$ff_d" rev-parse HEAD)" != ${quote(commit)} ]; then ff_git -C "$ff_d" fetch --quiet origin ${quote(what)}; fi`;
|
|
67247
68060
|
const sync = isPin(item.ref) ? [
|
|
67248
|
-
|
|
68061
|
+
fetch(commit),
|
|
67249
68062
|
`git -C "$ff_d" checkout --quiet --detach ${quote(commit)}`,
|
|
67250
68063
|
`git -C "$ff_d" reset --quiet --hard ${quote(commit)}`
|
|
67251
|
-
] : [
|
|
68064
|
+
] : [fetch(item.ref), `git -C "$ff_d" reset --quiet --hard ${quote(commit)}`];
|
|
67252
68065
|
return {
|
|
67253
68066
|
id: `repos:${item.name}:fetch`,
|
|
67254
68067
|
items: [item.name],
|
|
@@ -67372,20 +68185,20 @@ const TOOL_PACKAGES = {
|
|
|
67372
68185
|
bun: ["bun"]
|
|
67373
68186
|
};
|
|
67374
68187
|
const GlobalEntry = Struct({
|
|
67375
|
-
name: String$
|
|
67376
|
-
version: String$
|
|
67377
|
-
platform: optionalKey(Struct({ node: optionalKey(String$
|
|
68188
|
+
name: String$6,
|
|
68189
|
+
version: String$6,
|
|
68190
|
+
platform: optionalKey(Struct({ node: optionalKey(String$6) }))
|
|
67378
68191
|
});
|
|
67379
68192
|
const decodeFact = decodeUnknownOption(Union([
|
|
67380
68193
|
Struct({
|
|
67381
68194
|
fact: Literal("vp"),
|
|
67382
|
-
version: NullOr(String$
|
|
67383
|
-
path: optionalKey(String$
|
|
68195
|
+
version: NullOr(String$6),
|
|
68196
|
+
path: optionalKey(String$6)
|
|
67384
68197
|
}),
|
|
67385
68198
|
Struct({
|
|
67386
68199
|
fact: Literal("default"),
|
|
67387
|
-
tool: String$
|
|
67388
|
-
version: String$
|
|
68200
|
+
tool: String$6,
|
|
68201
|
+
version: String$6
|
|
67389
68202
|
}),
|
|
67390
68203
|
Struct({
|
|
67391
68204
|
fact: Literal("mode"),
|
|
@@ -67799,14 +68612,21 @@ const canRedraw = () => Boolean(process.stdout.isTTY) && process.env.TERM !== "d
|
|
|
67799
68612
|
const decodeAt = decodeUnknownOption(AtFact);
|
|
67800
68613
|
const runOn = fn("runOn")(function* (target, script, secrets, onLine, ledger) {
|
|
67801
68614
|
let first;
|
|
68615
|
+
let connected = false;
|
|
68616
|
+
yield* logDebug(`script:\n${script}`);
|
|
68617
|
+
const started = yield* currentTimeMillis;
|
|
67802
68618
|
const run = yield* runScript(target, script, secrets, (line) => {
|
|
67803
68619
|
const parsed = parseLine(line);
|
|
67804
68620
|
if (parsed.kind === "text" && first === void 0 && line.trim() !== "") first = line.trim();
|
|
67805
|
-
|
|
68621
|
+
const connect = connected ? void_ : ledger.connected(target.name);
|
|
68622
|
+
connected = true;
|
|
68623
|
+
return logDebug(`> ${line}`).pipe(andThen(connect), andThen(onLine(parsed)));
|
|
67806
68624
|
}).pipe(map$5((exitCode) => ({
|
|
67807
68625
|
kind: "ran",
|
|
67808
68626
|
exitCode
|
|
67809
68627
|
})), catch_((e) => ledger.fail(target.name, [e.message]).pipe(as({ kind: "failed" }))));
|
|
68628
|
+
const ended = yield* currentTimeMillis;
|
|
68629
|
+
yield* logInfo(`${run.kind === "ran" ? `exit ${run.exitCode}` : "could not start"} after ${duration(ended - started)}`);
|
|
67810
68630
|
if (!target.local && run.kind === "ran" && run.exitCode === 255) {
|
|
67811
68631
|
yield* ledger.skip(target.name, `ssh: ${first?.replace(/^tailscale: /, "") ?? "connection failed"}`);
|
|
67812
68632
|
return { kind: "skipped" };
|
|
@@ -68003,9 +68823,19 @@ const staleConfigs = fn("staleConfigs")(function* (config, own, checked, ledger)
|
|
|
68003
68823
|
});
|
|
68004
68824
|
const schemaJson = encodeSync(fromJsonString(Unknown, { space: 2 }));
|
|
68005
68825
|
const ship = fn("ship")(function* (flags) {
|
|
68006
|
-
|
|
68007
|
-
|
|
68008
|
-
const
|
|
68826
|
+
const tailnet = yield* readTailnet();
|
|
68827
|
+
const id = shipId(yield* now, tailnet.self.name);
|
|
68828
|
+
const hidden = /* @__PURE__ */ new Set();
|
|
68829
|
+
const logger = yield* openShipLog(id, hidden).pipe(catch_((e) => error(`could not open the Ship Log: ${e.message}`).pipe(as(void 0))));
|
|
68830
|
+
if (logger !== void 0) yield* addFinalizer(() => log(hintText(`log: fizz logs ${id}`)));
|
|
68831
|
+
yield* gen(function* () {
|
|
68832
|
+
yield* logInfo(`Ship ${id}: fleetfizz ${flags.version}, node ${process.version} on ${process.platform}`);
|
|
68833
|
+
yield* logInfo(`fizz ${process.argv.slice(2).join(" ")}`);
|
|
68834
|
+
for (const m of tailnet.fleet) yield* logInfo(`tailnet: ${m.name} ${m.platform}${m.online ? "" : " offline"}${m.ssh ? "" : " no-ssh"}${m.name === tailnet.self.name ? " (this Machine)" : ""}`);
|
|
68835
|
+
while ((yield* shipPass(flags, tailnet, hidden)) === "adopted");
|
|
68836
|
+
}).pipe(onExit((exit) => isSuccess(exit) ? logInfo("the Ship ended") : logError("the Ship stopped", exit.cause)), provide(layer$1(logger === void 0 ? [] : [logger])), provideService(MinimumLogLevel, "Debug"));
|
|
68837
|
+
}, scoped);
|
|
68838
|
+
const shipPass = fn("shipPass")(function* (flags, tailnet, hidden) {
|
|
68009
68839
|
const fs = yield* FileSystem;
|
|
68010
68840
|
const parsed = parseAnswers(flags.answers);
|
|
68011
68841
|
if ("invalid" in parsed) return yield* fail$1(new ShipError(parsed.invalid));
|
|
@@ -68014,10 +68844,11 @@ const shipPass = fn("shipPass")(function* (flags) {
|
|
|
68014
68844
|
if (notAddress !== void 0) return yield* fail$1(new ShipError(`--rebuild ${notAddress}: expected a record Item (repos:<name>) or all`));
|
|
68015
68845
|
const path = flags.config ?? configPath(process.env);
|
|
68016
68846
|
const config = yield* loadConfig(path);
|
|
68847
|
+
yield* logInfo(`config ${path}`);
|
|
68848
|
+
yield* logDebug(yield* fs.readFileString(path));
|
|
68017
68849
|
const ordered = orderProviders(PROVIDERS, (p) => dependenciesOf(p, config));
|
|
68018
68850
|
if ("cycle" in ordered) return yield* fail$1(new ShipError(`dependsOn cycle: ${ordered.cycle.join(" → ")}`));
|
|
68019
68851
|
const providers = ordered.order;
|
|
68020
|
-
const tailnet = yield* readTailnet();
|
|
68021
68852
|
const problem = unshippable(config, tailnet, flags.only, path);
|
|
68022
68853
|
if (problem !== void 0) return yield* fail$1(new ShipError(problem));
|
|
68023
68854
|
const fleet = new Set(config.machines);
|
|
@@ -68025,6 +68856,7 @@ const shipPass = fn("shipPass")(function* (flags) {
|
|
|
68025
68856
|
const order = config.machines;
|
|
68026
68857
|
const targetsList = tailnet.fleet.filter((m) => fleet.has(m.name) && (flags.only.length === 0 || flags.only.includes(m.name))).toSorted((a, b) => order.indexOf(a.name) - order.indexOf(b.name));
|
|
68027
68858
|
const count = `${targetsList.length} machine${targetsList.length === 1 ? "" : "s"}`;
|
|
68859
|
+
yield* logInfo(`${flags.dryRun ? "dry run, " : ""}targets: ${targetsList.map((m) => m.name).join(", ")}`);
|
|
68028
68860
|
yield* log(`${flags.dryRun ? "dry run, " : ""}${count} from ${tailnet.self.name}`);
|
|
68029
68861
|
const color = colorful();
|
|
68030
68862
|
const { ledger, store } = yield* makeLedger({
|
|
@@ -68087,7 +68919,10 @@ const shipPass = fn("shipPass")(function* (flags) {
|
|
|
68087
68919
|
local,
|
|
68088
68920
|
state: result.state
|
|
68089
68921
|
};
|
|
68090
|
-
}
|
|
68922
|
+
}, (effect, machine) => annotateLogs(effect, {
|
|
68923
|
+
machine: machine.name,
|
|
68924
|
+
phase: "check"
|
|
68925
|
+
})), { concurrency: "unbounded" }).pipe(map$5((list) => list.filter((g) => g !== void 0)));
|
|
68091
68926
|
const stale = yield* staleConfigs(config, own, checked, ledger);
|
|
68092
68927
|
if (stale.length > 0) {
|
|
68093
68928
|
const what = `newer config on ${stale.map((s) => s.description).join(", ")}`;
|
|
@@ -68135,9 +68970,13 @@ const shipPass = fn("shipPass")(function* (flags) {
|
|
|
68135
68970
|
provider,
|
|
68136
68971
|
items: checked.flatMap(({ machine }) => targetedItems(provider, config, machine))
|
|
68137
68972
|
}));
|
|
68973
|
+
yield* ledger.resolving(new Set(targeted.flatMap(({ provider, items }) => items.map((i) => `${provider.name}:${i.name}`))).size);
|
|
68138
68974
|
const lent = targeted.some(({ provider, items }) => provider.name === "repos" && items.length > 0) ? yield* readLentToken() : { token: void 0 };
|
|
68975
|
+
if (lent.token !== void 0) hidden.add(lent.token);
|
|
68976
|
+
yield* logInfo(lent.token !== void 0 ? "gh token: lent" : `gh token: none (${lent.reason ?? "no repos"})`);
|
|
68139
68977
|
if (lent.token === void 0 && lent.reason !== void 0) yield* ledger.note("info", `no gh token (${lent.reason}); private repos will fail`);
|
|
68140
68978
|
const resolved = Object.fromEntries(yield* forEach$1(targeted, ({ provider, items }) => provider.resolve(items, lent.token === void 0 ? {} : { token: lent.token }).pipe(map$5((r) => [provider.name, r])), { concurrency: "unbounded" }));
|
|
68979
|
+
yield* ledger.resolved;
|
|
68141
68980
|
const planAll = (cfg, answer) => checked.map((g) => ({
|
|
68142
68981
|
...g,
|
|
68143
68982
|
plan: planMachine({
|
|
@@ -68201,6 +69040,7 @@ const shipPass = fn("shipPass")(function* (flags) {
|
|
|
68201
69040
|
});
|
|
68202
69041
|
const stamped = stampWith(planned.map((g) => g.machine.name));
|
|
68203
69042
|
yield* fs.writeFileString(path, stamped);
|
|
69043
|
+
yield* logInfo(`stamped the config: shippedAt ${shippedAt}`);
|
|
68204
69044
|
const schema = `${schemaJson(fleetConfigJsonSchema())}\n`;
|
|
68205
69045
|
const stdin = applyStdin(lent.token, stamped, schema);
|
|
68206
69046
|
const delivered = yield* forEach$1(planned, fn("applyOne")(function* ({ machine, local, plan: p }) {
|
|
@@ -68208,12 +69048,20 @@ const shipPass = fn("shipPass")(function* (flags) {
|
|
|
68208
69048
|
name: machine.name,
|
|
68209
69049
|
local
|
|
68210
69050
|
}, p, applyScript(p), stdin, ledger)).done.includes("config") ? machine.name : void 0;
|
|
68211
|
-
}
|
|
69051
|
+
}, (effect, { machine }) => annotateLogs(effect, {
|
|
69052
|
+
machine: machine.name,
|
|
69053
|
+
phase: "apply"
|
|
69054
|
+
})), { concurrency: "unbounded" }).pipe(map$5((list) => list.filter((name) => name !== void 0)));
|
|
69055
|
+
yield* logInfo(`the config reached: ${delivered.join(", ")}`);
|
|
68212
69056
|
yield* fs.writeFileString(path, stampWith(delivered));
|
|
68213
69057
|
}, scoped);
|
|
68214
69058
|
//#endregion
|
|
68215
69059
|
//#region src/command.ts
|
|
68216
|
-
const
|
|
69060
|
+
const printProblems = (effect) => effect.pipe(catch_((e) => gen(function* () {
|
|
69061
|
+
yield* error(e.message);
|
|
69062
|
+
process.exitCode = 1;
|
|
69063
|
+
})));
|
|
69064
|
+
const shipCommand = make$1("ship", {
|
|
68217
69065
|
dryRun: Boolean$1("dry-run").pipe(withDefault(false), withDescription$1("Check and plan only. Print every Machine's plan and change nothing.")),
|
|
68218
69066
|
only: String$1("only").pipe(atLeast(0), withMetavar("machine"), withDescription$1("Ship only to this Machine. Repeat the flag for more.")),
|
|
68219
69067
|
rebuild: String$1("rebuild").pipe(atLeast(0), withMetavar("item"), withDescription$1("Rebuild a record Item (`repos:<name>`) even when it is up to date. `all` for every one.")),
|
|
@@ -68232,15 +69080,25 @@ const shipCommand = make("ship", {
|
|
|
68232
69080
|
...flags.enforce ? ["range=downgrade"] : [],
|
|
68233
69081
|
...flags.overwriteConfig ? ["config=overwrite"] : []
|
|
68234
69082
|
],
|
|
68235
|
-
config: flags.config
|
|
69083
|
+
config: getOrUndefined$1(flags.config),
|
|
68236
69084
|
version
|
|
68237
|
-
}).pipe(
|
|
68238
|
-
|
|
68239
|
-
|
|
68240
|
-
|
|
68241
|
-
|
|
69085
|
+
}).pipe(printProblems)));
|
|
69086
|
+
const reportCommand = make$1("report", {}).pipe(withDescription("Print the full Ledger of the last Ship from this Machine."), withHandler(() => report()));
|
|
69087
|
+
const logsCommand = make$1("logs", {
|
|
69088
|
+
ship: String$2("ship").pipe(optional$1, withDescription$2("The Ship id, printed at the end of every Ship.")),
|
|
69089
|
+
machine: String$1("machine").pipe(optional, withMetavar("machine"), withDescription$1("Print only this Machine's lines.")),
|
|
69090
|
+
list: Boolean$1("list").pipe(withDefault(false), withDescription$1(`List the Ships started here whose logs this Machine keeps (its last 20).`))
|
|
69091
|
+
}).pipe(withDescription("Print the Ship Log of a Ship: every script, every line each Machine printed, and every decision. Without a Ship id, the latest Ship that started on or reached this Machine, read over tailscale ssh when another Machine started it."), withHandler((flags) => logs({
|
|
69092
|
+
id: getOrUndefined$1(flags.ship),
|
|
69093
|
+
machine: getOrUndefined$1(flags.machine),
|
|
69094
|
+
list: flags.list
|
|
69095
|
+
}).pipe(printProblems)));
|
|
68242
69096
|
//#endregion
|
|
68243
69097
|
//#region src/bin.ts
|
|
68244
|
-
run(make("fizz").pipe(withDescription("Keep every Machine on your tailnet in line with one config."), withSubcommands([
|
|
69098
|
+
run(make$1("fizz").pipe(withDescription("Keep every Machine on your tailnet in line with one config."), withSubcommands([
|
|
69099
|
+
shipCommand,
|
|
69100
|
+
reportCommand,
|
|
69101
|
+
logsCommand
|
|
69102
|
+
])), { version }).pipe(provide(layer$2), runMain);
|
|
68245
69103
|
//#endregion
|
|
68246
69104
|
export {};
|