Schemas.ts overview

The WorkOS User Management wire shapes this package reads, as Schemas. Fields are snake_case, as WorkOS sends them; unknown fields are ignored, so a field WorkOS adds never fails a decode.

Since v0.1.0


Exports Grouped by Category


schemas

AuthenticationResponse

What POST /user_management/authenticate answers on success.

Signature

declare const AuthenticationResponse: Schema.Struct<{
  readonly user: Schema.Struct<{
    readonly id: Schema.String
    readonly email: Schema.String
    readonly email_verified: Schema.Boolean
    readonly first_name: Schema.optional<Schema.NullOr<Schema.String>>
    readonly last_name: Schema.optional<Schema.NullOr<Schema.String>>
    readonly name: Schema.optional<Schema.NullOr<Schema.String>>
    readonly profile_picture_url: Schema.optional<Schema.NullOr<Schema.String>>
    readonly last_sign_in_at: Schema.optional<Schema.NullOr<Schema.String>>
    readonly external_id: Schema.optional<Schema.NullOr<Schema.String>>
    readonly metadata: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>>
    readonly created_at: Schema.String
    readonly updated_at: Schema.String
  }>
  readonly organization_id: Schema.optional<Schema.NullOr<Schema.String>>
  readonly access_token: Schema.String
  readonly refresh_token: Schema.String
  readonly authentication_method: Schema.optional<Schema.NullOr<Schema.String>>
  readonly impersonator: Schema.optional<
    Schema.NullOr<
      Schema.Struct<{ readonly email: Schema.String; readonly reason: Schema.optional<Schema.NullOr<Schema.String>> }>
    >
  >
}>

Source

Since v0.1.0

ErrorBody

A WorkOS error body. code names the failure (invalid_credentials, email_verification_required, …); older endpoints put it in error.

Signature

declare const ErrorBody: Schema.Struct<{
  readonly code: Schema.optional<Schema.NullOr<Schema.String>>
  readonly error: Schema.optional<Schema.NullOr<Schema.String>>
  readonly message: Schema.optional<Schema.NullOr<Schema.String>>
  readonly error_description: Schema.optional<Schema.NullOr<Schema.String>>
  readonly pending_authentication_token: Schema.optional<Schema.NullOr<Schema.String>>
  readonly errors: Schema.optional<
    Schema.NullOr<Schema.$Array<Schema.Struct<{ readonly code: Schema.optional<Schema.NullOr<Schema.String>> }>>>
  >
}>

Source

Since v0.1.0

Identity

A WorkOS identity: a provider account linked to a user.

Signature

declare const Identity: Schema.Struct<{
  readonly idp_id: Schema.String
  readonly type: Schema.String
  readonly provider: Schema.String
}>

Source

Since v0.1.0

Impersonator

The admin impersonating a user, when the session is an impersonation.

Signature

declare const Impersonator: Schema.Struct<{
  readonly email: Schema.String
  readonly reason: Schema.optional<Schema.NullOr<Schema.String>>
}>

Source

Since v0.1.0

List

A page of a WorkOS list endpoint.

Signature

declare const List: <S extends Schema.Top>(
  item: S
) => Schema.Struct<{
  readonly data: Schema.$Array<S>
  readonly list_metadata: Schema.optional<
    Schema.Struct<{
      readonly before: Schema.optional<Schema.NullOr<Schema.String>>
      readonly after: Schema.optional<Schema.NullOr<Schema.String>>
    }>
  >
}>

Source

Since v0.1.0

MagicAuth

A Magic Auth code record. code is present only in the answer to its creation.

Signature

declare const MagicAuth: Schema.Struct<{
  readonly id: Schema.String
  readonly user_id: Schema.String
  readonly email: Schema.String
  readonly expires_at: Schema.String
  readonly code: Schema.optional<Schema.NullOr<Schema.String>>
}>

Source

Since v0.1.0

PasswordReset

A password reset. The token and URL are present only in the answer to its creation.

Signature

declare const PasswordReset: Schema.Struct<{
  readonly id: Schema.String
  readonly user_id: Schema.String
  readonly email: Schema.String
  readonly password_reset_token: Schema.optional<Schema.NullOr<Schema.String>>
  readonly password_reset_url: Schema.optional<Schema.NullOr<Schema.String>>
  readonly expires_at: Schema.String
}>

Source

Since v0.1.0

UserEnvelope

An answer that carries a user (password_reset/confirm, email_verification/confirm).

Signature

