Custom Profile Fields Schema (jsonb-types/custom-profile-fields.ts)

logto · packages/schemas/src/foundations/jsonb-types/custom-profile-fields.ts · typescript · MPL-2.0
auth, database, lang:typescript, fw:zod, tag:validation

Zod validation schemas and type definitions for custom user profile fields supporting primitive and composite types. Reuse when building extensible user profile management systems.

// Source: https://github.com/logto-io/logto | License: MPL-2.0 | Copyright under Patent Claims infringed by Covered Software in the absence of | Modified files must remain under MPL-2.0
// Modifications to this file must remain under MPL-2.0.
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from 'zod';

export enum CustomProfileFieldType {
  /* Primitive types */
  Text = 'Text',
  Number = 'Number',
  Date = 'Date',
  Checkbox = 'Checkbox',
  Select = 'Select',
  Url = 'Url',
  Regex = 'Regex',
  /* Composite types */
  Address = 'Address',
  Fullname = 'Fullname',
}

export const customProfileFieldTypeGuard = z.nativeEnum(CustomProfileFieldType);

export const fieldOptionGuard = z.object({
  label: z.string().optional(),
  value: z.string(),
});

export type

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key