/** * @fileoverview Runtime utilities for React components providing access to MemberJunction core functionality * @module @memberjunction/ng-react/utilities */ import { IMetadataProvider } from '@memberjunction/core'; import { ComponentUtilities } from '@memberjunction/interactive-component-types'; /** * Base class for providing runtime utilities to React components in Angular. * This class can be extended and registered with MJ's ClassFactory * to provide custom implementations of data access methods. */ export declare class RuntimeUtilities { private debug; /** * The provider every read in the built utilities goes through. Always set by * {@link buildUtilities} before use — falls back to the global provider there * (`provider ?? Metadata.Provider`) when the host doesn't supply one. */ private provider; /** * Builds the complete utilities object for React components * This is the main method that components will use * * @param provider the host's provider. A React component mounted under a non-default provider * passes its own `ProviderToUse`; omitting it falls back to the global default, named * explicitly rather than reached for via `new Metadata()`. */ buildUtilities(debug?: boolean, provider?: IMetadataProvider): ComponentUtilities; /** * Sets up the utilities object - copied from skip-chat implementation */ private SetupUtilities; private CreateSimpleAITools; /** * Creates the ML tools surface for components — listing trained models and scoring records. * `listModels` reads the `MJ: ML Models` catalog via RunView; `score` marshals the * `PredictiveStudio.ScoreRecordSet` Remote Operation over GraphQL to the server engine (the * Python sidecar lives server-side and cannot run in the browser). Returns `undefined` when no * GraphQL provider is available, so the `ml` capability degrades cleanly. */ private CreateSimpleMLTools; /** * Loads the trained-model catalog from `MJ: ML Models`, newest version first, mapping each row * to a {@link SimpleMLModelInfo}. Resilient — logs and returns `[]` on any failure. */ private listMLModels; /** * Builds the ExtraFilter clause for {@link listMLModels}. Defaults to `Status='Published'` so * components only see promoted models unless the caller overrides the status. */ private buildMLModelsFilter; /** Maps a single `MJ: ML Models` row to the component-facing {@link SimpleMLModelInfo} shape. */ private mapMLModel; /** Defensively parses a JSON metrics blob; returns `undefined` for null/empty/invalid JSON. */ private parseMLMetrics; /** * Scores records with a trained model by invoking the `PredictiveStudio.ScoreRecordSet` Remote * Operation. Normalizes `records` to primary-key strings, requests ephemeral predictions (no * write-back), and maps the result. Resilient — logs and returns a zeroed result with the input * records counted as failed on any error. */ private scoreMLRecords; /** * Normalizes a mixed array of primary-key strings and row objects into an array of primary-key * strings, reading `primaryKeyField` from objects. Drops entries without a resolvable key. */ private normalizeRecordKeys; /** Escapes single quotes for safe inlining into a RunView ExtraFilter SQL string literal. */ private escapeSqlLiteral; private CreateSimpleMetadata; private CreateSimpleGeoDataEngine; private CreateSimpleRunQuery; private CreateSimpleRunView; } /** * Factory function to create RuntimeUtilities * In a Node.js environment, this will use MJ's ClassFactory for runtime substitution * In a browser environment, it will use the base class directly */ export declare function createRuntimeUtilities(): RuntimeUtilities;