@memberjunction/graphql-dataprovider 2.128.0 → 2.130.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +164 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +212 -36
- package/dist/index.d.mts +212 -36
- package/dist/index.mjs +151 -60
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { GraphQLClient } from 'graphql-request';
|
|
2
2
|
export { gql } from 'graphql-request';
|
|
3
|
-
import { ProviderConfigDataBase, ProviderBase, IEntityDataProvider, IMetadataProvider,
|
|
3
|
+
import { ProviderConfigDataBase, ProviderBase, IEntityDataProvider, IMetadataProvider, IRunReportProvider, UserInfo, RunReportParams, RunReportResult, RunQueryParams, RunQueryResult, RunQueryWithCacheCheckParams, RunQueriesWithCacheCheckResponse, RunViewParams, RunViewResult, RunViewWithCacheCheckParams, RunViewsWithCacheCheckResponse, EntityInfo, ProviderType, CompositeKey, RecordChange, RecordDependency, KeyValuePair, PotentialDuplicateRequest, PotentialDuplicateResponse, RecordMergeRequest, EntityMergeOptions, RecordMergeResult, BaseEntity, EntitySaveOptions, EntityDeleteOptions, DatasetItemFilterType, DatasetResultType, DatasetStatusResultType, TransactionGroupBase, EntityRecordNameInput, EntityRecordNameResult, ILocalStorageProvider, TransactionResult } from '@memberjunction/core';
|
|
4
4
|
import { UserViewEntityExtended } from '@memberjunction/core-entities';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
import { ExecuteAgentParams, ExecuteAgentResult } from '@memberjunction/ai-core-plus';
|
|
7
7
|
import { ActionParam, ActionResult, EntityActionInvocationParams, EntityActionResult } from '@memberjunction/actions-base';
|
|
8
8
|
import { ComponentSpec } from '@memberjunction/interactive-component-types';
|
|
9
|
+
import { DBSchema } from '@tempfix/idb';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Client for executing AI operations through GraphQL.
|
|
@@ -151,6 +152,33 @@ declare class GraphQLAIClient {
|
|
|
151
152
|
* @private
|
|
152
153
|
*/
|
|
153
154
|
private handleAgentError;
|
|
155
|
+
/**
|
|
156
|
+
* Run an AI agent using an existing conversation detail ID.
|
|
157
|
+
* This is an optimized method that loads conversation history server-side,
|
|
158
|
+
* avoiding the need to send large attachment data from client to server.
|
|
159
|
+
*
|
|
160
|
+
* Use this method when:
|
|
161
|
+
* - The user's message has already been saved as a ConversationDetail
|
|
162
|
+
* - The conversation may have attachments (images, documents, etc.)
|
|
163
|
+
* - You want optimal performance by loading history on the server
|
|
164
|
+
*
|
|
165
|
+
* @param params The parameters for running the AI agent from conversation detail
|
|
166
|
+
* @returns A Promise that resolves to an ExecuteAgentResult object
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* const result = await aiClient.RunAIAgentFromConversationDetail({
|
|
171
|
+
* conversationDetailId: "detail-id-123",
|
|
172
|
+
* agentId: "agent-id",
|
|
173
|
+
* maxHistoryMessages: 20,
|
|
174
|
+
* createArtifacts: true,
|
|
175
|
+
* onProgress: (progress) => {
|
|
176
|
+
* console.log(`Progress: ${progress.message}`);
|
|
177
|
+
* }
|
|
178
|
+
* });
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
RunAIAgentFromConversationDetail(params: RunAIAgentFromConversationDetailParams): Promise<ExecuteAgentResult>;
|
|
154
182
|
/**
|
|
155
183
|
* Execute a simple prompt without requiring a stored AI Prompt entity.
|
|
156
184
|
* This method is designed for interactive components that need quick AI responses.
|
|
@@ -426,6 +454,69 @@ interface RunAIPromptResult {
|
|
|
426
454
|
*/
|
|
427
455
|
chatResult?: any;
|
|
428
456
|
}
|
|
457
|
+
/**
|
|
458
|
+
* Parameters for running an AI agent from an existing conversation detail.
|
|
459
|
+
* This is the optimized method that loads conversation history server-side.
|
|
460
|
+
*/
|
|
461
|
+
interface RunAIAgentFromConversationDetailParams {
|
|
462
|
+
/**
|
|
463
|
+
* The ID of the conversation detail (user's message) to use as context
|
|
464
|
+
*/
|
|
465
|
+
conversationDetailId: string;
|
|
466
|
+
/**
|
|
467
|
+
* The ID of the AI agent to run
|
|
468
|
+
*/
|
|
469
|
+
agentId: string;
|
|
470
|
+
/**
|
|
471
|
+
* Maximum number of history messages to include (default: 20)
|
|
472
|
+
*/
|
|
473
|
+
maxHistoryMessages?: number;
|
|
474
|
+
/**
|
|
475
|
+
* Data context to pass to the agent (will be JSON serialized)
|
|
476
|
+
*/
|
|
477
|
+
data?: Record<string, unknown>;
|
|
478
|
+
/**
|
|
479
|
+
* Payload to pass to the agent (will be JSON serialized)
|
|
480
|
+
*/
|
|
481
|
+
payload?: Record<string, unknown> | string;
|
|
482
|
+
/**
|
|
483
|
+
* ID of the last agent run for continuity
|
|
484
|
+
*/
|
|
485
|
+
lastRunId?: string;
|
|
486
|
+
/**
|
|
487
|
+
* Whether to auto-populate payload from last run
|
|
488
|
+
*/
|
|
489
|
+
autoPopulateLastRunPayload?: boolean;
|
|
490
|
+
/**
|
|
491
|
+
* Configuration ID to use
|
|
492
|
+
*/
|
|
493
|
+
configurationId?: string;
|
|
494
|
+
/**
|
|
495
|
+
* Whether to create artifacts from the agent's payload
|
|
496
|
+
*/
|
|
497
|
+
createArtifacts?: boolean;
|
|
498
|
+
/**
|
|
499
|
+
* Whether to create a user notification on completion
|
|
500
|
+
*/
|
|
501
|
+
createNotification?: boolean;
|
|
502
|
+
/**
|
|
503
|
+
* Source artifact ID for versioning
|
|
504
|
+
*/
|
|
505
|
+
sourceArtifactId?: string;
|
|
506
|
+
/**
|
|
507
|
+
* Source artifact version ID for versioning
|
|
508
|
+
*/
|
|
509
|
+
sourceArtifactVersionId?: string;
|
|
510
|
+
/**
|
|
511
|
+
* Optional callback for progress updates
|
|
512
|
+
*/
|
|
513
|
+
onProgress?: (progress: {
|
|
514
|
+
currentStep: string;
|
|
515
|
+
percentage?: number;
|
|
516
|
+
message: string;
|
|
517
|
+
metadata?: Record<string, unknown>;
|
|
518
|
+
}) => void;
|
|
519
|
+
}
|
|
429
520
|
|
|
430
521
|
/**************************************************************************************************************
|
|
431
522
|
* The graphQLDataProvider provides a data provider for the entities framework that uses GraphQL to communicate
|
|
@@ -482,7 +573,7 @@ declare class GraphQLProviderConfigData extends ProviderConfigDataBase {
|
|
|
482
573
|
* The GraphQLDataProvider class is a data provider for MemberJunction that implements the IEntityDataProvider, IMetadataProvider, IRunViewProvider, IRunReportProvider, IRunQueryProvider interfaces and connects to the
|
|
483
574
|
* 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.
|
|
484
575
|
*/
|
|
485
|
-
declare class GraphQLDataProvider extends ProviderBase implements IEntityDataProvider, IMetadataProvider,
|
|
576
|
+
declare class GraphQLDataProvider extends ProviderBase implements IEntityDataProvider, IMetadataProvider, IRunReportProvider {
|
|
486
577
|
private static _instance;
|
|
487
578
|
static get Instance(): GraphQLDataProvider;
|
|
488
579
|
constructor();
|
|
@@ -492,36 +583,6 @@ declare class GraphQLDataProvider extends ProviderBase implements IEntityDataPro
|
|
|
492
583
|
private _aiClient;
|
|
493
584
|
private _refreshPromise;
|
|
494
585
|
get ConfigData(): GraphQLProviderConfigData;
|
|
495
|
-
/**
|
|
496
|
-
* The core schema name constant. This should match the mjCoreSchema config value.
|
|
497
|
-
* TODO: Move this to @memberjunction/core once npm registration issues are resolved
|
|
498
|
-
* @see https://github.com/MemberJunction/MJ/issues/1452
|
|
499
|
-
*/
|
|
500
|
-
protected static readonly MJ_CORE_SCHEMA = "__mj";
|
|
501
|
-
/**
|
|
502
|
-
* Sanitizes a string to be a valid GraphQL name component, preserving original capitalization.
|
|
503
|
-
* GraphQL names must match the pattern [_A-Za-z][_0-9A-Za-z]* and cannot start with double underscore
|
|
504
|
-
*
|
|
505
|
-
* TODO: Move this to @memberjunction/core once npm registration issues are resolved
|
|
506
|
-
* @see https://github.com/MemberJunction/MJ/issues/1452
|
|
507
|
-
*
|
|
508
|
-
* Copied from @memberjunction/codegen-lib GraphQLServerGeneratorBase.sanitizeGraphQLName()
|
|
509
|
-
*/
|
|
510
|
-
protected sanitizeGraphQLName(input: string): string;
|
|
511
|
-
/**
|
|
512
|
-
* Generates the base GraphQL type name for an entity using SchemaBaseTable pattern.
|
|
513
|
-
* Preserves original capitalization. Special case: MJ core schema uses "MJ" prefix.
|
|
514
|
-
* This ensures unique type names across different schemas.
|
|
515
|
-
*
|
|
516
|
-
* TODO: Move this to @memberjunction/core once npm registration issues are resolved
|
|
517
|
-
* @see https://github.com/MemberJunction/MJ/issues/1452
|
|
518
|
-
*
|
|
519
|
-
* Copied from @memberjunction/codegen-lib GraphQLServerGeneratorBase.getServerGraphQLTypeNameBase()
|
|
520
|
-
*
|
|
521
|
-
* @param entity - The entity to generate the type name for
|
|
522
|
-
* @returns The base GraphQL type name (without suffix like ViewByID, DynamicView, etc.)
|
|
523
|
-
*/
|
|
524
|
-
protected getGraphQLTypeNameBase(entity: EntityInfo): string;
|
|
525
586
|
/**
|
|
526
587
|
* Gets the AI client for executing AI operations through GraphQL.
|
|
527
588
|
* The client is lazily initialized on first access.
|
|
@@ -584,17 +645,39 @@ declare class GraphQLDataProvider extends ProviderBase implements IEntityDataPro
|
|
|
584
645
|
/**************************************************************************/
|
|
585
646
|
/**************************************************************************/
|
|
586
647
|
/**************************************************************************/
|
|
587
|
-
|
|
648
|
+
protected InternalRunQuery(params: RunQueryParams, contextUser?: UserInfo): Promise<RunQueryResult>;
|
|
649
|
+
protected InternalRunQueries(params: RunQueryParams[], contextUser?: UserInfo): Promise<RunQueryResult[]>;
|
|
588
650
|
RunQueryByID(QueryID: string, CategoryID?: string, CategoryPath?: string, contextUser?: UserInfo, Parameters?: Record<string, any>, MaxRows?: number, StartRow?: number): Promise<RunQueryResult>;
|
|
589
651
|
RunQueryByName(QueryName: string, CategoryID?: string, CategoryPath?: string, contextUser?: UserInfo, Parameters?: Record<string, any>, MaxRows?: number, StartRow?: number): Promise<RunQueryResult>;
|
|
590
652
|
protected get QueryReturnFieldList(): string;
|
|
591
653
|
protected TransformQueryPayload(data: any): RunQueryResult;
|
|
654
|
+
/**
|
|
655
|
+
* RunQueriesWithCacheCheck - Smart cache validation for batch RunQueries.
|
|
656
|
+
* For each query, if cacheStatus is provided, the server checks if the cache is current
|
|
657
|
+
* using the Query's CacheValidationSQL. If current, returns status='current' with no data.
|
|
658
|
+
* If stale, returns status='stale' with fresh data.
|
|
659
|
+
*
|
|
660
|
+
* @param params - Array of RunQuery requests with optional cache status
|
|
661
|
+
* @param contextUser - Optional user context
|
|
662
|
+
* @returns Response containing results for each query in the batch
|
|
663
|
+
*/
|
|
664
|
+
RunQueriesWithCacheCheck<T = unknown>(params: RunQueryWithCacheCheckParams[], contextUser?: UserInfo): Promise<RunQueriesWithCacheCheckResponse<T>>;
|
|
592
665
|
/**************************************************************************/
|
|
593
666
|
/**************************************************************************/
|
|
594
667
|
/**************************************************************************/
|
|
595
668
|
/**************************************************************************/
|
|
596
|
-
|
|
597
|
-
|
|
669
|
+
protected InternalRunView<T = any>(params: RunViewParams, contextUser?: UserInfo): Promise<RunViewResult<T>>;
|
|
670
|
+
protected InternalRunViews<T = any>(params: RunViewParams[], contextUser?: UserInfo): Promise<RunViewResult<T>[]>;
|
|
671
|
+
/**
|
|
672
|
+
* RunViewsWithCacheCheck - Smart cache validation for batch RunViews.
|
|
673
|
+
* For each view, if cacheStatus is provided, the server checks if the cache is current.
|
|
674
|
+
* If current, returns status='current' with no data. If stale, returns status='stale' with fresh data.
|
|
675
|
+
*
|
|
676
|
+
* @param params - Array of RunView requests with optional cache status
|
|
677
|
+
* @param contextUser - Optional user context
|
|
678
|
+
* @returns Response containing results for each view in the batch
|
|
679
|
+
*/
|
|
680
|
+
RunViewsWithCacheCheck<T = unknown>(params: RunViewWithCacheCheckParams[], contextUser?: UserInfo): Promise<RunViewsWithCacheCheckResponse<T>>;
|
|
598
681
|
protected getEntityNameAndUserView(params: RunViewParams, contextUser?: UserInfo): Promise<{
|
|
599
682
|
entityName: string;
|
|
600
683
|
v: UserViewEntityExtended;
|
|
@@ -2146,6 +2229,7 @@ interface RunTestParams {
|
|
|
2146
2229
|
testId: string;
|
|
2147
2230
|
verbose?: boolean;
|
|
2148
2231
|
environment?: string;
|
|
2232
|
+
tags?: string[];
|
|
2149
2233
|
onProgress?: (progress: TestExecutionProgress) => void;
|
|
2150
2234
|
}
|
|
2151
2235
|
/**
|
|
@@ -2165,6 +2249,22 @@ interface RunTestSuiteParams {
|
|
|
2165
2249
|
verbose?: boolean;
|
|
2166
2250
|
environment?: string;
|
|
2167
2251
|
parallel?: boolean;
|
|
2252
|
+
tags?: string[];
|
|
2253
|
+
/**
|
|
2254
|
+
* Run only specific tests by their IDs.
|
|
2255
|
+
* If provided, only tests with matching IDs will be executed.
|
|
2256
|
+
*/
|
|
2257
|
+
selectedTestIds?: string[];
|
|
2258
|
+
/**
|
|
2259
|
+
* Start execution from this sequence number (inclusive).
|
|
2260
|
+
* Tests with sequence numbers less than this value will be skipped.
|
|
2261
|
+
*/
|
|
2262
|
+
sequenceStart?: number;
|
|
2263
|
+
/**
|
|
2264
|
+
* Stop execution at this sequence number (inclusive).
|
|
2265
|
+
* Tests with sequence numbers greater than this value will be skipped.
|
|
2266
|
+
*/
|
|
2267
|
+
sequenceEnd?: number;
|
|
2168
2268
|
onProgress?: (progress: TestExecutionProgress) => void;
|
|
2169
2269
|
}
|
|
2170
2270
|
/**
|
|
@@ -2700,4 +2800,80 @@ declare class GraphQLComponentRegistryClient {
|
|
|
2700
2800
|
SendComponentFeedback(params: ComponentFeedbackParams): Promise<ComponentFeedbackResponse>;
|
|
2701
2801
|
}
|
|
2702
2802
|
|
|
2703
|
-
|
|
2803
|
+
/**
|
|
2804
|
+
* In-memory storage provider using nested Map structure for category isolation.
|
|
2805
|
+
* Used as a fallback when browser storage is not available.
|
|
2806
|
+
*
|
|
2807
|
+
* Storage structure: Map<category, Map<key, value>>
|
|
2808
|
+
*/
|
|
2809
|
+
declare class BrowserStorageProviderBase implements ILocalStorageProvider {
|
|
2810
|
+
private _storage;
|
|
2811
|
+
/**
|
|
2812
|
+
* Gets or creates a category map
|
|
2813
|
+
*/
|
|
2814
|
+
private getCategoryMap;
|
|
2815
|
+
GetItem(key: string, category?: string): Promise<string | null>;
|
|
2816
|
+
SetItem(key: string, value: string, category?: string): Promise<void>;
|
|
2817
|
+
Remove(key: string, category?: string): Promise<void>;
|
|
2818
|
+
ClearCategory(category: string): Promise<void>;
|
|
2819
|
+
GetCategoryKeys(category: string): Promise<string[]>;
|
|
2820
|
+
}
|
|
2821
|
+
/**
|
|
2822
|
+
* IndexedDB schema with dynamic object stores per category.
|
|
2823
|
+
* Each category gets its own object store: mj:CategoryName
|
|
2824
|
+
*/
|
|
2825
|
+
interface MJ_MetadataDB extends DBSchema {
|
|
2826
|
+
'mj:default': {
|
|
2827
|
+
key: string;
|
|
2828
|
+
value: string;
|
|
2829
|
+
};
|
|
2830
|
+
'mj:Metadata': {
|
|
2831
|
+
key: string;
|
|
2832
|
+
value: string;
|
|
2833
|
+
};
|
|
2834
|
+
'mj:RunViewCache': {
|
|
2835
|
+
key: string;
|
|
2836
|
+
value: string;
|
|
2837
|
+
};
|
|
2838
|
+
'mj:RunQueryCache': {
|
|
2839
|
+
key: string;
|
|
2840
|
+
value: string;
|
|
2841
|
+
};
|
|
2842
|
+
'mj:DatasetCache': {
|
|
2843
|
+
key: string;
|
|
2844
|
+
value: string;
|
|
2845
|
+
};
|
|
2846
|
+
}
|
|
2847
|
+
/**
|
|
2848
|
+
* IndexedDB storage provider with category support via separate object stores.
|
|
2849
|
+
*
|
|
2850
|
+
* Known categories (mj:Metadata, mj:RunViewCache, etc.) get dedicated object stores.
|
|
2851
|
+
* Unknown categories fall back to the default store with prefixed keys.
|
|
2852
|
+
*/
|
|
2853
|
+
declare class BrowserIndexedDBStorageProvider extends BrowserStorageProviderBase {
|
|
2854
|
+
private dbPromise;
|
|
2855
|
+
private _dbReady;
|
|
2856
|
+
constructor();
|
|
2857
|
+
/**
|
|
2858
|
+
* Checks if a category has a dedicated object store
|
|
2859
|
+
*/
|
|
2860
|
+
private isKnownCategory;
|
|
2861
|
+
/**
|
|
2862
|
+
* Gets the object store name for a category.
|
|
2863
|
+
* Returns the dedicated store if it exists, otherwise returns the default store.
|
|
2864
|
+
*/
|
|
2865
|
+
private getStoreName;
|
|
2866
|
+
/**
|
|
2867
|
+
* Gets the key to use in the store.
|
|
2868
|
+
* For known stores, use the key as-is.
|
|
2869
|
+
* For unknown categories using the default store, prefix with category.
|
|
2870
|
+
*/
|
|
2871
|
+
private getStoreKey;
|
|
2872
|
+
SetItem(key: string, value: string, category?: string): Promise<void>;
|
|
2873
|
+
GetItem(key: string, category?: string): Promise<string | null>;
|
|
2874
|
+
Remove(key: string, category?: string): Promise<void>;
|
|
2875
|
+
ClearCategory(category: string): Promise<void>;
|
|
2876
|
+
GetCategoryKeys(category: string): Promise<string[]>;
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
export { ActionItemInput, ActionItemOutput, BrowserIndexedDBStorageProvider, BrowserStorageProviderBase, type ComponentDependencyTree, type ComponentSpecWithHash, type CreateQueryInput, type CreateQueryResult, type DeleteQueryOptionsInput, type DeleteQueryResult, type EmbedTextParams, type EmbedTextResult, type ExecuteSimplePromptParams, FieldMapper, GetDataOutput, type GetQueryDataByNameSystemUserInput, type GetQueryDataSystemUserInput, type GetRegistryComponentParams, GraphQLAIClient, GraphQLActionClient, GraphQLComponentRegistryClient, GraphQLDataProvider, GraphQLProviderConfigData, GraphQLSystemUserClient, GraphQLTestingClient, GraphQLTransactionGroup, type MJ_MetadataDB, type QueryEntity, type QueryField, type QueryParameter, type QueryPermission, type QueryPermissionInput, type RegistryComponentSearchResult, RoleInput, RolesAndUsersInput, type RunAIPromptParams, type RunAIPromptResult, type RunDynamicViewSystemUserInput, type RunQuerySystemUserResult, type RunTestParams, type RunTestResult, type RunTestSuiteParams, type RunTestSuiteResult, type RunViewByIDSystemUserInput, type RunViewByNameSystemUserInput, type RunViewSystemUserInput, type RunViewSystemUserResult, type RunViewSystemUserResultRow, type SearchRegistryComponentsParams, type SimplePromptResult, SimpleRemoteEntity, SimpleRemoteEntityField, SimpleRemoteEntityOutput, SyncDataAction, SyncDataResult, SyncRolesAndUsersResult, type TestExecutionProgress, type UpdateQueryInput, type UpdateQueryResult, UserInput, setupGraphQLClient };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { GraphQLClient } from 'graphql-request';
|
|
2
2
|
export { gql } from 'graphql-request';
|
|
3
|
-
import { ProviderConfigDataBase, ProviderBase, IEntityDataProvider, IMetadataProvider,
|
|
3
|
+
import { ProviderConfigDataBase, ProviderBase, IEntityDataProvider, IMetadataProvider, IRunReportProvider, UserInfo, RunReportParams, RunReportResult, RunQueryParams, RunQueryResult, RunQueryWithCacheCheckParams, RunQueriesWithCacheCheckResponse, RunViewParams, RunViewResult, RunViewWithCacheCheckParams, RunViewsWithCacheCheckResponse, EntityInfo, ProviderType, CompositeKey, RecordChange, RecordDependency, KeyValuePair, PotentialDuplicateRequest, PotentialDuplicateResponse, RecordMergeRequest, EntityMergeOptions, RecordMergeResult, BaseEntity, EntitySaveOptions, EntityDeleteOptions, DatasetItemFilterType, DatasetResultType, DatasetStatusResultType, TransactionGroupBase, EntityRecordNameInput, EntityRecordNameResult, ILocalStorageProvider, TransactionResult } from '@memberjunction/core';
|
|
4
4
|
import { UserViewEntityExtended } from '@memberjunction/core-entities';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
import { ExecuteAgentParams, ExecuteAgentResult } from '@memberjunction/ai-core-plus';
|
|
7
7
|
import { ActionParam, ActionResult, EntityActionInvocationParams, EntityActionResult } from '@memberjunction/actions-base';
|
|
8
8
|
import { ComponentSpec } from '@memberjunction/interactive-component-types';
|
|
9
|
+
import { DBSchema } from '@tempfix/idb';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Client for executing AI operations through GraphQL.
|
|
@@ -151,6 +152,33 @@ declare class GraphQLAIClient {
|
|
|
151
152
|
* @private
|
|
152
153
|
*/
|
|
153
154
|
private handleAgentError;
|
|
155
|
+
/**
|
|
156
|
+
* Run an AI agent using an existing conversation detail ID.
|
|
157
|
+
* This is an optimized method that loads conversation history server-side,
|
|
158
|
+
* avoiding the need to send large attachment data from client to server.
|
|
159
|
+
*
|
|
160
|
+
* Use this method when:
|
|
161
|
+
* - The user's message has already been saved as a ConversationDetail
|
|
162
|
+
* - The conversation may have attachments (images, documents, etc.)
|
|
163
|
+
* - You want optimal performance by loading history on the server
|
|
164
|
+
*
|
|
165
|
+
* @param params The parameters for running the AI agent from conversation detail
|
|
166
|
+
* @returns A Promise that resolves to an ExecuteAgentResult object
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* const result = await aiClient.RunAIAgentFromConversationDetail({
|
|
171
|
+
* conversationDetailId: "detail-id-123",
|
|
172
|
+
* agentId: "agent-id",
|
|
173
|
+
* maxHistoryMessages: 20,
|
|
174
|
+
* createArtifacts: true,
|
|
175
|
+
* onProgress: (progress) => {
|
|
176
|
+
* console.log(`Progress: ${progress.message}`);
|
|
177
|
+
* }
|
|
178
|
+
* });
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
RunAIAgentFromConversationDetail(params: RunAIAgentFromConversationDetailParams): Promise<ExecuteAgentResult>;
|
|
154
182
|
/**
|
|
155
183
|
* Execute a simple prompt without requiring a stored AI Prompt entity.
|
|
156
184
|
* This method is designed for interactive components that need quick AI responses.
|
|
@@ -426,6 +454,69 @@ interface RunAIPromptResult {
|
|
|
426
454
|
*/
|
|
427
455
|
chatResult?: any;
|
|
428
456
|
}
|
|
457
|
+
/**
|
|
458
|
+
* Parameters for running an AI agent from an existing conversation detail.
|
|
459
|
+
* This is the optimized method that loads conversation history server-side.
|
|
460
|
+
*/
|
|
461
|
+
interface RunAIAgentFromConversationDetailParams {
|
|
462
|
+
/**
|
|
463
|
+
* The ID of the conversation detail (user's message) to use as context
|
|
464
|
+
*/
|
|
465
|
+
conversationDetailId: string;
|
|
466
|
+
/**
|
|
467
|
+
* The ID of the AI agent to run
|
|
468
|
+
*/
|
|
469
|
+
agentId: string;
|
|
470
|
+
/**
|
|
471
|
+
* Maximum number of history messages to include (default: 20)
|
|
472
|
+
*/
|
|
473
|
+
maxHistoryMessages?: number;
|
|
474
|
+
/**
|
|
475
|
+
* Data context to pass to the agent (will be JSON serialized)
|
|
476
|
+
*/
|
|
477
|
+
data?: Record<string, unknown>;
|
|
478
|
+
/**
|
|
479
|
+
* Payload to pass to the agent (will be JSON serialized)
|
|
480
|
+
*/
|
|
481
|
+
payload?: Record<string, unknown> | string;
|
|
482
|
+
/**
|
|
483
|
+
* ID of the last agent run for continuity
|
|
484
|
+
*/
|
|
485
|
+
lastRunId?: string;
|
|
486
|
+
/**
|
|
487
|
+
* Whether to auto-populate payload from last run
|
|
488
|
+
*/
|
|
489
|
+
autoPopulateLastRunPayload?: boolean;
|
|
490
|
+
/**
|
|
491
|
+
* Configuration ID to use
|
|
492
|
+
*/
|
|
493
|
+
configurationId?: string;
|
|
494
|
+
/**
|
|
495
|
+
* Whether to create artifacts from the agent's payload
|
|
496
|
+
*/
|
|
497
|
+
createArtifacts?: boolean;
|
|
498
|
+
/**
|
|
499
|
+
* Whether to create a user notification on completion
|
|
500
|
+
*/
|
|
501
|
+
createNotification?: boolean;
|
|
502
|
+
/**
|
|
503
|
+
* Source artifact ID for versioning
|
|
504
|
+
*/
|
|
505
|
+
sourceArtifactId?: string;
|
|
506
|
+
/**
|
|
507
|
+
* Source artifact version ID for versioning
|
|
508
|
+
*/
|
|
509
|
+
sourceArtifactVersionId?: string;
|
|
510
|
+
/**
|
|
511
|
+
* Optional callback for progress updates
|
|
512
|
+
*/
|
|
513
|
+
onProgress?: (progress: {
|
|
514
|
+
currentStep: string;
|
|
515
|
+
percentage?: number;
|
|
516
|
+
message: string;
|
|
517
|
+
metadata?: Record<string, unknown>;
|
|
518
|
+
}) => void;
|
|
519
|
+
}
|
|
429
520
|
|
|
430
521
|
/**************************************************************************************************************
|
|
431
522
|
* The graphQLDataProvider provides a data provider for the entities framework that uses GraphQL to communicate
|
|
@@ -482,7 +573,7 @@ declare class GraphQLProviderConfigData extends ProviderConfigDataBase {
|
|
|
482
573
|
* The GraphQLDataProvider class is a data provider for MemberJunction that implements the IEntityDataProvider, IMetadataProvider, IRunViewProvider, IRunReportProvider, IRunQueryProvider interfaces and connects to the
|
|
483
574
|
* 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.
|
|
484
575
|
*/
|
|
485
|
-
declare class GraphQLDataProvider extends ProviderBase implements IEntityDataProvider, IMetadataProvider,
|
|
576
|
+
declare class GraphQLDataProvider extends ProviderBase implements IEntityDataProvider, IMetadataProvider, IRunReportProvider {
|
|
486
577
|
private static _instance;
|
|
487
578
|
static get Instance(): GraphQLDataProvider;
|
|
488
579
|
constructor();
|
|
@@ -492,36 +583,6 @@ declare class GraphQLDataProvider extends ProviderBase implements IEntityDataPro
|
|
|
492
583
|
private _aiClient;
|
|
493
584
|
private _refreshPromise;
|
|
494
585
|
get ConfigData(): GraphQLProviderConfigData;
|
|
495
|
-
/**
|
|
496
|
-
* The core schema name constant. This should match the mjCoreSchema config value.
|
|
497
|
-
* TODO: Move this to @memberjunction/core once npm registration issues are resolved
|
|
498
|
-
* @see https://github.com/MemberJunction/MJ/issues/1452
|
|
499
|
-
*/
|
|
500
|
-
protected static readonly MJ_CORE_SCHEMA = "__mj";
|
|
501
|
-
/**
|
|
502
|
-
* Sanitizes a string to be a valid GraphQL name component, preserving original capitalization.
|
|
503
|
-
* GraphQL names must match the pattern [_A-Za-z][_0-9A-Za-z]* and cannot start with double underscore
|
|
504
|
-
*
|
|
505
|
-
* TODO: Move this to @memberjunction/core once npm registration issues are resolved
|
|
506
|
-
* @see https://github.com/MemberJunction/MJ/issues/1452
|
|
507
|
-
*
|
|
508
|
-
* Copied from @memberjunction/codegen-lib GraphQLServerGeneratorBase.sanitizeGraphQLName()
|
|
509
|
-
*/
|
|
510
|
-
protected sanitizeGraphQLName(input: string): string;
|
|
511
|
-
/**
|
|
512
|
-
* Generates the base GraphQL type name for an entity using SchemaBaseTable pattern.
|
|
513
|
-
* Preserves original capitalization. Special case: MJ core schema uses "MJ" prefix.
|
|
514
|
-
* This ensures unique type names across different schemas.
|
|
515
|
-
*
|
|
516
|
-
* TODO: Move this to @memberjunction/core once npm registration issues are resolved
|
|
517
|
-
* @see https://github.com/MemberJunction/MJ/issues/1452
|
|
518
|
-
*
|
|
519
|
-
* Copied from @memberjunction/codegen-lib GraphQLServerGeneratorBase.getServerGraphQLTypeNameBase()
|
|
520
|
-
*
|
|
521
|
-
* @param entity - The entity to generate the type name for
|
|
522
|
-
* @returns The base GraphQL type name (without suffix like ViewByID, DynamicView, etc.)
|
|
523
|
-
*/
|
|
524
|
-
protected getGraphQLTypeNameBase(entity: EntityInfo): string;
|
|
525
586
|
/**
|
|
526
587
|
* Gets the AI client for executing AI operations through GraphQL.
|
|
527
588
|
* The client is lazily initialized on first access.
|
|
@@ -584,17 +645,39 @@ declare class GraphQLDataProvider extends ProviderBase implements IEntityDataPro
|
|
|
584
645
|
/**************************************************************************/
|
|
585
646
|
/**************************************************************************/
|
|
586
647
|
/**************************************************************************/
|
|
587
|
-
|
|
648
|
+
protected InternalRunQuery(params: RunQueryParams, contextUser?: UserInfo): Promise<RunQueryResult>;
|
|
649
|
+
protected InternalRunQueries(params: RunQueryParams[], contextUser?: UserInfo): Promise<RunQueryResult[]>;
|
|
588
650
|
RunQueryByID(QueryID: string, CategoryID?: string, CategoryPath?: string, contextUser?: UserInfo, Parameters?: Record<string, any>, MaxRows?: number, StartRow?: number): Promise<RunQueryResult>;
|
|
589
651
|
RunQueryByName(QueryName: string, CategoryID?: string, CategoryPath?: string, contextUser?: UserInfo, Parameters?: Record<string, any>, MaxRows?: number, StartRow?: number): Promise<RunQueryResult>;
|
|
590
652
|
protected get QueryReturnFieldList(): string;
|
|
591
653
|
protected TransformQueryPayload(data: any): RunQueryResult;
|
|
654
|
+
/**
|
|
655
|
+
* RunQueriesWithCacheCheck - Smart cache validation for batch RunQueries.
|
|
656
|
+
* For each query, if cacheStatus is provided, the server checks if the cache is current
|
|
657
|
+
* using the Query's CacheValidationSQL. If current, returns status='current' with no data.
|
|
658
|
+
* If stale, returns status='stale' with fresh data.
|
|
659
|
+
*
|
|
660
|
+
* @param params - Array of RunQuery requests with optional cache status
|
|
661
|
+
* @param contextUser - Optional user context
|
|
662
|
+
* @returns Response containing results for each query in the batch
|
|
663
|
+
*/
|
|
664
|
+
RunQueriesWithCacheCheck<T = unknown>(params: RunQueryWithCacheCheckParams[], contextUser?: UserInfo): Promise<RunQueriesWithCacheCheckResponse<T>>;
|
|
592
665
|
/**************************************************************************/
|
|
593
666
|
/**************************************************************************/
|
|
594
667
|
/**************************************************************************/
|
|
595
668
|
/**************************************************************************/
|
|
596
|
-
|
|
597
|
-
|
|
669
|
+
protected InternalRunView<T = any>(params: RunViewParams, contextUser?: UserInfo): Promise<RunViewResult<T>>;
|
|
670
|
+
protected InternalRunViews<T = any>(params: RunViewParams[], contextUser?: UserInfo): Promise<RunViewResult<T>[]>;
|
|
671
|
+
/**
|
|
672
|
+
* RunViewsWithCacheCheck - Smart cache validation for batch RunViews.
|
|
673
|
+
* For each view, if cacheStatus is provided, the server checks if the cache is current.
|
|
674
|
+
* If current, returns status='current' with no data. If stale, returns status='stale' with fresh data.
|
|
675
|
+
*
|
|
676
|
+
* @param params - Array of RunView requests with optional cache status
|
|
677
|
+
* @param contextUser - Optional user context
|
|
678
|
+
* @returns Response containing results for each view in the batch
|
|
679
|
+
*/
|
|
680
|
+
RunViewsWithCacheCheck<T = unknown>(params: RunViewWithCacheCheckParams[], contextUser?: UserInfo): Promise<RunViewsWithCacheCheckResponse<T>>;
|
|
598
681
|
protected getEntityNameAndUserView(params: RunViewParams, contextUser?: UserInfo): Promise<{
|
|
599
682
|
entityName: string;
|
|
600
683
|
v: UserViewEntityExtended;
|
|
@@ -2146,6 +2229,7 @@ interface RunTestParams {
|
|
|
2146
2229
|
testId: string;
|
|
2147
2230
|
verbose?: boolean;
|
|
2148
2231
|
environment?: string;
|
|
2232
|
+
tags?: string[];
|
|
2149
2233
|
onProgress?: (progress: TestExecutionProgress) => void;
|
|
2150
2234
|
}
|
|
2151
2235
|
/**
|
|
@@ -2165,6 +2249,22 @@ interface RunTestSuiteParams {
|
|
|
2165
2249
|
verbose?: boolean;
|
|
2166
2250
|
environment?: string;
|
|
2167
2251
|
parallel?: boolean;
|
|
2252
|
+
tags?: string[];
|
|
2253
|
+
/**
|
|
2254
|
+
* Run only specific tests by their IDs.
|
|
2255
|
+
* If provided, only tests with matching IDs will be executed.
|
|
2256
|
+
*/
|
|
2257
|
+
selectedTestIds?: string[];
|
|
2258
|
+
/**
|
|
2259
|
+
* Start execution from this sequence number (inclusive).
|
|
2260
|
+
* Tests with sequence numbers less than this value will be skipped.
|
|
2261
|
+
*/
|
|
2262
|
+
sequenceStart?: number;
|
|
2263
|
+
/**
|
|
2264
|
+
* Stop execution at this sequence number (inclusive).
|
|
2265
|
+
* Tests with sequence numbers greater than this value will be skipped.
|
|
2266
|
+
*/
|
|
2267
|
+
sequenceEnd?: number;
|
|
2168
2268
|
onProgress?: (progress: TestExecutionProgress) => void;
|
|
2169
2269
|
}
|
|
2170
2270
|
/**
|
|
@@ -2700,4 +2800,80 @@ declare class GraphQLComponentRegistryClient {
|
|
|
2700
2800
|
SendComponentFeedback(params: ComponentFeedbackParams): Promise<ComponentFeedbackResponse>;
|
|
2701
2801
|
}
|
|
2702
2802
|
|
|
2703
|
-
|
|
2803
|
+
/**
|
|
2804
|
+
* In-memory storage provider using nested Map structure for category isolation.
|
|
2805
|
+
* Used as a fallback when browser storage is not available.
|
|
2806
|
+
*
|
|
2807
|
+
* Storage structure: Map<category, Map<key, value>>
|
|
2808
|
+
*/
|
|
2809
|
+
declare class BrowserStorageProviderBase implements ILocalStorageProvider {
|
|
2810
|
+
private _storage;
|
|
2811
|
+
/**
|
|
2812
|
+
* Gets or creates a category map
|
|
2813
|
+
*/
|
|
2814
|
+
private getCategoryMap;
|
|
2815
|
+
GetItem(key: string, category?: string): Promise<string | null>;
|
|
2816
|
+
SetItem(key: string, value: string, category?: string): Promise<void>;
|
|
2817
|
+
Remove(key: string, category?: string): Promise<void>;
|
|
2818
|
+
ClearCategory(category: string): Promise<void>;
|
|
2819
|
+
GetCategoryKeys(category: string): Promise<string[]>;
|
|
2820
|
+
}
|
|
2821
|
+
/**
|
|
2822
|
+
* IndexedDB schema with dynamic object stores per category.
|
|
2823
|
+
* Each category gets its own object store: mj:CategoryName
|
|
2824
|
+
*/
|
|
2825
|
+
interface MJ_MetadataDB extends DBSchema {
|
|
2826
|
+
'mj:default': {
|
|
2827
|
+
key: string;
|
|
2828
|
+
value: string;
|
|
2829
|
+
};
|
|
2830
|
+
'mj:Metadata': {
|
|
2831
|
+
key: string;
|
|
2832
|
+
value: string;
|
|
2833
|
+
};
|
|
2834
|
+
'mj:RunViewCache': {
|
|
2835
|
+
key: string;
|
|
2836
|
+
value: string;
|
|
2837
|
+
};
|
|
2838
|
+
'mj:RunQueryCache': {
|
|
2839
|
+
key: string;
|
|
2840
|
+
value: string;
|
|
2841
|
+
};
|
|
2842
|
+
'mj:DatasetCache': {
|
|
2843
|
+
key: string;
|
|
2844
|
+
value: string;
|
|
2845
|
+
};
|
|
2846
|
+
}
|
|
2847
|
+
/**
|
|
2848
|
+
* IndexedDB storage provider with category support via separate object stores.
|
|
2849
|
+
*
|
|
2850
|
+
* Known categories (mj:Metadata, mj:RunViewCache, etc.) get dedicated object stores.
|
|
2851
|
+
* Unknown categories fall back to the default store with prefixed keys.
|
|
2852
|
+
*/
|
|
2853
|
+
declare class BrowserIndexedDBStorageProvider extends BrowserStorageProviderBase {
|
|
2854
|
+
private dbPromise;
|
|
2855
|
+
private _dbReady;
|
|
2856
|
+
constructor();
|
|
2857
|
+
/**
|
|
2858
|
+
* Checks if a category has a dedicated object store
|
|
2859
|
+
*/
|
|
2860
|
+
private isKnownCategory;
|
|
2861
|
+
/**
|
|
2862
|
+
* Gets the object store name for a category.
|
|
2863
|
+
* Returns the dedicated store if it exists, otherwise returns the default store.
|
|
2864
|
+
*/
|
|
2865
|
+
private getStoreName;
|
|
2866
|
+
/**
|
|
2867
|
+
* Gets the key to use in the store.
|
|
2868
|
+
* For known stores, use the key as-is.
|
|
2869
|
+
* For unknown categories using the default store, prefix with category.
|
|
2870
|
+
*/
|
|
2871
|
+
private getStoreKey;
|
|
2872
|
+
SetItem(key: string, value: string, category?: string): Promise<void>;
|
|
2873
|
+
GetItem(key: string, category?: string): Promise<string | null>;
|
|
2874
|
+
Remove(key: string, category?: string): Promise<void>;
|
|
2875
|
+
ClearCategory(category: string): Promise<void>;
|
|
2876
|
+
GetCategoryKeys(category: string): Promise<string[]>;
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
export { ActionItemInput, ActionItemOutput, BrowserIndexedDBStorageProvider, BrowserStorageProviderBase, type ComponentDependencyTree, type ComponentSpecWithHash, type CreateQueryInput, type CreateQueryResult, type DeleteQueryOptionsInput, type DeleteQueryResult, type EmbedTextParams, type EmbedTextResult, type ExecuteSimplePromptParams, FieldMapper, GetDataOutput, type GetQueryDataByNameSystemUserInput, type GetQueryDataSystemUserInput, type GetRegistryComponentParams, GraphQLAIClient, GraphQLActionClient, GraphQLComponentRegistryClient, GraphQLDataProvider, GraphQLProviderConfigData, GraphQLSystemUserClient, GraphQLTestingClient, GraphQLTransactionGroup, type MJ_MetadataDB, type QueryEntity, type QueryField, type QueryParameter, type QueryPermission, type QueryPermissionInput, type RegistryComponentSearchResult, RoleInput, RolesAndUsersInput, type RunAIPromptParams, type RunAIPromptResult, type RunDynamicViewSystemUserInput, type RunQuerySystemUserResult, type RunTestParams, type RunTestResult, type RunTestSuiteParams, type RunTestSuiteResult, type RunViewByIDSystemUserInput, type RunViewByNameSystemUserInput, type RunViewSystemUserInput, type RunViewSystemUserResult, type RunViewSystemUserResultRow, type SearchRegistryComponentsParams, type SimplePromptResult, SimpleRemoteEntity, SimpleRemoteEntityField, SimpleRemoteEntityOutput, SyncDataAction, SyncDataResult, SyncRolesAndUsersResult, type TestExecutionProgress, type UpdateQueryInput, type UpdateQueryResult, UserInput, setupGraphQLClient };
|