packages feed

keiro-dsl-0.12.0.0: test/conformance-projection-catalog/Generated/CatalogDemo/Shipments/EventStream.hs

-- @generated by keiro-dsl 0.12.0.0 (language keiro-dsl 5) from aggregate Shipments; do not edit.
module Generated.CatalogDemo.Shipments.EventStream
  ( shipmentsCategory
  , shipmentsCommandCategory
  , shipmentsEventStream
  , shipmentsEventStreamDef
  , ShipmentsEventStream
  , ShipmentsEventStreamDef
  ) where

import Generated.CatalogDemo.Shipments.Domain
import Generated.CatalogDemo.Shipments.Codec (shipmentsCodec)
import Generated.CatalogDemo.Shipments.Transducer (shipmentsTransducer)
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.
shipmentsCategory :: Stream.StreamCategory ShipmentsEventStreamDef
shipmentsCategory = Stream.categoryUnsafe "shipments"

-- The same category text, typed for command envelopes such as PMCommand.
shipmentsCommandCategory :: Stream.StreamCategory ShipmentsCommand
shipmentsCommandCategory = Stream.categoryUnsafe "shipments"

type ShipmentsEventStreamDef =
  EventStream (HsPred ShipmentsRegs ShipmentsCommand) ShipmentsRegs ShipmentsVertex ShipmentsCommand ShipmentsEvent

type ShipmentsEventStream =
  ValidatedEventStream (HsPred ShipmentsRegs ShipmentsCommand) ShipmentsRegs ShipmentsVertex ShipmentsCommand ShipmentsEvent

shipmentsEventStreamDef :: ShipmentsEventStreamDef
shipmentsEventStreamDef =
  EventStream
    { transducer = shipmentsTransducer,
      initialState = ShipmentsEmpty,
      initialRegisters = initialShipmentsRegs,
      eventCodec = shipmentsCodec,
      resolveStreamName = Stream.streamName,
      snapshotPolicy = Never,
      stateCodec = Nothing
    }

shipmentsEventStream :: ShipmentsEventStream
shipmentsEventStream =
  mkEventStreamOrThrow "Shipments" shipmentsEventStreamDef