@deslop/deploy 0.1.1345 → 0.1.1354
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/README.md +2 -10
- package/dist/client/assets/(home)-B0-O_52G.js +64 -0
- package/dist/client/assets/{dropdown-menu-DKb40k2X.js → dropdown-menu-B8uZGgHn.js} +1 -1
- package/dist/client/assets/effect-B1Wz7pgf.js +17 -0
- package/dist/client/assets/fleet-DgRC8GWG.js +2 -0
- package/dist/client/assets/{index-C1FILr3G.js → index-Ca9OEnQl.js} +2 -2
- package/dist/client/assets/{result-error-DRDBz7c7.js → result-error-ABURHIbj.js} +1 -1
- package/dist/client/assets/route-D9U3MWvH.js +1 -0
- package/dist/client/index.html +3 -3
- package/dist/server.js +399 -229
- package/package.json +2 -2
- package/dist/client/assets/(home)-BC7xuJB8.js +0 -64
- package/dist/client/assets/effect-B4gU06Rn.js +0 -17
- package/dist/client/assets/fleet-0_LwLxNC.js +0 -2
- package/dist/client/assets/route-BqVkC7pZ.js +0 -1
package/dist/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import { cwd, execPath, pid, platform } from "node:process";
|
|
3
|
+
import { arch, cwd, execPath, pid, platform } from "node:process";
|
|
4
4
|
import * as OS from "node:os";
|
|
5
5
|
import { cpus, hostname, loadavg, totalmem, userInfo } from "node:os";
|
|
6
6
|
import * as NodeChildProcess from "node:child_process";
|
|
@@ -4447,44 +4447,6 @@ const liftThrowable = (f) => (...a) => {
|
|
|
4447
4447
|
}
|
|
4448
4448
|
};
|
|
4449
4449
|
/**
|
|
4450
|
-
* Extracts the value from a `Some`, or throws a default `Error` for `None`.
|
|
4451
|
-
*
|
|
4452
|
-
* **When to use**
|
|
4453
|
-
*
|
|
4454
|
-
* Use when you need quick fail-fast unwrapping of an `Option` and a generic
|
|
4455
|
-
* error is acceptable.
|
|
4456
|
-
*
|
|
4457
|
-
* **Details**
|
|
4458
|
-
*
|
|
4459
|
-
* - `Some` → returns the inner value
|
|
4460
|
-
* - `None` → throws `new Error("getOrThrow called on a None")`
|
|
4461
|
-
*
|
|
4462
|
-
* **Example** (Throwing a default error)
|
|
4463
|
-
*
|
|
4464
|
-
* ```ts import.meta.vitest
|
|
4465
|
-
* import { Option, Result } from "effect"
|
|
4466
|
-
*
|
|
4467
|
-
* Option.getOrThrow(Option.some(1)) // => 1
|
|
4468
|
-
*
|
|
4469
|
-
* const failure = Result.try({
|
|
4470
|
-
* try: () => Option.getOrThrow(Option.none()),
|
|
4471
|
-
* catch: (error) => (error as Error).message
|
|
4472
|
-
* })
|
|
4473
|
-
* Result.getFailure(failure).pipe(Option.getOrElse(() => "no error")) // => "getOrThrow called on a None"
|
|
4474
|
-
* ```
|
|
4475
|
-
*
|
|
4476
|
-
* @see {@link getOrThrowWith} for a custom error
|
|
4477
|
-
* @see {@link getOrElse} for a non-throwing alternative
|
|
4478
|
-
*
|
|
4479
|
-
* @stability stable
|
|
4480
|
-
* @category converting
|
|
4481
|
-
* @since 2.0.0
|
|
4482
|
-
*/
|
|
4483
|
-
const getOrThrow$1 = /*#__PURE__*/ (/* @__PURE__ */ dual(2, (self, onNone) => {
|
|
4484
|
-
if (isSome(self)) return self.value;
|
|
4485
|
-
throw onNone();
|
|
4486
|
-
}))(() => /* @__PURE__ */ new Error("getOrThrow called on a None"));
|
|
4487
|
-
/**
|
|
4488
4450
|
* Transforms the value inside a `Some` using the provided function, leaving
|
|
4489
4451
|
* `None` unchanged.
|
|
4490
4452
|
*
|
|
@@ -4989,7 +4951,7 @@ const ServiceProto = {
|
|
|
4989
4951
|
.../*#__PURE__*/ Prototype({
|
|
4990
4952
|
label: "Service",
|
|
4991
4953
|
evaluate(fiber) {
|
|
4992
|
-
return exitSucceed(get$
|
|
4954
|
+
return exitSucceed(get$14(fiber.context, this));
|
|
4993
4955
|
}
|
|
4994
4956
|
}),
|
|
4995
4957
|
toJSON() {
|
|
@@ -5005,10 +4967,10 @@ const ServiceProto = {
|
|
|
5005
4967
|
return make$93(this, self);
|
|
5006
4968
|
},
|
|
5007
4969
|
use(f) {
|
|
5008
|
-
return withFiber$1((fiber) => f(get$
|
|
4970
|
+
return withFiber$1((fiber) => f(get$14(fiber.context, this)));
|
|
5009
4971
|
},
|
|
5010
4972
|
useSync(f) {
|
|
5011
|
-
return withFiber$1((fiber) => exitSucceed(f(get$
|
|
4973
|
+
return withFiber$1((fiber) => exitSucceed(f(get$14(fiber.context, this))));
|
|
5012
4974
|
}
|
|
5013
4975
|
};
|
|
5014
4976
|
const cacheKeys = /*#__PURE__*/ new Set();
|
|
@@ -5387,7 +5349,7 @@ const getUnsafe$1 = /*#__PURE__*/ dual(2, (self, service) => {
|
|
|
5387
5349
|
* @category getters
|
|
5388
5350
|
* @since 2.0.0
|
|
5389
5351
|
*/
|
|
5390
|
-
const get$
|
|
5352
|
+
const get$14 = getUnsafe$1;
|
|
5391
5353
|
const defaultValueCacheKey = "~effect/Context/defaultValue";
|
|
5392
5354
|
const getDefaultValue = (ref) => {
|
|
5393
5355
|
if (defaultValueCacheKey in ref) return ref[defaultValueCacheKey];
|
|
@@ -6506,7 +6468,7 @@ const has$6 = /*#__PURE__*/ dual(2, (self, key) => Object.hasOwn(self, key));
|
|
|
6506
6468
|
* @category getters
|
|
6507
6469
|
* @since 2.0.0
|
|
6508
6470
|
*/
|
|
6509
|
-
const get$
|
|
6471
|
+
const get$13 = /*#__PURE__*/ dual(2, (self, key) => Object.hasOwn(self, key) ? some$1(self[key]) : none());
|
|
6510
6472
|
/**
|
|
6511
6473
|
* Maps a record into another record by applying a transformation function to each of its values.
|
|
6512
6474
|
*
|
|
@@ -7098,7 +7060,7 @@ function isOutOfBounds(i, as) {
|
|
|
7098
7060
|
* @category getters
|
|
7099
7061
|
* @since 2.0.0
|
|
7100
7062
|
*/
|
|
7101
|
-
const get$
|
|
7063
|
+
const get$12 = /*#__PURE__*/ dual(2, (self, index) => {
|
|
7102
7064
|
const i = Math.floor(index);
|
|
7103
7065
|
return isOutOfBounds(i, self) ? none() : some$1(self[i]);
|
|
7104
7066
|
});
|
|
@@ -7159,7 +7121,7 @@ const getUnsafe = /*#__PURE__*/ dual(2, (self, index) => {
|
|
|
7159
7121
|
* @category getters
|
|
7160
7122
|
* @since 2.0.0
|
|
7161
7123
|
*/
|
|
7162
|
-
const head = /*#__PURE__*/ get$
|
|
7124
|
+
const head = /*#__PURE__*/ get$12(0);
|
|
7163
7125
|
/**
|
|
7164
7126
|
* Returns the first element of a `NonEmptyReadonlyArray` directly (no `Option`
|
|
7165
7127
|
* wrapper).
|
|
@@ -7866,6 +7828,42 @@ const getSomes = (self) => {
|
|
|
7866
7828
|
return out;
|
|
7867
7829
|
};
|
|
7868
7830
|
/**
|
|
7831
|
+
* Keeps transformed values for elements where a `Filter` succeeds.
|
|
7832
|
+
*
|
|
7833
|
+
* **When to use**
|
|
7834
|
+
*
|
|
7835
|
+
* Use to filter an iterable with a `Result`-returning transformation while
|
|
7836
|
+
* discarding failures.
|
|
7837
|
+
*
|
|
7838
|
+
* **Details**
|
|
7839
|
+
*
|
|
7840
|
+
* The filter receives `(element, index)`. Failures are discarded.
|
|
7841
|
+
*
|
|
7842
|
+
* **Example** (Filtering and transforming)
|
|
7843
|
+
*
|
|
7844
|
+
* ```ts import.meta.vitest
|
|
7845
|
+
* import { Array, Result } from "effect"
|
|
7846
|
+
*
|
|
7847
|
+
* Array.filterMap([1, 2, 3, 4], (n) => n % 2 === 0 ? Result.succeed(n * 10) : Result.failVoid) // => [20, 40]
|
|
7848
|
+
* ```
|
|
7849
|
+
*
|
|
7850
|
+
* @see {@link filter} — keep original elements matching a predicate
|
|
7851
|
+
* @see {@link partition} for keeping both successes and failures
|
|
7852
|
+
*
|
|
7853
|
+
* @stability stable
|
|
7854
|
+
* @category filtering
|
|
7855
|
+
* @since 2.0.0
|
|
7856
|
+
*/
|
|
7857
|
+
const filterMap = /*#__PURE__*/ dual(2, (self, f) => {
|
|
7858
|
+
const as = fromIterable$8(self);
|
|
7859
|
+
const out = [];
|
|
7860
|
+
for (let i = 0; i < as.length; i++) {
|
|
7861
|
+
const result = f(as[i], i);
|
|
7862
|
+
if (isSuccess$1(result)) out.push(result.success);
|
|
7863
|
+
}
|
|
7864
|
+
return out;
|
|
7865
|
+
});
|
|
7866
|
+
/**
|
|
7869
7867
|
* Keeps only elements satisfying a predicate (or refinement).
|
|
7870
7868
|
*
|
|
7871
7869
|
* **When to use**
|
|
@@ -9307,6 +9305,18 @@ const format$2 = (self) => {
|
|
|
9307
9305
|
*/
|
|
9308
9306
|
const fromPredicate = (predicate) => (input) => predicate(input) ? succeed$10(input) : fail$11(input);
|
|
9309
9307
|
/**
|
|
9308
|
+
* Creates a `Filter` from a function that returns an `Option`; `Some(value)`
|
|
9309
|
+
* passes with `value`, and `None` fails with the original input.
|
|
9310
|
+
*
|
|
9311
|
+
* @stability stable
|
|
9312
|
+
* @category constructors
|
|
9313
|
+
* @since 4.0.0
|
|
9314
|
+
*/
|
|
9315
|
+
const fromPredicateOption = (predicate) => (input) => {
|
|
9316
|
+
const o = predicate(input);
|
|
9317
|
+
return o._tag === "None" ? fail$11(input) : succeed$10(o.value);
|
|
9318
|
+
};
|
|
9319
|
+
/**
|
|
9310
9320
|
* Converts a Filter into a predicate function.
|
|
9311
9321
|
*
|
|
9312
9322
|
* **When to use**
|
|
@@ -10673,7 +10683,7 @@ var FiberImpl = class {
|
|
|
10673
10683
|
return this._dispatcher ??= this.cache.scheduler.makeDispatcher();
|
|
10674
10684
|
}
|
|
10675
10685
|
getRef(ref) {
|
|
10676
|
-
return get$
|
|
10686
|
+
return get$14(this.context, ref);
|
|
10677
10687
|
}
|
|
10678
10688
|
addObserver(cb) {
|
|
10679
10689
|
if (this._exit) {
|
|
@@ -10855,17 +10865,17 @@ var FiberImpl = class {
|
|
|
10855
10865
|
const makeFiberContextCache = (context) => {
|
|
10856
10866
|
const currentTracer = getOrUndefinedUnsafe(context, TracerKey);
|
|
10857
10867
|
return {
|
|
10858
|
-
scheduler: get$
|
|
10868
|
+
scheduler: get$14(context, Scheduler),
|
|
10859
10869
|
tracer: currentTracer,
|
|
10860
10870
|
tracerContext: currentTracer ? currentTracer["context"] : void 0,
|
|
10861
|
-
tracerEnabled: get$
|
|
10871
|
+
tracerEnabled: get$14(context, TracerEnabled),
|
|
10862
10872
|
span: getOrUndefinedUnsafe(context, ParentSpanKey),
|
|
10863
|
-
logLevel: get$
|
|
10864
|
-
minimumLogLevel: get$
|
|
10865
|
-
stackFrame: get$
|
|
10873
|
+
logLevel: get$14(context, CurrentLogLevel$1),
|
|
10874
|
+
minimumLogLevel: get$14(context, MinimumLogLevel$1),
|
|
10875
|
+
stackFrame: get$14(context, CurrentStackFrame),
|
|
10866
10876
|
runtimeMetrics: getOrUndefinedUnsafe(context, FiberRuntimeMetricsKey),
|
|
10867
|
-
maxOpsBeforeYield: get$
|
|
10868
|
-
preventYield: get$
|
|
10877
|
+
maxOpsBeforeYield: get$14(context, MaxOpsBeforeYield),
|
|
10878
|
+
preventYield: get$14(context, PreventSchedulerYield)
|
|
10869
10879
|
};
|
|
10870
10880
|
};
|
|
10871
10881
|
const deferredInterruptCont = {
|
|
@@ -11521,7 +11531,7 @@ const tapCauseFilter = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$4(s
|
|
|
11521
11531
|
/** @internal */
|
|
11522
11532
|
const tapError$4 = /*#__PURE__*/ dual(2, (self, f) => tapCauseFilter(self, findError$1, (e) => f(e)));
|
|
11523
11533
|
/** @internal */
|
|
11524
|
-
const catchIf$
|
|
11534
|
+
const catchIf$3 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, predicate, f, orElse) => catchCause$4(self, (cause) => {
|
|
11525
11535
|
const error = findRecoverableError(cause);
|
|
11526
11536
|
if (isFailure$1(error)) return failCause$6(error.failure);
|
|
11527
11537
|
if (!predicate(error.success)) return orElse ? orElse(error.success) : failCause$6(cause);
|
|
@@ -11538,7 +11548,7 @@ const catchFilter$3 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, f
|
|
|
11538
11548
|
/** @internal */
|
|
11539
11549
|
const catchTag$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, k, f, orElse) => {
|
|
11540
11550
|
const pred = Array.isArray(k) ? (e) => hasProperty(e, "_tag") && k.includes(e._tag) : isTagged(k);
|
|
11541
|
-
return catchIf$
|
|
11551
|
+
return catchIf$3(self, pred, f, orElse);
|
|
11542
11552
|
});
|
|
11543
11553
|
/** @internal */
|
|
11544
11554
|
const catchTags$2 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, cases, orElse) => {
|
|
@@ -11549,7 +11559,7 @@ const catchTags$2 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, cas
|
|
|
11549
11559
|
}, (e) => cases[e["_tag"]](e), orElse);
|
|
11550
11560
|
});
|
|
11551
11561
|
/** @internal */
|
|
11552
|
-
const catchReason$3 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, errorTag, reasonTag, f, orElse) => catchIf$
|
|
11562
|
+
const catchReason$3 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, errorTag, reasonTag, f, orElse) => catchIf$3(self, (e) => isTagged(e, errorTag) && hasProperty(e, "reason") && (orElse !== void 0 || isTagged(e.reason, reasonTag)), (e) => {
|
|
11553
11563
|
const reason = e.reason;
|
|
11554
11564
|
if (isTagged(reason, reasonTag)) return f(reason, e);
|
|
11555
11565
|
return orElse ? orElse(reason, e) : fail$10(e);
|
|
@@ -12399,11 +12409,11 @@ const NoopSpanProto = {
|
|
|
12399
12409
|
const noopSpan = (options) => Object.assign(Object.create(NoopSpanProto), options);
|
|
12400
12410
|
const filterDisablePropagation = (span) => {
|
|
12401
12411
|
if (!span) return none();
|
|
12402
|
-
return get$
|
|
12412
|
+
return get$14(span.annotations, DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(getOrUndefined$1(span.parent)) : none() : some$1(span);
|
|
12403
12413
|
};
|
|
12404
12414
|
/** @internal */
|
|
12405
12415
|
const makeSpanUnsafe = (fiber, name, options) => {
|
|
12406
|
-
const disablePropagation = !fiber.cache.tracerEnabled || options?.annotations && get$
|
|
12416
|
+
const disablePropagation = !fiber.cache.tracerEnabled || options?.annotations && get$14(options.annotations, DisablePropagation);
|
|
12407
12417
|
const parent = options?.parent !== void 0 ? some$1(options.parent) : options?.root ? none() : filterDisablePropagation(fiber.cache.span);
|
|
12408
12418
|
let span;
|
|
12409
12419
|
if (disablePropagation) span = noopSpan({
|
|
@@ -15688,7 +15698,7 @@ const unwrapKey = /*#__PURE__*/ Service$1("effect/Layer/unwrap");
|
|
|
15688
15698
|
* @category converting
|
|
15689
15699
|
* @since 4.0.0
|
|
15690
15700
|
*/
|
|
15691
|
-
const unwrap$8 = (self) => flatMap$4(effect(unwrapKey)(self), get$
|
|
15701
|
+
const unwrap$8 = (self) => flatMap$4(effect(unwrapKey)(self), get$14(unwrapKey));
|
|
15692
15702
|
const mergeAllEffect = (layers, memoMap, scope) => {
|
|
15693
15703
|
const parentScope = forkUnsafe(scope, "parallel");
|
|
15694
15704
|
return forEach$2(layers, (layer) => layer.build(memoMap, forkUnsafe(parentScope, "sequential")), { concurrency: layers.length }).pipe(map$9((context) => mergeAll$3(...context)));
|
|
@@ -18184,7 +18194,7 @@ const fromIterable$7 = (entries) => {
|
|
|
18184
18194
|
* @category getters
|
|
18185
18195
|
* @since 2.0.0
|
|
18186
18196
|
*/
|
|
18187
|
-
const get$
|
|
18197
|
+
const get$11 = /*#__PURE__*/ dual(2, (self, key) => {
|
|
18188
18198
|
if (self.backing.has(key)) return some$1(self.backing.get(key));
|
|
18189
18199
|
else if (isSimpleKey(key)) return none();
|
|
18190
18200
|
const hash$3 = hash(key);
|
|
@@ -18228,7 +18238,7 @@ const getFromBucket = (self, bucket, key) => {
|
|
|
18228
18238
|
* @category predicates
|
|
18229
18239
|
* @since 2.0.0
|
|
18230
18240
|
*/
|
|
18231
|
-
const has$4 = /*#__PURE__*/ dual(2, (self, key) => isSome(get$
|
|
18241
|
+
const has$4 = /*#__PURE__*/ dual(2, (self, key) => isSome(get$11(self, key)));
|
|
18232
18242
|
/**
|
|
18233
18243
|
* Sets a key-value pair in the MutableHashMap, mutating the map in place.
|
|
18234
18244
|
* If the key already exists, its value is updated.
|
|
@@ -20237,7 +20247,7 @@ const catchDefect = catchDefect$1;
|
|
|
20237
20247
|
* @category error handling
|
|
20238
20248
|
* @since 2.0.0
|
|
20239
20249
|
*/
|
|
20240
|
-
const catchIf = catchIf$
|
|
20250
|
+
const catchIf$2 = catchIf$3;
|
|
20241
20251
|
/**
|
|
20242
20252
|
* Recovers from specific errors using a `Filter`.
|
|
20243
20253
|
*
|
|
@@ -30815,7 +30825,7 @@ var HashMapImpl = class {
|
|
|
30815
30825
|
const thatImpl = that;
|
|
30816
30826
|
if (this.size !== thatImpl.size) return false;
|
|
30817
30827
|
for (const [key, value] of this) {
|
|
30818
|
-
const otherValue = pipe(that, get$
|
|
30828
|
+
const otherValue = pipe(that, get$10(key));
|
|
30819
30829
|
if (isNone(otherValue) || !equals$1(value, otherValue.value)) return false;
|
|
30820
30830
|
}
|
|
30821
30831
|
return true;
|
|
@@ -30861,7 +30871,7 @@ const fromIterable$6 = (entries) => {
|
|
|
30861
30871
|
return new HashMapImpl(false, 0, root, size);
|
|
30862
30872
|
};
|
|
30863
30873
|
/** @internal */
|
|
30864
|
-
const get$
|
|
30874
|
+
const get$10 = /*#__PURE__*/ dual(2, (self, key) => {
|
|
30865
30875
|
return self._root.get(0, hash(key), key);
|
|
30866
30876
|
});
|
|
30867
30877
|
/** @internal */
|
|
@@ -30978,7 +30988,7 @@ const fromIterable$5 = fromIterable$6;
|
|
|
30978
30988
|
* @category getters
|
|
30979
30989
|
* @since 2.0.0
|
|
30980
30990
|
*/
|
|
30981
|
-
const get$
|
|
30991
|
+
const get$9 = get$10;
|
|
30982
30992
|
/**
|
|
30983
30993
|
* Sets the specified key to the specified value using the internal hashing
|
|
30984
30994
|
* function.
|
|
@@ -31697,7 +31707,7 @@ const TypeId$58 = /*#__PURE__*/ Symbol.for("~effect/http/Headers");
|
|
|
31697
31707
|
const Proto$19 = /*#__PURE__*/ Object.defineProperties(/*#__PURE__*/ Object.create(null), {
|
|
31698
31708
|
[TypeId$58]: { value: TypeId$58 },
|
|
31699
31709
|
[symbolRedactable]: { value(context) {
|
|
31700
|
-
return redact$1(this, get$
|
|
31710
|
+
return redact$1(this, get$14(context, CurrentRedactedNames$1));
|
|
31701
31711
|
} },
|
|
31702
31712
|
toJSON: { value() {
|
|
31703
31713
|
return redact$2(this);
|
|
@@ -31772,6 +31782,18 @@ const fromInput$1 = (input) => {
|
|
|
31772
31782
|
*/
|
|
31773
31783
|
const fromRecordUnsafe = (input) => Object.setPrototypeOf(input, Proto$19);
|
|
31774
31784
|
/**
|
|
31785
|
+
* Gets a header value by name safely.
|
|
31786
|
+
*
|
|
31787
|
+
* **Details**
|
|
31788
|
+
*
|
|
31789
|
+
* The lookup lowercases the provided header name and returns `Option.none()` when absent.
|
|
31790
|
+
*
|
|
31791
|
+
* @stability unstable
|
|
31792
|
+
* @category combinators
|
|
31793
|
+
* @since 4.0.0
|
|
31794
|
+
*/
|
|
31795
|
+
const get$8 = /*#__PURE__*/ dual(2, (self, key) => fromUndefinedOr(self[key.toLowerCase()]));
|
|
31796
|
+
/**
|
|
31775
31797
|
* Returns a new `Headers` collection with the given header set.
|
|
31776
31798
|
*
|
|
31777
31799
|
* **Details**
|
|
@@ -32127,7 +32149,7 @@ const Proto$18 = {
|
|
|
32127
32149
|
[symbolRedactable](context) {
|
|
32128
32150
|
return {
|
|
32129
32151
|
_id: "UrlParams",
|
|
32130
|
-
params: Object.fromEntries(redact(this, get$
|
|
32152
|
+
params: Object.fromEntries(redact(this, get$14(context, CurrentRedactedNames)))
|
|
32131
32153
|
};
|
|
32132
32154
|
},
|
|
32133
32155
|
toJSON() {
|
|
@@ -32328,7 +32350,7 @@ const decodeQueryKey = (key) => {
|
|
|
32328
32350
|
return key;
|
|
32329
32351
|
}
|
|
32330
32352
|
};
|
|
32331
|
-
const currentRedactedNames = () => get$
|
|
32353
|
+
const currentRedactedNames = () => get$14(globalThis["~effect/Fiber/currentFiber"]?.context ?? empty$18(), CurrentRedactedNames);
|
|
32332
32354
|
/**
|
|
32333
32355
|
* Query parameter names or patterns to redact in inspection, spans and errors.
|
|
32334
32356
|
*
|
|
@@ -35668,6 +35690,11 @@ function structWithRest(ast, records) {
|
|
|
35668
35690
|
return new Objects(propertySignatures, indexSignatures, void 0, checks);
|
|
35669
35691
|
}
|
|
35670
35692
|
/** @internal */
|
|
35693
|
+
function tupleWithRest(ast, rest) {
|
|
35694
|
+
if (ast.encoding) throw new Error("TupleWithRest does not support encodings");
|
|
35695
|
+
return new Arrays(ast.isMutable, ast.elements, rest, void 0, ast.checks);
|
|
35696
|
+
}
|
|
35697
|
+
/** @internal */
|
|
35671
35698
|
function mutable$1(ast) {
|
|
35672
35699
|
if (ast.encoding) throw new Error("mutable does not support encodings");
|
|
35673
35700
|
return new Arrays(true, ast.elements, ast.rest, ast.annotations, ast.checks, void 0, ast.context, ast.encodingChecks);
|
|
@@ -37152,30 +37179,6 @@ function decodeUnknownEffect$1(schema, options) {
|
|
|
37152
37179
|
const parser = run$5(schema.ast);
|
|
37153
37180
|
return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
|
|
37154
37181
|
}
|
|
37155
|
-
/**
|
|
37156
|
-
* Creates an effectful decoder for input already typed as the schema's `Encoded`
|
|
37157
|
-
* type.
|
|
37158
|
-
*
|
|
37159
|
-
* **When to use**
|
|
37160
|
-
*
|
|
37161
|
-
* Use when you already have input typed as the schema's `Encoded` type and
|
|
37162
|
-
* need an `Effect` whose failure channel is `SchemaIssue.Issue`, while
|
|
37163
|
-
* preserving decoding service requirements.
|
|
37164
|
-
*
|
|
37165
|
-
* **Details**
|
|
37166
|
-
*
|
|
37167
|
-
* The returned function succeeds with the decoded `Type` or fails with a
|
|
37168
|
-
* `SchemaIssue.Issue`, preserving any decoding service requirements in the
|
|
37169
|
-
* returned `Effect`.
|
|
37170
|
-
*
|
|
37171
|
-
* @see {@link decodeUnknownEffect} for untyped boundary input
|
|
37172
|
-
* @see {@link encodeEffect} for the opposite direction
|
|
37173
|
-
*
|
|
37174
|
-
* @stability stable
|
|
37175
|
-
* @category decoding
|
|
37176
|
-
* @since 4.0.0
|
|
37177
|
-
*/
|
|
37178
|
-
const decodeEffect$1 = decodeUnknownEffect$1;
|
|
37179
37182
|
/** @internal */
|
|
37180
37183
|
function decodeUnknownOption$1(schema, options) {
|
|
37181
37184
|
return asOption(decodeUnknownEffect$1(schema, options));
|
|
@@ -40611,6 +40614,43 @@ function Tuple(elements) {
|
|
|
40611
40614
|
return makeTuple(tuple(elements), elements);
|
|
40612
40615
|
}
|
|
40613
40616
|
/**
|
|
40617
|
+
* Extends a fixed-length tuple schema with a variadic rest segment.
|
|
40618
|
+
*
|
|
40619
|
+
* **Details**
|
|
40620
|
+
*
|
|
40621
|
+
* The `rest` argument must be a non-empty fixed-length tuple of schemas.
|
|
40622
|
+
*
|
|
40623
|
+
* The resulting tuple starts with the fixed elements from `schema`. The first
|
|
40624
|
+
* schema in `rest` is the repeatable element schema, and any additional schemas
|
|
40625
|
+
* in `rest` are required trailing tuple elements after the variadic segment. For
|
|
40626
|
+
* example, `[Schema.Boolean, Schema.String]` represents zero or more booleans
|
|
40627
|
+
* followed by a final string.
|
|
40628
|
+
*
|
|
40629
|
+
* **Example** (Defining tuples with rest elements)
|
|
40630
|
+
*
|
|
40631
|
+
* ```ts import.meta.vitest
|
|
40632
|
+
* import { Schema } from "effect"
|
|
40633
|
+
*
|
|
40634
|
+
* // [string, number, ...boolean[]]
|
|
40635
|
+
* const schema = Schema.TupleWithRest(
|
|
40636
|
+
* Schema.Tuple([Schema.String, Schema.Number]),
|
|
40637
|
+
* [Schema.Boolean]
|
|
40638
|
+
* )
|
|
40639
|
+
*
|
|
40640
|
+
* Schema.decodeUnknownSync(schema)(["hello", 1, true, false]) // => ["hello", 1, true, false]
|
|
40641
|
+
* ```
|
|
40642
|
+
*
|
|
40643
|
+
* @stability stable
|
|
40644
|
+
* @category constructors
|
|
40645
|
+
* @since 4.0.0
|
|
40646
|
+
*/
|
|
40647
|
+
function TupleWithRest(schema, rest) {
|
|
40648
|
+
return make$72(tupleWithRest(schema.ast, rest.map(getAST)), {
|
|
40649
|
+
schema,
|
|
40650
|
+
rest
|
|
40651
|
+
});
|
|
40652
|
+
}
|
|
40653
|
+
/**
|
|
40614
40654
|
* @category constructors
|
|
40615
40655
|
* @since 4.0.0
|
|
40616
40656
|
*/
|
|
@@ -43254,7 +43294,7 @@ const defaultTimeToLive = (_, _key) => infinity;
|
|
|
43254
43294
|
* @since 4.0.0
|
|
43255
43295
|
*/
|
|
43256
43296
|
const get$7 = /*#__PURE__*/ dual(2, (self, key) => withFiber$1((fiber) => {
|
|
43257
|
-
const oentry = get$
|
|
43297
|
+
const oentry = get$11(self.map, key);
|
|
43258
43298
|
if (isSome(oentry)) {
|
|
43259
43299
|
remove$3(self.map, key);
|
|
43260
43300
|
if (!hasExpired(oentry.value, fiber)) {
|
|
@@ -43307,7 +43347,7 @@ var EntryImpl = class {
|
|
|
43307
43347
|
}
|
|
43308
43348
|
};
|
|
43309
43349
|
const removeEntry = (self, key, entry) => {
|
|
43310
|
-
const current = get$
|
|
43350
|
+
const current = get$11(self.map, key);
|
|
43311
43351
|
if (isSome(current) && current.value === entry) remove$3(self.map, key);
|
|
43312
43352
|
};
|
|
43313
43353
|
const hasExpired = (entry, fiber) => {
|
|
@@ -44087,7 +44127,7 @@ const publishUnsafe = /*#__PURE__*/ dual(2, (self, value) => {
|
|
|
44087
44127
|
* @since 2.0.0
|
|
44088
44128
|
*/
|
|
44089
44129
|
const subscribe = (self) => uninterruptible(contextWith((services) => {
|
|
44090
|
-
const localScope = get$
|
|
44130
|
+
const localScope = get$14(services, Scope);
|
|
44091
44131
|
const scope = forkUnsafe(self.scope);
|
|
44092
44132
|
const subscription = makeSubscriptionUnsafe(self.pubsub, self.subscribers, self.strategy, self.ended);
|
|
44093
44133
|
return addFinalizer$1(scope, unsubscribe(subscription)).pipe(andThen(addFinalizerExit(localScope, (exit) => close(scope, exit))), as(subscription));
|
|
@@ -46200,6 +46240,38 @@ const catch_$1 = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter(self, findR
|
|
|
46200
46240
|
*/
|
|
46201
46241
|
const tapError$2 = /*#__PURE__*/ dual(2, (self, f) => transformPull$1(self, (pull) => succeed$5(tapError$3(pull, (err) => isDone$1(err) ? void_$2 : asVoid(f(err))))));
|
|
46202
46242
|
/**
|
|
46243
|
+
* Recovers from typed channel errors that match a predicate or refinement.
|
|
46244
|
+
*
|
|
46245
|
+
* **When to use**
|
|
46246
|
+
*
|
|
46247
|
+
* Use to recover from typed channel errors when a predicate or refinement
|
|
46248
|
+
* selects the failures that should switch to a recovery channel.
|
|
46249
|
+
*
|
|
46250
|
+
* **Details**
|
|
46251
|
+
*
|
|
46252
|
+
* Matching errors are handled by the recovery function. Non-matching errors
|
|
46253
|
+
* are handled by `orElse` when provided. Without `orElse`, non-matching errors
|
|
46254
|
+
* are re-failed.
|
|
46255
|
+
*
|
|
46256
|
+
* **Gotchas**
|
|
46257
|
+
*
|
|
46258
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
46259
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
46260
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
46261
|
+
*
|
|
46262
|
+
* @see {@link catch_ catch} for recovering from every typed channel error
|
|
46263
|
+
* @see {@link catchFilter} for selecting typed errors with a `Filter`
|
|
46264
|
+
* @see {@link catchTag} for selecting tagged typed errors
|
|
46265
|
+
* @see {@link catchCauseFilter} for selecting full causes with a `Filter`
|
|
46266
|
+
*
|
|
46267
|
+
* @stability stable
|
|
46268
|
+
* @category error handling
|
|
46269
|
+
* @since 4.0.0
|
|
46270
|
+
*/
|
|
46271
|
+
const catchIf$1 = /*#__PURE__*/ dual((args) => isChannel(args[0]), (self, predicate, f, orElse) => catch_$1(self, (err) => {
|
|
46272
|
+
return predicate(err) ? f(err) : orElse ? orElse(err) : fail$1(err);
|
|
46273
|
+
}));
|
|
46274
|
+
/**
|
|
46203
46275
|
* Recovers from typed channel errors selected by a `Filter`.
|
|
46204
46276
|
*
|
|
46205
46277
|
* **When to use**
|
|
@@ -47496,7 +47568,7 @@ const walk = /*#__PURE__*/ fnUntraced(function* (fs, compiled, options) {
|
|
|
47496
47568
|
const isUnlisted = (value) => value === "." || value === ".." || isRoot(value);
|
|
47497
47569
|
const probe = (parent, name, named) => {
|
|
47498
47570
|
const path = toFsPath(join$2(parent, name));
|
|
47499
|
-
return fs.stat(path).pipe(map$7((info) => info.type), catchReason$2("PlatformError", "NotFound", () => fs.readLink(path).pipe(as("SymbolicLink"), catchIf(isNotLink, () => succeed$5(void 0)))), catchIf(named ? isMissing : isIgnorable, () => succeed$5(void 0)), map$7((type) => type === void 0 ? void 0 : {
|
|
47571
|
+
return fs.stat(path).pipe(map$7((info) => info.type), catchReason$2("PlatformError", "NotFound", () => fs.readLink(path).pipe(as("SymbolicLink"), catchIf$2(isNotLink, () => succeed$5(void 0)))), catchIf$2(named ? isMissing : isIgnorable, () => succeed$5(void 0)), map$7((type) => type === void 0 ? void 0 : {
|
|
47500
47572
|
name,
|
|
47501
47573
|
type
|
|
47502
47574
|
}));
|
|
@@ -47510,7 +47582,7 @@ const walk = /*#__PURE__*/ fnUntraced(function* (fs, compiled, options) {
|
|
|
47510
47582
|
else if (node._tag !== "End") listed = true;
|
|
47511
47583
|
}
|
|
47512
47584
|
const probed = listed ? [...literals].filter(isUnlisted) : [...literals];
|
|
47513
|
-
return zipWith(listed ? catchIf(fs.readDirectoryEntries(toFsPath(relative)), named ? isMissing : isIgnorable, () => succeed$5([])) : succeed$5([]), forEach$1(probed, (name) => probe(relative, name, named), { concurrency: 16 }), (listing, found) => ({
|
|
47585
|
+
return zipWith(listed ? catchIf$2(fs.readDirectoryEntries(toFsPath(relative)), named ? isMissing : isIgnorable, () => succeed$5([])) : succeed$5([]), forEach$1(probed, (name) => probe(relative, name, named), { concurrency: 16 }), (listing, found) => ({
|
|
47514
47586
|
entries: sort([...listing, ...found.filter(isNotUndefined)], byName),
|
|
47515
47587
|
named: named && !listed
|
|
47516
47588
|
}));
|
|
@@ -47535,10 +47607,10 @@ const walk = /*#__PURE__*/ fnUntraced(function* (fs, compiled, options) {
|
|
|
47535
47607
|
if (!descend && !needsDirectory(compiled, next) && !excludeNeedsDirectory) return child(false, false);
|
|
47536
47608
|
if (type !== "Unknown" && type !== "SymbolicLink") return child(type === "Directory", false);
|
|
47537
47609
|
const path = toFsPath(relative);
|
|
47538
|
-
return fs.stat(path).pipe(map$7((info) => info.type === "Directory"), catchIf(isIgnorable, () => succeed$5(false)), flatMap$3((isDirectory) => {
|
|
47610
|
+
return fs.stat(path).pipe(map$7((info) => info.type === "Directory"), catchIf$2(isIgnorable, () => succeed$5(false)), flatMap$3((isDirectory) => {
|
|
47539
47611
|
const resolved = child(isDirectory, type === "SymbolicLink");
|
|
47540
47612
|
if (type === "SymbolicLink" || resolved?.next === void 0 || result.globstar.size === 0) return succeed$5(resolved);
|
|
47541
|
-
return fs.readLink(path).pipe(as(child(isDirectory, true)), catchIf(isNotLink, () => succeed$5(resolved)));
|
|
47613
|
+
return fs.readLink(path).pipe(as(child(isDirectory, true)), catchIf$2(isNotLink, () => succeed$5(resolved)));
|
|
47542
47614
|
}));
|
|
47543
47615
|
};
|
|
47544
47616
|
let slots = DIRECTORY_CONCURRENCY;
|
|
@@ -48082,7 +48154,7 @@ const makeUnsafe$3 = (options) => ({
|
|
|
48082
48154
|
*/
|
|
48083
48155
|
const make$66 = (options) => withFiber((fiber) => {
|
|
48084
48156
|
const context = fiber.context;
|
|
48085
|
-
const scope = get$
|
|
48157
|
+
const scope = get$14(context, Scope);
|
|
48086
48158
|
const self = makeUnsafe$3({
|
|
48087
48159
|
lookup: options.lookup,
|
|
48088
48160
|
context,
|
|
@@ -48149,7 +48221,7 @@ const get$5 = /*#__PURE__*/ dual(2, (self, key) => uninterruptibleMask((restore)
|
|
|
48149
48221
|
if (self.state._tag === "Closed") return interrupt$1;
|
|
48150
48222
|
const state = self.state;
|
|
48151
48223
|
const parent = getCurrent();
|
|
48152
|
-
const o = get$
|
|
48224
|
+
const o = get$11(state.map, key);
|
|
48153
48225
|
let entry;
|
|
48154
48226
|
if (o._tag === "Some") {
|
|
48155
48227
|
entry = o.value;
|
|
@@ -48183,7 +48255,7 @@ const get$5 = /*#__PURE__*/ dual(2, (self, key) => uninterruptibleMask((restore)
|
|
|
48183
48255
|
}));
|
|
48184
48256
|
const removeInterrupted = (self, key, entry, context) => {
|
|
48185
48257
|
if (self.state._tag === "Closed") return;
|
|
48186
|
-
const o = get$
|
|
48258
|
+
const o = get$11(self.state.map, key);
|
|
48187
48259
|
if (o._tag === "None" || o.value !== entry) return;
|
|
48188
48260
|
remove$3(self.state.map, key);
|
|
48189
48261
|
if (entry.refCount > 0) return;
|
|
@@ -48200,13 +48272,13 @@ const release$1 = (self, key, entry) => suspend$3(() => {
|
|
|
48200
48272
|
entry.refCount--;
|
|
48201
48273
|
if (entry.refCount > 0) return void_$2;
|
|
48202
48274
|
else if (self.state._tag === "Closed") return closeEntry(entry);
|
|
48203
|
-
const o = get$
|
|
48275
|
+
const o = get$11(self.state.map, key);
|
|
48204
48276
|
if (o._tag === "None" || o.value !== entry) return closeEntry(entry);
|
|
48205
48277
|
else if (isZero$1(entry.idleTimeToLive)) {
|
|
48206
48278
|
remove$3(self.state.map, key);
|
|
48207
48279
|
return closeEntry(entry);
|
|
48208
48280
|
} else if (!isFinite$2(entry.idleTimeToLive)) return void_$2;
|
|
48209
|
-
const clock = get$
|
|
48281
|
+
const clock = get$14(self.context, Clock);
|
|
48210
48282
|
resetExpiresAt(entry, clock);
|
|
48211
48283
|
if (entry.fiber) return void_$2;
|
|
48212
48284
|
entry.fiber = uninterruptibleMask(function loop(restore) {
|
|
@@ -48214,7 +48286,7 @@ const release$1 = (self, key, entry) => suspend$3(() => {
|
|
|
48214
48286
|
const remaining = entry.expiresAt - now;
|
|
48215
48287
|
if (remaining <= 0) {
|
|
48216
48288
|
if (self.state._tag === "Closed" || entry.refCount > 0) return void_$2;
|
|
48217
|
-
const o = get$
|
|
48289
|
+
const o = get$11(self.state.map, key);
|
|
48218
48290
|
if (o._tag === "None" || o.value !== entry) return void_$2;
|
|
48219
48291
|
remove$3(self.state.map, key);
|
|
48220
48292
|
return ignoreCause(close(entry.scope, void_$3), {
|
|
@@ -48256,7 +48328,7 @@ var RcRefImpl = class {
|
|
|
48256
48328
|
/** @internal */
|
|
48257
48329
|
const make$65 = (options) => withFiber((fiber) => {
|
|
48258
48330
|
const context = fiber.context;
|
|
48259
|
-
const scope = get$
|
|
48331
|
+
const scope = get$14(context, Scope);
|
|
48260
48332
|
const ref = new RcRefImpl(options.acquire, context, scope, options.idleTimeToLive !== void 0 ? fromInputUnsafe$1(options.idleTimeToLive) : void 0);
|
|
48261
48333
|
return as(addFinalizerExit(scope, () => {
|
|
48262
48334
|
const state = ref.state;
|
|
@@ -49529,6 +49601,47 @@ const catch_ = /*#__PURE__*/ dual(2, (self, f) => fromChannel(catch_$1(self.chan
|
|
|
49529
49601
|
*/
|
|
49530
49602
|
const tapError$1 = /*#__PURE__*/ dual(2, (self, f) => self.channel.pipe(tapError$2(f), fromChannel));
|
|
49531
49603
|
/**
|
|
49604
|
+
* Recovers from errors that match a predicate by switching to a recovery stream.
|
|
49605
|
+
*
|
|
49606
|
+
* **Details**
|
|
49607
|
+
*
|
|
49608
|
+
* When a failure matches the filter, the stream switches to the recovery
|
|
49609
|
+
* stream. Non-matching failures propagate downstream, so the error type is
|
|
49610
|
+
* preserved unless the filter narrows it.
|
|
49611
|
+
*
|
|
49612
|
+
* **Gotchas**
|
|
49613
|
+
*
|
|
49614
|
+
* If the cause contains a defect, the handler is skipped and every typed error
|
|
49615
|
+
* is converted to a defect, preserving reason order and interrupts. An
|
|
49616
|
+
* interruption alongside a typed error does not prevent recovery.
|
|
49617
|
+
*
|
|
49618
|
+
* **Example** (Catching matching failures)
|
|
49619
|
+
*
|
|
49620
|
+
* ```ts import.meta.vitest
|
|
49621
|
+
* import { Effect, Stream } from "effect"
|
|
49622
|
+
*
|
|
49623
|
+
* const stream = Stream.make(1, 2).pipe(
|
|
49624
|
+
* Stream.concat(Stream.fail(42)),
|
|
49625
|
+
* Stream.catchIf(
|
|
49626
|
+
* (error): error is 42 => error === 42,
|
|
49627
|
+
* () => Stream.make(999)
|
|
49628
|
+
* )
|
|
49629
|
+
* )
|
|
49630
|
+
*
|
|
49631
|
+
* const program = Effect.gen(function*() {
|
|
49632
|
+
* const values = yield* Stream.runCollect(stream)
|
|
49633
|
+
* values // => [ 1, 2, 999 ]
|
|
49634
|
+
* })
|
|
49635
|
+
*
|
|
49636
|
+
* await Effect.runPromise(program)
|
|
49637
|
+
* ```
|
|
49638
|
+
*
|
|
49639
|
+
* @stability stable
|
|
49640
|
+
* @category error handling
|
|
49641
|
+
* @since 4.0.0
|
|
49642
|
+
*/
|
|
49643
|
+
const catchIf = /*#__PURE__*/ dual((args) => isStream(args[0]), (self, predicate, f, orElse) => fromChannel(catchIf$1(toChannel(self), predicate, (e) => f(e).channel, orElse && ((e) => orElse(e).channel))));
|
|
49644
|
+
/**
|
|
49532
49645
|
* Recovers from errors that match a `Filter` by switching to a recovery
|
|
49533
49646
|
* stream.
|
|
49534
49647
|
*
|
|
@@ -53863,7 +53976,7 @@ const make$55 = /*#__PURE__*/ sync(() => {
|
|
|
53863
53976
|
};
|
|
53864
53977
|
const query = (keys, effect) => gen(function* () {
|
|
53865
53978
|
const services = yield* context();
|
|
53866
|
-
const scope = get$
|
|
53979
|
+
const scope = get$14(services, Scope);
|
|
53867
53980
|
const results = yield* make$84();
|
|
53868
53981
|
const runFork = flow(runForkWith(services), runIn(scope));
|
|
53869
53982
|
let running = false;
|
|
@@ -55253,7 +55366,7 @@ const makeSqliteAcquirers = (options) => {
|
|
|
55253
55366
|
}) });
|
|
55254
55367
|
const rollback = (conn) => {
|
|
55255
55368
|
if (isTransaction) return isTransaction(conn) ? asVoid(conn.executeUnprepared("ROLLBACK", [], void 0)) : void_$2;
|
|
55256
|
-
return conn.executeUnprepared("ROLLBACK", [], void 0).pipe(asVoid, catchIf(isNoTransactionError, () => void_$2));
|
|
55369
|
+
return conn.executeUnprepared("ROLLBACK", [], void 0).pipe(asVoid, catchIf$2(isNoTransactionError, () => void_$2));
|
|
55257
55370
|
};
|
|
55258
55371
|
const available = flatMap$3(options.connection, (conn) => {
|
|
55259
55372
|
if (poisoned === void 0) return succeed$5(conn);
|
|
@@ -58304,6 +58417,14 @@ const updateContentLength = (headers, body) => {
|
|
|
58304
58417
|
const contentLength = body._tag === "Empty" || body._tag === "FormData" ? void 0 : body.contentLength;
|
|
58305
58418
|
return contentLength === void 0 ? remove$1(headers, "content-length") : set$2(headers, "content-length", contentLength.toString());
|
|
58306
58419
|
};
|
|
58420
|
+
/**
|
|
58421
|
+
* @internal
|
|
58422
|
+
*/
|
|
58423
|
+
const parseContentLength = (contentLength) => {
|
|
58424
|
+
if (contentLength === null || contentLength === void 0 || !/^\d+$/.test(contentLength)) return;
|
|
58425
|
+
const parsed = Number(contentLength);
|
|
58426
|
+
return Number.isSafeInteger(parsed) ? parsed : void 0;
|
|
58427
|
+
};
|
|
58307
58428
|
// ../../node_modules/.pnpm/effect@4.1.4/node_modules/effect/dist/http/Url.js
|
|
58308
58429
|
/**
|
|
58309
58430
|
* Parses and edits platform `URL` values.
|
|
@@ -59176,6 +59297,28 @@ const setStatus = /*#__PURE__*/ dual((args) => isHttpServerResponse(args[0]), (s
|
|
|
59176
59297
|
* @since 4.0.0
|
|
59177
59298
|
*/
|
|
59178
59299
|
const omitsBody = (response, withoutBody = false) => withoutBody || response.status === 204 || response.status === 205 || response.status === 304;
|
|
59300
|
+
/**
|
|
59301
|
+
* Converts an `HttpClientResponse` to an `HttpServerResponse`.
|
|
59302
|
+
*
|
|
59303
|
+
* **Details**
|
|
59304
|
+
*
|
|
59305
|
+
* The response body is streamed from the client response. `Set-Cookie` headers are
|
|
59306
|
+
* removed from the header map and represented in the response cookie collection.
|
|
59307
|
+
*
|
|
59308
|
+
* @stability unstable
|
|
59309
|
+
* @category converting
|
|
59310
|
+
* @since 4.0.0
|
|
59311
|
+
*/
|
|
59312
|
+
const fromClientResponse = (response) => {
|
|
59313
|
+
const headers = remove$1(response.headers, "set-cookie");
|
|
59314
|
+
return makeResponse$2({
|
|
59315
|
+
status: response.status,
|
|
59316
|
+
headers,
|
|
59317
|
+
cookies: response.cookies,
|
|
59318
|
+
body: stream$2(catchIf(response.stream, isEmptyBodyError, () => empty$6), getOrUndefined$1(get$8(headers, "content-type")), parseContentLength(headers["content-length"]))
|
|
59319
|
+
});
|
|
59320
|
+
};
|
|
59321
|
+
const isEmptyBodyError = (error) => isHttpClientError(error) && error.reason._tag === "EmptyBodyError";
|
|
59179
59322
|
const Proto$8 = {
|
|
59180
59323
|
...PipeInspectableProto,
|
|
59181
59324
|
[TypeId$20]: TypeId$20,
|
|
@@ -61403,7 +61546,7 @@ const isMultipartError = (u) => hasProperty(u, MultipartErrorTypeId);
|
|
|
61403
61546
|
* @since 4.0.0
|
|
61404
61547
|
*/
|
|
61405
61548
|
const makeConfig = (headers) => withFiber((fiber) => {
|
|
61406
|
-
const mimeTypes = get$
|
|
61549
|
+
const mimeTypes = get$14(fiber.context, FieldMimeTypes);
|
|
61407
61550
|
return succeed$5({
|
|
61408
61551
|
headers,
|
|
61409
61552
|
maxParts: fiber.getRef(MaxParts),
|
|
@@ -63189,7 +63332,7 @@ var MiddlewareImpl = class MiddlewareImpl {
|
|
|
63189
63332
|
const stack = [getOrUndefinedUnsafe(context$4, fnContextKey)];
|
|
63190
63333
|
if (this.dependencies) {
|
|
63191
63334
|
const memoMap = yield* CurrentMemoMap;
|
|
63192
|
-
const scope = get$
|
|
63335
|
+
const scope = get$14(context$4, Scope);
|
|
63193
63336
|
const depsContext = yield* buildWithMemoMap(this.dependencies, memoMap, scope);
|
|
63194
63337
|
stack.push(...getMiddleware$1(depsContext));
|
|
63195
63338
|
}
|
|
@@ -63244,9 +63387,9 @@ const serve = (appLayer, options) => {
|
|
|
63244
63387
|
const layerWithRouter = provideMerge(appLayer, options?.routerConfig ? provide$2(layer$20, succeed$6(RouterConfig)(options.routerConfig)) : layer$20);
|
|
63245
63388
|
return contextWith((context) => {
|
|
63246
63389
|
const memoMap = CurrentMemoMap.forkOrCreate(context);
|
|
63247
|
-
return buildWithMemoMap(layerWithRouter, memoMap, get$
|
|
63390
|
+
return buildWithMemoMap(layerWithRouter, memoMap, get$14(context, Scope));
|
|
63248
63391
|
}).pipe(map$7((context) => {
|
|
63249
|
-
const handler = get$
|
|
63392
|
+
const handler = get$14(context, HttpRouter).asHttpEffect();
|
|
63250
63393
|
return merge$4(middleware ? serve$1(handler, middleware) : serve$1(handler), succeedContext(context));
|
|
63251
63394
|
}), unwrap$8, options?.disableListenLog ? identity : withLogAddress);
|
|
63252
63395
|
};
|
|
@@ -65600,7 +65743,7 @@ const Strict = /*#__PURE__*/ Reference("effect/ai/Tool/Strict", { defaultValue:
|
|
|
65600
65743
|
* @category getters
|
|
65601
65744
|
* @since 4.0.0
|
|
65602
65745
|
*/
|
|
65603
|
-
const getStrictMode = (tool) => get$
|
|
65746
|
+
const getStrictMode = (tool) => get$14(tool.annotations, Strict);
|
|
65604
65747
|
const suspectRx = /"__proto__"\s*:|"constructor"\s*:|\\u/;
|
|
65605
65748
|
function _parse(text) {
|
|
65606
65749
|
const obj = JSON.parse(text);
|
|
@@ -73028,7 +73171,7 @@ const makeNoSerialization$1 = /*#__PURE__*/ fnUntraced(function* (group, options
|
|
|
73028
73171
|
const disableTracing = options?.disableTracing ?? false;
|
|
73029
73172
|
const generateRequestId = options?.generateRequestId ?? (() => requestIdCounter++);
|
|
73030
73173
|
const services = yield* context();
|
|
73031
|
-
const scope = get$
|
|
73174
|
+
const scope = get$14(services, Scope);
|
|
73032
73175
|
const entries = /* @__PURE__ */ new Map();
|
|
73033
73176
|
let isShutdown = false;
|
|
73034
73177
|
yield* addFinalizer$1(scope, withFiber((parent) => {
|
|
@@ -73375,7 +73518,7 @@ const makeRpcSchemas = (codecFor) => {
|
|
|
73375
73518
|
let entry = cache.get(rpc);
|
|
73376
73519
|
if (entry !== void 0) return entry;
|
|
73377
73520
|
const streamSchemas = getStreamSchemas(rpc.successSchema);
|
|
73378
|
-
const parseOptions = get$
|
|
73521
|
+
const parseOptions = get$14(rpc.annotations, ParseOptions);
|
|
73379
73522
|
const exitSchema$2 = exitSchema(rpc);
|
|
73380
73523
|
let decodeDiscardExit;
|
|
73381
73524
|
entry = {
|
|
@@ -80029,7 +80172,7 @@ const makeNoSerialization = /*#__PURE__*/ fnUntraced(function* (group, options)
|
|
|
80029
80172
|
const concurrency = options.concurrency ?? "unbounded";
|
|
80030
80173
|
const disableFatalDefects = options.disableFatalDefects ?? false;
|
|
80031
80174
|
const services = yield* context();
|
|
80032
|
-
const scope = get$
|
|
80175
|
+
const scope = get$14(services, Scope);
|
|
80033
80176
|
const trackFiber = runIn(forkUnsafe(scope, "parallel"));
|
|
80034
80177
|
const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* make$82(concurrency);
|
|
80035
80178
|
const clients = /* @__PURE__ */ new Map();
|
|
@@ -80270,7 +80413,7 @@ const rpcCodecs = (codecFor, rpc) => {
|
|
|
80270
80413
|
let codecs = shared ? sharedRpcCodecs.get(rpc) : void 0;
|
|
80271
80414
|
if (codecs === void 0) {
|
|
80272
80415
|
const streamSchemas = getStreamSchemas(rpc.successSchema);
|
|
80273
|
-
const parseOptions = get$
|
|
80416
|
+
const parseOptions = get$14(rpc.annotations, ParseOptions);
|
|
80274
80417
|
codecs = {
|
|
80275
80418
|
decode: decodeUnknownEffect(codecFor(rpc.payloadSchema), parseOptions),
|
|
80276
80419
|
encodeChunk: encodeUnknownEffect(codecFor(NonEmptyArray(isSome(streamSchemas) ? streamSchemas.value.success : Any)), parseOptions),
|
|
@@ -80408,7 +80551,7 @@ const make$21 = /*#__PURE__*/ fnUntraced(function* (group, options) {
|
|
|
80408
80551
|
const exitSchema$1 = exitSchema(rpc);
|
|
80409
80552
|
discardSchemas = {
|
|
80410
80553
|
...schemas,
|
|
80411
|
-
encodeExit: encodeUnknownEffect(codecFor(Exit(Void, exitSchema$1.error, exitSchema$1.defect)), get$
|
|
80554
|
+
encodeExit: encodeUnknownEffect(codecFor(Exit(Void, exitSchema$1.error, exitSchema$1.defect)), get$14(rpc.annotations, ParseOptions))
|
|
80412
80555
|
};
|
|
80413
80556
|
discardSchemasCache.set(rpc, discardSchemas);
|
|
80414
80557
|
}
|
|
@@ -80988,7 +81131,7 @@ const runMiddleware = (handler, middleware, invocation, request) => {
|
|
|
80988
81131
|
if (isSuccess$1(failure) && !hasDies(cause)) {
|
|
80989
81132
|
const error = failure.success.error;
|
|
80990
81133
|
if (isHidden(error)) return fail$6(error);
|
|
80991
|
-
if (middleware.length === 0 || get$
|
|
81134
|
+
if (middleware.length === 0 || get$14(reasonAnnotations(failure.success), HandlerFailure)) return failCause$3(cause);
|
|
80992
81135
|
if (isMcpError(error)) return rejectWith(error);
|
|
80993
81136
|
}
|
|
80994
81137
|
return logError(cause).pipe(andThen(report(cause)), andThen(rejectWith(internalError)));
|
|
@@ -81068,7 +81211,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$1()("effect/ai/Mc
|
|
|
81068
81211
|
const queued = {
|
|
81069
81212
|
notification,
|
|
81070
81213
|
delivered,
|
|
81071
|
-
requestLiveness: get$
|
|
81214
|
+
requestLiveness: get$14(fiber.context, RequestLiveness),
|
|
81072
81215
|
requestContext: getOrUndefined(fiber.context, McpRequestContext),
|
|
81073
81216
|
requestHeaders: getOrUndefined(fiber.context, HttpServerRequest)?.headers
|
|
81074
81217
|
};
|
|
@@ -81078,7 +81221,7 @@ var McpServer = class McpServer extends (/*#__PURE__*/ Service$1()("effect/ai/Mc
|
|
|
81078
81221
|
_tag: "Exit",
|
|
81079
81222
|
exit: void_$3
|
|
81080
81223
|
}));
|
|
81081
|
-
const requestQueue = get$
|
|
81224
|
+
const requestQueue = get$14(fiber.context, RequestNotificationQueue);
|
|
81082
81225
|
if (requestQueue !== void 0 && queued.requestContext !== void 0 && isRequestNotification(notification)) {
|
|
81083
81226
|
offerUnsafe(requestQueue, queued);
|
|
81084
81227
|
return andThen(_await(delivered), acknowledge);
|
|
@@ -82136,7 +82279,7 @@ const registerToolkit = /*#__PURE__*/ fnUntraced(function* (toolkit) {
|
|
|
82136
82279
|
const failure = findFail(cause);
|
|
82137
82280
|
if (isSuccess$1(failure)) {
|
|
82138
82281
|
const error = failure.success.error;
|
|
82139
|
-
const origin = get$
|
|
82282
|
+
const origin = get$14(reasonAnnotations(failure.success), FailureOrigin);
|
|
82140
82283
|
if (origin === "parameters" && isParameterValidationError(error)) return fail$6(new InvalidParams({ message: error.reason.message }));
|
|
82141
82284
|
if (origin === "handler" && isDeclaredFailure(error)) return catchCause$2(declaredFailureResult(error), internalToolError);
|
|
82142
82285
|
}
|
|
@@ -82151,10 +82294,10 @@ const registerToolkit = /*#__PURE__*/ fnUntraced(function* (toolkit) {
|
|
|
82151
82294
|
outputSchema,
|
|
82152
82295
|
annotations: {
|
|
82153
82296
|
...getOption(tool.annotations, Title).pipe(map$13((title) => ({ title })), getOrUndefined$1),
|
|
82154
|
-
readOnlyHint: get$
|
|
82155
|
-
destructiveHint: get$
|
|
82156
|
-
idempotentHint: get$
|
|
82157
|
-
openWorldHint: get$
|
|
82297
|
+
readOnlyHint: get$14(tool.annotations, Readonly),
|
|
82298
|
+
destructiveHint: get$14(tool.annotations, Destructive),
|
|
82299
|
+
idempotentHint: get$14(tool.annotations, Idempotent),
|
|
82300
|
+
openWorldHint: get$14(tool.annotations, OpenWorld)
|
|
82158
82301
|
},
|
|
82159
82302
|
_meta: toolMeta
|
|
82160
82303
|
});
|
|
@@ -93914,7 +94057,7 @@ const Formatter = /*#__PURE__*/ Reference("effect/cli/CliOutput", { defaultValue
|
|
|
93914
94057
|
*/
|
|
93915
94058
|
const defaultPresenter = { present: /*#__PURE__*/ fnUntraced(function* (event) {
|
|
93916
94059
|
const context$2 = yield* context();
|
|
93917
|
-
const formatter = getOrUndefined(context$2, Formatter) ?? defaultFormatter({ colors: get$
|
|
94060
|
+
const formatter = getOrUndefined(context$2, Formatter) ?? defaultFormatter({ colors: get$14(context$2, TerminalCapabilities).canColor });
|
|
93918
94061
|
switch (event._tag) {
|
|
93919
94062
|
case "Help": return yield* log(formatter.formatHelpDoc(event.helpDoc));
|
|
93920
94063
|
case "InvalidInvocation":
|
|
@@ -96336,7 +96479,7 @@ const defaults = { builtIns: BuiltIns };
|
|
|
96336
96479
|
*
|
|
96337
96480
|
* @internal
|
|
96338
96481
|
*/
|
|
96339
|
-
const resolveFormatter = /*#__PURE__*/ contextWith((context) => succeed$5(getOrUndefined(context, Formatter) ?? defaultFormatter({ colors: get$
|
|
96482
|
+
const resolveFormatter = /*#__PURE__*/ contextWith((context) => succeed$5(getOrUndefined(context, Formatter) ?? defaultFormatter({ colors: get$14(context, TerminalCapabilities).canColor })));
|
|
96340
96483
|
// ../../node_modules/.pnpm/effect@4.1.4/node_modules/effect/dist/cli/internal/lexer.js
|
|
96341
96484
|
/**
|
|
96342
96485
|
* @internal
|
|
@@ -98121,7 +98264,7 @@ const toInternalServerError = (request, cause) => new HttpServerError({ reason:
|
|
|
98121
98264
|
request,
|
|
98122
98265
|
cause
|
|
98123
98266
|
}) });
|
|
98124
|
-
const handlePlatformError = (request, self) => catchIf(self, (error) => error.reason._tag === "NotFound", () => fail$6(toRouteNotFoundError(request)), (error) => fail$6(toInternalServerError(request, error)));
|
|
98267
|
+
const handlePlatformError = (request, self) => catchIf$2(self, (error) => error.reason._tag === "NotFound", () => fail$6(toRouteNotFoundError(request)), (error) => fail$6(toInternalServerError(request, error)));
|
|
98125
98268
|
const acceptsHtml = (accept) => accept !== void 0 && accept.toLowerCase().includes("text/html");
|
|
98126
98269
|
const stripWeakEtagPrefix = (value) => {
|
|
98127
98270
|
const trimmed = value.trim();
|
|
@@ -106054,7 +106197,7 @@ const prepareTools$1 = /*#__PURE__*/ fnUntraced(function* ({ betas, capabilities
|
|
|
106054
106197
|
input_schema,
|
|
106055
106198
|
...isNotUndefined(description) ? { description } : void 0,
|
|
106056
106199
|
...isNotUndefined(strict) ? { strict } : void 0,
|
|
106057
|
-
...get$
|
|
106200
|
+
...get$14(tool.annotations, DeferLoading) ? { defer_loading: true } : void 0
|
|
106058
106201
|
});
|
|
106059
106202
|
if (capabilities.supportsStructuredOutput === true) betas.add("structured-outputs-2025-11-13");
|
|
106060
106203
|
}
|
|
@@ -110846,10 +110989,10 @@ const layerFlusher = /*#__PURE__*/ sync$1(Flusher, () => {
|
|
|
110846
110989
|
*/
|
|
110847
110990
|
const make$5 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
110848
110991
|
const services = yield* context();
|
|
110849
|
-
const clock = get$
|
|
110850
|
-
const scope = get$
|
|
110992
|
+
const clock = get$14(services, Clock);
|
|
110993
|
+
const scope = get$14(services, Scope);
|
|
110851
110994
|
const exportInterval = max$1(fromInputUnsafe$1(options.exportInterval), zero$2);
|
|
110852
|
-
const client = get$
|
|
110995
|
+
const client = get$14(services, HttpClient).pipe(tap((response) => ignore$1(response.arrayBuffer)), tapError((error) => error.response ? ignore$1(error.response.arrayBuffer) : void_$2), filterStatusOk, transformResponse(provideService$2(TracerPropagationEnabled, false)), retryTransient({
|
|
110853
110996
|
schedule: policy,
|
|
110854
110997
|
times: 3
|
|
110855
110998
|
}));
|
|
@@ -111520,7 +111663,20 @@ const layerRoutes = use((router) => gen(function* () {
|
|
|
111520
111663
|
if (isFailure$1(account)) return empty$1(failureOptions(account.failure, 401));
|
|
111521
111664
|
return yield* schemaJson(Account)(account.success, { headers: { "cache-control": "no-store" } });
|
|
111522
111665
|
}));
|
|
111523
|
-
for (const origin of toArray(issuer))
|
|
111666
|
+
for (const origin of toArray(issuer)) {
|
|
111667
|
+
yield* router.add("GET", "/auth/sign-in", map$7(HttpServerRequest, (request) => redirect(`${new URL("/sign-in", origin).href}?${new URLSearchParams({ next: new URL(request.url, "http://local").searchParams.get("next") ?? canonical })}`)));
|
|
111668
|
+
const client = yield* HttpClient;
|
|
111669
|
+
yield* router.add("POST", "/auth/sign-out", gen(function* () {
|
|
111670
|
+
const request = yield* HttpServerRequest;
|
|
111671
|
+
if (request.headers["origin"] !== new URL(canonical).origin) return text("Invalid sign-out origin; no changes committed", { status: 403 });
|
|
111672
|
+
const target = new URL("/sign-out", origin);
|
|
111673
|
+
target.search = new URLSearchParams({ next: new URL(request.url, canonical).searchParams.get("next") ?? canonical }).toString();
|
|
111674
|
+
return yield* pipe(client.post(target.href, { headers: {
|
|
111675
|
+
cookie: request.headers["cookie"] ?? "",
|
|
111676
|
+
origin: new URL(origin).origin
|
|
111677
|
+
} }), provideService$2(RequestInit, { redirect: "manual" }), timeout("10 seconds"), map$7(fromClientResponse), tapError$3(() => logWarning("Auth did not confirm sign-out")), catch_$2(() => succeed$5(text("Auth sign-out was not confirmed; the shared session may remain", { status: 503 }))));
|
|
111678
|
+
}));
|
|
111679
|
+
}
|
|
111524
111680
|
}));
|
|
111525
111681
|
function layerIcon(icon) {
|
|
111526
111682
|
const response = succeed$5(text(icon, {
|
|
@@ -111678,7 +111834,7 @@ const make$1 = (options) => gen(function* () {
|
|
|
111678
111834
|
timeToLive: (exit) => isSuccess(exit) ? prepareCacheTTL : zero$2
|
|
111679
111835
|
});
|
|
111680
111836
|
const runStatement = (statement, params, raw) => withFiber((fiber) => {
|
|
111681
|
-
const useSafeIntegers = get$
|
|
111837
|
+
const useSafeIntegers = get$14(fiber.context, SafeIntegers);
|
|
111682
111838
|
return try_({
|
|
111683
111839
|
try: () => {
|
|
111684
111840
|
statement.setReadBigInts(useSafeIntegers);
|
|
@@ -111693,7 +111849,7 @@ const make$1 = (options) => gen(function* () {
|
|
|
111693
111849
|
});
|
|
111694
111850
|
});
|
|
111695
111851
|
const runStatementValues = (statement, params) => withFiber((fiber) => {
|
|
111696
|
-
const useSafeIntegers = get$
|
|
111852
|
+
const useSafeIntegers = get$14(fiber.context, SafeIntegers);
|
|
111697
111853
|
return try_({
|
|
111698
111854
|
try: () => {
|
|
111699
111855
|
statement.setReadBigInts(useSafeIntegers);
|
|
@@ -111703,7 +111859,7 @@ const make$1 = (options) => gen(function* () {
|
|
|
111703
111859
|
});
|
|
111704
111860
|
});
|
|
111705
111861
|
const runStatementValuesUnprepared = (statement, params) => withFiber((fiber) => {
|
|
111706
|
-
const useSafeIntegers = get$
|
|
111862
|
+
const useSafeIntegers = get$14(fiber.context, SafeIntegers);
|
|
111707
111863
|
return try_({
|
|
111708
111864
|
try: () => {
|
|
111709
111865
|
statement.setReadBigInts(useSafeIntegers);
|
|
@@ -111850,6 +112006,7 @@ const dataDirectory = gen(function* () {
|
|
|
111850
112006
|
mode: 448,
|
|
111851
112007
|
recursive: true
|
|
111852
112008
|
});
|
|
112009
|
+
yield* (yield* FileSystem).chmod(directory, 448);
|
|
111853
112010
|
return directory;
|
|
111854
112011
|
});
|
|
111855
112012
|
const retiredSessions = effectDiscard(make$18({})({
|
|
@@ -112469,24 +112626,14 @@ const JsonFromString = (schema) => {
|
|
|
112469
112626
|
jsonUpdate: schema
|
|
112470
112627
|
});
|
|
112471
112628
|
};
|
|
112472
|
-
|
|
112473
|
-
const TimeFrame = Literals([
|
|
112629
|
+
Literals([
|
|
112474
112630
|
"10m",
|
|
112475
112631
|
"1h",
|
|
112476
112632
|
"24h",
|
|
112477
112633
|
"7d",
|
|
112478
112634
|
"30d"
|
|
112479
112635
|
]);
|
|
112480
|
-
|
|
112481
|
-
"1h": hours(1),
|
|
112482
|
-
"7d": days(7),
|
|
112483
|
-
"10m": minutes(10),
|
|
112484
|
-
"24h": days(1),
|
|
112485
|
-
"30d": days(30)
|
|
112486
|
-
};
|
|
112487
|
-
function timeFrameDuration(frame) {
|
|
112488
|
-
return TIME_FRAME_DURATIONS[frame];
|
|
112489
|
-
}
|
|
112636
|
+
hours(1), days(7), minutes(10), days(1), days(30);
|
|
112490
112637
|
const DateTimeUtcFromFiniteMillis = pipe(Finite.check(isBetween({
|
|
112491
112638
|
maximum: 864e13,
|
|
112492
112639
|
minimum: -864e13
|
|
@@ -112783,13 +112930,25 @@ Literals([
|
|
|
112783
112930
|
"sys",
|
|
112784
112931
|
"user"
|
|
112785
112932
|
]);
|
|
112786
|
-
const CpuCounters =
|
|
112933
|
+
const CpuCounters = TupleWithRest(Tuple([
|
|
112934
|
+
FiniteFromString,
|
|
112935
|
+
FiniteFromString,
|
|
112936
|
+
FiniteFromString,
|
|
112937
|
+
FiniteFromString,
|
|
112938
|
+
FiniteFromString
|
|
112939
|
+
]), [FiniteFromString]);
|
|
112787
112940
|
const LoadAverages = ArraySchema(FiniteFromString);
|
|
112788
112941
|
const CgroupPath = brand("DeployCgroupPath")(String$6);
|
|
112789
|
-
const HistoryMinutes = Literals(
|
|
112942
|
+
const HistoryMinutes = Literals([
|
|
112943
|
+
10,
|
|
112944
|
+
60,
|
|
112945
|
+
1440,
|
|
112946
|
+
10080,
|
|
112947
|
+
43200
|
|
112948
|
+
]);
|
|
112790
112949
|
const HistoryQuery = Struct$2({ minutes: pipe(HistoryMinutes, decodeTo(Duration, {
|
|
112791
112950
|
decode: transform$3(minutes),
|
|
112792
|
-
encode: transformEffect$1((range) => pipe(range, toMinutes,
|
|
112951
|
+
encode: transformEffect$1((range) => pipe(range, toMinutes, decodeUnknownEffect$1(HistoryMinutes)))
|
|
112793
112952
|
})) });
|
|
112794
112953
|
const HistoryToolInput = Struct$2({
|
|
112795
112954
|
...HistoryQuery.fields,
|
|
@@ -112924,7 +113083,7 @@ function caddyConfig(rows, storage) {
|
|
|
112924
113083
|
return `{\n\tadmin 127.0.0.1:20219\n\tgrace_period 10s\n\tpersist_config off\n\tstorage file_system {\n\t\troot ${encodeSync(fromJsonString(String$6))(storage)}\n\t}\n}\n\n${pipe(rows, filter$5((row) => row.kind === "public"), map$10((row) => `${row.hostname} {\n\tencode\n\treverse_proxy 127.0.0.1:${row.port}\n}\n`), join$4("\n"))}`;
|
|
112925
113084
|
}
|
|
112926
113085
|
function ownsMapping(status, row) {
|
|
112927
|
-
return !exists(status.AllowFunnel, (permissions) => permissions[`${row.hostname}:${row.port}`] === true) && pipe(status.Web, flatMap$8(get$
|
|
113086
|
+
return !exists(status.AllowFunnel, (permissions) => permissions[`${row.hostname}:${row.port}`] === true) && pipe(status.Web, flatMap$8(get$13(`${row.hostname}:${row.port}`)), exists((value) => size$4(value.Handlers) === 1 && pipe(value.Handlers, get$13("/"), flatMap$8((handler) => handler.Proxy), exists((proxy) => proxy === `http://127.0.0.1:${row.port}`))));
|
|
112928
113087
|
}
|
|
112929
113088
|
function exposureUrl(row) {
|
|
112930
113089
|
if (row.kind === "tailnet") return `https://${row.hostname}:${row.port}`;
|
|
@@ -113037,7 +113196,7 @@ var Exposures = class extends Service$1()("@deslop/deploy/services/exposures/ser
|
|
|
113037
113196
|
if (some(current, (row) => row.name === input.name)) return yield* DeployError.make({ message: "Remove the existing owned exposure before changing it" });
|
|
113038
113197
|
if (some(current, (row) => row.hostname === input.hostname && (row.kind === "public" || row.port === input.port))) return yield* DeployError.make({ message: "This hostname or port already has an owned exposure" });
|
|
113039
113198
|
if (input.kind === "public" && !input.publicAccess) return yield* DeployError.make({ message: "Explicitly confirm public access before publishing a port" });
|
|
113040
|
-
if (input.kind === "public" && platform !== "linux") return yield* DeployError.make({ message: "Public exposure needs a Linux worker; expose this port to the tailnet" });
|
|
113199
|
+
if (input.kind === "public" && (platform !== "linux" || arch !== "x64")) return yield* DeployError.make({ message: "Public exposure needs a Linux x64 worker; expose this port to the tailnet" });
|
|
113041
113200
|
const exposure = Exposure.make(omit(input, ["publicAccess"]));
|
|
113042
113201
|
if (exposure.kind === "tailnet") yield* checkTailnet(exposure);
|
|
113043
113202
|
yield* asStorageDeployError(insertExposure(exposure));
|
|
@@ -113141,11 +113300,14 @@ function unitFailures(text) {
|
|
|
113141
113300
|
const id = fields["Id"] ?? "";
|
|
113142
113301
|
const result = fields["Result"] ?? "";
|
|
113143
113302
|
const status = parse$2(fields["ExecMainStatus"] ?? "");
|
|
113144
|
-
if (!isNonEmpty$1(id) || !isNonEmpty$1(result) ||
|
|
113145
|
-
return
|
|
113146
|
-
|
|
113147
|
-
|
|
113148
|
-
|
|
113303
|
+
if (!isNonEmpty$1(id) || !isNonEmpty$1(result) || !isNonEmpty$1(fields["ExecMainCode"] ?? "")) return [];
|
|
113304
|
+
return match$8(status, {
|
|
113305
|
+
onNone: () => [],
|
|
113306
|
+
onSome: (exitStatus) => [[UnitId.make(id), {
|
|
113307
|
+
at: map$13(parse$2(replace(/^@/u, "")(fields["StateChangeTimestamp"] ?? "")), (seconds) => mapEpochMillis(makeUnsafe$5(0), () => seconds * 1e3)),
|
|
113308
|
+
reason: failureReason(result, exitStatus, fields["ExecMainCode"] !== "0")
|
|
113309
|
+
}]]
|
|
113310
|
+
});
|
|
113149
113311
|
}), fromEntries);
|
|
113150
113312
|
}
|
|
113151
113313
|
// src/services/inventory/lib/launchd.ts
|
|
@@ -113294,7 +113456,7 @@ function alias(value$4) {
|
|
|
113294
113456
|
return pipe(value(value$4), when("vite-plus", constant("vp")), orElse(() => value$4));
|
|
113295
113457
|
}
|
|
113296
113458
|
function shellRest(tokens) {
|
|
113297
|
-
const script = pipe(tokens, get$
|
|
113459
|
+
const script = pipe(tokens, get$12(2), getOrElse$1(constant("")));
|
|
113298
113460
|
const shifts = match$8(match$2(/\bshift\b/gu)(script), {
|
|
113299
113461
|
onNone: constant(0),
|
|
113300
113462
|
onSome: (matches) => matches.length
|
|
@@ -113315,11 +113477,11 @@ function unwrapTokens(tokens, cwd) {
|
|
|
113315
113477
|
},
|
|
113316
113478
|
onSome: (index) => drop$1(tokens, index + 1)
|
|
113317
113479
|
})), cwd);
|
|
113318
|
-
if (contains$1(SHELLS, name) && pipe(tokens, get$
|
|
113480
|
+
if (contains$1(SHELLS, name) && pipe(tokens, get$12(1), getOrElse$1(constant(""))) === "-c") return unwrapTokens(shellRest(tokens), cwd);
|
|
113319
113481
|
if (contains$1(RUNTIMES, name)) return pipe(tokens, findFirstIndex((token, index) => index > 0 && !isFlag(token)), match$8({
|
|
113320
113482
|
onNone: () => tokens,
|
|
113321
113483
|
onSome: (index) => {
|
|
113322
|
-
const script = pipe(tokens, get$
|
|
113484
|
+
const script = pipe(tokens, get$12(index), getOrElse$1(constant("")));
|
|
113323
113485
|
const pkg = capture(/.*node_modules\/((?:@[^/]+\/)?[^/.][^/]*)\//u, script);
|
|
113324
113486
|
const app = orElse$3(capture(/\.deslop\/([^/]+)\//u, script), () => flatMap$8(cwd, (value) => capture(/\/apps\/([^/]+)$/u, value)));
|
|
113325
113487
|
return [pipe(pkg, orElse$3(() => app), getOrElse$1(() => basename(script))), ...drop$1(tokens, index + 1)];
|
|
@@ -113344,7 +113506,7 @@ function scan(name, subject, args, words, values) {
|
|
|
113344
113506
|
onSome: (token) => {
|
|
113345
113507
|
if (isFlag(token)) {
|
|
113346
113508
|
const parsed = flagParts(token);
|
|
113347
|
-
const next = pipe(args, get$
|
|
113509
|
+
const next = pipe(args, get$12(1), filter$7((value) => !isFlag(value)));
|
|
113348
113510
|
const value = orElse$3(parsed.inline, () => next);
|
|
113349
113511
|
return scan(name, subject, match(isNone(parsed.inline) && isSome(next), {
|
|
113350
113512
|
onFalse: () => drop$1(args, 1),
|
|
@@ -113380,7 +113542,7 @@ function scan(name, subject, args, words, values) {
|
|
|
113380
113542
|
function commandLabel(argv, cwd) {
|
|
113381
113543
|
const [head = "", ...args] = unwrap(argv, cwd);
|
|
113382
113544
|
const name = alias(basename(head));
|
|
113383
|
-
const subject = pipe(SUBJECT, get$
|
|
113545
|
+
const subject = pipe(SUBJECT, get$13(name), getOrElse$1(() => empty$15()));
|
|
113384
113546
|
const scanned = scan(name, subject, args, [], {});
|
|
113385
113547
|
if (contains$1(SHELLS, name) && isReadonlyArrayEmpty(scanned.words)) return {
|
|
113386
113548
|
detail: pipe(cwd, map$13(basename), getOrElse$1(constant(""))),
|
|
@@ -113388,7 +113550,7 @@ function commandLabel(argv, cwd) {
|
|
|
113388
113550
|
};
|
|
113389
113551
|
return match$8(scanned.ssh, {
|
|
113390
113552
|
onNone: () => ({
|
|
113391
|
-
detail: join$4([...take$3(scanned.words, 2), ...filter$5(getSomes(map$10(subject, (flag) => get$
|
|
113553
|
+
detail: join$4([...take$3(scanned.words, 2), ...filter$5(getSomes(map$10(subject, (flag) => get$13(scanned.values, flag))), isNonEmpty$1)], " "),
|
|
113392
113554
|
name
|
|
113393
113555
|
}),
|
|
113394
113556
|
onSome: (ssh) => {
|
|
@@ -113408,7 +113570,7 @@ function sourceBelongsToWorker(source, worker) {
|
|
|
113408
113570
|
return source.name === worker || startsWith(`${worker} · `)(source.name);
|
|
113409
113571
|
}
|
|
113410
113572
|
function processOwner(cgroup) {
|
|
113411
|
-
const container = pipe(cgroup, match$2(/\/(?:docker-|docker\/)([a-f0-9]{12,64})(?:\.scope)?(?:\/|\n|$)/u), flatMap$8((match) => get$
|
|
113573
|
+
const container = pipe(cgroup, match$2(/\/(?:docker-|docker\/)([a-f0-9]{12,64})(?:\.scope)?(?:\/|\n|$)/u), flatMap$8((match) => get$12(match, 1)));
|
|
113412
113574
|
if (isSome(container)) return map$13(container, (id) => AppId.make(`container:${slice(0, 12)(id)}`));
|
|
113413
113575
|
const segments = split$1(cgroup, /[/\n]/u);
|
|
113414
113576
|
const service = findLastIndex(segments, endsWith(".service"));
|
|
@@ -113481,7 +113643,7 @@ function workloads(items) {
|
|
|
113481
113643
|
const attached = filter$5(byUnit[item.worker]?.[`unit:${unit}`] ?? [], (listener) => contains$2(listener.unit, unit));
|
|
113482
113644
|
const bindings = pipe(item.bindings, getOrElse$1(empty$15), map$10((binding) => ({
|
|
113483
113645
|
...item,
|
|
113484
|
-
...pipe(get$
|
|
113646
|
+
...pipe(get$9(bySocket, socket(item.worker, {
|
|
113485
113647
|
address: some$1(binding.address),
|
|
113486
113648
|
port: some$1(binding.port),
|
|
113487
113649
|
protocol: some$1(binding.protocol)
|
|
@@ -113597,7 +113759,7 @@ function processTree(rows) {
|
|
|
113597
113759
|
const visited = empty$5();
|
|
113598
113760
|
function build(row) {
|
|
113599
113761
|
add$1(visited, row.pid);
|
|
113600
|
-
const below = pipe(get$
|
|
113762
|
+
const below = pipe(get$13(children, `${row.pid}`), getOrElse$1(empty$15), filter$5((child) => !has(visited, child.pid)), map$10(build));
|
|
113601
113763
|
const self = {
|
|
113602
113764
|
children: [],
|
|
113603
113765
|
command: row.command,
|
|
@@ -113629,12 +113791,9 @@ function processTree(rows) {
|
|
|
113629
113791
|
function workerNames(snapshot) {
|
|
113630
113792
|
return dedupe([...snapshot.workers, ...map$10(snapshot.items, (item) => item.worker)]);
|
|
113631
113793
|
}
|
|
113632
|
-
function sourceWorker(source, workers, local) {
|
|
113633
|
-
return pipe(workers, findFirst((worker) => sourceBelongsToWorker(source, worker)), orElse$3(() => local));
|
|
113634
|
-
}
|
|
113635
113794
|
function errorsOf(sources, workers, worker) {
|
|
113636
113795
|
const local = head(workers);
|
|
113637
|
-
return pipe(sources, filter$5((source) =>
|
|
113796
|
+
return pipe(sources, filter$5((source) => pipe(workers, findFirst((candidate) => sourceBelongsToWorker(source, candidate)), orElse$3(() => local), contains$2(worker))), filterMap(fromPredicateOption((source) => map$13(source.error, (error) => `${replace(`${worker} · `, "")(source.name)}: ${error}`))));
|
|
113638
113797
|
}
|
|
113639
113798
|
function portsOf(row) {
|
|
113640
113799
|
return pipe([...row.listeners, ...row.exposures], filter$5((item) => !contains$2(item.address, "container")), map$10((item) => item.port), getSomes, dedupe, sort(Number$6));
|
|
@@ -113675,7 +113834,7 @@ function appOf(row, withProcesses) {
|
|
|
113675
113834
|
};
|
|
113676
113835
|
}
|
|
113677
113836
|
function exposureOf(item) {
|
|
113678
|
-
return {
|
|
113837
|
+
return map$13(item.url, (url) => ({
|
|
113679
113838
|
access: pipe(item.publicAccess, contains$2(true), match({
|
|
113680
113839
|
onFalse: constant("tailnet"),
|
|
113681
113840
|
onTrue: constant("public")
|
|
@@ -113683,8 +113842,8 @@ function exposureOf(item) {
|
|
|
113683
113842
|
id: item.id,
|
|
113684
113843
|
name: ExposureName.make(item.name),
|
|
113685
113844
|
port: item.port,
|
|
113686
|
-
url
|
|
113687
|
-
};
|
|
113845
|
+
url
|
|
113846
|
+
}));
|
|
113688
113847
|
}
|
|
113689
113848
|
function matches(row, app) {
|
|
113690
113849
|
const needle = toLowerCase(app);
|
|
@@ -113717,7 +113876,7 @@ function listApps(snapshot, input) {
|
|
|
113717
113876
|
})));
|
|
113718
113877
|
const exposures = pipe(own, flatMap$6((row) => {
|
|
113719
113878
|
if (row.item.kind !== "exposure" || onlyFailing) return [];
|
|
113720
|
-
return
|
|
113879
|
+
return toArray(exposureOf(row.item));
|
|
113721
113880
|
}), sort(mapInput(String$10, (exposure) => exposure.url)));
|
|
113722
113881
|
return {
|
|
113723
113882
|
apps,
|
|
@@ -113741,20 +113900,17 @@ function requestOf(item) {
|
|
|
113741
113900
|
}
|
|
113742
113901
|
const jobRequest = fnUntraced(function* (snapshot, input) {
|
|
113743
113902
|
const matching = filter$5(workloads(snapshot.items), (row) => contains$2(row.item.scheduled, true) && !exists(input.worker, (worker) => row.item.worker !== worker) && (workloadName(row.item) === input.job || row.item.name === input.job));
|
|
113744
|
-
if (
|
|
113903
|
+
if (!isArrayNonEmpty(matching)) return yield* DeployError.make({ message: `No scheduled job named ${input.job}; list_apps shows the jobs.` });
|
|
113745
113904
|
if (matching.length > 1) return yield* DeployError.make({ message: `${input.job} runs on more than one worker; pass its worker.` });
|
|
113746
|
-
return requestOf(
|
|
113905
|
+
return requestOf(headNonEmpty(matching).item);
|
|
113747
113906
|
});
|
|
113748
113907
|
// src/services/inventory/lib/processes.ts
|
|
113749
113908
|
const SECRET = /(?:token|secret|passw(?:or)?d|key|auth|credential|cookie|session)/iu;
|
|
113750
113909
|
const PROCESS_INTERVAL = seconds(2);
|
|
113751
113910
|
function processStatus(status) {
|
|
113752
|
-
const values = pipe(trim(status), split$1("\n"),
|
|
113753
|
-
const at = getOrThrow$1(indexOf(":")(line));
|
|
113754
|
-
return [slice(0, at)(line), trim(slice(at + 1)(line))];
|
|
113755
|
-
}));
|
|
113911
|
+
const values = pipe(trim(status), split$1("\n"), filterMap(fromPredicateOption((line) => map$13(indexOf(":")(line), (at) => [slice(0, at)(line), trim(slice(at + 1)(line))]))), fromEntries);
|
|
113756
113912
|
function field(name) {
|
|
113757
|
-
return pipe(get$
|
|
113913
|
+
return pipe(get$13(values, name), filter$7(isNonEmpty$1), getOrUndefined$1);
|
|
113758
113914
|
}
|
|
113759
113915
|
return {
|
|
113760
113916
|
memory: decodeSync(ResidentMemoryFromKiB)(split$1(values["VmRSS"] ?? "", /\s+/u)[0] || "0"),
|
|
@@ -113827,7 +113983,7 @@ function processUsage(current, previous) {
|
|
|
113827
113983
|
});
|
|
113828
113984
|
const process = {
|
|
113829
113985
|
...record.process,
|
|
113830
|
-
cpu: pipe(get$
|
|
113986
|
+
cpu: pipe(get$9(known, record.process.pid), filter$7((value) => equals$1(value.start, record.start) && isGreaterThan$3(elapsed, zero$2) && isGreaterThanOrEqualTo$3(record.ticks, value.ticks) && exists(previous, (old) => pipe(old.time, distance(current.time), isGreaterThanOrEqualTo$3(PROCESS_INTERVAL)) && pipe(old.time, distance(current.time), isLessThanOrEqualTo$3(seconds(90))))), map$13((value) => clamp(toMillis(subtract(record.ticks, value.ticks)) / toMillis(elapsed) * 100, {
|
|
113831
113987
|
maximum: 100,
|
|
113832
113988
|
minimum: 0
|
|
113833
113989
|
})))
|
|
@@ -113859,7 +114015,7 @@ function launchdProcesses(text, agents) {
|
|
|
113859
114015
|
function agent(pid, visited = empty$5()) {
|
|
113860
114016
|
if (has(visited, pid)) return none();
|
|
113861
114017
|
add$1(visited, pid);
|
|
113862
|
-
return pipe(agents, get$
|
|
114018
|
+
return pipe(agents, get$9(pid), orElse$3(() => pipe(parents, get$9(pid), flatMap$8((parent) => agent(parent, visited)))));
|
|
113863
114019
|
}
|
|
113864
114020
|
return getSomes(map$10(rows, (row) => flatMap$8(agent(row.pid), (unit) => map$13(all$4({
|
|
113865
114021
|
start: make$78(row.start),
|
|
@@ -114034,7 +114190,7 @@ function portItems(sockets, worker, http, source) {
|
|
|
114034
114190
|
}];
|
|
114035
114191
|
}), { concurrency: 8 })));
|
|
114036
114192
|
return yield* forEach$1(sockets, fnUntraced(function* (socket) {
|
|
114037
|
-
const origin = flatMap$8(socket.process, (process) => get$
|
|
114193
|
+
const origin = flatMap$8(socket.process, (process) => get$9(metadata, process.pid));
|
|
114038
114194
|
const unit = flatMap$8(origin, (process) => process.unit);
|
|
114039
114195
|
const process = flatMap$8(socket.process, (match) => {
|
|
114040
114196
|
if (!startsWith("node")(match.name)) return liftPredicate(match.name, isNonEmpty$1);
|
|
@@ -114159,7 +114315,7 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
114159
114315
|
return map$10(listed.rows, (row) => InventoryItem.make({
|
|
114160
114316
|
active: row.active === "active",
|
|
114161
114317
|
detail: `${scope} · ${row.description}`,
|
|
114162
|
-
failure: get$
|
|
114318
|
+
failure: get$13(failures, row.unit),
|
|
114163
114319
|
health: match(row.active === "failed", {
|
|
114164
114320
|
onFalse: constant("quiet"),
|
|
114165
114321
|
onTrue: constant("error")
|
|
@@ -114167,9 +114323,9 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
114167
114323
|
id: ItemId.make(`${worker}:${scope}:${row.unit}`),
|
|
114168
114324
|
kind: "service",
|
|
114169
114325
|
name: row.unit,
|
|
114170
|
-
next: flatten$6(get$
|
|
114326
|
+
next: flatten$6(get$9(scheduled, row.unit)),
|
|
114171
114327
|
running: row.active === "activating" || row.active === "deactivating" || row.active === "active" && row.sub === "running",
|
|
114172
|
-
scheduled: pipe(scheduled, get$
|
|
114328
|
+
scheduled: pipe(scheduled, get$9(row.unit), map$13(constTrue)),
|
|
114173
114329
|
scope: some$1(scope),
|
|
114174
114330
|
state: match(row.active === "active", {
|
|
114175
114331
|
onFalse: () => `${row.active} · ${row.sub}`,
|
|
@@ -114306,7 +114462,7 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
114306
114462
|
}
|
|
114307
114463
|
const records = map$12(launchd.table, (text) => {
|
|
114308
114464
|
const agents = fromIterable$5(map$10(apps, (app) => [app.pid, app.label]));
|
|
114309
|
-
return filter$5(launchdProcesses(text, agents), (record) => record.process.pid === selfProcess || !pipe(agents, get$
|
|
114465
|
+
return filter$5(launchdProcesses(text, agents), (record) => record.process.pid === selfProcess || !pipe(agents, get$9(selfProcess), contains$2(record.unit)));
|
|
114310
114466
|
});
|
|
114311
114467
|
const owned = getOrElse(records, empty$15);
|
|
114312
114468
|
return {
|
|
@@ -114497,9 +114653,9 @@ const SERIES = {
|
|
|
114497
114653
|
43200: hours(6)
|
|
114498
114654
|
};
|
|
114499
114655
|
function counters(stat, uptime, time) {
|
|
114500
|
-
const values =
|
|
114656
|
+
const values = decodeUnknownSync(CpuCounters)(pipe(stat, split$1("\n"), head, getOrElse$1(constant("")), trim, split$1(/\s+/u), drop$1(1), take$3(8)));
|
|
114501
114657
|
return {
|
|
114502
|
-
cpuIdle: millis((
|
|
114658
|
+
cpuIdle: millis((values[3] + values[4]) * 10),
|
|
114503
114659
|
cpuTotal: millis(sumAll(values) * 10),
|
|
114504
114660
|
time,
|
|
114505
114661
|
uptime: seconds(decodeSync(FiniteFromString)(split$1(uptime, " ")[0]))
|
|
@@ -114526,7 +114682,7 @@ function cpuCounters(cpus, uptime, time) {
|
|
|
114526
114682
|
}
|
|
114527
114683
|
function vmStatMemory(text, total) {
|
|
114528
114684
|
const pages = fromEntries(getSomes(pipe(text, split$1("\n"), map$10((line) => map$13(match$2(/^"?([^":]+)"?:\s+([0-9]+)\.$/u)(trim(line)), (match) => [match[1] ?? "", match[2] ?? ""])))));
|
|
114529
|
-
const page = decodeUnknownSync(FiniteFromString)(pipe(match$2(/page size of ([0-9]+) bytes/u)(text), flatMap$8(get$
|
|
114685
|
+
const page = decodeUnknownSync(FiniteFromString)(pipe(match$2(/page size of ([0-9]+) bytes/u)(text), flatMap$8(get$12(1)), getOrUndefined$1));
|
|
114530
114686
|
const counts = decodeUnknownSync(VmStatPages)(pages);
|
|
114531
114687
|
return {
|
|
114532
114688
|
total,
|
|
@@ -114673,7 +114829,7 @@ function history(samples, minutes, now) {
|
|
|
114673
114829
|
function bandName(id, labels) {
|
|
114674
114830
|
if (id === "other") return "Low impact";
|
|
114675
114831
|
if (id === "system") return "System";
|
|
114676
|
-
return pipe(labels, get$
|
|
114832
|
+
return pipe(labels, get$13(id), getOrElse$1(() => replaceAll(/^service:[a-z]+:(?:deslop-)?|\.service$/gu, "")(replace(/^container:/u, "container ")(id))));
|
|
114677
114833
|
}
|
|
114678
114834
|
function appCgroup(path, siblings) {
|
|
114679
114835
|
const name = getOrElse$1(last$1(split$1(path, "/")), constant(""));
|
|
@@ -114704,7 +114860,7 @@ function appShares(current, previous) {
|
|
|
114704
114860
|
const measured = isGreaterThan$3(elapsed, zero$2) && exists(previous, (old) => pipe(old.time, distance(current.time), isLessThanOrEqualTo$3(seconds(90))));
|
|
114705
114861
|
return pipe(toEntries(groupBy(toEntries(current.cgroups), (entry) => entry[1].id)), filter$5((entry) => sumAll(map$10(entry[1], (cgroup) => cgroup[1].memory)) >= 1024 ** 2), map$10((entry) => {
|
|
114706
114862
|
const [id, cgroups] = entry;
|
|
114707
|
-
const deltas = getSomes(map$10(cgroups, (cgroup) => pipe(flatMap$8(previous, (old) => get$
|
|
114863
|
+
const deltas = getSomes(map$10(cgroups, (cgroup) => pipe(flatMap$8(previous, (old) => get$13(old.cgroups, cgroup[0])), filter$7((old) => measured && isGreaterThanOrEqualTo$3(cgroup[1].usage, old.usage)), map$13((old) => toMicros(subtract(cgroup[1].usage, old.usage))))));
|
|
114708
114864
|
return {
|
|
114709
114865
|
cpu: match$6(deltas, {
|
|
114710
114866
|
onEmpty: () => none(),
|
|
@@ -114857,7 +115013,7 @@ var Metrics = class extends Service$1()("@deslop/deploy/services/metrics/service
|
|
|
114857
115013
|
});
|
|
114858
115014
|
const deleteExpired = void_({
|
|
114859
115015
|
Request: Sample.fields.time,
|
|
114860
|
-
execute: (now) => forEach$1([AppHistory.table, MachineSample.table], (table) => sql`DELETE FROM ${sql(table)} WHERE ${sql.or(map$10(
|
|
115016
|
+
execute: (now) => forEach$1([AppHistory.table, MachineSample.table], (table) => sql`DELETE FROM ${sql(table)} WHERE ${sql.or(map$10(HistoryMinutes.literals, (minutes$1) => sql`(step = ${toMillis(SERIES[minutes$1])} AND since < ${now - toMillis(minutes(minutes$1)) - toMillis(SERIES[minutes$1])})`))}`, { concurrency: 1 })
|
|
114861
115017
|
});
|
|
114862
115018
|
const previous = yield* make$56(none());
|
|
114863
115019
|
const lastApps = yield* make$56(none());
|
|
@@ -114882,22 +115038,27 @@ var Metrics = class extends Service$1()("@deslop/deploy/services/metrics/service
|
|
|
114882
115038
|
}
|
|
114883
115039
|
const appCgroups = walk([CgroupPath.make("")], []);
|
|
114884
115040
|
const apps = gen(function* () {
|
|
114885
|
-
const readings = yield* forEach$1(yield* appCgroups, (path) =>
|
|
114886
|
-
|
|
114887
|
-
|
|
114888
|
-
|
|
114889
|
-
|
|
114890
|
-
|
|
114891
|
-
|
|
114892
|
-
|
|
114893
|
-
|
|
114894
|
-
|
|
114895
|
-
|
|
114896
|
-
|
|
114897
|
-
|
|
114898
|
-
|
|
114899
|
-
|
|
114900
|
-
|
|
115041
|
+
const readings = yield* forEach$1(yield* appCgroups, (path) => match$8(processOwner(path), {
|
|
115042
|
+
onNone: () => fail$6(DeployError.make({ message: `The cgroup ${path} has no app owner.` })),
|
|
115043
|
+
onSome: fnUntraced(function* (id) {
|
|
115044
|
+
return yield* pipe(all$1({
|
|
115045
|
+
cpu: fs.readFileString(`${CGROUP}${path}/cpu.stat`),
|
|
115046
|
+
memory: fs.readFileString(`${CGROUP}${path}/memory.stat`)
|
|
115047
|
+
}, { concurrency: "unbounded" }), catchTag("PlatformError", (cause) => {
|
|
115048
|
+
if (isTagged(cause.reason, "NotFound")) return undefined_$1;
|
|
115049
|
+
return fail$6(cause);
|
|
115050
|
+
}), flatMap$3((stats) => {
|
|
115051
|
+
if (stats === void 0) return succeedNone;
|
|
115052
|
+
return match$8(cgroupUsage(stats.cpu, stats.memory), {
|
|
115053
|
+
onNone: () => fail$6(DeployError.make({ message: `The cgroup counters for ${path} are missing or invalid.` })),
|
|
115054
|
+
onSome: (usage) => succeedSome([path, {
|
|
115055
|
+
id,
|
|
115056
|
+
...usage
|
|
115057
|
+
}])
|
|
115058
|
+
});
|
|
115059
|
+
}));
|
|
115060
|
+
})
|
|
115061
|
+
}), { concurrency: 8 });
|
|
114901
115062
|
return fromEntries(getSomes(readings));
|
|
114902
115063
|
});
|
|
114903
115064
|
const refreshStorage = pipe(scoped(match(platform === "darwin", {
|
|
@@ -114992,7 +115153,7 @@ var Metrics = class extends Service$1()("@deslop/deploy/services/metrics/service
|
|
|
114992
115153
|
worker
|
|
114993
115154
|
});
|
|
114994
115155
|
const time = yield* now;
|
|
114995
|
-
const step =
|
|
115156
|
+
const step = SERIES[yield* asDeployError$1(encodeEffect(HistoryQuery.fields.minutes)(query.minutes))];
|
|
114996
115157
|
const samples = yield* asDeployError$1(listSeries({
|
|
114997
115158
|
after: subtractDuration(chartWindow(query.minutes, time).start, step),
|
|
114998
115159
|
step
|
|
@@ -115153,7 +115314,10 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
|
|
|
115153
115314
|
};
|
|
115154
115315
|
}), "Fleet.local");
|
|
115155
115316
|
const remote = fnUntraced(function* (worker, use) {
|
|
115156
|
-
const peer =
|
|
115317
|
+
const peer = yield* pipe(peers, get$13(worker.name), match$8({
|
|
115318
|
+
onNone: () => DeployError.make({ message: `Worker ${worker.name} is not configured.` }),
|
|
115319
|
+
onSome: succeed$5
|
|
115320
|
+
}));
|
|
115157
115321
|
if (!(yield* get$2(peer.connected))) return yield* DeployError.make({ message: "Worker is unreachable" });
|
|
115158
115322
|
return yield* pipe(use(peer.client), timeout(seconds(15)), withSpan("Fleet.remote", { attributes: { worker: worker.name } }));
|
|
115159
115323
|
});
|
|
@@ -115173,7 +115337,7 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
|
|
|
115173
115337
|
const time = yield* now;
|
|
115174
115338
|
const cached = yield* get$2(lastMetrics);
|
|
115175
115339
|
return [own, ...map$10(workers, (worker) => {
|
|
115176
|
-
const saved = get$
|
|
115340
|
+
const saved = get$9(cached, [worker.name, query.minutes]);
|
|
115177
115341
|
return {
|
|
115178
115342
|
...cachedHistory(query, time, saved),
|
|
115179
115343
|
error: match$8(saved, {
|
|
@@ -115219,7 +115383,7 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
|
|
|
115219
115383
|
worker: worker.name
|
|
115220
115384
|
})), tapError$3((cause) => logWarning("A worker history could not be read", cause)), catch_$2(fnUntraced(function* (cause) {
|
|
115221
115385
|
return {
|
|
115222
|
-
...cachedHistory(query, yield* now, get$
|
|
115386
|
+
...cachedHistory(query, yield* now, get$9(yield* get$2(lastMetrics), [worker.name, query.minutes])),
|
|
115223
115387
|
error: some$1(cause.message),
|
|
115224
115388
|
stale: true,
|
|
115225
115389
|
worker: worker.name
|
|
@@ -115393,8 +115557,10 @@ function checkWorker(snapshot, worker) {
|
|
|
115393
115557
|
failing: none(),
|
|
115394
115558
|
worker: none()
|
|
115395
115559
|
});
|
|
115396
|
-
|
|
115397
|
-
|
|
115560
|
+
return pipe(worker, filter$7((selected) => !some(workers, (row) => row.worker === selected)), match$8({
|
|
115561
|
+
onNone: () => void_$2,
|
|
115562
|
+
onSome: (selected) => fail$6(DeployError.make({ message: `Unknown worker ${selected}; valid workers: ${pipe(workers, map$10((row) => row.worker), join$4(", "))}. Nothing changed.` }))
|
|
115563
|
+
}));
|
|
115398
115564
|
}
|
|
115399
115565
|
function processPaths(tree, prefix) {
|
|
115400
115566
|
return flatMap$6(tree, (node, index) => [`${prefix}${index}`, ...processPaths(getOrElse$1(node.children, empty$15), `${prefix}${index}.`)]);
|
|
@@ -115452,16 +115618,20 @@ function inventoryPage(workers, input) {
|
|
|
115452
115618
|
};
|
|
115453
115619
|
}
|
|
115454
115620
|
function focusedInventory(workers, app) {
|
|
115455
|
-
|
|
115456
|
-
|
|
115457
|
-
|
|
115458
|
-
|
|
115459
|
-
|
|
115460
|
-
|
|
115461
|
-
|
|
115462
|
-
|
|
115463
|
-
|
|
115464
|
-
|
|
115621
|
+
return match$8(app, {
|
|
115622
|
+
onNone: () => workers,
|
|
115623
|
+
onSome: (queryText) => {
|
|
115624
|
+
const query = toLowerCase(queryText);
|
|
115625
|
+
function matchingName(row) {
|
|
115626
|
+
return pipe(row.name, toLowerCase, includes(query));
|
|
115627
|
+
}
|
|
115628
|
+
return map$10(workers, (worker) => ({
|
|
115629
|
+
...worker,
|
|
115630
|
+
exposures: pipe(worker.exposures, map$13((rows) => filter$5(rows, matchingName)), orElseSome(() => [])),
|
|
115631
|
+
jobs: pipe(worker.jobs, map$13((rows) => filter$5(rows, matchingName)), orElseSome(() => []))
|
|
115632
|
+
}));
|
|
115633
|
+
}
|
|
115634
|
+
});
|
|
115465
115635
|
}
|
|
115466
115636
|
function metricSummary(series) {
|
|
115467
115637
|
const values = getSomes(series);
|