declare const UserEnvelope: Schema.Struct<{
  readonly user: Schema.Struct<{
    readonly id: Schema.String
    readonly email: Schema.String
    readonly email_verified: Schema.Boolean
    readonly first_name: Schema.optional<Schema.NullOr<Schema.String>>
    readonly last_name: Schema.optional<Schema.NullOr<Schema.String>>
    readonly name: Schema.optional<Schema.NullOr<Schema.String>>
    readonly profile_picture_url: Schema.optional<Schema.NullOr<Schema.String>>
    readonly last_sign_in_at: Schema.optional<Schema.NullOr<Schema.String>>
    readonly external_id: Schema.optional<Schema.NullOr<Schema.String>>
    readonly metadata: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>>
    readonly created_at: Schema.String
    readonly updated_at: Schema.String
  }>
}>

Source

Since v0.1.0

WireEvent

A WorkOS event, from a webhook or GET /events. data is the event’s object, decoded further by the event type.

Signature

declare const WireEvent: Schema.Struct<{
  readonly id: Schema.String
  readonly event: Schema.String
  readonly data: Schema.Unknown
  readonly created_at: Schema.String
}>

Source

Since v0.1.0

WireSession

A WorkOS session, as GET /user_management/users/:id/sessions lists it.

Signature

declare const WireSession: Schema.Struct<{
  readonly id: Schema.String
  readonly user_id: Schema.String
  readonly organization_id: Schema.optional<Schema.NullOr<Schema.String>>
  readonly status: Schema.String
  readonly auth_method: Schema.optional<Schema.NullOr<Schema.String>>
  readonly ip_address: Schema.optional<Schema.NullOr<Schema.String>>
  readonly user_agent: Schema.optional<Schema.NullOr<Schema.String>>
  readonly impersonator: Schema.optional<
    Schema.NullOr<
      Schema.Struct<{ readonly email: Schema.String; readonly reason: Schema.optional<Schema.NullOr<Schema.String>> }>
    >
  >
  readonly expires_at: Schema.String
  readonly ended_at: Schema.optional<Schema.NullOr<Schema.String>>
  readonly created_at: Schema.String
  readonly updated_at: Schema.String
}>

Source

Since v0.1.0

WireUser

A WorkOS user (object: "user").

Signature

declare const WireUser: Schema.Struct<{
  readonly id: Schema.String
  readonly email: Schema.String
  readonly email_verified: Schema.Boolean
  readonly first_name: Schema.optional<Schema.NullOr<Schema.String>>
  readonly last_name: Schema.optional<Schema.NullOr<Schema.String>>
  readonly name: Schema.optional<Schema.NullOr<Schema.String>>
  readonly profile_picture_url: Schema.optional<Schema.NullOr<Schema.String>>
  readonly last_sign_in_at: Schema.optional<Schema.NullOr<Schema.String>>
  readonly external_id: Schema.optional<Schema.NullOr<Schema.String>>
  readonly metadata: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.String>>>
  readonly created_at: Schema.String
  readonly updated_at: Schema.String
}>

Source

Since v0.1.0

utils

AuthenticationResponse (type alias)

Signature

type AuthenticationResponse = typeof AuthenticationResponse.Type

Source

Since v0.1.0

ErrorBody (type alias)

Signature

type ErrorBody = typeof ErrorBody.Type

Source

Since v0.1.0

Identity (type alias)

Signature

type Identity = typeof Identity.Type

Source

Since v0.1.0

Impersonator (type alias)

Signature

type Impersonator = typeof Impersonator.Type

Source

Since v0.1.0

MagicAuth (type alias)

Signature

type MagicAuth = typeof MagicAuth.Type

Source

Since v0.1.0

PasswordReset (type alias)

Signature

type PasswordReset = typeof PasswordReset.Type

Source

Since v0.1.0

UserEnvelope (type alias)

Signature

type UserEnvelope = typeof UserEnvelope.Type

Source

Since v0.1.0

WireEvent (type alias)

Signature

type WireEvent = typeof WireEvent.Type

Source

Since v0.1.0

WireSession (type alias)

Signature

type WireSession = typeof WireSession.Type

Source

Since v0.1.0

WireUser (type alias)

Signature

type WireUser = typeof WireUser.Type

Source

Since v0.1.0

instant

A WorkOS timestamp (ISO 8601, or epoch milliseconds) as a Date; one that does not parse reads as the epoch rather than failing a whole answer.

Signature

declare const instant: (value: string | number) => Date

Source

Since v0.1.0


This site uses Just the Docs, a documentation theme for Jekyll.