Options
All
  • Public
  • Public/Protected
  • All
Menu

Module model

Index

Type aliases

CanReadFunction

CanReadFunction: (input: CanReadInput) => boolean

Type declaration

    • (input: CanReadInput): boolean
    • Parameters

      • input: CanReadInput

      Returns boolean

ExtendModelFunc

ExtendModelFunc<TExtended>: (model: VulcanModel) => TExtended

Type parameters

Type declaration

PermissionChecker

PermissionChecker: (options: { context?: any; document?: VulcanDocument | null; operationName?: string; user?: (VulcanDocument & { groups: GroupName[] }) | null }) => boolean

Type declaration

    • (options: { context?: any; document?: VulcanDocument | null; operationName?: string; user?: (VulcanDocument & { groups: GroupName[] }) | null }): boolean
    • Parameters

      • options: { context?: any; document?: VulcanDocument | null; operationName?: string; user?: (VulcanDocument & { groups: GroupName[] }) | null }
        • Optional context?: any

          Request context, will only exist server-side

        • Optional document?: VulcanDocument | null
        • Optional operationName?: string

          Request context, will only exist server-side

        • Optional user?: (VulcanDocument & { groups: GroupName[] }) | null

          NOTE: vulcan/permissions depends on VulcanModel so the type cannot be VulcanUser. We should either expose VulcanUser from vulcan/model directly or keep it as is

          Or maybe "permissions" should extend vulcan/model with the permissions field

      Returns boolean

Functions

Const createModel

  • createModel<TModelDefinition>(options: CreateModelOptions<VulcanSchema<AnyObject>>): TModelDefinition
  • Type parameters

    • TModelDefinition: VulcanModel<VulcanSchema<AnyObject>, TModelDefinition>

    Parameters

    Returns TModelDefinition

Const createSchema

  • createSchema(schema: VulcanSchema<AnyObject>, apiSchema?: {}, dbSchema?: {}): VulcanSchema<AnyObject>
  • Convert a schema definition to a valid Vulcan schema => in Vulcan Next we correctly split apiSchema and dbSchema so almost no need of such a function + we try to have a unified syntax for schema

    We convert to a valid Simple-Schema only has a last resort when we actually need Simple-Schema (eg for validation)

    deprecated

    Used only internally in Vulcan to parse "arrayItem". If used in your app: use a server model instead of API schema ; use a custom connector instead of dbSchema ; for other fields we parse them directly in createModel

    Parameters

    • schema: VulcanSchema<AnyObject>
    • apiSchema: {} = {}
    • dbSchema: {} = {}

    Returns VulcanSchema<AnyObject>

Const extractArrayItems

  • extractArrayItems(schema: any, fieldName: any, arrayItem: any, level?: number): void
  • Parameters

    • schema: any
    • fieldName: any
    • arrayItem: any
    • level: number = 1

    Returns void

Generated using TypeDoc