{
  "id": "@typed/fx/Subject#Service",
  "canonicalId": "@typed/fx/Subject#Service",
  "symbol": {
    "id": "@typed/fx/Subject#Service",
    "packageName": "@typed/fx",
    "moduleName": "Subject",
    "exportName": "Service",
    "kind": "function",
    "signatures": [
      "export declare function Service<Self, A, E = never>(): <const Id extends string>(id: Id) => Subject.Class<Self, Id, A, E>;"
    ],
    "summary": "Defines an Effect context service that is simultaneously a `Subject`, `Fx`, and `Sink` facade.",
    "sections": {
      "Why": "A named subject often represents an application-wide event boundary. `Service` keeps that\nboundary type-safe and lets producers, consumers, and layers compose through Effect's normal\nservice channel instead of a module-global mutable instance.",
      "Ownership and lifetime": "Defining the class acquires nothing. Calling its static `make` creates a layer backed by scoped\n`Subject.make`; releasing the layer interrupts subscriptions and clears replay. Static `Fx` and\n`Sink` operations require `Self`, then delegate to the installed subject. Invalid replay\ncapacities fail layer construction with `Cause.IllegalArgumentError`."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport { Fx } from \"@typed/fx\"\nimport * as Subject from \"@typed/fx/Subject\"\n\nclass Notifications extends Subject.Service<Notifications, string>()(\"Notifications\") {}\n\nconst program = Effect.gen(function* () {\n  yield* Notifications.onSuccess(\"saved\")\n  return yield* Fx.first(Notifications)\n}).pipe(Effect.provide(Notifications.make(1)), Effect.scoped)"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/fx/src/Subject/Subject.ts",
      "line": 1488
    },
    "since": "1.0.0",
    "category": "Subject services"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/fx/Subject#Service",
    "packageName": "@typed/fx",
    "packageVersion": "2.0.0-beta.7",
    "moduleName": "Subject",
    "consumerSpecifier": "@typed/fx/Subject",
    "exportName": "Service",
    "qualifiedName": "Service",
    "declarationKey": "declaration:212df9a6155de8527bc6b01b",
    "family": "function",
    "signatures": [
      "export declare function Service<Self, A, E = never>(): <const Id extends string>(id: Id) => Subject.Class<Self, Id, A, E>;"
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Subject/Subject.ts",
        "start": {
          "line": 1488,
          "column": 1
        },
        "end": {
          "line": 1535,
          "column": 2
        }
      }
    ],
    "aliases": [
      "@typed/fx#Subject.Service"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:212df9a6155de8527bc6b01b",
    "name": "Service",
    "family": "function",
    "facets": [
      {
        "family": "function",
        "syntaxKind": "FunctionDeclaration",
        "signatures": [
          "export declare function Service<Self, A, E = never>(): <const Id extends string>(id: Id) => Subject.Class<Self, Id, A, E>;"
        ],
        "typeParameters": [
          "Self",
          "A",
          "E = never"
        ],
        "sourceSpans": [
          {
            "file": "packages/fx/src/Subject/Subject.ts",
            "start": {
              "line": 1488,
              "column": 1
            },
            "end": {
              "line": 1535,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare function Service<Self, A, E = never>(): <const Id extends string>(id: Id) => Subject.Class<Self, Id, A, E>;"
    ],
    "typeParameters": [
      "Self",
      "A",
      "E = never"
    ],
    "summary": "Defines an Effect context service that is simultaneously a `Subject`, `Fx`, and `Sink` facade.",
    "sections": {
      "Why": "A named subject often represents an application-wide event boundary. `Service` keeps that\nboundary type-safe and lets producers, consumers, and layers compose through Effect's normal\nservice channel instead of a module-global mutable instance.",
      "Ownership and lifetime": "Defining the class acquires nothing. Calling its static `make` creates a layer backed by scoped\n`Subject.make`; releasing the layer interrupts subscriptions and clears replay. Static `Fx` and\n`Sink` operations require `Self`, then delegate to the installed subject. Invalid replay\ncapacities fail layer construction with `Cause.IllegalArgumentError`."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { Effect } from \"effect\"\nimport { Fx } from \"@typed/fx\"\nimport * as Subject from \"@typed/fx/Subject\"\n\nclass Notifications extends Subject.Service<Notifications, string>()(\"Notifications\") {}\n\nconst program = Effect.gen(function* () {\n  yield* Notifications.onSuccess(\"saved\")\n  return yield* Fx.first(Notifications)\n}).pipe(Effect.provide(Notifications.make(1)), Effect.scoped)"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/fx/src/Subject/Subject.ts",
        "start": {
          "line": 1488,
          "column": 1
        },
        "end": {
          "line": 1535,
          "column": 2
        }
      }
    ],
    "since": "1.0.0",
    "category": "Subject services"
  }
}
