@deslop/deploy 0.1.1348 → 0.1.1356
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)-Bis7Oi2o.js +64 -0
- package/dist/client/assets/{dropdown-menu-Dn2IgVIB.js → dropdown-menu-8489xqR3.js} +1 -1
- package/dist/client/assets/effect-B2m7fCEw.js +17 -0
- package/dist/client/assets/fleet-CZjkGb7_.js +2 -0
- package/dist/client/assets/index-DHQ87BlY.js +2 -0
- package/dist/client/assets/{result-error-DRDBz7c7.js → result-error-qEesekeA.js} +1 -1
- package/dist/client/assets/route-CCtePQ8D.js +1 -0
- package/dist/client/index.html +3 -3
- package/dist/server.js +361 -177
- package/package.json +2 -2
- package/dist/client/assets/(home)-ClQpa-Un.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/index-DAF-PLNU.js +0 -2
- package/dist/client/assets/route-DynyVony.js +0 -1
package/dist/server.js
CHANGED
|
@@ -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
|
*
|
|
@@ -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**
|
|
@@ -8911,7 +8909,7 @@ const Order$6 = /*#__PURE__*/ make$94((self, that) => matchPair(self, that, {
|
|
|
8911
8909
|
* @category instances
|
|
8912
8910
|
* @since 2.0.0
|
|
8913
8911
|
*/
|
|
8914
|
-
const Equivalence$
|
|
8912
|
+
const Equivalence$5 = (self, that) => matchPair(self, that, {
|
|
8915
8913
|
onMillis: (self, that) => self === that,
|
|
8916
8914
|
onNanos: (self, that) => self === that,
|
|
8917
8915
|
onInfinity: (self, that) => self.value._tag === that.value._tag
|
|
@@ -9174,7 +9172,7 @@ const isGreaterThanOrEqualTo$3 = /*#__PURE__*/ isGreaterThanOrEqualTo$4(Order$6)
|
|
|
9174
9172
|
* @category predicates
|
|
9175
9173
|
* @since 2.0.0
|
|
9176
9174
|
*/
|
|
9177
|
-
const equals = /*#__PURE__*/ dual(2, (self, that) => Equivalence$
|
|
9175
|
+
const equals = /*#__PURE__*/ dual(2, (self, that) => Equivalence$5(self, that));
|
|
9178
9176
|
/**
|
|
9179
9177
|
* Decomposes a `Duration` into normalized signed components.
|
|
9180
9178
|
*
|
|
@@ -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**
|
|
@@ -11901,6 +11911,8 @@ const onErrorFilter = /*#__PURE__*/ dual(3, (self, filter, f) => onExit$2(self,
|
|
|
11901
11911
|
const onInterrupt$1 = /*#__PURE__*/ dual(2, (self, finalizer) => onErrorFilter(causeFilterInterruptors, finalizer)(self));
|
|
11902
11912
|
/** @internal */
|
|
11903
11913
|
const acquireUseRelease$1 = (acquire, use, release) => uninterruptibleMask$1((restore) => flatMap$5(acquire, (a) => onExitPrimitive$1(suspend$4(() => restore(use(a))), (exit) => release(a, exit), true)));
|
|
11914
|
+
/** @internal */
|
|
11915
|
+
const cachedInvalidateWithTTL$1 = /*#__PURE__*/ dual(2, (self, ttl) => sync$2(() => makeCachedUnsafe(self, typeof ttl === "function" ? (exit) => toMillis(fromInputUnsafe$1(ttl(exit))) : constant(toMillis(fromInputUnsafe$1(ttl))))));
|
|
11904
11916
|
const infiniteTTL = /*#__PURE__*/ constant(Infinity);
|
|
11905
11917
|
const makeCachedUnsafe = (self, ttlMillis) => {
|
|
11906
11918
|
let expiresAt = 0;
|
|
@@ -16424,6 +16436,8 @@ const isUtc$1 = (self) => self._tag === "Utc";
|
|
|
16424
16436
|
/** @internal */
|
|
16425
16437
|
const isZoned = (self) => self._tag === "Zoned";
|
|
16426
16438
|
/** @internal */
|
|
16439
|
+
const Equivalence$4 = /*#__PURE__*/ make$95((a, b) => a.epochMilliseconds === b.epochMilliseconds);
|
|
16440
|
+
/** @internal */
|
|
16427
16441
|
const Order$5 = /*#__PURE__*/ make$94((self, that) => self.epochMilliseconds < that.epochMilliseconds ? -1 : self.epochMilliseconds > that.epochMilliseconds ? 1 : 0);
|
|
16428
16442
|
const makeUtc = (epochMillis) => {
|
|
16429
16443
|
const self = Object.create(ProtoUtc);
|
|
@@ -22164,6 +22178,66 @@ const onExit$1 = onExit$2;
|
|
|
22164
22178
|
*/
|
|
22165
22179
|
const cached = cached$1;
|
|
22166
22180
|
/**
|
|
22181
|
+
* Creates a cached effect result for a fixed duration or a duration computed
|
|
22182
|
+
* from its `Exit` and allows manual invalidation before expiration.
|
|
22183
|
+
*
|
|
22184
|
+
* **When to use**
|
|
22185
|
+
*
|
|
22186
|
+
* Use when an effect result should be cached for a bounded time and callers
|
|
22187
|
+
* also need a manual invalidation effect to force recomputation before
|
|
22188
|
+
* expiration.
|
|
22189
|
+
*
|
|
22190
|
+
* **Details**
|
|
22191
|
+
*
|
|
22192
|
+
* This function behaves similarly to {@link cachedWithTTL} by caching the
|
|
22193
|
+
* result of an effect for a specified period of time. However, it introduces an
|
|
22194
|
+
* additional feature: it provides an effect that allows you to manually
|
|
22195
|
+
* invalidate the cached result before it naturally expires.
|
|
22196
|
+
*
|
|
22197
|
+
* This gives you more control over the cache, allowing you to refresh the
|
|
22198
|
+
* result when needed, even if the original cache has not yet expired.
|
|
22199
|
+
*
|
|
22200
|
+
* Once the cache is invalidated, the next time the effect is evaluated, the
|
|
22201
|
+
* result will be recomputed, and the cache will be refreshed.
|
|
22202
|
+
*
|
|
22203
|
+
* **Example** (Memoizing with TTL and invalidation)
|
|
22204
|
+
*
|
|
22205
|
+
* ```ts import.meta.vitest
|
|
22206
|
+
* import { Effect } from "effect"
|
|
22207
|
+
* const output: Array<unknown> = []
|
|
22208
|
+
* const record = (value: unknown) => Effect.sync(() => { output.push(value) })
|
|
22209
|
+
*
|
|
22210
|
+
* let i = 1
|
|
22211
|
+
* const expensiveTask = Effect.sync(() => {
|
|
22212
|
+
* void output.push("expensive task...")
|
|
22213
|
+
* return `result ${i++}`
|
|
22214
|
+
* })
|
|
22215
|
+
*
|
|
22216
|
+
* const program = Effect.gen(function*() {
|
|
22217
|
+
* const [cached, invalidate] = yield* Effect.cachedInvalidateWithTTL(
|
|
22218
|
+
* expensiveTask,
|
|
22219
|
+
* "1 hour"
|
|
22220
|
+
* )
|
|
22221
|
+
* yield* cached.pipe(Effect.andThen(record))
|
|
22222
|
+
* yield* cached.pipe(Effect.andThen(record))
|
|
22223
|
+
* yield* invalidate
|
|
22224
|
+
* yield* cached.pipe(Effect.andThen(record))
|
|
22225
|
+
* })
|
|
22226
|
+
*
|
|
22227
|
+
* Effect.runSync(program)
|
|
22228
|
+
* output // => ["expensive task...", "result 1", "result 1", "expensive task...", "result 2"]
|
|
22229
|
+
* ```
|
|
22230
|
+
*
|
|
22231
|
+
* @see {@link cached} for a similar function that caches the result
|
|
22232
|
+
* indefinitely.
|
|
22233
|
+
* @see {@link cachedWithTTL} for a similar function that caches the result for
|
|
22234
|
+
* a specified duration but does not include an effect for manual invalidation.
|
|
22235
|
+
* @stability stable
|
|
22236
|
+
* @category caching
|
|
22237
|
+
* @since 2.0.0
|
|
22238
|
+
*/
|
|
22239
|
+
const cachedInvalidateWithTTL = cachedInvalidateWithTTL$1;
|
|
22240
|
+
/**
|
|
22167
22241
|
* Returns an effect that is immediately interrupted.
|
|
22168
22242
|
*
|
|
22169
22243
|
* **Example** (Creating an interrupted effect)
|
|
@@ -29946,6 +30020,32 @@ const isDateTime = isDateTime$1;
|
|
|
29946
30020
|
*/
|
|
29947
30021
|
const isUtc = isUtc$1;
|
|
29948
30022
|
/**
|
|
30023
|
+
* Provides an `Equivalence` for comparing two `DateTime` values for equality.
|
|
30024
|
+
*
|
|
30025
|
+
* **Details**
|
|
30026
|
+
*
|
|
30027
|
+
* Two `DateTime` values are considered equivalent if they represent the same
|
|
30028
|
+
* point in time, regardless of their time zone.
|
|
30029
|
+
*
|
|
30030
|
+
* **Example** (Comparing DateTime values for equivalence)
|
|
30031
|
+
*
|
|
30032
|
+
* ```ts import.meta.vitest
|
|
30033
|
+
* import { DateTime } from "effect"
|
|
30034
|
+
*
|
|
30035
|
+
* const utc = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
30036
|
+
* const zoned = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
|
|
30037
|
+
* timeZone: "Europe/London"
|
|
30038
|
+
* })
|
|
30039
|
+
*
|
|
30040
|
+
* DateTime.Equivalence(utc, zoned) // => true
|
|
30041
|
+
* ```
|
|
30042
|
+
*
|
|
30043
|
+
* @stability stable
|
|
30044
|
+
* @category instances
|
|
30045
|
+
* @since 3.6.0
|
|
30046
|
+
*/
|
|
30047
|
+
const Equivalence$3 = Equivalence$4;
|
|
30048
|
+
/**
|
|
29949
30049
|
* Provides an `Order` for comparing and sorting `DateTime` values.
|
|
29950
30050
|
*
|
|
29951
30051
|
* **Details**
|
|
@@ -35680,6 +35780,11 @@ function structWithRest(ast, records) {
|
|
|
35680
35780
|
return new Objects(propertySignatures, indexSignatures, void 0, checks);
|
|
35681
35781
|
}
|
|
35682
35782
|
/** @internal */
|
|
35783
|
+
function tupleWithRest(ast, rest) {
|
|
35784
|
+
if (ast.encoding) throw new Error("TupleWithRest does not support encodings");
|
|
35785
|
+
return new Arrays(ast.isMutable, ast.elements, rest, void 0, ast.checks);
|
|
35786
|
+
}
|
|
35787
|
+
/** @internal */
|
|
35683
35788
|
function mutable$1(ast) {
|
|
35684
35789
|
if (ast.encoding) throw new Error("mutable does not support encodings");
|
|
35685
35790
|
return new Arrays(true, ast.elements, ast.rest, ast.annotations, ast.checks, void 0, ast.context, ast.encodingChecks);
|
|
@@ -37164,30 +37269,6 @@ function decodeUnknownEffect$1(schema, options) {
|
|
|
37164
37269
|
const parser = run$5(schema.ast);
|
|
37165
37270
|
return options === void 0 ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
|
|
37166
37271
|
}
|
|
37167
|
-
/**
|
|
37168
|
-
* Creates an effectful decoder for input already typed as the schema's `Encoded`
|
|
37169
|
-
* type.
|
|
37170
|
-
*
|
|
37171
|
-
* **When to use**
|
|
37172
|
-
*
|
|
37173
|
-
* Use when you already have input typed as the schema's `Encoded` type and
|
|
37174
|
-
* need an `Effect` whose failure channel is `SchemaIssue.Issue`, while
|
|
37175
|
-
* preserving decoding service requirements.
|
|
37176
|
-
*
|
|
37177
|
-
* **Details**
|
|
37178
|
-
*
|
|
37179
|
-
* The returned function succeeds with the decoded `Type` or fails with a
|
|
37180
|
-
* `SchemaIssue.Issue`, preserving any decoding service requirements in the
|
|
37181
|
-
* returned `Effect`.
|
|
37182
|
-
*
|
|
37183
|
-
* @see {@link decodeUnknownEffect} for untyped boundary input
|
|
37184
|
-
* @see {@link encodeEffect} for the opposite direction
|
|
37185
|
-
*
|
|
37186
|
-
* @stability stable
|
|
37187
|
-
* @category decoding
|
|
37188
|
-
* @since 4.0.0
|
|
37189
|
-
*/
|
|
37190
|
-
const decodeEffect$1 = decodeUnknownEffect$1;
|
|
37191
37272
|
/** @internal */
|
|
37192
37273
|
function decodeUnknownOption$1(schema, options) {
|
|
37193
37274
|
return asOption(decodeUnknownEffect$1(schema, options));
|
|
@@ -40623,6 +40704,43 @@ function Tuple(elements) {
|
|
|
40623
40704
|
return makeTuple(tuple(elements), elements);
|
|
40624
40705
|
}
|
|
40625
40706
|
/**
|
|
40707
|
+
* Extends a fixed-length tuple schema with a variadic rest segment.
|
|
40708
|
+
*
|
|
40709
|
+
* **Details**
|
|
40710
|
+
*
|
|
40711
|
+
* The `rest` argument must be a non-empty fixed-length tuple of schemas.
|
|
40712
|
+
*
|
|
40713
|
+
* The resulting tuple starts with the fixed elements from `schema`. The first
|
|
40714
|
+
* schema in `rest` is the repeatable element schema, and any additional schemas
|
|
40715
|
+
* in `rest` are required trailing tuple elements after the variadic segment. For
|
|
40716
|
+
* example, `[Schema.Boolean, Schema.String]` represents zero or more booleans
|
|
40717
|
+
* followed by a final string.
|
|
40718
|
+
*
|
|
40719
|
+
* **Example** (Defining tuples with rest elements)
|
|
40720
|
+
*
|
|
40721
|
+
* ```ts import.meta.vitest
|
|
40722
|
+
* import { Schema } from "effect"
|
|
40723
|
+
*
|
|
40724
|
+
* // [string, number, ...boolean[]]
|
|
40725
|
+
* const schema = Schema.TupleWithRest(
|
|
40726
|
+
* Schema.Tuple([Schema.String, Schema.Number]),
|
|
40727
|
+
* [Schema.Boolean]
|
|
40728
|
+
* )
|
|
40729
|
+
*
|
|
40730
|
+
* Schema.decodeUnknownSync(schema)(["hello", 1, true, false]) // => ["hello", 1, true, false]
|
|
40731
|
+
* ```
|
|
40732
|
+
*
|
|
40733
|
+
* @stability stable
|
|
40734
|
+
* @category constructors
|
|
40735
|
+
* @since 4.0.0
|
|
40736
|
+
*/
|
|
40737
|
+
function TupleWithRest(schema, rest) {
|
|
40738
|
+
return make$72(tupleWithRest(schema.ast, rest.map(getAST)), {
|
|
40739
|
+
schema,
|
|
40740
|
+
rest
|
|
40741
|
+
});
|
|
40742
|
+
}
|
|
40743
|
+
/**
|
|
40626
40744
|
* @category constructors
|
|
40627
40745
|
* @since 4.0.0
|
|
40628
40746
|
*/
|
|
@@ -110654,7 +110772,7 @@ const RUNTIME_PATH = "/api/runtime";
|
|
|
110654
110772
|
const RuntimeConfig = Struct$2({
|
|
110655
110773
|
auth: OptionFromOptionalKey(Origin),
|
|
110656
110774
|
name: String$6,
|
|
110657
|
-
traces:
|
|
110775
|
+
traces: OptionFromOptionalKey(Origin),
|
|
110658
110776
|
version: AppVersion
|
|
110659
110777
|
});
|
|
110660
110778
|
const RPC_PATH = "/api/rpc";
|
|
@@ -111618,7 +111736,7 @@ const layerTelemetry = unwrap$8(gen(function* () {
|
|
|
111618
111736
|
const layerRoutes = use((router) => gen(function* () {
|
|
111619
111737
|
const auth = yield* Auth;
|
|
111620
111738
|
const issuer = yield* option(String$5("AUTH_URL"));
|
|
111621
|
-
const traces = yield*
|
|
111739
|
+
const traces = yield* option(String$5("OTEL_URL"));
|
|
111622
111740
|
const canonical = yield* String$5("APP_URL");
|
|
111623
111741
|
const metadata = yield* cached(packageMetadata);
|
|
111624
111742
|
yield* router.add("GET", RUNTIME_PATH, gen(function* () {
|
|
@@ -112598,24 +112716,14 @@ const JsonFromString = (schema) => {
|
|
|
112598
112716
|
jsonUpdate: schema
|
|
112599
112717
|
});
|
|
112600
112718
|
};
|
|
112601
|
-
|
|
112602
|
-
const TimeFrame = Literals([
|
|
112719
|
+
Literals([
|
|
112603
112720
|
"10m",
|
|
112604
112721
|
"1h",
|
|
112605
112722
|
"24h",
|
|
112606
112723
|
"7d",
|
|
112607
112724
|
"30d"
|
|
112608
112725
|
]);
|
|
112609
|
-
|
|
112610
|
-
"1h": hours(1),
|
|
112611
|
-
"7d": days(7),
|
|
112612
|
-
"10m": minutes(10),
|
|
112613
|
-
"24h": days(1),
|
|
112614
|
-
"30d": days(30)
|
|
112615
|
-
};
|
|
112616
|
-
function timeFrameDuration(frame) {
|
|
112617
|
-
return TIME_FRAME_DURATIONS[frame];
|
|
112618
|
-
}
|
|
112726
|
+
hours(1), days(7), minutes(10), days(1), days(30);
|
|
112619
112727
|
const DateTimeUtcFromFiniteMillis = pipe(Finite.check(isBetween({
|
|
112620
112728
|
maximum: 864e13,
|
|
112621
112729
|
minimum: -864e13
|
|
@@ -112912,13 +113020,25 @@ Literals([
|
|
|
112912
113020
|
"sys",
|
|
112913
113021
|
"user"
|
|
112914
113022
|
]);
|
|
112915
|
-
const CpuCounters =
|
|
113023
|
+
const CpuCounters = TupleWithRest(Tuple([
|
|
113024
|
+
FiniteFromString,
|
|
113025
|
+
FiniteFromString,
|
|
113026
|
+
FiniteFromString,
|
|
113027
|
+
FiniteFromString,
|
|
113028
|
+
FiniteFromString
|
|
113029
|
+
]), [FiniteFromString]);
|
|
112916
113030
|
const LoadAverages = ArraySchema(FiniteFromString);
|
|
112917
113031
|
const CgroupPath = brand("DeployCgroupPath")(String$6);
|
|
112918
|
-
const HistoryMinutes = Literals(
|
|
113032
|
+
const HistoryMinutes = Literals([
|
|
113033
|
+
10,
|
|
113034
|
+
60,
|
|
113035
|
+
1440,
|
|
113036
|
+
10080,
|
|
113037
|
+
43200
|
|
113038
|
+
]);
|
|
112919
113039
|
const HistoryQuery = Struct$2({ minutes: pipe(HistoryMinutes, decodeTo(Duration, {
|
|
112920
113040
|
decode: transform$3(minutes),
|
|
112921
|
-
encode: transformEffect$1((range) => pipe(range, toMinutes,
|
|
113041
|
+
encode: transformEffect$1((range) => pipe(range, toMinutes, decodeUnknownEffect$1(HistoryMinutes)))
|
|
112922
113042
|
})) });
|
|
112923
113043
|
const HistoryToolInput = Struct$2({
|
|
112924
113044
|
...HistoryQuery.fields,
|
|
@@ -113270,11 +113390,14 @@ function unitFailures(text) {
|
|
|
113270
113390
|
const id = fields["Id"] ?? "";
|
|
113271
113391
|
const result = fields["Result"] ?? "";
|
|
113272
113392
|
const status = parse$2(fields["ExecMainStatus"] ?? "");
|
|
113273
|
-
if (!isNonEmpty$1(id) || !isNonEmpty$1(result) ||
|
|
113274
|
-
return
|
|
113275
|
-
|
|
113276
|
-
|
|
113277
|
-
|
|
113393
|
+
if (!isNonEmpty$1(id) || !isNonEmpty$1(result) || !isNonEmpty$1(fields["ExecMainCode"] ?? "")) return [];
|
|
113394
|
+
return match$8(status, {
|
|
113395
|
+
onNone: () => [],
|
|
113396
|
+
onSome: (exitStatus) => [[UnitId.make(id), {
|
|
113397
|
+
at: map$13(parse$2(replace(/^@/u, "")(fields["StateChangeTimestamp"] ?? "")), (seconds) => mapEpochMillis(makeUnsafe$5(0), () => seconds * 1e3)),
|
|
113398
|
+
reason: failureReason(result, exitStatus, fields["ExecMainCode"] !== "0")
|
|
113399
|
+
}]]
|
|
113400
|
+
});
|
|
113278
113401
|
}), fromEntries);
|
|
113279
113402
|
}
|
|
113280
113403
|
// src/services/inventory/lib/launchd.ts
|
|
@@ -113758,12 +113881,9 @@ function processTree(rows) {
|
|
|
113758
113881
|
function workerNames(snapshot) {
|
|
113759
113882
|
return dedupe([...snapshot.workers, ...map$10(snapshot.items, (item) => item.worker)]);
|
|
113760
113883
|
}
|
|
113761
|
-
function sourceWorker(source, workers, local) {
|
|
113762
|
-
return pipe(workers, findFirst((worker) => sourceBelongsToWorker(source, worker)), orElse$3(() => local));
|
|
113763
|
-
}
|
|
113764
113884
|
function errorsOf(sources, workers, worker) {
|
|
113765
113885
|
const local = head(workers);
|
|
113766
|
-
return pipe(sources, filter$5((source) =>
|
|
113886
|
+
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}`))));
|
|
113767
113887
|
}
|
|
113768
113888
|
function portsOf(row) {
|
|
113769
113889
|
return pipe([...row.listeners, ...row.exposures], filter$5((item) => !contains$2(item.address, "container")), map$10((item) => item.port), getSomes, dedupe, sort(Number$6));
|
|
@@ -113804,7 +113924,7 @@ function appOf(row, withProcesses) {
|
|
|
113804
113924
|
};
|
|
113805
113925
|
}
|
|
113806
113926
|
function exposureOf(item) {
|
|
113807
|
-
return {
|
|
113927
|
+
return map$13(item.url, (url) => ({
|
|
113808
113928
|
access: pipe(item.publicAccess, contains$2(true), match({
|
|
113809
113929
|
onFalse: constant("tailnet"),
|
|
113810
113930
|
onTrue: constant("public")
|
|
@@ -113812,8 +113932,8 @@ function exposureOf(item) {
|
|
|
113812
113932
|
id: item.id,
|
|
113813
113933
|
name: ExposureName.make(item.name),
|
|
113814
113934
|
port: item.port,
|
|
113815
|
-
url
|
|
113816
|
-
};
|
|
113935
|
+
url
|
|
113936
|
+
}));
|
|
113817
113937
|
}
|
|
113818
113938
|
function matches(row, app) {
|
|
113819
113939
|
const needle = toLowerCase(app);
|
|
@@ -113846,7 +113966,7 @@ function listApps(snapshot, input) {
|
|
|
113846
113966
|
})));
|
|
113847
113967
|
const exposures = pipe(own, flatMap$6((row) => {
|
|
113848
113968
|
if (row.item.kind !== "exposure" || onlyFailing) return [];
|
|
113849
|
-
return
|
|
113969
|
+
return toArray(exposureOf(row.item));
|
|
113850
113970
|
}), sort(mapInput(String$10, (exposure) => exposure.url)));
|
|
113851
113971
|
return {
|
|
113852
113972
|
apps,
|
|
@@ -113870,18 +113990,15 @@ function requestOf(item) {
|
|
|
113870
113990
|
}
|
|
113871
113991
|
const jobRequest = fnUntraced(function* (snapshot, input) {
|
|
113872
113992
|
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));
|
|
113873
|
-
if (
|
|
113993
|
+
if (!isArrayNonEmpty(matching)) return yield* DeployError.make({ message: `No scheduled job named ${input.job}; list_apps shows the jobs.` });
|
|
113874
113994
|
if (matching.length > 1) return yield* DeployError.make({ message: `${input.job} runs on more than one worker; pass its worker.` });
|
|
113875
|
-
return requestOf(
|
|
113995
|
+
return requestOf(headNonEmpty(matching).item);
|
|
113876
113996
|
});
|
|
113877
113997
|
// src/services/inventory/lib/processes.ts
|
|
113878
113998
|
const SECRET = /(?:token|secret|passw(?:or)?d|key|auth|credential|cookie|session)/iu;
|
|
113879
113999
|
const PROCESS_INTERVAL = seconds(2);
|
|
113880
114000
|
function processStatus(status) {
|
|
113881
|
-
const values = pipe(trim(status), split$1("\n"),
|
|
113882
|
-
const at = getOrThrow$1(indexOf(":")(line));
|
|
113883
|
-
return [slice(0, at)(line), trim(slice(at + 1)(line))];
|
|
113884
|
-
}));
|
|
114001
|
+
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);
|
|
113885
114002
|
function field(name) {
|
|
113886
114003
|
return pipe(get$13(values, name), filter$7(isNonEmpty$1), getOrUndefined$1);
|
|
113887
114004
|
}
|
|
@@ -113973,8 +114090,8 @@ function processReadings(current, previous) {
|
|
|
113973
114090
|
readings: processUsage(current, map$13(previous, (cached) => cached.baseline))
|
|
113974
114091
|
};
|
|
113975
114092
|
}
|
|
113976
|
-
function
|
|
113977
|
-
|
|
114093
|
+
function launchdRows(text) {
|
|
114094
|
+
return getSomes(pipe(text, split$1("\n"), map$10((line) => flatMap$8(match$2(/^\s*([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+(\S+)\s+(\S+\s+\S+\s+\S+\s+\S+\s+\S+)\s+(.*)$/u)(line), (match) => map$13(all$4({
|
|
113978
114095
|
memory: decodeOption(ResidentMemoryFromKiB)(match[3] ?? ""),
|
|
113979
114096
|
parent: decodeOption(ProcessIdFromString)(match[2] ?? ""),
|
|
113980
114097
|
pid: decodeOption(ProcessIdFromString)(match[1] ?? "")
|
|
@@ -113984,6 +114101,12 @@ function launchdProcesses(text, agents) {
|
|
|
113984
114101
|
cpu: match[4] ?? "",
|
|
113985
114102
|
start: match[5] ?? ""
|
|
113986
114103
|
}))))));
|
|
114104
|
+
}
|
|
114105
|
+
function launchdStarts(text) {
|
|
114106
|
+
return fromIterable$5(map$10(launchdRows(text), (row) => [row.pid, row.start]));
|
|
114107
|
+
}
|
|
114108
|
+
function launchdProcesses(text, agents) {
|
|
114109
|
+
const rows = launchdRows(text);
|
|
113987
114110
|
const parents = fromIterable$5(map$10(rows, (row) => [row.pid, row.parent]));
|
|
113988
114111
|
function agent(pid, visited = empty$5()) {
|
|
113989
114112
|
if (has(visited, pid)) return none();
|
|
@@ -114151,7 +114274,7 @@ function probeSocket(listener, process) {
|
|
|
114151
114274
|
return listener.protocol === "tcp" && listener.port >= 1024 && isSome(match$2(/^(?:127\.0\.0\.1|0\.0\.0\.0):/u)(listener.address)) && isNone(match$2(/^(?:postgres|redis|ssh|cloudflared|tailscaled|caddy)$/u)(process));
|
|
114152
114275
|
}
|
|
114153
114276
|
// src/services/inventory/service.ts
|
|
114154
|
-
function portItems(sockets, worker,
|
|
114277
|
+
function portItems(sockets, worker, probe, source) {
|
|
114155
114278
|
return gen(function* () {
|
|
114156
114279
|
const metadata = fromIterable$5(yield* pipe(getSomes(map$10(sockets, (socket) => socket.process)), dedupeWith((left, right) => left.pid === right.pid), forEach$1(fnUntraced(function* (process) {
|
|
114157
114280
|
return [process.pid, {
|
|
@@ -114159,6 +114282,7 @@ function portItems(sockets, worker, http, source) {
|
|
|
114159
114282
|
onFalse: () => succeedNone,
|
|
114160
114283
|
onTrue: () => source.cwd(process.pid)
|
|
114161
114284
|
}),
|
|
114285
|
+
start: yield* source.start(process.pid),
|
|
114162
114286
|
unit: yield* source.unit(process.pid)
|
|
114163
114287
|
}];
|
|
114164
114288
|
}), { concurrency: 8 })));
|
|
@@ -114174,20 +114298,13 @@ function portItems(sockets, worker, http, source) {
|
|
|
114174
114298
|
});
|
|
114175
114299
|
const response = yield* match(probeSocket(socket, getOrElse$1(process, constant(""))), {
|
|
114176
114300
|
onFalse: () => succeed$5(none()),
|
|
114177
|
-
onTrue:
|
|
114178
|
-
|
|
114179
|
-
|
|
114180
|
-
|
|
114181
|
-
|
|
114182
|
-
|
|
114183
|
-
|
|
114184
|
-
sampled: false,
|
|
114185
|
-
startTime: 0n
|
|
114186
|
-
})) }), map$7((value) => ({
|
|
114187
|
-
http: true,
|
|
114188
|
-
ui: value.status >= 200 && value.status < 400 && includes("text/html")(value.headers["content-type"] ?? "")
|
|
114189
|
-
})), provideService$2(RequestInit, { redirect: "manual" }), provideService$2(TracerDisabledWhen, constTrue), timeout(millis(700)), option$1);
|
|
114190
|
-
})
|
|
114301
|
+
onTrue: () => probe(socket.port, match$8(socket.process, {
|
|
114302
|
+
onNone: constant(""),
|
|
114303
|
+
onSome: (listener) => pipe(origin, flatMap$8((value) => value.start), match$8({
|
|
114304
|
+
onNone: constant(""),
|
|
114305
|
+
onSome: (start) => `${listener.pid}:${start}`
|
|
114306
|
+
}))
|
|
114307
|
+
}))
|
|
114191
114308
|
});
|
|
114192
114309
|
return InventoryItem.make({
|
|
114193
114310
|
address: some$1(socket.address),
|
|
@@ -114249,6 +114366,31 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
114249
114366
|
const worker = yield* decodeEffect(WorkerId)(hostname());
|
|
114250
114367
|
const selfProcess = yield* decodeEffect(ProcessId)(pid);
|
|
114251
114368
|
const processState = yield* make$56(none());
|
|
114369
|
+
function head(port) {
|
|
114370
|
+
return pipe(http.head(`http://127.0.0.1:${port}/`, { headers: toHeaders(new NativeSpan({
|
|
114371
|
+
annotations: empty$18(),
|
|
114372
|
+
kind: "internal",
|
|
114373
|
+
links: [],
|
|
114374
|
+
name: "Deploy.probe",
|
|
114375
|
+
parent: none(),
|
|
114376
|
+
sampled: false,
|
|
114377
|
+
startTime: 0n
|
|
114378
|
+
})) }), map$7((value) => ({
|
|
114379
|
+
http: true,
|
|
114380
|
+
ui: value.status >= 200 && value.status < 400 && includes("text/html")(value.headers["content-type"] ?? "")
|
|
114381
|
+
})), provideService$2(RequestInit, { redirect: "manual" }), provideService$2(TracerDisabledWhen, constTrue), timeout(millis(700)), option$1);
|
|
114382
|
+
}
|
|
114383
|
+
const probes = yield* makeWith$2((key) => head(key[0]), {
|
|
114384
|
+
capacity: Infinity,
|
|
114385
|
+
timeToLive: (exit) => match(isSuccess(exit) && isSome(exit.value), {
|
|
114386
|
+
onFalse: () => seconds(5),
|
|
114387
|
+
onTrue: () => infinity
|
|
114388
|
+
})
|
|
114389
|
+
});
|
|
114390
|
+
function probe(port, identity) {
|
|
114391
|
+
if (identity === "") return head(port);
|
|
114392
|
+
return get$7(probes, [port, identity]);
|
|
114393
|
+
}
|
|
114252
114394
|
const units = fnUntraced(function* (system) {
|
|
114253
114395
|
const scope = match(system, {
|
|
114254
114396
|
onFalse: constant("user"),
|
|
@@ -114359,31 +114501,31 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
114359
114501
|
collect("User services", units(false)),
|
|
114360
114502
|
collect("System services", units(true)),
|
|
114361
114503
|
collect("Docker", docker),
|
|
114362
|
-
collect("Listening ports", flatMap$3(command("ss", ["-H", "-lntup"]), (text) => portItems(getSomes(pipe(trim(text), split$1("\n"), map$10(socketLine))), worker,
|
|
114504
|
+
collect("Listening ports", flatMap$3(command("ss", ["-H", "-lntup"]), (text) => portItems(getSomes(pipe(trim(text), split$1("\n"), map$10(socketLine))), worker, probe, {
|
|
114363
114505
|
cwd: (processId) => option$1(fs.readLink(`/proc/${processId}/cwd`)),
|
|
114506
|
+
start: (processId) => map$7(option$1(fs.readFileString(`/proc/${processId}/stat`)), flatMap$8((stat) => flatMap$8(lastIndexOf(")")(stat), (at) => pipe(slice(at + 2)(stat), split$1(/\s+/u), get$12(19))))),
|
|
114364
114507
|
unit: (processId) => map$7(option$1(fs.readFileString(`/proc/${processId}/cgroup`)), (cgroup) => socketUnit(getOrElse$1(cgroup, constant(""))))
|
|
114365
114508
|
})))
|
|
114366
114509
|
]
|
|
114367
114510
|
});
|
|
114511
|
+
const bundleNames = yield* make$71({
|
|
114512
|
+
capacity: Infinity,
|
|
114513
|
+
lookup: fnUntraced(function* (bundle) {
|
|
114514
|
+
return yield* pipe(command("/usr/bin/plutil", [
|
|
114515
|
+
"-convert",
|
|
114516
|
+
"json",
|
|
114517
|
+
"-o",
|
|
114518
|
+
"-",
|
|
114519
|
+
`${bundle}/Contents/Info.plist`
|
|
114520
|
+
]), flatMap$3(decodeEffect(fromJsonString(Struct$2({
|
|
114521
|
+
CFBundleDisplayName: optionalKey(Unknown),
|
|
114522
|
+
CFBundleName: optionalKey(Unknown)
|
|
114523
|
+
})))), map$7((fields) => pipe([fields.CFBundleDisplayName, fields.CFBundleName], filter$5(isString$1), map$10(trim), findFirst(isNonEmpty$1))), option$1, map$7(flatten$6));
|
|
114524
|
+
})
|
|
114525
|
+
});
|
|
114368
114526
|
const darwin = gen(function* () {
|
|
114369
114527
|
const namedAgents = gen(function* () {
|
|
114370
|
-
|
|
114371
|
-
const bundleNames = yield* make$71({
|
|
114372
|
-
capacity: agents.length + 1,
|
|
114373
|
-
lookup: fnUntraced(function* (bundle) {
|
|
114374
|
-
return yield* pipe(command("/usr/bin/plutil", [
|
|
114375
|
-
"-convert",
|
|
114376
|
-
"json",
|
|
114377
|
-
"-o",
|
|
114378
|
-
"-",
|
|
114379
|
-
`${bundle}/Contents/Info.plist`
|
|
114380
|
-
]), flatMap$3(decodeEffect(fromJsonString(Struct$2({
|
|
114381
|
-
CFBundleDisplayName: optionalKey(Unknown),
|
|
114382
|
-
CFBundleName: optionalKey(Unknown)
|
|
114383
|
-
})))), map$7((fields) => pipe([fields.CFBundleDisplayName, fields.CFBundleName], filter$5(isString$1), map$10(trim), findFirst(isNonEmpty$1))), option$1, map$7(flatten$6));
|
|
114384
|
-
})
|
|
114385
|
-
});
|
|
114386
|
-
return getSomes(yield* forEach$1(agents, fnUntraced(function* (agent) {
|
|
114528
|
+
return getSomes(yield* forEach$1(launchAgents(yield* command("launchctl", ["list"])), fnUntraced(function* (agent) {
|
|
114387
114529
|
if (startsWith("deslop-")(agent.label)) return some$1(agent);
|
|
114388
114530
|
const program = flatMap$8(yield* option$1(command("launchctl", ["print", `gui/${userInfo().uid}/${agent.label}`])), launchProgram);
|
|
114389
114531
|
if (exists(program, systemProgram)) return none();
|
|
@@ -114438,6 +114580,7 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
114438
114580
|
return filter$5(launchdProcesses(text, agents), (record) => record.process.pid === selfProcess || !pipe(agents, get$9(selfProcess), contains$2(record.unit)));
|
|
114439
114581
|
});
|
|
114440
114582
|
const owned = getOrElse(records, empty$15);
|
|
114583
|
+
const starts = pipe(launchd.table, map$12(launchdStarts), getOrElse(empty$11));
|
|
114441
114584
|
return {
|
|
114442
114585
|
processes: map$7(fromResult(records), (found) => ({
|
|
114443
114586
|
records: found,
|
|
@@ -114480,7 +114623,7 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
114480
114623
|
"-iUDP",
|
|
114481
114624
|
"-F",
|
|
114482
114625
|
"pctPnT"
|
|
114483
|
-
]), (text) => portItems(lsofSockets(text), worker,
|
|
114626
|
+
]), (text) => portItems(lsofSockets(text), worker, probe, {
|
|
114484
114627
|
cwd: fnUntraced(function* (processId) {
|
|
114485
114628
|
return pipe(yield* option$1(command("lsof", [
|
|
114486
114629
|
"-nP",
|
|
@@ -114492,6 +114635,7 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
114492
114635
|
"-Fn"
|
|
114493
114636
|
])), getOrElse$1(constant("")), split$1("\n"), findFirst(startsWith("n")), map$13(slice(1)));
|
|
114494
114637
|
}),
|
|
114638
|
+
start: (processId) => succeed$5(get$9(starts, processId)),
|
|
114495
114639
|
unit: (processId) => succeed$5(pipe(owned, findFirst((record) => record.process.pid === processId), map$13((record) => record.unit)))
|
|
114496
114640
|
})))
|
|
114497
114641
|
]
|
|
@@ -114606,9 +114750,10 @@ var Inventory = class extends Service$1()("@deslop/deploy/services/inventory/ser
|
|
|
114606
114750
|
};
|
|
114607
114751
|
})), "Inventory.snapshot", { attributes: { worker } });
|
|
114608
114752
|
const snapshot = yield* make$51(yield* collectSnapshot);
|
|
114609
|
-
const
|
|
114610
|
-
|
|
114753
|
+
const [ensureFresh, invalidate] = yield* cachedInvalidateWithTTL(pipe(snapshot, updateEffect(() => collectSnapshot), withSpan("Inventory.refresh")), seconds(5));
|
|
114754
|
+
const refresh = andThen(invalidate, ensureFresh);
|
|
114611
114755
|
return {
|
|
114756
|
+
ensureFresh,
|
|
114612
114757
|
refresh,
|
|
114613
114758
|
run: fn("Inventory.run")(function* (input) {
|
|
114614
114759
|
yield* onExit$1(start(input), () => refresh);
|
|
@@ -114626,9 +114771,9 @@ const SERIES = {
|
|
|
114626
114771
|
43200: hours(6)
|
|
114627
114772
|
};
|
|
114628
114773
|
function counters(stat, uptime, time) {
|
|
114629
|
-
const values =
|
|
114774
|
+
const values = decodeUnknownSync(CpuCounters)(pipe(stat, split$1("\n"), head, getOrElse$1(constant("")), trim, split$1(/\s+/u), drop$1(1), take$3(8)));
|
|
114630
114775
|
return {
|
|
114631
|
-
cpuIdle: millis((
|
|
114776
|
+
cpuIdle: millis((values[3] + values[4]) * 10),
|
|
114632
114777
|
cpuTotal: millis(sumAll(values) * 10),
|
|
114633
114778
|
time,
|
|
114634
114779
|
uptime: seconds(decodeSync(FiniteFromString)(split$1(uptime, " ")[0]))
|
|
@@ -114933,6 +115078,10 @@ function sampled(read) {
|
|
|
114933
115078
|
try: read
|
|
114934
115079
|
});
|
|
114935
115080
|
}
|
|
115081
|
+
function sameBucket(row, time) {
|
|
115082
|
+
const step = toMillis(row.step);
|
|
115083
|
+
return Math.floor(toEpochMillis(row.since) / step) === Math.floor(toEpochMillis(time) / step);
|
|
115084
|
+
}
|
|
114936
115085
|
var Metrics = class extends Service$1()("@deslop/deploy/services/metrics/service/Metrics", { make: gen(function* () {
|
|
114937
115086
|
const fs = yield* FileSystem;
|
|
114938
115087
|
const sql = yield* SqlClient;
|
|
@@ -114986,7 +115135,7 @@ var Metrics = class extends Service$1()("@deslop/deploy/services/metrics/service
|
|
|
114986
115135
|
});
|
|
114987
115136
|
const deleteExpired = void_({
|
|
114988
115137
|
Request: Sample.fields.time,
|
|
114989
|
-
execute: (now) => forEach$1([AppHistory.table, MachineSample.table], (table) => sql`DELETE FROM ${sql(table)} WHERE ${sql.or(map$10(
|
|
115138
|
+
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 })
|
|
114990
115139
|
});
|
|
114991
115140
|
const previous = yield* make$56(none());
|
|
114992
115141
|
const lastApps = yield* make$56(none());
|
|
@@ -115011,22 +115160,27 @@ var Metrics = class extends Service$1()("@deslop/deploy/services/metrics/service
|
|
|
115011
115160
|
}
|
|
115012
115161
|
const appCgroups = walk([CgroupPath.make("")], []);
|
|
115013
115162
|
const apps = gen(function* () {
|
|
115014
|
-
const readings = yield* forEach$1(yield* appCgroups, (path) =>
|
|
115015
|
-
|
|
115016
|
-
|
|
115017
|
-
|
|
115018
|
-
|
|
115019
|
-
|
|
115020
|
-
|
|
115021
|
-
|
|
115022
|
-
|
|
115023
|
-
|
|
115024
|
-
|
|
115025
|
-
|
|
115026
|
-
|
|
115027
|
-
|
|
115028
|
-
|
|
115029
|
-
|
|
115163
|
+
const readings = yield* forEach$1(yield* appCgroups, (path) => match$8(processOwner(path), {
|
|
115164
|
+
onNone: () => fail$6(DeployError.make({ message: `The cgroup ${path} has no app owner.` })),
|
|
115165
|
+
onSome: fnUntraced(function* (id) {
|
|
115166
|
+
return yield* pipe(all$1({
|
|
115167
|
+
cpu: fs.readFileString(`${CGROUP}${path}/cpu.stat`),
|
|
115168
|
+
memory: fs.readFileString(`${CGROUP}${path}/memory.stat`)
|
|
115169
|
+
}, { concurrency: "unbounded" }), catchTag("PlatformError", (cause) => {
|
|
115170
|
+
if (isTagged(cause.reason, "NotFound")) return undefined_$1;
|
|
115171
|
+
return fail$6(cause);
|
|
115172
|
+
}), flatMap$3((stats) => {
|
|
115173
|
+
if (stats === void 0) return succeedNone;
|
|
115174
|
+
return match$8(cgroupUsage(stats.cpu, stats.memory), {
|
|
115175
|
+
onNone: () => fail$6(DeployError.make({ message: `The cgroup counters for ${path} are missing or invalid.` })),
|
|
115176
|
+
onSome: (usage) => succeedSome([path, {
|
|
115177
|
+
id,
|
|
115178
|
+
...usage
|
|
115179
|
+
}])
|
|
115180
|
+
});
|
|
115181
|
+
}));
|
|
115182
|
+
})
|
|
115183
|
+
}), { concurrency: 8 });
|
|
115030
115184
|
return fromEntries(getSomes(readings));
|
|
115031
115185
|
});
|
|
115032
115186
|
const refreshStorage = pipe(scoped(match(platform === "darwin", {
|
|
@@ -115089,6 +115243,8 @@ var Metrics = class extends Service$1()("@deslop/deploy/services/metrics/service
|
|
|
115089
115243
|
}), loadavg(), old))
|
|
115090
115244
|
};
|
|
115091
115245
|
});
|
|
115246
|
+
const pending = yield* make$56(yield* asDeployError$1(listBuckets(yield* now)));
|
|
115247
|
+
const writes = yield* make$82(1);
|
|
115092
115248
|
const collect = pipe(gen(function* () {
|
|
115093
115249
|
const time = yield* now;
|
|
115094
115250
|
const old = yield* get$2(previous);
|
|
@@ -115098,18 +115254,32 @@ var Metrics = class extends Service$1()("@deslop/deploy/services/metrics/service
|
|
|
115098
115254
|
onTrue: () => darwin(time, disks, old)
|
|
115099
115255
|
});
|
|
115100
115256
|
yield* set(previous, some$1(measured.current));
|
|
115101
|
-
yield*
|
|
115257
|
+
yield* writes.withPermits(1)(update(pending, (rows) => {
|
|
115258
|
+
const [current, completed] = partition(rows, fromPredicate((row) => sameBucket(row, time)));
|
|
115259
|
+
return [...completed, ...map$10(rollup(measured.value.point, current), (row) => evolve(row, { apps: (readings) => pipe(readings, filter$7(isReadonlyArrayNonEmpty), map$13(sort(mapInput(String$10, (app) => app.id)))) }))];
|
|
115260
|
+
}));
|
|
115102
115261
|
yield* set(latest, {
|
|
115103
115262
|
disks: measured.value.disks,
|
|
115104
115263
|
load: measured.value.load
|
|
115105
115264
|
});
|
|
115106
115265
|
yield* set(failure, none());
|
|
115107
|
-
}),
|
|
115266
|
+
}), tapError$3((cause) => logWarning("Metrics could not be sampled", cause)), catch_$2((cause) => set(failure, some$1(cause.message))));
|
|
115267
|
+
const flush = pipe(gen(function* () {
|
|
115268
|
+
const rows = yield* get$2(pending);
|
|
115269
|
+
if (isReadonlyArrayNonEmpty(rows)) yield* pipe(saveSamples(rows), sql.withTransaction, asDeployError$1);
|
|
115270
|
+
const time = yield* now;
|
|
115271
|
+
yield* set(pending, filter$5(rows, (row) => sameBucket(row, time)));
|
|
115272
|
+
}), writes.withPermits(1), withSpan("Metrics.collect", { attributes: { worker } }), tapError$3((cause) => set(failure, some$1(cause.message))), ignore$1({
|
|
115273
|
+
log: "Error",
|
|
115274
|
+
message: "Resource history could not be saved"
|
|
115275
|
+
}));
|
|
115108
115276
|
const prune = pipe(now, flatMap$3(deleteExpired), sql.withTransaction, asDeployError$1, withSpan("Metrics.prune", { attributes: { worker } }));
|
|
115109
115277
|
yield* prune;
|
|
115110
115278
|
yield* refreshStorage;
|
|
115111
115279
|
yield* collect;
|
|
115280
|
+
yield* addFinalizer(() => flush);
|
|
115112
115281
|
yield* pipe(collect, schedule(fixed(seconds(1))), forkScoped);
|
|
115282
|
+
yield* pipe(flush, schedule(fixed(seconds(10))), forkScoped);
|
|
115113
115283
|
yield* pipe(refreshStorage, schedule(spaced(seconds(30))), forkScoped);
|
|
115114
115284
|
yield* pipe(prune, ignore$1({
|
|
115115
115285
|
log: "Error",
|
|
@@ -115121,10 +115291,14 @@ var Metrics = class extends Service$1()("@deslop/deploy/services/metrics/service
|
|
|
115121
115291
|
worker
|
|
115122
115292
|
});
|
|
115123
115293
|
const time = yield* now;
|
|
115124
|
-
const step =
|
|
115125
|
-
const samples = yield*
|
|
115126
|
-
|
|
115127
|
-
|
|
115294
|
+
const step = SERIES[yield* asDeployError$1(encodeEffect(HistoryQuery.fields.minutes)(query.minutes))];
|
|
115295
|
+
const samples = yield* writes.withPermits(1)(gen(function* () {
|
|
115296
|
+
const stored = yield* asDeployError$1(listSeries({
|
|
115297
|
+
after: subtractDuration(chartWindow(query.minutes, time).start, step),
|
|
115298
|
+
step
|
|
115299
|
+
}));
|
|
115300
|
+
const buffered = filter$5(yield* get$2(pending), (row) => equals(row.step, step));
|
|
115301
|
+
return sort([...filter$5(stored, (row) => !some(buffered, (value) => Equivalence$3(value.since, row.since))), ...buffered], mapInput(Order$2, (row) => row.since));
|
|
115128
115302
|
}));
|
|
115129
115303
|
const now$2 = yield* get$2(latest);
|
|
115130
115304
|
return {
|
|
@@ -115282,7 +115456,10 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
|
|
|
115282
115456
|
};
|
|
115283
115457
|
}), "Fleet.local");
|
|
115284
115458
|
const remote = fnUntraced(function* (worker, use) {
|
|
115285
|
-
const peer =
|
|
115459
|
+
const peer = yield* pipe(peers, get$13(worker.name), match$8({
|
|
115460
|
+
onNone: () => DeployError.make({ message: `Worker ${worker.name} is not configured.` }),
|
|
115461
|
+
onSome: succeed$5
|
|
115462
|
+
}));
|
|
115286
115463
|
if (!(yield* get$2(peer.connected))) return yield* DeployError.make({ message: "Worker is unreachable" });
|
|
115287
115464
|
return yield* pipe(use(peer.client), timeout(seconds(15)), withSpan("Fleet.remote", { attributes: { worker: worker.name } }));
|
|
115288
115465
|
});
|
|
@@ -115370,6 +115547,7 @@ var Fleet = class Fleet extends Service$1()("@deslop/deploy/services/fleet/servi
|
|
|
115370
115547
|
});
|
|
115371
115548
|
})),
|
|
115372
115549
|
snapshot: withSpan(gen(function* () {
|
|
115550
|
+
yield* inventory.ensureFresh;
|
|
115373
115551
|
const own = yield* local;
|
|
115374
115552
|
const others = yield* forEach$1(workers, (worker) => pipe(remote(worker, (client) => client("inventory.snapshot", void 0)), timeout(seconds(2)), map$7((snapshot) => ({
|
|
115375
115553
|
...snapshot,
|
|
@@ -115437,7 +115615,7 @@ const RpcHandlers = RpcContracts.toLayer(gen(function* () {
|
|
|
115437
115615
|
yield* onExit$1(exposures.hide(input.name), () => localInventory.refresh);
|
|
115438
115616
|
}, onExit$1(() => invalidate(["deployInventory"]))),
|
|
115439
115617
|
"inventory.run": fleet.run,
|
|
115440
|
-
"inventory.snapshot": () => fleet.local,
|
|
115618
|
+
"inventory.snapshot": () => andThen(localInventory.ensureFresh, fleet.local),
|
|
115441
115619
|
"inventory.start": (input) => onExit$1(localInventory.run(input), () => invalidate(["deployInventory"])),
|
|
115442
115620
|
"inventory.watch": () => inventory,
|
|
115443
115621
|
"metrics.history": fleet.history,
|
|
@@ -115522,8 +115700,10 @@ function checkWorker(snapshot, worker) {
|
|
|
115522
115700
|
failing: none(),
|
|
115523
115701
|
worker: none()
|
|
115524
115702
|
});
|
|
115525
|
-
|
|
115526
|
-
|
|
115703
|
+
return pipe(worker, filter$7((selected) => !some(workers, (row) => row.worker === selected)), match$8({
|
|
115704
|
+
onNone: () => void_$2,
|
|
115705
|
+
onSome: (selected) => fail$6(DeployError.make({ message: `Unknown worker ${selected}; valid workers: ${pipe(workers, map$10((row) => row.worker), join$4(", "))}. Nothing changed.` }))
|
|
115706
|
+
}));
|
|
115527
115707
|
}
|
|
115528
115708
|
function processPaths(tree, prefix) {
|
|
115529
115709
|
return flatMap$6(tree, (node, index) => [`${prefix}${index}`, ...processPaths(getOrElse$1(node.children, empty$15), `${prefix}${index}.`)]);
|
|
@@ -115581,16 +115761,20 @@ function inventoryPage(workers, input) {
|
|
|
115581
115761
|
};
|
|
115582
115762
|
}
|
|
115583
115763
|
function focusedInventory(workers, app) {
|
|
115584
|
-
|
|
115585
|
-
|
|
115586
|
-
|
|
115587
|
-
|
|
115588
|
-
|
|
115589
|
-
|
|
115590
|
-
|
|
115591
|
-
|
|
115592
|
-
|
|
115593
|
-
|
|
115764
|
+
return match$8(app, {
|
|
115765
|
+
onNone: () => workers,
|
|
115766
|
+
onSome: (queryText) => {
|
|
115767
|
+
const query = toLowerCase(queryText);
|
|
115768
|
+
function matchingName(row) {
|
|
115769
|
+
return pipe(row.name, toLowerCase, includes(query));
|
|
115770
|
+
}
|
|
115771
|
+
return map$10(workers, (worker) => ({
|
|
115772
|
+
...worker,
|
|
115773
|
+
exposures: pipe(worker.exposures, map$13((rows) => filter$5(rows, matchingName)), orElseSome(() => [])),
|
|
115774
|
+
jobs: pipe(worker.jobs, map$13((rows) => filter$5(rows, matchingName)), orElseSome(() => []))
|
|
115775
|
+
}));
|
|
115776
|
+
}
|
|
115777
|
+
});
|
|
115594
115778
|
}
|
|
115595
115779
|
function metricSummary(series) {
|
|
115596
115780
|
const values = getSomes(series);
|