WRDSchema | WebHare Platform SDK
WebHare Platform SDK
    Preparing search index...

    Class WRDSchema<S>

    Type Parameters

    • S extends SchemaTypeDefinition = AnySchemaTypeDefinition
    Index

    Constructors

    • Open a WRD schema by tag

      Type Parameters

      • S extends SchemaTypeDefinition = AnySchemaTypeDefinition

      Parameters

      • tag: string

      Returns WRDSchema<S>

    Properties

    tag: string

    Methods

    • Parameters

      • __namedParameters: { refresh?: boolean } = {}

      Returns Promise<SchemaData>

    • Parameters

      • type: number

      Returns Promise<null | string>

    • Returns Promise<IteratorObject<{ id: number; tag: TypeRec }, undefined, unknown>>

    • Parameters

      • tag: undefined | string

      Returns Promise<number>

    • Parameters

      • type: string
      • allowMissingType: true

      Returns Promise<null | HSVMObject>

    • Parameters

      • type: string
      • allowMissingType: false

      Returns Promise<HSVMObject>

    • Type Parameters

      • T extends string

      Parameters

      • type: T
      • ids: number | number[]
      • Optionaloptions: EntityCloseOptions

      Returns Promise<void>

    • Parameters

      • tag: string
      • config: Partial<WRDTypeMetadata> & Pick<WRDTypeMetadata, "metaType">

      Returns Promise<WRDType<S, string>>

    • Type Parameters

      • T extends string

      Parameters

      • type: T
      • ids: number | number[]

      Returns Promise<void>

    • Describe a wrdType

      Parameters

      • tagOrId: string | number

        Either the string tag or the type number to describe

      Returns Promise<null | WRDTypeMetadata>

    • Type Parameters

      • T extends string
      • EnrichKey extends string
      • DataRow extends { [K in string]: null | number }
      • Mapping extends EnrichOutputMap<S[T]>
      • RightOuterJoin extends boolean = false

      Parameters

      Returns WRDEnrichResult<S, T, EnrichKey, DataRow, Mapping, RightOuterJoin>

    • Test whether this schema actually exists in the database

      Returns Promise<boolean>

    • Type Parameters

      • T extends SchemaTypeDefinition

      Returns WRDSchema<CombineSchemas<S, T>>

    • Returns the wrdId of the entity that matches the properties of the query object.

      Type Parameters

      • T extends string

      Parameters

      • type: T

        Type to search in

      • query: MatchObjectQueryable<S[T]>

        Query object (field-value pairs)

      • Optionaloptions: { historyMode?: SimpleHistoryMode | HistoryModeData }

        Options for the search

      Returns Promise<null | number>

    • Parameters

      • type: keyof S & string | (keyof S & string)[]

      Returns Promise<string[]>

    • Type Parameters

      • M extends string | { [K: string]: OutputMap<S[T]> } | readonly AttrRef<S[T]>[]
      • T extends string

      Parameters

      • type: T
      • id: number
      • mapping: M
      • options: GetFieldsOptions & { allowMissing: true; export: true }

      Returns Promise<null | MapRecordOutputMap<S[T], RecordizeOutputMap<S[T], M>, true>>

    • Type Parameters

      • M extends string | { [K: string]: OutputMap<S[T]> } | readonly AttrRef<S[T]>[]
      • T extends string

      Parameters

      • type: T
      • id: number
      • mapping: M
      • options: GetFieldsOptions & { allowMissing: true; export?: false }

      Returns Promise<null | MapRecordOutputMap<S[T], RecordizeOutputMap<S[T], M>, false>>

    • Type Parameters

      • M extends string | { [K: string]: OutputMap<S[T]> } | readonly AttrRef<S[T]>[]
      • T extends string

      Parameters

      • type: T
      • id: number
      • mapping: M
      • options: GetFieldsOptions & { export: true }

      Returns Promise<MapRecordOutputMap<S[T], RecordizeOutputMap<S[T], M>, true>>

    • Type Parameters

      • M extends string | { [K: string]: OutputMap<S[T]> } | readonly AttrRef<S[T]>[]
      • T extends string

      Parameters

      • type: T
      • id: number
      • mapping: M
      • options: GetFieldsOptions & { export?: false }

      Returns Promise<MapRecordOutputMap<S[T], RecordizeOutputMap<S[T], M>, false>>

    • Type Parameters

      • M extends string | { [K: string]: OutputMap<S[T]> } | readonly AttrRef<S[T]>[]
      • T extends string

      Parameters

      • type: T
      • id: number
      • mapping: M

      Returns Promise<MapRecordOutputMap<S[T], RecordizeOutputMap<S[T], M>, false>>

    • Type Parameters

      • M extends string | { [K: string]: OutputMap<S[T]> } | readonly AttrRef<S[T]>[]
      • T extends string
      • Export extends boolean

      Parameters

      • type: T
      • id: number
      • mapping: M
      • Optionaloptions: GetFieldsOptions

      Returns Promise<null | MapRecordOutputMap<S[T], RecordizeOutputMap<S[T], M>, Export>>

    • Parameters

      • opts: { allowMissing: true }

      Returns Promise<null | number>

    • Parameters

      • Optionalopts: { allowMissing?: boolean }

      Returns Promise<number>

    • Reserve a wrdGuid

      Type Parameters

      • T extends string

      Parameters

      • type: T

      Returns string

    • Reserve a wrdId

      Type Parameters

      • T extends string

      Parameters

      • type: T

      Returns Promise<number>

    • Type Parameters

      • T extends string

      Parameters

      • type: T

      Returns WRDType<S, T>

    • Test whether a type exists in this schema

      Parameters

      • tag: string

      Returns Promise<boolean>

    • Type Parameters

      • T extends string

      Parameters

      • type: T
      • value: Partial<WRDInsertable<S[T]>>
      • options: { importMode?: boolean; temp: true }

      Returns Promise<number>

    • Type Parameters

      • T extends string

      Parameters

      • type: T
      • value: Partial<WRDInsertable<S[T]>>
      • options: { importMode: true; temp?: boolean }

      Returns Promise<number>

    • Type Parameters

      • T extends string

      Parameters

      • type: T
      • value: WRDInsertable<S[T]>
      • Optionaloptions: { importMode?: boolean; temp?: boolean }

      Returns Promise<number>

    • Type Parameters

      • T extends string

      Parameters

      • type: T

      Returns WRDModificationBuilder<S, T>

    • Type Parameters

      • T extends string

      Parameters

      • type: T

      Returns WRDSingleQueryBuilder<S, T, null>

    • Returns the wrdId of an entity that has a field with a specific value, or null if not found.

      Type Parameters

      • T extends string
      • F extends string

      Parameters

      • type: T
      • field: F

        Field to filter on

      • value: WhereValueOptions<S[T], F, WhereConditions<S[T], F> & "=">["value"]

        Value to match (using condition "=")

      • Optionaloptions: GetOptionsIfExists<
            WhereValueOptions<S[T], F, WhereConditions<S[T], F> & "=">,
            object,
        > & { historyMode?: SimpleHistoryMode | HistoryModeData }

        Additional options for the filter

      Returns Promise<null | number>

      /// Returns the wrdId of an entity with the first name "John" (or null if no such entity exists)
      const result = await schema.search("wrdPerson", "wrdFirstName", "John");
    • Type Parameters

      • T extends string

      Parameters

      • type: T

      Returns WRDSingleQueryBuilder<S, T, null>

      use query() in WebHare 5.4.1+

    • Updates fields of a specific entity

      Type Parameters

      • T extends string

      Parameters

      • type: T
      • entity: number | MatchObjectQueryable<S[T]>

        wrdId of the entity to update, or a query object to find the entity (throws if none or multiple entities match the query)

      • value: WRDUpdatable<S[T]>

        Value to match (using condition "=")

      • Optionaloptions: { importMode?: boolean }

        Additional options for the filter

      Returns Promise<void>

      /// Returns the wrdId of an entity with the first name "John" (or null if no such entity exists)
      const result = await schema.search("wrdPerson", "wrdFirstName", "John");
    • Parameters

      • updates: SchemaUpdates

      Returns Promise<void>

    • Insert an entity, or update if it exists

      Type Parameters

      • T extends string
      • Q extends object
      • U extends object

      Parameters

      Returns Promise<[number, boolean]>