{
  "id": "@typed/fx#Push.exhaustLatestMap",
  "canonicalId": "@typed/fx/Push#exhaustLatestMap",
  "symbol": {
    "id": "@typed/fx#Push.exhaustLatestMap",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "Push.exhaustLatestMap",
    "kind": "constant",
    "signatures": [
      "export declare const exhaustLatestMap: {\n    <B, C, E3, R3>(f: (b: B) => Fx.Fx<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n    <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Fx.Fx<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n};"
    ],
    "summary": "Runs one inner Fx at a time and retains only the latest value received while busy.\n\nA value while idle starts immediately. While its inner runs, newer outer values\nreplace a single pending slot. `f(value)` is evaluated and an inner Fx is\nconstructed before every replacement; a superseded pending Fx is never run.\nAfter completion, only the latest pending Fx starts. Accepted inners preserve\ntheir own order and all values. The input Sink is unchanged.",
    "sections": {
      "Why": "This is useful when work must not overlap but the newest requested state must\neventually be processed.",
      "Ownership and lifetime": "The output Scope owns one active inner fiber and an in-memory latest slot. It\njoins the final inner before completion and interrupts it with the subscription.\nInner failures and services join the output channels."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as Fx from \"@typed/fx/Fx\"\nimport * as Push from \"@typed/fx/Push\"\nimport * as Sink from \"@typed/fx/Sink\"\n\nconst constructed: Array<number> = []\nconst started: Array<number> = []\nconst finalized: Array<number> = []\nconst push = Push.make(\n  Sink.make(() => Effect.void, (_: string) => Effect.void),\n  Fx.fromIterable([1, 2, 3])\n)\nconst latest = Push.exhaustLatestMap(push, (id) => {\n  constructed.push(id)\n  return Fx.make<number>((sink) =>\n    Effect.gen(function* () {\n      yield* Effect.sync(() => started.push(id))\n      yield* Effect.sleep(\"5 millis\")\n      yield* sink.onSuccess(id * 10 + 1)\n      yield* Effect.sleep(\"5 millis\")\n      yield* sink.onSuccess(id * 10 + 2)\n    }).pipe(Effect.ensuring(Effect.sync(() => finalized.push(id))))\n  )\n})\nconst program = Fx.collectAll(latest).pipe(\n  Effect.map((values) => ({ values, constructed, started, finalized })),\n  Effect.scoped\n)\n// => values [11, 12, 31, 32]; constructed [1, 2, 3]; started/finalized [1, 3]."
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Push/Push.ts",
      "line": 1803
    },
    "since": "1.0.0",
    "category": "Concurrent output work"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#Push.exhaustLatestMap",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.7",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "Push",
    "qualifiedName": "Push.exhaustLatestMap",
    "declarationKey": "declaration:ff7d5f2889cede194c77352b",
    "family": "variable",
    "signatures": [
      "export declare const exhaustLatestMap: {\n    <B, C, E3, R3>(f: (b: B) => Fx.Fx<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n    <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Fx.Fx<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1803,
          "column": 14
        },
        "end": {
          "line": 1832,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1804,
          "column": 3
        },
        "end": {
          "line": 1808,
          "column": 57
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1809,
          "column": 3
        },
        "end": {
          "line": 1812,
          "column": 55
        }
      }
    ],
    "aliases": [
      "@typed/fx/Push#exhaustLatestMap"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#Push",
    "static": false,
    "importedFrom": "declaration:ff7d5f2889cede194c77352b"
  },
  "declaration": {
    "declarationKey": "declaration:ff7d5f2889cede194c77352b",
    "name": "exhaustLatestMap",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const exhaustLatestMap: {\n    <B, C, E3, R3>(f: (b: B) => Fx.Fx<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n    <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Fx.Fx<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Push/Push.ts",
            "start": {
              "line": 1803,
              "column": 14
            },
            "end": {
              "line": 1832,
              "column": 3
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<B, C, E3, R3>(f: (b: B) => Fx.Fx<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;",
          "<A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Fx.Fx<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;"
        ],
        "typeParameters": [
          "B",
          "C",
          "E3",
          "R3",
          "A",
          "E",
          "R",
          "E2",
          "R2"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Push/Push.ts",
            "start": {
              "line": 1804,
              "column": 3
            },
            "end": {
              "line": 1808,
              "column": 57
            }
          },
          {
            "file": "packages/fx/src/Push/Push.ts",
            "start": {
              "line": 1809,
              "column": 3
            },
            "end": {
              "line": 1812,
              "column": 55
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const exhaustLatestMap: {\n    <B, C, E3, R3>(f: (b: B) => Fx.Fx<C, E3, R3>): <A, E, R, E2, R2>(push: Push<A, E, R, B, E2, R2>) => Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n    <A, E, R, B, E2, R2, C, E3, R3>(push: Push<A, E, R, B, E2, R2>, f: (b: B) => Fx.Fx<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n};"
    ],
    "typeParameters": [
      "B",
      "C",
      "E3",
      "R3",
      "A",
      "E",
      "R",
      "E2",
      "R2"
    ],
    "summary": "Runs one inner Fx at a time and retains only the latest value received while busy.\n\nA value while idle starts immediately. While its inner runs, newer outer values\nreplace a single pending slot. `f(value)` is evaluated and an inner Fx is\nconstructed before every replacement; a superseded pending Fx is never run.\nAfter completion, only the latest pending Fx starts. Accepted inners preserve\ntheir own order and all values. The input Sink is unchanged.",
    "sections": {
      "Why": "This is useful when work must not overlap but the newest requested state must\neventually be processed.",
      "Ownership and lifetime": "The output Scope owns one active inner fiber and an in-memory latest slot. It\njoins the final inner before completion and interrupts it with the subscription.\nInner failures and services join the output channels."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as Fx from \"@typed/fx/Fx\"\nimport * as Push from \"@typed/fx/Push\"\nimport * as Sink from \"@typed/fx/Sink\"\n\nconst constructed: Array<number> = []\nconst started: Array<number> = []\nconst finalized: Array<number> = []\nconst push = Push.make(\n  Sink.make(() => Effect.void, (_: string) => Effect.void),\n  Fx.fromIterable([1, 2, 3])\n)\nconst latest = Push.exhaustLatestMap(push, (id) => {\n  constructed.push(id)\n  return Fx.make<number>((sink) =>\n    Effect.gen(function* () {\n      yield* Effect.sync(() => started.push(id))\n      yield* Effect.sleep(\"5 millis\")\n      yield* sink.onSuccess(id * 10 + 1)\n      yield* Effect.sleep(\"5 millis\")\n      yield* sink.onSuccess(id * 10 + 2)\n    }).pipe(Effect.ensuring(Effect.sync(() => finalized.push(id))))\n  )\n})\nconst program = Fx.collectAll(latest).pipe(\n  Effect.map((values) => ({ values, constructed, started, finalized })),\n  Effect.scoped\n)\n// => values [11, 12, 31, 32]; constructed [1, 2, 3]; started/finalized [1, 3]."
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1803,
          "column": 14
        },
        "end": {
          "line": 1832,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1804,
          "column": 3
        },
        "end": {
          "line": 1808,
          "column": 57
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1809,
          "column": 3
        },
        "end": {
          "line": 1812,
          "column": 55
        }
      }
    ],
    "since": "1.0.0",
    "category": "Concurrent output work"
  }
}
