MJAPI server URL
Optional, JWT token that is used for a normal user authentication flow. This is required if mjAPIKey is not provided.
Optional, UUID that is used to track a session. This can be any string.
Shared Secret key that is provided for system user authentication. This is required if token is not provided.
Returns the underlying GraphQL client which is an instance of the GraphQLClient object from the graphql-request package. This is useful if you want to perform any operation that is not directly supported by this class via specialized methods.
Checks whether a given user has read permission on a list of entities. Used by Skip Brain's permission gate to verify entity-level access before building components that reference those entities.
Creates a new query using the CreateQueryExtended mutation. This method is restricted to system users only.
CreateQuerySystemUserInput containing all the query attributes including optional CategoryPath
Promise containing the result of the query creation
Deletes a query by ID using the DeleteQueryExtended mutation. This method is restricted to system users only.
The ID of the query to delete
Optionaloptions: DeleteQueryOptionsInputOptional delete options controlling action execution
Promise containing the result of the query deletion
Generate embeddings using local embedding models. This method allows system-level generation of text embeddings.
The parameters for embedding generation
A Promise that resolves to an EmbedTextResult object
Execute a simple prompt without requiring a stored AI Prompt entity. This method allows system-level execution of simple prompts.
The parameters for the simple prompt execution
A Promise that resolves to a SimplePromptResult object
This method will return a list of all entities that are available on the remote server. This is a lightweight call that only returns the basic metadata for each entity and does not include all of the attributes at either the entity or the field level. This is useful for getting a list of entities that are available on the remote server and knowing their IDs and Entity Field IDs on the remote server. For core MemberJunction entities and entity fields, the ID values are globally unique and set by the MemberJunction distribution, however, for other entities that are generated on each target system they can vary so it is best to use lookups name or a combination of SchemaName and BaseTable to uniquely identify an entity.
Calls the GetData() query on the server to execute any number of provided SQL queries in parallel and returns the results. The queries MUST BE read only and not perform any DML operations. The remote server will execute the queries using a special lower-privilege user that is not allowed to perform any form of write operations.
an array of SQL queries to execute on the remote server
the short-lived access token that is required to perform this operation. This is different from the MJAPI key and is used for a second factor and is a short-lived token. You will receive this token when an MJAPI calls your server to request something along with the URL to call back.
Executes a stored query by ID using the GetQueryDataSystemUser resolver.
Query input parameters for execution by ID
Promise containing the query execution results
Executes a stored query by name using the GetQueryDataByNameSystemUser resolver.
Query input parameters for execution by name
Promise containing the query execution results
Execute a lightweight preview search as the system user. Suitable for autocomplete / type-ahead scenarios with smaller payloads.
Preview search parameters (query, optional max results)
A SearchClientResponse with preview results
Run an AI agent with system user privileges. This method allows system-level execution of AI agents without user authentication.
The parameters for running the AI agent
A Promise that resolves to a RunAIAgentResult object
Run an AI prompt with system user privileges. This method allows system-level execution of AI prompts without user authentication.
The parameters for running the AI prompt
A Promise that resolves to a RunAIPromptResult object
Runs a dynamic view using the RunDynamicViewSystemUser resolver.
View input parameters for dynamic view execution
Promise containing the view execution results
Runs a view by ID using the RunViewByIDSystemUser resolver.
View input parameters for running by ID
Promise containing the view execution results
Runs a view by name using the RunViewByNameSystemUser resolver.
View input parameters for running by name
Promise containing the view execution results
Runs multiple views using the RunViewsSystemUser resolver. This method allows system users to execute view queries with the same functionality as regular users but with system-level privileges.
Array of view input parameters
Promise containing the results from all view executions
Execute a full knowledge search as the system user. Invokes the
SearchKnowledgeAsSystemUser mutation which delegates to SearchEngine.Instance.
Search parameters (query, optional filters, max results, min score)
A SearchClientResponse with ranked, fused results from all active search providers
This method is used to invoke the data synchronization mutation on the remote server. This method is used to create, update, or delete records in the remote server. The method takes an array of ActionItemInput objects Each of the ActionItemInput objects represents a single action to take on a single entity. The action can be Create, Update, CreateOrUpdate, Delete, or DeleteWithFilter. The RecordJSON field is used for Create, CreateOrUpdate and Update whereas the DeleteFilter field is used for DeleteWithFilter. The PrimaryKey and AlternateKey fields are used to identify the record to be acted upon.
Use of the AlternateKey is important for situations where you might have divergent primary keys across systems. For example for user entities that are individually generated on each system by CodeGen, the primary key will be different per system, so you would use the combination of the SchemaName and BaseTable to identify the entity and then use the AlternateKey to provide the combination of these fields to uniquely identify the record for updates.
This method will sync the roles and users on the remote server. This method is used to create, update, or delete roles and users on the remote server. The method takes a RolesAndUsersInput object that contains an array of RoleInput objects. Note that this will not result in the removal of roles on the remote server that are deemed to be built-in MemberJunction roles such as Developer, Integration and UI.
Tests transient (unsaved) SQL with full composition + Nunjucks template processing. Calls the TestQuerySQL resolver which uses a read-only connection and enforces MaxRows limits.
This enables external systems to test query SQL before saving to the database, including inline dependency resolution and parameter substitution.
The transient query spec including SQL, parameters, dependencies, and MaxRows
Promise containing execution results with parsed data rows
Updates an existing query with the provided attributes. This method is restricted to system users only.
UpdateQueryInput containing the query ID and fields to update
Promise containing the result of the query update including updated fields, parameters, entities, and permissions
Specialized client that is designed to be used exclusively on the server side by the System User using the MJ API KEY. This is designed to allow server side code such as within the context of an MJAPI server to talk to another MAJPI server but as the client.
It is possible for a server to use the regular
Graph QLData Provider
client to talk to another MJAPI server, but that would require the server to have a user account and the server would have to be able to log in as that user via a JWT token. This is not always possible or convenient in the flow.
Also the standard client configuration process has a certain amount over overhead in always loading up certain metadata that is not necessary for many system user operations.
Finaly, this client can be used in parallel with the regular client to allow a server to mix and match the two as needed.