{
  "id": "@typed/fx#Push.exhaustLatestMapEffect",
  "canonicalId": "@typed/fx/Push#exhaustLatestMapEffect",
  "symbol": {
    "id": "@typed/fx#Push.exhaustLatestMapEffect",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "Push.exhaustLatestMapEffect",
    "kind": "constant",
    "signatures": [
      "export declare const exhaustLatestMapEffect: {\n    <B, C, E3, R3>(f: (b: B) => Effect.Effect<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) => Effect.Effect<C, E3, R3>): Push<A, E, R, C, E2 | E3, R2 | R3 | Scope.Scope>;\n};"
    ],
    "summary": "Runs one mapped Effect at a time and retains only the latest value received while busy.\n\nEach accepted Effect can emit one result. While it runs, one pending Effect is\nrepeatedly overwritten; after completion only the latest pending Effect starts.\nThe mapping callback still runs and constructs an Effect for every value before\nreplacement; superseded Effects are not run. The input side is unchanged.",
    "sections": {
      "Why": "This provides non-overlapping Effect work with eventual latest-state handling,\navoiding an unbounded queue of obsolete requests.",
      "Ownership and lifetime": "The output Scope owns the active Effect fiber and pending slot. It waits for the\nfinal Effect, interrupts it with the subscription, and runs its finalizers.\nEffect 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 finalized: Array<number> = []\nconst push = Push.make(\n  Sink.make(() => Effect.void, (_: string) => Effect.void),\n  Fx.fromIterable([1, 2, 3])\n)\nconst latestSaved = Push.exhaustLatestMapEffect(push, (id) => {\n  constructed.push(id)\n  return Effect.sleep(\"10 millis\").pipe(\n    Effect.as(id),\n    Effect.ensuring(Effect.sync(() => finalized.push(id)))\n  )\n})\nconst program = Fx.collectAll(latestSaved).pipe(\n  Effect.map((values) => ({ values, constructed, finalized })),\n  Effect.scoped\n)\n// Effect.runPromise(program) => { values: [1, 3], constructed: [1, 2, 3], finalized: [1, 3] }"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Push/Push.ts",
      "line": 1884
    },
    "since": "1.0.0",
    "category": "Concurrent output work"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#Push.exhaustLatestMapEffect",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "Push",
    "qualifiedName": "Push.exhaustLatestMapEffect",
    "declarationKey": "declaration:66016342e4a19cf2330ccfea",
    "family": "variable",
    "signatures": [
      "export declare const exhaustLatestMapEffect: {\n    <B, C, E3, R3>(f: (b: B) => Effect.Effect<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) => Effect.Effect<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": 1884,
          "column": 14
        },
        "end": {
          "line": 1913,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1885,
          "column": 3
        },
        "end": {
          "line": 1889,
          "column": 57
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1890,
          "column": 3
        },
        "end": {
          "line": 1893,
          "column": 55
        }
      }
    ],
    "aliases": [
      "@typed/fx/Push#exhaustLatestMapEffect"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#Push",
    "static": false,
    "importedFrom": "declaration:66016342e4a19cf2330ccfea"
  },
  "declaration": {
    "declarationKey": "declaration:66016342e4a19cf2330ccfea",
    "name": "exhaustLatestMapEffect",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const exhaustLatestMapEffect: {\n    <B, C, E3, R3>(f: (b: B) => Effect.Effect<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) => Effect.Effect<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": 1884,
              "column": 14
            },
            "end": {
              "line": 1913,
              "column": 3
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<B, C, E3, R3>(f: (b: B) => Effect.Effect<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) => Effect.Effect<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": 1885,
              "column": 3
            },
            "end": {
              "line": 1889,
              "column": 57
            }
          },
          {
            "file": "packages/fx/src/Push/Push.ts",
            "start": {
              "line": 1890,
              "column": 3
            },
            "end": {
              "line": 1893,
              "column": 55
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const exhaustLatestMapEffect: {\n    <B, C, E3, R3>(f: (b: B) => Effect.Effect<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) => Effect.Effect<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 mapped Effect at a time and retains only the latest value received while busy.\n\nEach accepted Effect can emit one result. While it runs, one pending Effect is\nrepeatedly overwritten; after completion only the latest pending Effect starts.\nThe mapping callback still runs and constructs an Effect for every value before\nreplacement; superseded Effects are not run. The input side is unchanged.",
    "sections": {
      "Why": "This provides non-overlapping Effect work with eventual latest-state handling,\navoiding an unbounded queue of obsolete requests.",
      "Ownership and lifetime": "The output Scope owns the active Effect fiber and pending slot. It waits for the\nfinal Effect, interrupts it with the subscription, and runs its finalizers.\nEffect 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 finalized: Array<number> = []\nconst push = Push.make(\n  Sink.make(() => Effect.void, (_: string) => Effect.void),\n  Fx.fromIterable([1, 2, 3])\n)\nconst latestSaved = Push.exhaustLatestMapEffect(push, (id) => {\n  constructed.push(id)\n  return Effect.sleep(\"10 millis\").pipe(\n    Effect.as(id),\n    Effect.ensuring(Effect.sync(() => finalized.push(id)))\n  )\n})\nconst program = Fx.collectAll(latestSaved).pipe(\n  Effect.map((values) => ({ values, constructed, finalized })),\n  Effect.scoped\n)\n// Effect.runPromise(program) => { values: [1, 3], constructed: [1, 2, 3], finalized: [1, 3] }"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1884,
          "column": 14
        },
        "end": {
          "line": 1913,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1885,
          "column": 3
        },
        "end": {
          "line": 1889,
          "column": 57
        }
      },
      {
        "file": "packages/fx/src/Push/Push.ts",
        "start": {
          "line": 1890,
          "column": 3
        },
        "end": {
          "line": 1893,
          "column": 55
        }
      }
    ],
    "since": "1.0.0",
    "category": "Concurrent output work"
  }
}
