Class used to run a query and return the results. Provides an abstraction layer for executing saved queries with proper security checks. Supports both instance-based and static provider patterns.

Constructors

Properties

_globalProviderKey: string = 'MJ_RunQueryProvider'

Accessors

  • get Provider(): IRunQueryProvider
  • Gets the static query provider instance. Used when no instance-specific provider is configured.

    Returns IRunQueryProvider

    The global query provider

    Throws

    Error if global object store is not available

  • set Provider(value): void
  • Sets the static query provider instance. This provider will be used by all RunQuery instances that don't have their own provider.

    Parameters

    Returns void

    Throws

    Error if global object store is not available

Methods

  • Executes multiple queries in a single batch operation. More efficient than calling RunQuery multiple times as it reduces network overhead and allows the database to execute queries in parallel.

    Parameters

    • params: RunQueryParams[]

      Array of query parameters, each specifying a query to execute

    • Optional contextUser: UserInfo

      Optional user context for permissions (mainly used server-side)

    Returns Promise<RunQueryResult[]>

    Array of query results in the same order as the input params

  • Executes a saved query and returns the results. The query must exist in the system and the user must have permission to execute it. Queries can be identified by QueryID or by QueryName + CategoryPath combination. CategoryPath supports hierarchical navigation (e.g., "/MJ/AI/Agents/") and falls back to simple name matching.

    Parameters

    • params: RunQueryParams

      Parameters including query ID or name with optional CategoryPath for disambiguation

    • Optional contextUser: UserInfo

      Optional user context for permissions (mainly used server-side)

    Returns Promise<RunQueryResult>

    Query results including data rows and execution metadata