{
  "id": "@typed/fx#Fx.keyed",
  "canonicalId": "@typed/fx/Fx#keyed",
  "symbol": {
    "id": "@typed/fx#Fx.keyed",
    "packageName": "@typed/fx",
    "moduleName": ".",
    "exportName": "Fx.keyed",
    "kind": "constant",
    "signatures": [
      "export declare const keyed: {\n    <A, B extends PropertyKey, C, E2, R2>(options: KeyedOptions<A, B, C, E2, R2>): <E, R>(fx: Fx<ReadonlyArray<A>, E, R>) => Fx<ReadonlyArray<C>, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n    <A, E, R, B extends PropertyKey, C, E2, R2>(fx: Fx<ReadonlyArray<A>, E, R>, options: KeyedOptions<A, B, C, E2, R2>): Fx<ReadonlyArray<C>, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n};"
    ],
    "summary": "Efficiently transforms a list of values into a list of Fx streams, using keys to track identity.\n\nThis is crucial for performance when rendering lists or managing collections of stateful entities.\nWhen the input list changes:\n- New keys cause `onValue` to be called.\n- Existing keys have their `RefSubject` updated with the new value.\n- Removed keys close the supplied child Scope and clean resources registered\n  through it; the `onValue` run fiber remains owned by the outer parent Scope.",
    "sections": {
      "Why": "A stable key separates identity from position. Consumers can move or update\nthe exact result already associated with a value instead of recreating every\nresult when a collection changes. This is the state-preserving substrate used\nby keyed template rendering, but the combinator itself is renderer-agnostic.",
      "Ownership and lifetime": "Each key receives its own `RefSubject` and child `Scope`. Reusing a key updates\nthat subject in place. Removing a key closes the child Scope and therefore the\nresources registered through its supplied Scope service. The `onValue` run\nfiber itself is forked in the outer parent Scope, so child-Scope closure does\nnot guarantee interruption of an arbitrary Fx that ignores Scope. Interrupting\nthe outer run closes the parent and remaining children. Source and `onValue`\nfailures, services, and Scope requirements remain visible in the return type.",
      "Ordering and failures": "Each source array produces a unique-key diff. Added keys start one child Fx;\nreused keys update their existing RefSubject, including moves; removed keys\nhave their child Scope closed. A child may emit repeatedly, replacing only\nthat key's latest output. Arrays follow current source order and contain the\ncontiguous ready prefix: a later key is withheld until every earlier key has\nemitted at least once. Debounce coalesces scheduled arrays, not child Fx\nvalues. Duplicate keys fail with `Cause.IllegalArgumentError` rather than\nsharing a child lifetime."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx } from \"@typed/fx\"\n\nconst rows = Fx.keyed(Fx.succeed([{ id: \"a\", value: 1 }]), {\n  getKey: (row) => row.id,\n  onValue: (row) => Fx.map(row, ({ value }) => value)\n})"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Fx/combinators/keyed.ts",
      "line": 171
    },
    "since": "1.0.0",
    "category": "Keyed work"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx#Fx.keyed",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": ".",
    "consumerSpecifier": "@typed/fx",
    "exportName": "Fx",
    "qualifiedName": "Fx.keyed",
    "declarationKey": "declaration:0f506e32bc4360bf6e260309",
    "family": "variable",
    "signatures": [
      "export declare const keyed: {\n    <A, B extends PropertyKey, C, E2, R2>(options: KeyedOptions<A, B, C, E2, R2>): <E, R>(fx: Fx<ReadonlyArray<A>, E, R>) => Fx<ReadonlyArray<C>, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n    <A, E, R, B extends PropertyKey, C, E2, R2>(fx: Fx<ReadonlyArray<A>, E, R>, options: KeyedOptions<A, B, C, E2, R2>): Fx<ReadonlyArray<C>, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/keyed.ts",
        "start": {
          "line": 171,
          "column": 14
        },
        "end": {
          "line": 195,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/keyed.ts",
        "start": {
          "line": 172,
          "column": 3
        },
        "end": {
          "line": 176,
          "column": 88
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/keyed.ts",
        "start": {
          "line": 177,
          "column": 3
        },
        "end": {
          "line": 180,
          "column": 86
        }
      }
    ],
    "aliases": [
      "@typed/fx/Fx#keyed"
    ],
    "isAlias": true,
    "parentId": "@typed/fx#Fx",
    "static": false,
    "importedFrom": "declaration:0f506e32bc4360bf6e260309"
  },
  "declaration": {
    "declarationKey": "declaration:0f506e32bc4360bf6e260309",
    "name": "keyed",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const keyed: {\n    <A, B extends PropertyKey, C, E2, R2>(options: KeyedOptions<A, B, C, E2, R2>): <E, R>(fx: Fx<ReadonlyArray<A>, E, R>) => Fx<ReadonlyArray<C>, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n    <A, E, R, B extends PropertyKey, C, E2, R2>(fx: Fx<ReadonlyArray<A>, E, R>, options: KeyedOptions<A, B, C, E2, R2>): Fx<ReadonlyArray<C>, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/keyed.ts",
            "start": {
              "line": 171,
              "column": 14
            },
            "end": {
              "line": 195,
              "column": 3
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<A, B extends PropertyKey, C, E2, R2>(options: KeyedOptions<A, B, C, E2, R2>): <E, R>(fx: Fx<ReadonlyArray<A>, E, R>) => Fx<ReadonlyArray<C>, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;",
          "<A, E, R, B extends PropertyKey, C, E2, R2>(fx: Fx<ReadonlyArray<A>, E, R>, options: KeyedOptions<A, B, C, E2, R2>): Fx<ReadonlyArray<C>, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;"
        ],
        "typeParameters": [
          "A",
          "B extends PropertyKey",
          "C",
          "E2",
          "R2",
          "E",
          "R"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Fx/combinators/keyed.ts",
            "start": {
              "line": 172,
              "column": 3
            },
            "end": {
              "line": 176,
              "column": 88
            }
          },
          {
            "file": "packages/fx/src/Fx/combinators/keyed.ts",
            "start": {
              "line": 177,
              "column": 3
            },
            "end": {
              "line": 180,
              "column": 86
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const keyed: {\n    <A, B extends PropertyKey, C, E2, R2>(options: KeyedOptions<A, B, C, E2, R2>): <E, R>(fx: Fx<ReadonlyArray<A>, E, R>) => Fx<ReadonlyArray<C>, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n    <A, E, R, B extends PropertyKey, C, E2, R2>(fx: Fx<ReadonlyArray<A>, E, R>, options: KeyedOptions<A, B, C, E2, R2>): Fx<ReadonlyArray<C>, E | E2 | Cause.IllegalArgumentError, R | R2 | Scope.Scope>;\n};"
    ],
    "typeParameters": [
      "A",
      "B extends PropertyKey",
      "C",
      "E2",
      "R2",
      "E",
      "R"
    ],
    "summary": "Efficiently transforms a list of values into a list of Fx streams, using keys to track identity.\n\nThis is crucial for performance when rendering lists or managing collections of stateful entities.\nWhen the input list changes:\n- New keys cause `onValue` to be called.\n- Existing keys have their `RefSubject` updated with the new value.\n- Removed keys close the supplied child Scope and clean resources registered\n  through it; the `onValue` run fiber remains owned by the outer parent Scope.",
    "sections": {
      "Why": "A stable key separates identity from position. Consumers can move or update\nthe exact result already associated with a value instead of recreating every\nresult when a collection changes. This is the state-preserving substrate used\nby keyed template rendering, but the combinator itself is renderer-agnostic.",
      "Ownership and lifetime": "Each key receives its own `RefSubject` and child `Scope`. Reusing a key updates\nthat subject in place. Removing a key closes the child Scope and therefore the\nresources registered through its supplied Scope service. The `onValue` run\nfiber itself is forked in the outer parent Scope, so child-Scope closure does\nnot guarantee interruption of an arbitrary Fx that ignores Scope. Interrupting\nthe outer run closes the parent and remaining children. Source and `onValue`\nfailures, services, and Scope requirements remain visible in the return type.",
      "Ordering and failures": "Each source array produces a unique-key diff. Added keys start one child Fx;\nreused keys update their existing RefSubject, including moves; removed keys\nhave their child Scope closed. A child may emit repeatedly, replacing only\nthat key's latest output. Arrays follow current source order and contain the\ncontiguous ready prefix: a later key is withheld until every earlier key has\nemitted at least once. Debounce coalesces scheduled arrays, not child Fx\nvalues. Duplicate keys fail with `Cause.IllegalArgumentError` rather than\nsharing a child lifetime."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Fx } from \"@typed/fx\"\n\nconst rows = Fx.keyed(Fx.succeed([{ id: \"a\", value: 1 }]), {\n  getKey: (row) => row.id,\n  onValue: (row) => Fx.map(row, ({ value }) => value)\n})"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Fx/combinators/keyed.ts",
        "start": {
          "line": 171,
          "column": 14
        },
        "end": {
          "line": 195,
          "column": 3
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/keyed.ts",
        "start": {
          "line": 172,
          "column": 3
        },
        "end": {
          "line": 176,
          "column": 88
        }
      },
      {
        "file": "packages/fx/src/Fx/combinators/keyed.ts",
        "start": {
          "line": 177,
          "column": 3
        },
        "end": {
          "line": 180,
          "column": 86
        }
      }
    ],
    "since": "1.0.0",
    "category": "Keyed work"
  }
}
