@deslop/scope 0.1.1132 → 0.1.1133

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/server.js +40 -4
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -7381,6 +7381,42 @@ const dedupe = (self) => {
7381
7381
  for (const value of input) if (hashBucketsAdd(buckets, value)) out.push(value);
7382
7382
  return out;
7383
7383
  };
7384
+ /**
7385
+ * Computes the number of elements in an iterable that satisfy a predicate.
7386
+ *
7387
+ * **When to use**
7388
+ *
7389
+ * Use when you need to count how many elements of an iterable satisfy a
7390
+ * predicate.
7391
+ *
7392
+ * **Details**
7393
+ *
7394
+ * The predicate receives both the element and its index. Empty iterables return
7395
+ * `0`.
7396
+ *
7397
+ * **Example** (Counting even numbers)
7398
+ *
7399
+ * ```ts import.meta.vitest
7400
+ * import { Array } from "effect"
7401
+ *
7402
+ * Array.countBy([1, 2, 3, 4, 5], (n) => n % 2 === 0) // => 2
7403
+ * ```
7404
+ *
7405
+ * @see {@link filter} — when you need the matching elements, not just the count
7406
+ *
7407
+ * @stability stable
7408
+ * @category folding
7409
+ * @since 3.16.0
7410
+ */
7411
+ const countBy = /*#__PURE__*/ dual(2, (self, f) => {
7412
+ let count = 0;
7413
+ const as = fromIterable$5(self);
7414
+ for (let i = 0; i < as.length; i++) {
7415
+ const a = as[i];
7416
+ if (f(a, i)) count++;
7417
+ }
7418
+ return count;
7419
+ });
7384
7420
  //#endregion
7385
7421
  //#region ../../node_modules/.pnpm/effect@4.0.5/node_modules/effect/dist/Scheduler.js
7386
7422
  /**
@@ -65339,7 +65375,7 @@ const layerNodeHttpServer = layerConfig(createServer, {
65339
65375
  });
65340
65376
  //#endregion
65341
65377
  //#region package.json
65342
- var version = "0.1.1132";
65378
+ var version = "0.1.1133";
65343
65379
  //#endregion
65344
65380
  //#region src/services/telemetry/schema.ts
65345
65381
  var TelemetryError = class extends TaggedError()("TelemetryError", {
@@ -65555,7 +65591,7 @@ function summary(entries, query) {
65555
65591
  }
65556
65592
  return {
65557
65593
  count: entries.length,
65558
- errors: filter$1(entries, (entry) => entry.status === 2).length,
65594
+ errors: countBy(entries, (entry) => entry.status === 2),
65559
65595
  from: query.from,
65560
65596
  maxMs: percentile(1),
65561
65597
  p50Ms: percentile(.5),
@@ -65728,9 +65764,9 @@ var Telemetry = class extends Service$2()("@deslop/scope/services/telemetry/serv
65728
65764
  const root = getOrElse(head(view.spans), () => getOrThrow$1(head(records)));
65729
65765
  return {
65730
65766
  durationMs: view.durationMs,
65731
- errors: filter$1(records, (entry) => entry.status === 2).length,
65767
+ errors: countBy(records, (entry) => entry.status === 2),
65732
65768
  id,
65733
- logs: filter$1(records, (entry) => entry.signal === "log").length,
65769
+ logs: countBy(records, (entry) => entry.signal === "log"),
65734
65770
  operation: root.name,
65735
65771
  service: root.service,
65736
65772
  services: view.services,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deslop/scope",
3
- "version": "0.1.1132",
3
+ "version": "0.1.1133",
4
4
  "description": "An Effect development debugger: an OTLP/HTTP JSON receiver whose traces and logs agents query over MCP.",
5
5
  "repository": {
6
6
  "type": "git",