Member Junction
    Preparing search index...

    The GraphQLDataProvider class is a data provider for MemberJunction that implements the IEntityDataProvider, IMetadataProvider, IRunViewProvider, IRunReportProvider, IRunQueryProvider interfaces and connects to the MJAPI server using GraphQL. This class is used to interact with the server to get and save data, as well as to get metadata about the entities and fields in the system.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    Accessors

    Methods

    backgroundValidateAndRefresh BuildDatasetFilterFromConfig CacheDataset cacheDeniedForViewOnlyRequest CheckToSeeIfRefreshNeeded ClearDatasetCache ClientToolRequests CloneAllMetadata ComputeRunViewRLSWhereClause Config ConvertBackToMJFields ConvertItemFiltersToUniqueKey CopyMetadataFromGlobalProvider CreateNewGraphQLClient CreateSharedMetadataShell CreateTransactionGroup Delete disposeWebSocketResources ensureKeyValuePairValueIsString EntityByID EntityByName EntityStatusCheck ExecuteGQL ExecuteQueryFromSpec extractMaxUpdatedAt FindISAChildEntities FindISAChildEntity ForceSocketReconnect FullTextSearch GenerateUUID GetAllMetadata GetAndCacheDatasetByName GetCachedDataset GetCachedRecordName GetCurrentUser GetDataContextData GetDataContextItemData GetDatasetByName GetDatasetCacheKey GetDatasetStatusByName GetDynamicHeaders GetEntityDependencies getEntityNameAndUserView GetEntityObject GetEntityRecordName GetEntityRecordNames GetLatestMetadataUpdates GetLocalDatasetTimestamp GetPreferredUUID GetRecordChanges GetRecordDependencies GetRecordDuplicates GetRecordFavoriteStatus getRelatedEntityString GetStoredSessionID getViewRunTimeFieldList InternalExecuteQueryFromSpec InternalGetEntityRecordName InternalGetEntityRecordNames InternalRouteOperation InternalRunQueries InternalRunQuery InternalRunView InternalRunViews invalidateInflightViewsForEntity IsDatasetCached IsDatasetCacheUpToDate IsExternalQuery IsServerCacheAllowedForEntity Load LoadLocalMetadataFromStorage LocalMetadataObsolete mergeCachedAndFreshResults mergeQueryCachedAndFreshResults MergeRecords PostProcessEntityMetadata PostProcessRunView PostProcessRunViews PostRunQueries PostRunQuery PostRunView PostRunViews PreProcessRunView PreProcessRunViews PreRunQueries PreRunQuery PreRunView PreRunViews preValidateAndRefresh PushStatusUpdates RebuildEntityMaps Refresh RefreshIfNeeded RefreshRemoteMetadataTimestamps RefreshToken RemoveDynamicHeader RemoveLocalMetadataFromStorage ResolvePlatformSQLInParams ResolveQueryCacheAuthorization ResolveSQL RouteOperation RunAdhocQuery RunPostRunViewHooks RunPreRunViewHooks RunQueries RunQueriesWithCacheCheck RunQuery RunQueryByID RunQueryByName RunReport RunView runViewCacheEligible RunViews RunViewsWithCacheCheck Save SaveLocalMetadataToStorage SearchEntities searchEntitiesSemanticPass SearchEntity SetCachedRecordName SetDynamicHeader SetRecordFavoriteStatus shouldAutoCache subscribe SubscribeToCacheInvalidation TransformQueryPayload TransformSimpleObjectToEntityObject UnsubscribeFromCacheInvalidation UpdateLocalMetadata arrayBufferToBase64 base64ToArrayBuffer clearClientCache ExecuteGQL RefreshToken UnionFieldsWithPrimaryKeys

    Constructors

    Properties

    _preRunQueriesResultType: {
        allCached: boolean;
        cachedResults?: RunQueryResult[];
        cacheStatusMap?: Map<
            number,
            {
                result?: RunQueryResult;
                status: "hit"
                | "miss"
                | "disabled"
                | "expired";
            },
        >;
        telemetryEventId?: string;
        uncachedParams?: RunQueryParams[];
    }

    Result from PreRunQueries hook containing cache status for batch operations

    _preRunQueryResultType: {
        cachedResult?: RunQueryResult;
        cacheStatus: "hit" | "miss" | "disabled" | "expired";
        fingerprint?: string;
        telemetryEventId?: string;
    }

    Result from PreRunQuery hook containing cache status and optional cached result

    _preRunViewResultType: {
        cachedResult?: RunViewResult;
        cacheStatus: "hit" | "miss" | "disabled" | "expired";
        callerRequestedFields?: string[];
        fingerprint?: string;
        telemetryEventId?: string;
    }

    Result from PreRunView hook containing cache status and optional cached result

    Type Declaration

    • OptionalcachedResult?: RunViewResult
    • cacheStatus: "hit" | "miss" | "disabled" | "expired"
    • OptionalcallerRequestedFields?: string[]

      The caller's original Fields list (lowercased), captured before PreRunView widened params.Fields to all entity fields for cache-superset storage. Non-null ONLY when that widening actually happened — PostRunView uses it to project cache-miss DB results back down to the requested shape.

    • Optionalfingerprint?: string
    • OptionaltelemetryEventId?: string
    _preRunViewsResultType: {
        allCached: boolean;
        cachedResults?: RunViewResult[];
        cacheStatusMap?: Map<
            number,
            {
                result?: RunViewResult;
                status: "hit"
                | "miss"
                | "disabled"
                | "expired";
            },
        >;
        callerFieldsMap?: Map<number, string[]>;
        fingerprintMap?: Map<number, string>;
        smartCacheCheckParams?: RunViewWithCacheCheckParams[];
        telemetryEventId?: string;
        uncachedParams?: RunViewParams[];
        useSmartCacheCheck?: boolean;
    }

    Result from PreRunViews hook containing cache status for batch operations

    Type Declaration

    • allCached: boolean
    • OptionalcachedResults?: RunViewResult[]
    • OptionalcacheStatusMap?: Map<
          number,
          { result?: RunViewResult; status: "hit"
          | "miss"
          | "disabled"
          | "expired" },
      >
    • OptionalcallerFieldsMap?: Map<number, string[]>

      Per-param-index caller Fields lists (lowercased), captured before PreRunViews widened params.Fields to all entity fields for cache-superset storage. An index is present ONLY when that widening actually happened — PostRunViews uses it to project cache-miss DB results back down to the requested shape.

    • OptionalfingerprintMap?: Map<number, string>

      Per-param-index cache fingerprints computed during PreRunViews — carried forward so PostRunViews doesn't recompute the RLS where-clause and fingerprint string for every batch item.

    • OptionalsmartCacheCheckParams?: RunViewWithCacheCheckParams[]

      When CacheLocal is enabled, contains the cache check params to send to server

    • OptionaltelemetryEventId?: string
    • OptionaluncachedParams?: RunViewParams[]
    • OptionaluseSmartCacheCheck?: boolean

      When CacheLocal is enabled, indicates we should use smart cache check

    _mjMetadataDatasetName: string
    CoalesceWindowMs: number

    When enabled, concurrent RunViews calls arriving within the same microtask (or within CoalesceWindowMs) are merged into a single mega-batch before hitting the network. This dramatically reduces the number of HTTP round-trips during startup when multiple engines independently call RunViews in parallel.

    Set to 0 to disable coalescing. Default 10ms — enough to capture all engines that fire in the same tick, without adding perceptible delay.

    DedupLingerMs: number

    How long (ms) a resolved RunViews result stays available for instant replay. Set to 0 to disable the linger window (in-flight dedup still applies). Default 5 000 ms.

    MaxLingerEntries: number

    Safety cap on the number of linger entries held simultaneously. The linger window is a latency optimization — under extreme churn (more distinct query keys than this resolving within one window) new resolutions skip lingering instead of accumulating result arrays in memory.

    MinRefreshCheckIntervalMs: number

    Minimum interval (ms) between metadata refresh checks to prevent redundant network calls when Config()/RefreshIfNeeded() fire in quick succession (e.g., multiple engines during startup). Does NOT affect forced Refresh() calls. Default: 30 000 ms.

    ServerAutoCacheMaxRows: number

    Maximum row count for auto-caching on the server side. When TrustLocalCacheCompletely is true and a RunView result has no ExtraFilter, no OrderBy, and the result count is at or below this threshold, the result is automatically stored in LocalCacheManager even without an explicit CacheLocal flag.

    This captures small reference/lookup tables that are repeatedly queried by multiple clients while avoiding caching large ad-hoc result sets. Invalidation is handled by the standard BaseEntity event-driven upsert (safe because unfiltered caches can be updated in-place).

    Set to 0 to disable auto-caching. Default 250.

    VerboseCacheInvalidationLogging: boolean = false

    Opt-in verbose logging for the real-time cache-invalidation subscription. Off by default — these messages fire on every cross-server save/delete and flood the console. Set to true (e.g. from the console: GraphQLDataProvider.VerboseCacheInvalidationLogging = true) only when debugging cache-invalidation / cross-server sync behavior.

    Accessors

    • get AllExplorerNavigationItems(): ExplorerNavigationItem[]

      Gets all explorer navigation items including inactive ones.

      Returns ExplorerNavigationItem[]

      Array of all ExplorerNavigationItem objects

    • get AllMetadata(): AllMetadata

      Returns the currently loaded local metadata from within the instance

      Returns AllMetadata

    • get AllowRefresh(): boolean

      Determines if a refresh is currently allowed or not. Subclasses should return FALSE if they are performing operations that should prevent refreshes. This helps avoid metadata refreshes during critical operations.

      Returns boolean

    • get Applications(): ApplicationInfo[]

      Gets all application metadata in the system.

      Returns ApplicationInfo[]

      Array of ApplicationInfo objects representing all applications

    • get AuditLogTypes(): AuditLogTypeInfo[]

      Gets all audit log types defined for tracking system activities.

      Returns AuditLogTypeInfo[]

      Array of AuditLogTypeInfo objects

    • get AuthorizationRoles(): AuthorizationRoleInfo[]

      Gets the flat collection of authorization-role assignments. Consumed lazily by AuthorizationInfo.Roles — consumers should prefer accessing roles through AuthorizationInfo.Roles rather than filtering this array directly.

      Returns AuthorizationRoleInfo[]

      Array of AuthorizationRoleInfo join-table objects

    • get Authorizations(): AuthorizationInfo[]

      Gets all authorization definitions in the system.

      Returns AuthorizationInfo[]

      Array of AuthorizationInfo objects defining permissions

    • get CurrentUser(): UserInfo

      Gets the current user's information including roles and permissions.

      Returns UserInfo

      UserInfo object for the authenticated user

    • get Entities(): EntityInfo[]

      Gets all entity metadata in the system.

      Returns EntityInfo[]

      Array of EntityInfo objects representing all entities

    • get FileSystemProvider(): IFileSystemProvider

      Returns the filesystem provider for the current environment. Default implementation returns null (no filesystem access). Server-side providers should override this to return a NodeFileSystemProvider.

      Returns IFileSystemProvider

    • get InstanceConnectionString(): string

      The connection string for each GraphQLProvider instance is simply the URL for the GraphQL endpoint. This is because each GraphQLDataProvider instance can be configured with a different URL and each URL is a unique combination of host/port/etc.

      Returns string

    • get LatestLocalMetadata(): MetadataInfo[]

      Gets the latest metadata timestamps from local cache. Used for comparison with remote timestamps.

      Returns MetadataInfo[]

      Array of locally cached metadata timestamps

    • get LatestRemoteMetadata(): MetadataInfo[]

      Gets the latest metadata timestamps from the remote server. Used to determine if local cache is out of date.

      Returns MetadataInfo[]

      Array of metadata timestamp information

    • get Libraries(): LibraryInfo[]

      Gets all library definitions in the system.

      Returns LibraryInfo[]

      Array of LibraryInfo objects representing code libraries

    • get LocalStoragePrefix(): string

      The GraphQLDataProvider uses a prefix for local storage that is equal to the URL of the GraphQL endpoint. This is because the GraphQLDataProvider can be configured multiple times with different URLs and each configuration will have its own local storage. This is useful when you want to have multiple connections to different servers and you don't want the local storage to be shared between them. The URL is normalized to remove special characters and replace anything other than alphanumeric characters with an underscore.

      Returns string

    • get PlatformKey(): DatabasePlatform

      Returns the database platform key for this provider. Override in subclasses to return the appropriate platform. Defaults to 'sqlserver' for backward compatibility.

      Returns DatabasePlatform

    • get PreRunQueriesResult(): {
          allCached: boolean;
          cachedResults?: RunQueryResult[];
          cacheStatusMap?: Map<
              number,
              {
                  result?: RunQueryResult;
                  status: "hit"
                  | "miss"
                  | "disabled"
                  | "expired";
              },
          >;
          telemetryEventId?: string;
          uncachedParams?: RunQueryParams[];
      }

      Returns {
          allCached: boolean;
          cachedResults?: RunQueryResult[];
          cacheStatusMap?: Map<
              number,
              {
                  result?: RunQueryResult;
                  status: "hit"
                  | "miss"
                  | "disabled"
                  | "expired";
              },
          >;
          telemetryEventId?: string;
          uncachedParams?: RunQueryParams[];
      }

    • get PreRunQueryResult(): {
          cachedResult?: RunQueryResult;
          cacheStatus: "hit"
          | "miss"
          | "disabled"
          | "expired";
          fingerprint?: string;
          telemetryEventId?: string;
      }

      Returns {
          cachedResult?: RunQueryResult;
          cacheStatus: "hit" | "miss" | "disabled" | "expired";
          fingerprint?: string;
          telemetryEventId?: string;
      }

    • get PreRunViewResult(): {
          cachedResult?: RunViewResult;
          cacheStatus: "hit"
          | "miss"
          | "disabled"
          | "expired";
          callerRequestedFields?: string[];
          fingerprint?: string;
          telemetryEventId?: string;
      }

      Returns {
          cachedResult?: RunViewResult;
          cacheStatus: "hit" | "miss" | "disabled" | "expired";
          callerRequestedFields?: string[];
          fingerprint?: string;
          telemetryEventId?: string;
      }

      • OptionalcachedResult?: RunViewResult
      • cacheStatus: "hit" | "miss" | "disabled" | "expired"
      • OptionalcallerRequestedFields?: string[]

        The caller's original Fields list (lowercased), captured before PreRunView widened params.Fields to all entity fields for cache-superset storage. Non-null ONLY when that widening actually happened — PostRunView uses it to project cache-miss DB results back down to the requested shape.

      • Optionalfingerprint?: string
      • OptionaltelemetryEventId?: string
    • get PreRunViewsResult(): {
          allCached: boolean;
          cachedResults?: RunViewResult[];
          cacheStatusMap?: Map<
              number,
              {
                  result?: RunViewResult;
                  status: "hit"
                  | "miss"
                  | "disabled"
                  | "expired";
              },
          >;
          callerFieldsMap?: Map<number, string[]>;
          fingerprintMap?: Map<number, string>;
          smartCacheCheckParams?: RunViewWithCacheCheckParams[];
          telemetryEventId?: string;
          uncachedParams?: RunViewParams[];
          useSmartCacheCheck?: boolean;
      }

      Returns {
          allCached: boolean;
          cachedResults?: RunViewResult[];
          cacheStatusMap?: Map<
              number,
              {
                  result?: RunViewResult;
                  status: "hit"
                  | "miss"
                  | "disabled"
                  | "expired";
              },
          >;
          callerFieldsMap?: Map<number, string[]>;
          fingerprintMap?: Map<number, string>;
          smartCacheCheckParams?: RunViewWithCacheCheckParams[];
          telemetryEventId?: string;
          uncachedParams?: RunViewParams[];
          useSmartCacheCheck?: boolean;
      }

      • allCached: boolean
      • OptionalcachedResults?: RunViewResult[]
      • OptionalcacheStatusMap?: Map<
            number,
            { result?: RunViewResult; status: "hit"
            | "miss"
            | "disabled"
            | "expired" },
        >
      • OptionalcallerFieldsMap?: Map<number, string[]>

        Per-param-index caller Fields lists (lowercased), captured before PreRunViews widened params.Fields to all entity fields for cache-superset storage. An index is present ONLY when that widening actually happened — PostRunViews uses it to project cache-miss DB results back down to the requested shape.

      • OptionalfingerprintMap?: Map<number, string>

        Per-param-index cache fingerprints computed during PreRunViews — carried forward so PostRunViews doesn't recompute the RLS where-clause and fingerprint string for every batch item.

      • OptionalsmartCacheCheckParams?: RunViewWithCacheCheckParams[]

        When CacheLocal is enabled, contains the cache check params to send to server

      • OptionaltelemetryEventId?: string
      • OptionaluncachedParams?: RunViewParams[]
      • OptionaluseSmartCacheCheck?: boolean

        When CacheLocal is enabled, indicates we should use smart cache check

    • get Queries(): QueryInfo[]

      Returns QueryInfo[]

      Use QueryEngine.Instance.Queries from @memberjunction/core-entities. Will be removed in v6.x.

    • get QueryCategories(): QueryCategoryInfo[]

      Returns QueryCategoryInfo[]

      Use QueryEngine.Instance.Categories from @memberjunction/core-entities. Will be removed in v6.x.

    • get QueryDependencies(): QueryDependencyInfo[]

      Returns QueryDependencyInfo[]

      Use QueryEngine.Instance.Dependencies from @memberjunction/core-entities. Will be removed in v6.x.

    • get QueryEntities(): QueryEntityInfo[]

      Returns QueryEntityInfo[]

      Use QueryEngine.Instance.QueryEntities from @memberjunction/core-entities. Will be removed in v6.x.

    • get QueryFields(): QueryFieldInfo[]

      Returns QueryFieldInfo[]

      Use QueryEngine.Instance.Fields from @memberjunction/core-entities. Will be removed in v6.x.

    • get QueryParameters(): QueryParameterInfo[]

      Returns QueryParameterInfo[]

      Use QueryEngine.Instance.Parameters from @memberjunction/core-entities. Will be removed in v6.x.

    • get QueryPermissions(): QueryPermissionInfo[]

      Returns QueryPermissionInfo[]

      Use QueryEngine.Instance.Permissions from @memberjunction/core-entities. Will be removed in v6.x.

    • get QuerySQLs(): QuerySQLInfo[]

      Returns QuerySQLInfo[]

      Use QueryEngine.Instance.QuerySQLs from @memberjunction/core-entities. Will be removed in v6.x.

    • get Roles(): RoleInfo[]

      Gets all security roles defined in the system.

      Returns RoleInfo[]

      Array of RoleInfo objects representing all roles

    • get RowLevelSecurityFilters(): RowLevelSecurityFilterInfo[]

      Gets all row-level security filters defined in the system.

      Returns RowLevelSecurityFilterInfo[]

      Array of RowLevelSecurityFilterInfo objects for data access control

    • get SQLDialects(): SQLDialectInfo[]

      Returns SQLDialectInfo[]

      Use QueryEngine.Instance.SQLDialects from @memberjunction/core-entities. Will be removed in v6.x.

    • get TrustLocalCacheCompletely(): boolean

      When true, cached RunView/RunQuery results are returned immediately on a cache hit without any server-side validation round-trip.

      Server-side providers (DatabaseProviderBase and its subclasses) override this to return true because the cache is kept in perfect sync via BaseEntity save/delete events and cross-server Redis pub/sub — the DB validation query is unnecessary overhead.

      Client-side providers (e.g. GraphQLDataProvider) keep the default false so that the lightweight smart cache check (maxUpdatedAt + rowCount) is still performed against the server before trusting the browser cache.

      Returns boolean

    • get VisibleExplorerNavigationItems(): ExplorerNavigationItem[]

      Gets only active explorer navigation items sorted by sequence. Results are cached for performance.

      Returns ExplorerNavigationItem[]

      Array of active ExplorerNavigationItem objects

    Methods

    • Background validation for the stale-while-revalidate fast-start pattern. Checks if local metadata is still current; if stale, fetches fresh metadata and atomically swaps it in. The app continues operating on cached data during this process — no blocking.

      Parameters

      Returns Promise<void>

    • SECURITY — decide whether the shared cache must be BYPASSED for a RunView that targets a saved VIEW rather than a named entity (no EntityName), under a context user.

      The cache-hit path returns BEFORE the DB provider's read-permission gate (CheckUserReadPermissions). The primary gate keys off the entity resolved from params.EntityName, so a ViewID-/ViewName-only request (the Explorer-standard shape for a saved view) yields no entity there and the gate is disarmed — a read-denied user could be served rows a permitted user warmed for the same ViewID. The vw: fingerprint segment makes the two users' requests collide on exactly one slot, so the leak is clean.

      Returns true when the cache must be skipped for this call (fail-closed):

      • ViewEntity supplied and its entity resolves → apply the normal CanRead gate on it (allow caching for a permitted user; deny for a read-denied one).
      • ViewEntity absent/unresolvable but ViewID/ViewName present → fail closed: the view's real entity (hence the user's permission) is only known after the async MJ: User Views lookup that the cache-hit path deliberately skips, so we cannot safely consult the cache. Returns false when there is no context user, when EntityName is set (the normal gate owns that path), or when no view identifier is present at all (nothing to gate).

      Parameters

      Returns boolean

    • If the specified datasetName is cached, this method will clear the cache. If itemFilters are provided, the combination of datasetName and the filters are used to determine a match in the cache

      Parameters

      Returns Promise<void>

    • Subscribe to client tool requests for a specific agent session. The returned Observable emits ClientToolRequestNotification objects when the server-side agent wants to invoke a browser-side tool.

      Parameters

      • sessionId: string

        The agent session ID to filter requests for

      Returns Observable<Record<string, unknown>>

      Observable that emits tool request notifications

    • Computes the per-user Row-Level-Security WHERE clause that InternalRunView will append to this query's SQL for the given user, so it can be folded into the cache fingerprint. RLS-scoped reads return a different result set than unscoped reads of the same entity+filter; without including the RLS clause in the cache key, a scoped user could be served a cached unscoped result set (a data leak).

      Returns '' when the user is exempt from RLS on this entity (the common case), which makes the resulting fingerprint byte-identical to the pre-RLS format — preserving normal cache sharing.

      Uses this (the active provider) to resolve the entity, never the global Metadata, so the correct per-provider/per-tenant metadata is consulted.

      Parameters

      Returns string

    • This method configures the class instance. If separateConnection is false or not provided, the global/static variables are set that means that the Config() call will affect all callers to the GraphQLDataProvider including via wrappers like the Metadata class. If separateConnection is true, then the instance variables are set and only this instance of the GraphQLDataProvider will be affected by the Config() call.

      Parameters

      Returns Promise<boolean>

      If separateConnection is true, metadata for the provider will be loaded but will NOT affect the Metadata class/singleton. This is because the Metadata class is a singleton that binds to the first Config() call in the process where separateConnection is falsy.

    • This method will convert back any fields that start with mj_ back to _mj so that the entity object can properly update itself with the data that was returned from the server

      Parameters

      • ret: any

      Returns any

    • Adopts the global provider's metadata for this instance without reloading it from the server: shares the (immutable post-Config) metadata arrays by reference via CreateSharedMetadataShell and builds this instance's entity lookup maps.

      Returns boolean

    • Parameters

      • url: string
      • token: string
      • sessionId: string
      • mjAPIKey: string
      • OptionaluserAPIKey: string

      Returns GraphQLClient

    • Builds this instance's AllMetadata as a thin shell over another provider's already-loaded metadata: every metadata array is a PER-INSTANCE shallow copy whose elements are the SHARED Info object instances, and CurrentUser remains this instance's own.

      Why sharing the instances is safe — and why this replaced the former deep clone (CloneAllMetadata) on the reuse-global fast path: the metadata graph is immutable after Config. Refreshes swap the WHOLE AllMetadata object (UpdateLocalMetadata), never mutate the Info objects in place, so the only per-instance datum inside the graph is CurrentUser — which this shell keeps independent. The deep clone cost ~1s of event-loop-blocking constructor work per provider on every server request (MemberJunction/MJ#3083); the shell is ~20 array-of-pointer copies (microseconds).

      Why the array containers are copied rather than aliased: an in-place .sort()/.push()/.splice() by request-scoped code then stays local to that provider — matching the clone era's isolation for the common accidental mutation class — instead of reordering the global graph for every other in-flight request. Only the top-level AllMetadata collections get this per-instance protection: everything below them is shared, including the nested arrays owned by Info objects (entity.Fields, entity.RelatedEntities, application.ApplicationEntities, ...) — an in-place mutation of those is process-wide. Property writes on the shared Info objects themselves are likewise visible process-wide (as they always were on the client's global provider): treat Info objects and everything they own as read-only; copy before sorting.

      Override precedence: if a subclass overrides BOTH this method and the deprecated CloneAllMetadata, the CloneAllMetadata override wins on the fast path (see CopyMetadataFromGlobalProvider) — the conservative back-compat choice, since pre-#3083 subclasses could only have customized adoption through CloneAllMetadata. Remove the CloneAllMetadata override to activate a CreateSharedMetadataShell override.

      Parameters

      Returns AllMetadata

    • O(1) entity lookup by ID (UUID-normalized). Falls back to linear search if the internal Map hasn't been built yet.

      Parameters

      • entityID: string

      Returns EntityInfo

    • O(1) entity lookup by name (case-insensitive, trimmed). Falls back to linear search if the internal Map hasn't been built yet.

      Parameters

      • entityName: string

      Returns EntityInfo

    • Used to check to see if the entity in question is active or not If it is not active, it will throw an exception or log a warning depending on the status of the entity being either Deprecated or Disabled.

      Parameters

      Returns Promise<void>

    • Executes the GQL query with the provided variables. If the token is expired, it will attempt to refresh the token and then re-execute the query. If the token is expired and the refresh fails, it will throw an error.

      Parameters

      • query: string
      • variables: any
      • refreshTokenIfNeeded: boolean = true

      Returns Promise<any>

    • Executes a query from a QueryExecutionSpec — the lower-layer interface-based entry point. Runs the full pipeline: composition resolution → Nunjucks template processing → SQL execution. Subclasses (GenericDatabaseProvider) provide the concrete implementation via InternalExecuteQueryFromSpec.

      Parameters

      • spec: QueryExecutionSpec

        The execution spec describing the query, parameters, and inline dependencies

      • OptionalcontextUser: UserInfo

        Optional user context for permissions (required server-side)

      Returns Promise<RunQueryResult>

      Query results including data rows and execution metadata

    • Parameters

      • results: unknown[]

      Returns string

    • Discovers ALL IS-A child entities that have records matching the given PK. Used for overlapping subtype parents (AllowMultipleSubtypes = true). Calls the server-side FindISAChildEntities resolver via GraphQL.

      Parameters

      • entityInfo: EntityInfo

        The parent entity to check children for

      • recordPKValue: string

        The primary key value to search for in child tables

      • OptionalcontextUser: UserInfo

        Optional context user (unused on client, present for interface parity)

      Returns Promise<{ ChildEntityName: string }[]>

      Array of child entity names found (empty if none)

    • Discovers which IS-A child entity has a record matching the given PK. Calls the server-side FindISAChildEntity resolver via GraphQL.

      Parameters

      • entityInfo: EntityInfo

        The parent entity to check children for

      • recordPKValue: string

        The primary key value to search for in child tables

      • OptionalcontextUser: UserInfo

        Optional context user (unused on client, present for interface parity)

      Returns Promise<{ ChildEntityName: string }>

      The child entity name if found, or null if no child record exists

    • Performs a full-text search across all entities that have FullTextSearchEnabled=true. Uses the existing RunView + UserSearchString infrastructure which routes through the database-native FTS capabilities (SQL Server FREETEXT functions, PostgreSQL tsvector).

      This is the default implementation that works across all database providers. Each provider's createViewUserSearchSQL() method handles the platform-specific SQL generation.

      Parameters

      Returns Promise<FullTextSearchResult>

      /packages/MJCore/docs/FULL_TEXT_SEARCH_GUIDE.md for comprehensive documentation

    • Retrieves all metadata from the server and constructs typed instances. Uses the MJ_Metadata dataset for efficient bulk loading.

      Parameters

      Returns Promise<AllMetadata>

      Complete metadata collection with all relationships

    • Asynchronous lookup of a cached entity record name. Returns the cached name if available, or undefined if not cached. Use this for synchronous contexts (like template rendering) where you can't await GetEntityRecordName().

      Parameters

      • entityName: string

        The name of the entity

      • compositeKey: CompositeKey

        The primary key value(s) for the record

      • OptionalloadIfNeeded: boolean

        If set to true, will load from database if not already cached

      Returns Promise<string>

      The cached display name, or undefined if not in cache

    • Creates a new instance of a BaseEntity subclass for the specified entity and automatically calls NewRecord() to initialize it. This method serves as the core implementation for entity instantiation in the MemberJunction framework.

      Type Parameters

      Parameters

      • entityName: string

        The name of the entity to create (must exist in metadata)

      • OptionalcontextUser: UserInfo

        Optional user context for permissions and audit tracking

      Returns Promise<T>

      Promise resolving to the newly created entity instance with NewRecord() called

      Error if entity name is not found in metadata or if instantiation fails

    • Creates a new instance of a BaseEntity subclass and loads an existing record using the provided key. This overload provides a convenient way to instantiate and load in a single operation.

      Type Parameters

      Parameters

      • entityName: string

        The name of the entity to create (must exist in metadata)

      • loadKey: CompositeKey

        CompositeKey containing the primary key value(s) for the record to load

      • OptionalcontextUser: UserInfo

        Optional user context for permissions and audit tracking

      Returns Promise<T>

      Promise resolving to the entity instance with the specified record loaded

      Error if entity name is not found, instantiation fails, or record cannot be loaded

    • Gets the display name for a single entity record with caching. Uses the entity's IsNameField or falls back to 'Name' field if available.

      Parameters

      • entityName: string

        The name of the entity

      • compositeKey: CompositeKey

        The primary key value(s) for the record

      • OptionalcontextUser: UserInfo

        Optional user context for permissions

      • OptionalforceRefresh: boolean

        If true, bypasses cache and queries database

      Returns Promise<string>

      The display name of the record or null if not found

    • Returns a list of dependencies - records that are linked to the specified Entity/KeyValuePairs combination. A dependency is as defined by the relationships in the database. The MemberJunction metadata that is used for this simply reflects the foreign key relationships that exist in the database. The CodeGen tool is what detects all of the relationships and generates the metadata that is used by MemberJunction. The metadata in question is within the EntityField table and specifically the RelatedEntity and RelatedEntityField columns. In turn, this method uses that metadata and queries the database to determine the dependencies. To get the list of entity dependencies you can use the utility method GetEntityDependencies(), which doesn't check for dependencies on a specific record, but rather gets the metadata in one shot that can be used for dependency checking.

      Parameters

      • entityName: string

        the name of the entity to check

      • primaryKey: CompositeKey

      Returns Promise<RecordDependency[]>

    • Retrieves the stored session ID from the LocalStorageProvider if available. If no session ID is found, returns null. The session ID is stored using the same storage mechanism as other persistent data with a key specific to the current URL to ensure uniqueness across different server connections.

      Returns Promise<string>

      The stored session ID or null if not found

    • Drops every in-flight/lingered RunView entry whose params touch the given entity (lowercased name). Called on BaseEntity save/delete/remote-invalidate.

      Parameters

      • lowerEntityName: string

      Returns void

    • Whether a saved query is bound to an external data source. The base returns false; providers that support external data sources override this (consulting query metadata) so the outer RunQuery CacheLocal layer can defer to InternalRunQuery's own external TTL caching. Synchronous + non-throwing: resolves from cached metadata only.

      Parameters

      Returns boolean

    • Checks whether server-side caching is allowed for the entity in the given RunViewParams. Returns false for entities that have TrustServerCacheCompletely = false, or for Record Changes which is always exempt (rows are created via raw SQL side-effects, not BaseEntity.Save(), so cache invalidation events never fire).

      Parameters

      Returns boolean

    • Loads metadata from local storage if available. Deserializes and reconstructs typed metadata objects.

      Returns Promise<void>

    • Checks if local metadata is obsolete compared to remote metadata. Compares timestamps and row counts to detect changes.

      Parameters

      • Optionaltype: string

        Optional specific metadata type to check

      Returns boolean

      True if local metadata is out of date

    • Merges cached and fresh results for RunViews, maintaining original order.

      Parameters

      • preResult: {
            allCached: boolean;
            cachedResults?: RunViewResult[];
            cacheStatusMap?: Map<
                number,
                {
                    result?: RunViewResult;
                    status: "hit"
                    | "miss"
                    | "disabled"
                    | "expired";
                },
            >;
            callerFieldsMap?: Map<number, string[]>;
            fingerprintMap?: Map<number, string>;
            smartCacheCheckParams?: RunViewWithCacheCheckParams[];
            telemetryEventId?: string;
            uncachedParams?: RunViewParams[];
            useSmartCacheCheck?: boolean;
        }

        The pre-processing result with cache info

        • allCached: boolean
        • OptionalcachedResults?: RunViewResult[]
        • OptionalcacheStatusMap?: Map<
              number,
              { result?: RunViewResult; status: "hit"
              | "miss"
              | "disabled"
              | "expired" },
          >
        • OptionalcallerFieldsMap?: Map<number, string[]>

          Per-param-index caller Fields lists (lowercased), captured before PreRunViews widened params.Fields to all entity fields for cache-superset storage. An index is present ONLY when that widening actually happened — PostRunViews uses it to project cache-miss DB results back down to the requested shape.

        • OptionalfingerprintMap?: Map<number, string>

          Per-param-index cache fingerprints computed during PreRunViews — carried forward so PostRunViews doesn't recompute the RLS where-clause and fingerprint string for every batch item.

        • OptionalsmartCacheCheckParams?: RunViewWithCacheCheckParams[]

          When CacheLocal is enabled, contains the cache check params to send to server

        • OptionaltelemetryEventId?: string
        • OptionaluncachedParams?: RunViewParams[]
        • OptionaluseSmartCacheCheck?: boolean

          When CacheLocal is enabled, indicates we should use smart cache check

      • freshResults: RunViewResult[]

        The fresh results from InternalRunViews

      Returns RunViewResult[]

      Combined results in original order

    • Merges cached and fresh results for RunQueries, maintaining original order.

      Parameters

      • preResult: {
            allCached: boolean;
            cachedResults?: RunQueryResult[];
            cacheStatusMap?: Map<
                number,
                {
                    result?: RunQueryResult;
                    status: "hit"
                    | "miss"
                    | "disabled"
                    | "expired";
                },
            >;
            telemetryEventId?: string;
            uncachedParams?: RunQueryParams[];
        }

        The pre-processing result with cache info

      • freshResults: RunQueryResult[]

        The fresh results from InternalRunQueries

      Returns RunQueryResult[]

      Combined results in original order

    • This method will merge two or more records based on the request provided. The RecordMergeRequest type you pass in specifies the record that will survive the merge, the records to merge into the surviving record, and an optional field map that can update values in the surviving record, if desired. The process followed is:

      1. A transaction is started
      2. The surviving record is loaded and fields are updated from the field map, if provided, and the record is saved. If a FieldMap not provided within the request object, this step is skipped.
      3. For each of the records that will be merged INTO the surviving record, we call the GetEntityDependencies() method and get a list of all other records in the database are linked to the record to be deleted. We then go through each of those dependencies and update the link to point to the SurvivingRecordID and save the record.
      4. The record to be deleted is then deleted.
      5. The transaction is committed if all of the above steps are succesful, otherwise it is rolled back.

      The return value from this method contains detailed information about the execution of the process. In addition, all attempted merges are logged in the RecordMergeLog and RecordMergeDeletionLog tables.

      Parameters

      Returns Promise<RecordMergeResult>

    • Base class utilty method that should be called after each sub-class handles its internal RunViews() process before returning results This handles the optional conversion of simple objects to entity objects for each requested view depending on if the params requests a result_type === 'entity_object'

      Parameters

      Returns Promise<void>

    • Post-processing hook for RunQueries (batch). Handles telemetry end.

      Parameters

      • results: RunQueryResult[]

        Array of query results

      • params: RunQueryParams[]

        Array of query parameters

      • preResult: {
            allCached: boolean;
            cachedResults?: RunQueryResult[];
            cacheStatusMap?: Map<
                number,
                {
                    result?: RunQueryResult;
                    status: "hit"
                    | "miss"
                    | "disabled"
                    | "expired";
                },
            >;
            telemetryEventId?: string;
            uncachedParams?: RunQueryParams[];
        }

        The pre-processing result

      • OptionalcontextUser: UserInfo

        Optional user context

      Returns Promise<void>

    • Post-processing hook for RunQuery. Handles cache storage and telemetry end.

      Parameters

      • result: RunQueryResult

        The query result

      • params: RunQueryParams

        The query parameters

      • preResult: {
            cachedResult?: RunQueryResult;
            cacheStatus: "hit" | "miss" | "disabled" | "expired";
            fingerprint?: string;
            telemetryEventId?: string;
        }

        The pre-processing result

      • OptionalcontextUser: UserInfo

        Optional user context

      Returns Promise<void>

    • Post-processing hook for RunView. Handles result transformation, cache storage, and telemetry end.

      Parameters

      • result: RunViewResult

        The view result

      • params: RunViewParams

        The view parameters

      • preResult: {
            cachedResult?: RunViewResult;
            cacheStatus: "hit" | "miss" | "disabled" | "expired";
            callerRequestedFields?: string[];
            fingerprint?: string;
            telemetryEventId?: string;
        }

        The pre-processing result

        • OptionalcachedResult?: RunViewResult
        • cacheStatus: "hit" | "miss" | "disabled" | "expired"
        • OptionalcallerRequestedFields?: string[]

          The caller's original Fields list (lowercased), captured before PreRunView widened params.Fields to all entity fields for cache-superset storage. Non-null ONLY when that widening actually happened — PostRunView uses it to project cache-miss DB results back down to the requested shape.

        • Optionalfingerprint?: string
        • OptionaltelemetryEventId?: string
      • OptionalcontextUser: UserInfo

        Optional user context

      Returns Promise<void>

    • Post-processing hook for RunViews (batch). Handles result transformation, cache storage, and telemetry end.

      Parameters

      • results: RunViewResult[]

        Array of view results

      • params: RunViewParams[]

        Array of view parameters

      • preResult: {
            allCached: boolean;
            cachedResults?: RunViewResult[];
            cacheStatusMap?: Map<
                number,
                {
                    result?: RunViewResult;
                    status: "hit"
                    | "miss"
                    | "disabled"
                    | "expired";
                },
            >;
            callerFieldsMap?: Map<number, string[]>;
            fingerprintMap?: Map<number, string>;
            smartCacheCheckParams?: RunViewWithCacheCheckParams[];
            telemetryEventId?: string;
            uncachedParams?: RunViewParams[];
            useSmartCacheCheck?: boolean;
        }

        The pre-processing result

        • allCached: boolean
        • OptionalcachedResults?: RunViewResult[]
        • OptionalcacheStatusMap?: Map<
              number,
              { result?: RunViewResult; status: "hit"
              | "miss"
              | "disabled"
              | "expired" },
          >
        • OptionalcallerFieldsMap?: Map<number, string[]>

          Per-param-index caller Fields lists (lowercased), captured before PreRunViews widened params.Fields to all entity fields for cache-superset storage. An index is present ONLY when that widening actually happened — PostRunViews uses it to project cache-miss DB results back down to the requested shape.

        • OptionalfingerprintMap?: Map<number, string>

          Per-param-index cache fingerprints computed during PreRunViews — carried forward so PostRunViews doesn't recompute the RLS where-clause and fingerprint string for every batch item.

        • OptionalsmartCacheCheckParams?: RunViewWithCacheCheckParams[]

          When CacheLocal is enabled, contains the cache check params to send to server

        • OptionaltelemetryEventId?: string
        • OptionaluncachedParams?: RunViewParams[]
        • OptionaluseSmartCacheCheck?: boolean

          When CacheLocal is enabled, indicates we should use smart cache check

      • OptionalcontextUser: UserInfo

        Optional user context

      Returns Promise<void>

    • Type Parameters

      • T = any

      Parameters

      Returns Promise<void>

      Use PreRunView instead. This method is kept for backward compatibility.

    • Base class implementation for handling pre-processing of RunViews() each sub-class should call this within their RunViews() method implementation

      Parameters

      Returns Promise<void>

    • Pre-processing hook for RunQueries (batch). Handles telemetry for batch query operations.

      Parameters

      Returns Promise<
          {
              allCached: boolean;
              cachedResults?: RunQueryResult[];
              cacheStatusMap?: Map<
                  number,
                  {
                      result?: RunQueryResult;
                      status: "hit"
                      | "miss"
                      | "disabled"
                      | "expired";
                  },
              >;
              telemetryEventId?: string;
              uncachedParams?: RunQueryParams[];
          },
      >

      Pre-processing result

    • Pre-processing hook for RunQuery. Handles telemetry and cache lookup.

      Parameters

      Returns Promise<
          {
              cachedResult?: RunQueryResult;
              cacheStatus: "hit"
              | "miss"
              | "disabled"
              | "expired";
              fingerprint?: string;
              telemetryEventId?: string;
          },
      >

      Pre-processing result with cache status and optional cached result

    • Pre-processing hook for RunView. Handles telemetry, validation, entity status check, and cache lookup.

      Parameters

      Returns Promise<
          {
              cachedResult?: RunViewResult;
              cacheStatus: "hit"
              | "miss"
              | "disabled"
              | "expired";
              callerRequestedFields?: string[];
              fingerprint?: string;
              telemetryEventId?: string;
          },
      >

      Pre-processing result with cache status and optional cached result

    • Pre-processing hook for RunViews (batch). Handles telemetry, validation, and cache lookup for multiple views.

      Parameters

      Returns Promise<
          {
              allCached: boolean;
              cachedResults?: RunViewResult[];
              cacheStatusMap?: Map<
                  number,
                  {
                      result?: RunViewResult;
                      status: "hit"
                      | "miss"
                      | "disabled"
                      | "expired";
                  },
              >;
              callerFieldsMap?: Map<number, string[]>;
              fingerprintMap?: Map<number, string>;
              smartCacheCheckParams?: RunViewWithCacheCheckParams[];
              telemetryEventId?: string;
              uncachedParams?: RunViewParams[];
              useSmartCacheCheck?: boolean;
          },
      >

      Pre-processing result with cache status for each view

    • Synchronous pre-validation of cached metadata before engine startup.

      On a warm load we serve the metadata graph from IndexedDB so the app can boot without pulling MBs of metadata from the server. Before engines run, this method makes one batched timestamp round-trip to confirm the snapshot is still current:

      • Cached metadata is current → engines proceed against the cached snapshot. Their RunViews calls go through the normal smart-cache-check path which batches per-view fingerprints to the server — efficient and authoritative.
      • Cached metadata is stale → refresh framework metadata in place before engines start, then proceed normally.

      Cost on the warm-current path is one batched timestamp fetch (~50–200 ms depending on RTT). On the warm-stale path we additionally pay the full metadata fetch but avoid serving stale data to the UI in the first place.

      Caller contract: invoke this before StartupManager.Startup().

      Parameters

      Returns Promise<void>

    • Rebuilds the O(1) entity lookup Maps from the current AllEntities array. Called automatically from UpdateLocalMetadata().

      Returns void

    • Refreshes all metadata from the server. Respects the AllowRefresh flag from subclasses.

      Parameters

      Returns Promise<boolean>

      True if refresh was initiated or allowed

    • Resolves any PlatformSQL values in RunViewParams to plain strings for the active platform. Mutates the params object in place so downstream InternalRunView implementations always receive plain string values for ExtraFilter and OrderBy.

      Parameters

      Returns void

    • The RunQuery cache-serve seam (B45/B46) — resolves a RunQuery request against this provider's query metadata and answers, in ONE computation performed BEFORE fingerprinting:

      • categoryPath: the RESOLVED query's canonical full category path. This becomes a distinguishing fingerprint segment (B46) so two same-named queries in different categories can never collide onto one cache slot. When the request is unresolvable the caller falls back to the CALLER-STATED params.CategoryPath (still distinguishing, just not canonicalized).
      • resolvable: whether metadata could resolve the request at all. Runtime-created queries are typically NOT resolvable from the base metadata cache (it does not refresh in-process) — the gate then applies the warmer tie-break instead.
      • authorized: whether user may run the resolved query. Meaningful only when resolvable is true.

      The BASE implementation resolves from the metadata Queries cache and enforces the ROLES-ONLY QueryInfo.UserCanRun — the strongest check available at this layer. Providers with richer query metadata MUST override this to enforce the SAME authorization their miss path enforces (GenericDatabaseProvider overrides with MJQueryEntityExtended.UserCanRun, which adds entity CanRead + recursive composition checks — the exact check ValidateQueryForExecution applies on a cache miss). The invariant this seam exists to hold: a cache HIT must never be easier to read than a cache MISS (B45 was precisely that asymmetry — the TTL gate checked roles only while the miss path also checked entity read permissions).

      Parameters

      Returns QueryCacheAuthorization

    • Resolves a PlatformSQL value to the appropriate SQL string for this provider's platform. If the value is a plain string, it is returned as-is (backward compatible). If the value is a PlatformSQL object, the platform-specific variant is used if available, otherwise the default variant is used.

      Parameters

      Returns string

    • Routes a typed Remote Operation by key to its implementation (see IRemoteOperationProvider).

      This is the public power-tool transport seam. Prefer the typed BaseRemotableOperation.Execute() entry point in application code — RouteOperation is the stringly-typed escape hatch for dynamic dispatch / generic tooling, not for building significant systems. Server providers override InternalRouteOperation to execute the operation in-process; the client (GraphQL) provider overrides it to marshal over the wire. Only registered, active (and, when AI-authored, approved) operations are routable, and every call is authorized on the server side.

      Type Parameters

      • TInput = unknown
      • TOutput = unknown

      Parameters

      • operationKey: string

        Stable registry key of the operation (e.g. RecordProcess.RunNow).

      • input: TInput

        The operation's typed input payload.

      • Optionaloptions: RemoteOpInvokeOptions

        Optional invocation options (mode, progress callback, user, provider, fingerprint).

      Returns Promise<RemoteOpResult<TOutput>>

      The operation result; never throws for logical failures — check Success/ErrorMessage.

    • Executes an ad-hoc SQL query via the ExecuteAdhocQuery GraphQL resolver. The server validates the SQL (SELECT/WITH only) and executes on a read-only connection.

      Parameters

      • sql: string
      • OptionalmaxRows: number
      • OptionaltimeoutSeconds: number
      • OptionalstartRow: number

      Returns Promise<RunQueryResult>

    • Runs all registered PostRunView hooks against a single result, returning the (possibly mutated) result.

      Protected (not private) for the same reason as RunPreRunViewHooks above: a subclass pipeline that returns view rows WITHOUT passing through PostRunView/PostRunViews — e.g. the RunViewsWithCacheCheck smart-cache path — MUST apply these hooks to the rows it returns. PostRunView is the OUTPUT half of the enforcement seam (data masking / audit); a path that skips it returns rows the hooked paths would have masked.

      Parameters

      Returns Promise<RunViewResult>

    • Runs all registered PreRunView hooks against a single RunViewParams, returning the (possibly mutated) params.

      Protected (not private) on purpose: any subclass pipeline that executes view queries WITHOUT passing through PreRunView/PreRunViews — e.g. the RunViewsWithCacheCheck smart-cache path in GenericDatabaseProvider — MUST apply these hooks itself. Hooks are an enforcement seam (tenant scoping middleware injects filters here); a query path that skips them silently returns rows the hooked paths would have filtered out.

      Parameters

      Returns Promise<RunViewParams>

    • Runs multiple queries based on the provided parameters. This method orchestrates the full execution flow for batch query operations.

      Parameters

      • params: RunQueryParams[]

        Array of query parameters

      • OptionalcontextUser: UserInfo

        Optional user context for permissions (required server-side)

      Returns Promise<RunQueryResult[]>

      Array of query results

    • Runs a view based on the provided parameters. This method orchestrates the full execution flow: pre-processing, cache check, internal execution, post-processing, and cache storage.

      Type Parameters

      • T = any

      Parameters

      • params: RunViewParams

        The view parameters

      • OptionalcontextUser: UserInfo

        Optional user context for permissions (required server-side)

      Returns Promise<RunViewResult<T>>

      The view results

    • Single source of truth for whether a RunView call participates in the local cache (both READ and WRITE). Pre/Post hooks for the singular and batch paths must all use this predicate — historically each site recomputed it inline and they drifted (PostRunViews wrote BypassCache results into the cache, poisoning the Fields-agnostic superset slot with narrow rows).

      Ineligible:

      • BypassCache — caller explicitly wants true DB state, no cache interaction
      • AfterKey — keyset pages are single-use AND the fingerprint doesn't include the seek key, so caching a page would poison the entity+filter slot
      • ResultType 'count_only' — returns no rows; caching its empty Results under a fingerprint that excludes ResultType would poison row queries
      • entities where server caching is disallowed

      Parameters

      Returns boolean

    • Runs multiple views based on the provided parameters. Wraps the execution pipeline with request deduplication and a linger window so that concurrent (and near-sequential) identical calls share a single server round-trip. Every caller receives a shallow-copied Results array to protect against cross-caller mutations (push/sort/splice).

      Type Parameters

      • T = any

      Parameters

      • params: RunViewParams[]

        Array of view parameters

      • OptionalcontextUser: UserInfo

        Optional user context for permissions (required server-side)

      Returns Promise<RunViewResult<T>[]>

      Array of view results (shallow-copied Results per caller)

    • Ranked search over many entities in one GraphQL round-trip.

      Both the singular SearchEntity and the batched SearchEntities forms on the client route through the same plural GQL endpoint — one request, one response, regardless of how many entities are in params. The full ranking (lexical + semantic + RRF blend + permission filter) runs server-side against the backing database provider; the client just unpacks the already-ranked, permission-filtered result groups and returns them aligned by input order.

      Overrides the inherited Promise.all-based fan-out on ProviderBase because the client has no embedder, no vector pool, and no business doing the work locally — N round-trips to N entities would be silly when one batched payload returns the same answer.

      Parameters

      Returns Promise<EntitySearchResult[][]>

    • Stores a record name in the cache for later synchronous retrieval via GetCachedRecordName(). Called automatically by BaseEntity after Load(), LoadFromData(), and Save() operations.

      Parameters

      • entityName: string

        The name of the entity

      • compositeKey: CompositeKey

        The primary key value(s) for the record

      • recordName: string

        The display name to cache

      Returns void

    • Sets a dynamic header that will be included in all subsequent GraphQL requests. Dynamic headers survive token refreshes and client re-creation.

      This is useful for passing per-session context (e.g., organization selection) that the server needs on every request but isn't part of the auth token.

      Parameters

      • key: string

        The header name (e.g., 'x-organization-id')

      • value: string

        The header value

      Returns void

    • Generic subscription method for GraphQL subscriptions

      Parameters

      • subscription: string

        The GraphQL subscription query

      • Optionalvariables: any

        Variables to pass to the subscription

      Returns Observable<any>

      Observable that emits subscription data

    • Updates the local metadata cache with new data.

      Parameters

      Returns void

    • Converts an ArrayBuffer to a base64-encoded string. Used for compressed metadata storage/retrieval.

      Parameters

      • buffer: ArrayBuffer

      Returns string

    • Converts a base64-encoded string to an ArrayBuffer. Used for compressed metadata storage/retrieval.

      Parameters

      • base64: string

      Returns ArrayBuffer

    • Clears all MJ client-side caches that are tied to a user session.

      Call this on logout to ensure that a subsequent login as a different user does not see stale metadata or cached data rows from the previous session.

      Specifically clears:

      • The MJ_Metadata IndexedDB database (entity definitions, RunView/RunQuery/Dataset caches)
      • All localStorage keys except those in preservedKeys

      Parameters

      • preservedKeys: Set<string> = ...

        localStorage keys to keep across logout (e.g. theme preference). Defaults to an empty set.

      Returns Promise<void>

    • Static version of the ExecuteGQL method that will use the global instance of the GraphQLDataProvider and execute the specified query with the provided variables. If the token is expired, it will attempt to refresh the token and then re-execute the query. If the token is expired and the refresh fails, it will throw an error.

      Parameters

      • query: string
      • variables: any
      • refreshTokenIfNeeded: boolean = true

      Returns Promise<any>

    • Returns the caller's requested fields (lowercased) unioned with the entity's primary key field names. Platform contract: when Fields is explicitly specified, results ALWAYS include the primary key(s) — the direct SQL path has always done this, differential smart-cache merges require it, and entity linking in UIs depends on it. Applying the same union at every projection site keeps result shapes identical across cached, non-cached, and smart-cache paths.

      Parameters

      Returns string[]