Skip to content

Remult ​

  • Remult

repo ​

Return's a Repository of the specific entity type

example: ​

ts
const taskRepo = remult.repo(Task);

see: ​

Repository

Arguments:

  • entity - the entity to use
  • dataProvider - an optional alternative data provider to use. Useful for writing to offline storage or an alternative data provider

subscribeAuth ​

  • subscribeAuth

Arguments:

  • listener

initUser ​

Fetches user information from the backend and updates the remult.user object. Typically used during application initialization and user authentication.

returns: ​

A promise that resolves to the user's information or undefined if unavailable.

authenticated ​

Checks if a user was authenticated

isAllowed ​

checks if the user has any of the roles specified in the parameters

example: ​

ts
remult.isAllowed("admin")

see: ​

Allowed

Arguments:

  • roles

isAllowedForInstance ​

checks if the user matches the allowedForInstance callback

see: ​

Allowed

Arguments:

  • instance
  • allowed

useFetch ​

  • useFetch

Arguments:

  • fetch

dataProvider ​

The current data provider

constructor ​

Creates a new instance of the remult object.

Can receive either an HttpProvider or a DataProvider as a parameter - which will be used to fetch data from.

If no provider is specified, fetch will be used as an http provider

Arguments:

  • http

call ​

Used to call a backendMethod using a specific remult object

example: ​

ts
await remult.call(TasksController.setAll, undefined, true);

Arguments:

  • backendMethod - the backend method to call
  • classInstance - the class instance of the backend method, for static backend methods use undefined
  • args - the arguments to send to the backend method

onFind ​

A helper callback that can be used to debug and trace all find operations. Useful in debugging scenarios

Arguments:

  • metadata

  • options

    • limit - Number of rows returned. (Defaults to 100 in the browser)

    example: ​

    ts
    await repo(Products).find({ limit: 10 })
    • page - Determines the page number to retrieve. Works in tandem with the limit option.

    example: ​

    ts
    await repo(Products).find({ page: 2 })
    • load
    • include - An option used to specify which related entities should be included when querying the source entity. It allows you to eagerly load related data to avoid N+1 query problems.

    param: ​

    An object specifying the related entities to include, their options, and filtering criteria.

    Example usage:

    ts
    const orders = await customerRepo.find({
      include: {
        // Include the 'tags' relation for each customer.
        tags: true,
      },
    });

    In this example, the tags relation for each customer will be loaded and included in the query result.

    see: ​

    • select - An option used to specify which fields should be included in the result.

    example: ​

    ts
    await repo(Task).find({ select: { id: true, title: true } })
    • where - filters the data

    example: ​

    ts
    await taskRepo.find({ where: { completed:false } })

    see: ​

    For more usage examples see EntityFilter

    • orderBy - Determines the order of items returned .

    example: ​

    ts
    await repo(Products).find({ orderBy: { name: "asc" }})

    example: ​

    ts
    await repo(Products).find({ orderBy: { price: "desc", name: "asc" }})
    • args

clearAllCache ​

  • clearAllCache

entityRefInit ​

A helper callback that is called whenever an entity is created.

context ​

context that can be used to store custom information that will be disposed as part of the remult object.

remult.context is pre-filled in a framework-agnostic way with:

  • headers.get(key: string) of request
  • headers.getAll() of request

Check out the extensibility section for more custom options.

apiClient ​

The api client that will be used by remult to perform calls to the api

user ​

  • user

liveQueryStorage ​

  • liveQueryStorage

subscriptionServer ​

  • subscriptionServer

liveQueryPublisher ​

  • liveQueryPublisher

liveQuerySubscriber ​

  • liveQuerySubscriber

MIT Licensed | Made by the Remult team with ❤️