{
  "id": "@typed/fx/RefSubject#runUpdates",
  "canonicalId": "@typed/fx/RefSubject#runUpdates",
  "symbol": {
    "id": "@typed/fx/RefSubject#runUpdates",
    "packageName": "@typed/fx",
    "moduleName": "RefSubject",
    "exportName": "runUpdates",
    "kind": "constant",
    "signatures": [
      "export declare const runUpdates: {\n    <A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {\n        readonly onInterrupt: (value: A) => Effect.Effect<C, E3, R3>;\n        readonly value?: \"initial\" | \"current\";\n    }): (ref: RefSubject<A, E, R>) => Effect.Effect<B, E | E2 | E3, R | R2 | R3>;\n    <A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(ref: RefSubject<A, E, R>, f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {\n        readonly onInterrupt: (value: A) => Effect.Effect<C, E3, R3>;\n        readonly value?: \"initial\" | \"current\";\n    }): Effect.Effect<B, E | E2 | E3, R | R2 | R3>;\n};"
    ],
    "summary": "Runs an effect that can modify a `RefSubject` transactionally, with optional interrupt handling.",
    "sections": {
      "Why": "Runs an effect that can modify a `RefSubject` transactionally, with optional interrupt handling.\nThe transition is serialized at the RefSubject rather than coordinated by callers or UI\ncomponents.",
      "Ownership and lifetime": "Running run updates performs one serialized subject transition and resolves with its committed\nvalue. It acquires no resource; failures and services remain those of the source ref."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as RefSubject from \"@typed/fx/RefSubject\"\n\nconst program = Effect.gen(function* () {\n  const balance = yield* RefSubject.make(100)\n\n  // Transfer money atomically with interrupt handling\n  yield* RefSubject.runUpdates(\n    balance,\n    (ref) =>\n      Effect.gen(function* () {\n        const current = yield* ref.get\n        if (current >= 50) {\n          yield* ref.set(current - 50)\n          return \"Transfer successful\"\n        }\n        return \"Insufficient funds\"\n      }),\n    {\n      onInterrupt: (value) => Effect.sync(() => console.log(`Interrupted at balance: ${value}`)),\n      value: \"initial\"\n    }\n  )\n})"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/RefSubject/RefSubject.ts",
      "line": 2553
    },
    "since": "1.0.0",
    "category": "Transactions"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/RefSubject#runUpdates",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.13",
    "moduleName": "RefSubject",
    "consumerSpecifier": "@typed/fx/RefSubject",
    "exportName": "runUpdates",
    "qualifiedName": "runUpdates",
    "declarationKey": "declaration:6c3e42c64d917d789efb8627",
    "family": "variable",
    "signatures": [
      "export declare const runUpdates: {\n    <A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {\n        readonly onInterrupt: (value: A) => Effect.Effect<C, E3, R3>;\n        readonly value?: \"initial\" | \"current\";\n    }): (ref: RefSubject<A, E, R>) => Effect.Effect<B, E | E2 | E3, R | R2 | R3>;\n    <A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(ref: RefSubject<A, E, R>, f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {\n        readonly onInterrupt: (value: A) => Effect.Effect<C, E3, R3>;\n        readonly value?: \"initial\" | \"current\";\n    }): Effect.Effect<B, E | E2 | E3, R | R2 | R3>;\n};"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 2553,
          "column": 14
        },
        "end": {
          "line": 2594,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 2554,
          "column": 3
        },
        "end": {
          "line": 2560,
          "column": 79
        }
      },
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 2562,
          "column": 3
        },
        "end": {
          "line": 2569,
          "column": 49
        }
      }
    ],
    "aliases": [
      "@typed/fx#RefSubject.runUpdates"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:6c3e42c64d917d789efb8627",
    "name": "runUpdates",
    "family": "variable",
    "facets": [
      {
        "family": "variable",
        "syntaxKind": "VariableDeclaration",
        "signatures": [
          "export declare const runUpdates: {\n    <A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {\n        readonly onInterrupt: (value: A) => Effect.Effect<C, E3, R3>;\n        readonly value?: \"initial\" | \"current\";\n    }): (ref: RefSubject<A, E, R>) => Effect.Effect<B, E | E2 | E3, R | R2 | R3>;\n    <A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(ref: RefSubject<A, E, R>, f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {\n        readonly onInterrupt: (value: A) => Effect.Effect<C, E3, R3>;\n        readonly value?: \"initial\" | \"current\";\n    }): Effect.Effect<B, E | E2 | E3, R | R2 | R3>;\n};"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/fx/src/RefSubject/RefSubject.ts",
            "start": {
              "line": 2553,
              "column": 14
            },
            "end": {
              "line": 2594,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      },
      {
        "family": "call-signature",
        "syntaxKind": "CallSignature",
        "signatures": [
          "<A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {\n    readonly onInterrupt: (value: A) => Effect.Effect<C, E3, R3>;\n    readonly value?: \"initial\" | \"current\";\n}): (ref: RefSubject<A, E, R>) => Effect.Effect<B, E | E2 | E3, R | R2 | R3>;",
          "<A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(ref: RefSubject<A, E, R>, f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {\n    readonly onInterrupt: (value: A) => Effect.Effect<C, E3, R3>;\n    readonly value?: \"initial\" | \"current\";\n}): Effect.Effect<B, E | E2 | E3, R | R2 | R3>;"
        ],
        "typeParameters": [
          "A",
          "E",
          "R",
          "B",
          "E2",
          "R2",
          "R3 = never",
          "E3 = never",
          "C = never"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/RefSubject/RefSubject.ts",
            "start": {
              "line": 2554,
              "column": 3
            },
            "end": {
              "line": 2560,
              "column": 79
            }
          },
          {
            "file": "packages/fx/src/RefSubject/RefSubject.ts",
            "start": {
              "line": 2562,
              "column": 3
            },
            "end": {
              "line": 2569,
              "column": 49
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare const runUpdates: {\n    <A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {\n        readonly onInterrupt: (value: A) => Effect.Effect<C, E3, R3>;\n        readonly value?: \"initial\" | \"current\";\n    }): (ref: RefSubject<A, E, R>) => Effect.Effect<B, E | E2 | E3, R | R2 | R3>;\n    <A, E, R, B, E2, R2, R3 = never, E3 = never, C = never>(ref: RefSubject<A, E, R>, f: (ref: GetSetDelete<A, E, R>) => Effect.Effect<B, E2, R2>, options?: {\n        readonly onInterrupt: (value: A) => Effect.Effect<C, E3, R3>;\n        readonly value?: \"initial\" | \"current\";\n    }): Effect.Effect<B, E | E2 | E3, R | R2 | R3>;\n};"
    ],
    "typeParameters": [
      "A",
      "E",
      "R",
      "B",
      "E2",
      "R2",
      "R3 = never",
      "E3 = never",
      "C = never"
    ],
    "summary": "Runs an effect that can modify a `RefSubject` transactionally, with optional interrupt handling.",
    "sections": {
      "Why": "Runs an effect that can modify a `RefSubject` transactionally, with optional interrupt handling.\nThe transition is serialized at the RefSubject rather than coordinated by callers or UI\ncomponents.",
      "Ownership and lifetime": "Running run updates performs one serialized subject transition and resolves with its committed\nvalue. It acquires no resource; failures and services remain those of the source ref."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport * as RefSubject from \"@typed/fx/RefSubject\"\n\nconst program = Effect.gen(function* () {\n  const balance = yield* RefSubject.make(100)\n\n  // Transfer money atomically with interrupt handling\n  yield* RefSubject.runUpdates(\n    balance,\n    (ref) =>\n      Effect.gen(function* () {\n        const current = yield* ref.get\n        if (current >= 50) {\n          yield* ref.set(current - 50)\n          return \"Transfer successful\"\n        }\n        return \"Insufficient funds\"\n      }),\n    {\n      onInterrupt: (value) => Effect.sync(() => console.log(`Interrupted at balance: ${value}`)),\n      value: \"initial\"\n    }\n  )\n})"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 2553,
          "column": 14
        },
        "end": {
          "line": 2594,
          "column": 2
        }
      },
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 2554,
          "column": 3
        },
        "end": {
          "line": 2560,
          "column": 79
        }
      },
      {
        "file": "packages/fx/src/RefSubject/RefSubject.ts",
        "start": {
          "line": 2562,
          "column": 3
        },
        "end": {
          "line": 2569,
          "column": 49
        }
      }
    ],
    "since": "1.0.0",
    "category": "Transactions"
  }
}
