An implementation of the FIN record service.

Please note, this is currently not part of the official Haystack standard.

Constructors

Methods

  • Create some records on the server.

    Parameters

    • dicts: HGrid | HaysonDict[] | HList<HDict> | HDict[]

      An array of dicts, array of hayson dicts, list of dicts or a grid.

    Returns Promise<HGrid<Record>>

    The resultant grid of the create operation. The grid contains a 'created' number property for the number of records created in the meta.

  • Create a single record on the server.

    Parameters

    • dict: HaysonDict | HDict

      The record to create.

    Returns Promise<Record>

    The resultant dict of the create operation.

  • Delete some records via a haystack filter.

    This method should be used with extreme caution! This command could unintentionally delete critical records in a database.

    Parameters

    • filter: string

      The haystack filter to query by.

    Returns Promise<HGrid<Record>>

    A grid with the records that were deleted. Each record only contains the id and mod properties. The grid meta contains an deleted number property for the total number of records deleted.

  • Delete multiple records via their ids.

    Parameters

    • ids: HList<HRef> | string[] | HRef[]

    Returns Promise<HGrid<Record>>

    A grid with the records that were deleted. Each record only contains the id and mod properties. The grid meta contains an deleted number property for the total number of records deleted.

  • Duplicate an existing record in the database.

    Parameters

    • options: { count: number; id: string | HRef; includeChildren: boolean }

      The duplicate options.

      • count: number

        The number of times to duplicate a record.

      • id: string | HRef

        The id of the record to duplicate.

      • includeChildren: boolean

        Whether to also duplicate any contained child records.

    Returns Promise<HList<HRef>>

    A list of top level record ids that were duplicated. This does not include any child record ids that were duplicated.

  • Query some records via a haystack filter.

    Parameters

    • filter: string

      The haystack filter to query by.

    • Optionaloptions: ReadOptions

      Optional options for read operation.

    Returns Promise<HGrid<Record>>

    The result of the read operation.

  • Read a record via its id.

    Parameters

    • id: string | HRef

      The id of the record to read.

    Returns Promise<Record>

    The record.

    An error if the record can't be found.

  • Read multiple records via their ids.

    Parameters

    • ids: HList<HRef> | string[] | HRef[]
    • Optionaloptions: ReadOptions

      Optional options for read operation.

    Returns Promise<HGrid<Record>>

    The result of the read operation.

  • Query some records via a haystack filter and return the record count.

    Parameters

    • filter: string

      The haystack filter to query by.

    Returns Promise<number>

    The number of records counted.

  • Update some records via their ids.

    Parameters

    • dicts: HaysonDict | HDict | HGrid | HaysonDict[] | HList<HDict> | HDict[]

      The dicts to update. Each record must specify an id.

    Returns Promise<HGrid<Record>>

    A grid with the records that were updated. Each record only contains the id and mod properties. The grid meta contains an updated number property for the total number of records updated.

  • Update by a filter.

    This method should be used with extreme caution! This command could unintentionally update critical records in a database.

    Parameters

    • filter: string
    • dict: HaysonDict | HDict

      The dict to be applied to all records found.

    Returns Promise<HGrid<Record>>

    A grid with the records that were updated. Each record only contains the id and mod properties. The grid meta contains an updated number property for the total number of records updated.