packages feed

keiro-dsl-0.9.0.0: test/conformance-structural/Generated/StructuralConformance/ArtifactCatalog/EventStream.hs

-- @generated by keiro-dsl 0.8.0.0 (language keiro-dsl 4) from aggregate ArtifactCatalog; do not edit.
module Generated.StructuralConformance.ArtifactCatalog.EventStream
  ( artifactCatalogCategory
  , artifactCatalogCommandCategory
  , artifactCatalogEventStream
  , artifactCatalogEventStreamDef
  , ArtifactCatalogEventStream
  , ArtifactCatalogEventStreamDef
  ) where

import Generated.StructuralConformance.ArtifactCatalog.Domain
import Generated.StructuralConformance.ArtifactCatalog.Codec (artifactCatalogCodec)
import Generated.StructuralConformance.ArtifactCatalog.Transducer (artifactCatalogFoldFingerprint, artifactCatalogTransducer)
import Keiki.Core (HsPred)
import Keiro.EventStream (EventStream (..), SnapshotPolicy (..))
import Keiro.EventStream.Validate (ValidatedEventStream, mkEventStreamOrThrow)
import Keiro.Stream qualified as Stream

-- The validated aggregate stream category (hole-kind 5: referenced, never retyped).
-- Entity streams are '<category>-<id>' via Keiro.Stream.entityStream.
-- categoryUnsafe is safe here because this generated literal passed the DSL category proof.
artifactCatalogCategory :: Stream.StreamCategory ArtifactCatalogEventStreamDef
artifactCatalogCategory = Stream.categoryUnsafe "artifactCatalog"

-- The same category text, typed for command envelopes such as PMCommand.
artifactCatalogCommandCategory :: Stream.StreamCategory ArtifactCatalogCommand
artifactCatalogCommandCategory = Stream.categoryUnsafe "artifactCatalog"

type ArtifactCatalogEventStreamDef =
  EventStream (HsPred ArtifactCatalogRegs ArtifactCatalogCommand) ArtifactCatalogRegs ArtifactCatalogVertex ArtifactCatalogCommand ArtifactCatalogEvent

type ArtifactCatalogEventStream =
  ValidatedEventStream (HsPred ArtifactCatalogRegs ArtifactCatalogCommand) ArtifactCatalogRegs ArtifactCatalogVertex ArtifactCatalogCommand ArtifactCatalogEvent

artifactCatalogEventStreamDef :: ArtifactCatalogEventStreamDef
artifactCatalogEventStreamDef =
  EventStream
    { transducer = artifactCatalogTransducer,
      initialState = ArtifactCatalogEmpty,
      initialRegisters = initialArtifactCatalogRegs,
      eventCodec = artifactCatalogCodec,
      resolveStreamName = Stream.streamName,
      snapshotPolicy = Never,
      stateCodec = Nothing
    }

artifactCatalogEventStream :: ArtifactCatalogEventStream
artifactCatalogEventStream =
  mkEventStreamOrThrow "ArtifactCatalog" artifactCatalogEventStreamDef