Skip to content

EntityProxy

4 exports Added in v1.0.0 Source

Constructors

Derives an HttpApiGroup from an Entity.

Signature

declare function toHttpApiGroup<Name extends string, Type extends string, Rpcs extends Any>(
  name: Name,
  entity: Entity<Type, Rpcs>,
): HttpApiGroup<Name, ConvertHttpApi<Rpcs>>;

toRpcGroup

Added in v1.0.0 Source

Derives an RpcGroup from an Entity.

Signature

declare function toRpcGroup<Type extends string, Rpcs extends Any>(
  entity: Entity<Type, Rpcs>,
): RpcGroup<ConvertRpcs<Rpcs, Type>>;

Other

ConvertHttpApi type

Added in v1.0.0 Source

Signature

type ConvertHttpApi<Rpcs extends Rpc.Any> =
  Rpcs extends Rpc.Rpc<infer _Tag, infer _Payload, infer _Success, infer _Error, infer _Middleware>
    ?
        | HttpApiEndpoint.HttpApiEndpoint<
            _Tag,
            "POST",
            {
              readonly entityId: string;
            },
            never,
            _Payload["Type"],
            never,
            _Success["Type"],
            _Error["Type"] | MailboxFull | AlreadyProcessingMessage | PersistenceError,
            _Payload["Context"] | _Success["Context"],
            _Error["Context"]
          >
        | HttpApiEndpoint.HttpApiEndpoint<
            `${_Tag}Discard`,
            "POST",
            {
              readonly entityId: string;
            },
            never,
            _Payload["Type"],
            never,
            void,
            MailboxFull | AlreadyProcessingMessage | PersistenceError
          >
    : never;

ConvertRpcs type

Added in v1.0.0 Source

Signature

type ConvertRpcs<Rpcs extends Rpc.Any, Prefix extends string> =
  Rpcs extends Rpc.Rpc<infer _Tag, infer _Payload, infer _Success, infer _Error, infer _Middleware>
    ?
        | Rpc.Rpc<
            `${Prefix}.${_Tag}`,
            Schema.Struct<{
              entityId: typeof Schema.String;
              payload: _Payload;
            }>,
            _Success,
            Schema.Schema<
              | _Error["Type"]
              | MailboxFull
              | AlreadyProcessingMessage
              | PersistenceError
              | _Error["Encoded"]
              | (typeof MailboxFull)["Encoded"]
              | (typeof AlreadyProcessingMessage)["Encoded"]
              | (typeof PersistenceError)["Encoded"],
              _Error["Context"]
            >
          >
        | Rpc.Rpc<
            `${Prefix}.${_Tag}Discard`,
            Schema.Struct<{
              entityId: typeof Schema.String;
              payload: _Payload;
            }>,
            typeof Schema.Void,
            Schema.Union<
              [typeof MailboxFull, typeof AlreadyProcessingMessage, typeof PersistenceError]
            >
          >
    : never;