hidden

Don't hide the id or you won't find any record ;-)

Usage

class User extends Model {
  static entity = 'users'
  
  // only return fields "name" and "phone" for this model by default
  static hidden = ['secret']
  static fields () {
    return {
      id: this.uid(),
      name: this.string(''),
      phone: this.number(0),
      secret: this.string('')
    }
  }
}

With Decorator

User.ts
import { Model } from 'pinia-orm'
import { Attr, Hidden, Uid } from 'pinia-orm/decorators'
class User extends Model {
  static entity = 'users'
  @Uid() declare id: string
  @Attr('{}') declare name: string
  @Hidden() @Attr('{}') declare secret: string
}

Typescript Declarations

const visible: hidden[] = []