Skip to content
TypeScript
2.9 KB
Raw Blame
// Generated by @effect/graphql-generator. Do not edit.
import * as Schema from "effect/Schema"

export const ID = Schema.String

/** An instant, as an ISO-8601 string. */
export const DateTime = Schema.DateTimeUtcFromString

/** - `ANY` */
export const ReadonlyArray = Schema.Literals(["ANY"])
export type ReadonlyArray = typeof ReadonlyArray.Type

/**
 * What a member may do in a room.
 *
 * - `OWNER`
 * - `MEMBER`
 * - `GUEST`
 */
export const Role = Schema.Literals(["OWNER", "MEMBER", "GUEST"])
export type Role = typeof Role.Type

/** Filters messages. */
export const MessageFilter: Schema.Codec<MessageFilter, MessageFilterEncoded> = Schema.Struct({
  postedAfter: Schema.optional(Schema.NullOr(DateTime)),
  member: Schema.optional(Schema.NullOr(Schema.suspend(() => MemberMatch))),
  or: Schema.optional(Schema.NullOr(Schema.Array(Schema.suspend(() => MessageFilter)))),
  shadow: Schema.optional(Schema.NullOr(ReadonlyArray))
})
export interface MessageFilter {
  readonly postedAfter?: typeof DateTime.Type | null | undefined
  readonly member?: MemberMatch | null | undefined
  /** Any of these filters. */
  readonly or?: readonly MessageFilter[] | null | undefined
  /** A type named like a TypeScript global, which generated code must not shadow. */
  readonly shadow?: ReadonlyArray | null | undefined
}
export interface MessageFilterEncoded {
  readonly postedAfter?: typeof DateTime.Encoded | null | undefined
  readonly member?: MemberMatchEncoded | null | undefined
  readonly or?: readonly MessageFilterEncoded[] | null | undefined
  readonly shadow?: typeof ReadonlyArray.Encoded | null | undefined
}

/** Exactly one way to match a member. */
export const MemberMatch: Schema.Codec<MemberMatch, MemberMatchEncoded> = Schema.Union([
  Schema.Struct({
    id: ID,
    posted: Schema.optionalKey(Schema.Never)
  }),
  Schema.Struct({
    id: Schema.optionalKey(Schema.Never),
    /** Members who posted a matching message. */
    posted: Schema.suspend(() => MessageFilter)
  })
])
export type MemberMatch =
  | { readonly id: typeof ID.Type; readonly posted?: never }
  | { readonly id?: never; readonly posted: MessageFilter }
export type MemberMatchEncoded =
  | { readonly id: typeof ID.Encoded; readonly posted?: never }
  | { readonly id?: never; readonly posted: MessageFilterEncoded }

/** Exactly one way to pick a room. */
export const RoomBy = Schema.Opaque<RoomBy>()(Schema.Union([
  Schema.Struct({
    id: ID,
    slug: Schema.optionalKey(Schema.Never)
  }),
  Schema.Struct({
    id: Schema.optionalKey(Schema.Never),
    slug: Schema.String
  })
]))
export type RoomBy =
  | { readonly id: typeof ID.Type; readonly slug?: never }
  | { readonly id?: never; readonly slug: string }

/** The possible `__typename` values of each interface and union the operations select from. */
export declare namespace Typename {
  /** Every possible `__typename` of interface `Event`. */
  export type Event = "MemberJoined" | "MessagePosted" | "RoomRenamed"
}