Skip to content

js-bao-wss-client


js-bao-wss-client / defineModelSchema

Function: defineModelSchema() ​

defineModelSchema<TFields>(input): DefinedModelSchema<TFields>

Define a model's schema: its fields, and optionally its compound unique constraints, relationships and class name.

A unique constraint applies to scalar fields only. unique: true on a stringset field, or a uniqueConstraints entry naming a stringset field, is refused here: no writer can build that key consistently, so the platform cannot honor it.

Type Parameters ​

TFields ​

TFields extends Record<string, FieldOptions>

Parameters ​

input ​

DefineModelSchemaInput<TFields>

Returns ​

DefinedModelSchema<TFields>

Throws ​

UniqueStringsetError when the schema declares a unique constraint over a stringset field. The message names the model, the field (and the constraint, for a compound one) and the reason.

Documentation validated against js-bao-wss-client 3.4.0 · js-bao 0.11.0 · primitive-admin 1.0.62 · primitive-app 3.1.0 — 2026-09-30