effect-tea-persistent
    Preparing search index...
    • The one place a program is declared: its schemas, which give every type the program is written in, and then what it does (decision 0035). An object literal typed Program<T> names each type twice, and holds neither the keys work may use nor the messages an operation answers. Here each piece says its own type. The schemas say what the state, the flags, the messages, the operations, the rejections, the senders and the projection are. keys says the space of keys the work is held under (decision 0033). Each runner says which messages its kind of operation answers, and which services it needs (decision 0034). indexes says what a query filters and orders by. children says the parts the state holds, whose messages, work and keys the library derives (decision 0133).

      Type Parameters

      • State extends object
      • Flags
      • Inbound
      • Projection extends Json
      • Internal = never
      • Operation extends Readonly<{ _tag: string }> = never
      • Rejection = never
      • Sender = null

      Parameters

      • schemas: Readonly<
            {
                flags: Schema.Codec<Flags, Json>;
                inbound: Schema.Codec<Inbound, Json>;
                internal?: Schema.Codec<Internal, Json>;
                operation?: Schema.Codec<Operation, Json>;
                projection: Schema.Codec<Projection, Json>;
                rejection?: Schema.Codec<Rejection, Json>;
                sender?: Schema.Codec<Sender, Json>;
                state: Schema.Codec<State, Json>;
            },
        >

      Returns <
          Indexes extends
              Readonly<Record<string, (projection: Projection) => Scalar>>,
          Topics extends Readonly<Record<string, (projection: Projection) => Json>>,
          const Name extends string,
          const List extends DeclaredKeys = [],
          Operations extends
              Declared<Operation, Internal> = Declared<Operation, Internal>,
          const C extends
              Readonly<
                  Record<string, One<State, AnyPart> | Each<State, any, AnyPart>>,
              > = {},
      >(
          declaration: Readonly<
              {
                  children?: C;
                  keys?: List & LiteralNames<List>;
                  project: (state: State, children: Projections<State, C>) => Projection;
              },
          > & UpdateOf<State, Inbound | Internal, Sender, never, Rejection, C> & WorkOf<
              State,
              Internal,
              Operation,
              KeysOf<List>,
          > & OperationsOf<Operation, Operations> & OnEventOf<State, never, C> & (
              [TakenBy<Inbound, Names<C>> | TakenBy<Internal, Names<C>>] extends [
                  never,
              ]
                  ? unknown
                  : Readonly<
                      {
                          "an own message takes the name of a child": | TakenBy<
                              Inbound,
                              Names<C>,
                          >
                          | TakenBy<Internal, Names<C>>;
                      },
                  >
          ) & (
              [TakenBy<Rejection, Names<C>>] extends [never]
                  ? unknown
                  : Readonly<
                      {
                          "an own reason takes the name of a child": TakenBy<
                              Rejection,
                              Names<C>,
                          >;
                      },
                  >
          ) & (
              [OperationsTakenBy<Operation, C>] extends [never]
                  ? unknown
                  : Readonly<
                      {
                          "an own operation takes the name of a child's": OperationsTakenBy<
                              Operation,
                              C,
                          >;
                      },
                  >
          ) & (
              [
                  {
                      [K in string]: [Sender] extends [PartIn<(...)[(...)]>["sender"]]
                          ? never
                          : K
                  }[Names<C>],
              ] extends [never]
                  ? unknown
                  : Readonly<
                      {
                          "a child reads a sender its parent does not have": {
                              [K in string]: [Sender] extends [PartIn<(...)>["sender"]]
                                  ? never
                                  : K
                          }[Names<C>];
                      },
                  >
          ) & Readonly<
              {
                  indexes?: Indexes;
                  init: (flags: Flags, at: Utc) => State | Rejected<Rejection>;
                  migrations?: readonly Readonly<
                      {
                          flags?: (json: Json) => Json;
                          inbound?: (json: Json) => Json;
                          internal?: (json: Json) => Json;
                          operation?: (json: Json) => Json;
                          projection?: (json: Json) => Json;
                          rejection?: (json: Json) => Json;
                          sender?: (json: Json) => Json;
                          state?: (json: Json) => Json;
                      },
                  >[];
                  name: Name;
                  topics?: Topics;
              },
          >,
      ) => Program<
          Readonly<
              {
                  flags: Flags;
                  inbound: Inbound
                  | Wrapped<C, "inbound">;
                  internal: Internal | Wrapped<C, "internal">;
                  key: Extract<keyof KeysOf<List>, string> | ChildKey<C>;
                  operation: Operation | ChildOperation<C>;
                  parameter: ParametersOf<KeysOf<List>> & ChildParameter<C>;
                  projection: Projection;
                  rejection: Rejection | ChildRejection<C>;
                  sender: Sender;
                  services:
                      | Services<
                          Operations[keyof Operations] extends Readonly<
                              { run: (...args: ...) => ... },
                          >
                              ? Running
                              : never,
                      >
                      | ChildServices<C>;
                  state: State;
              },
          > & Readonly<{ index: IndexNames<Indexes>; topics: TopicValues<Topics> }>,
          Name,
      >