Private Static Readonly LOG_Default prefix for auto-generated SQL log filenames
Private EventProtected AfterProtected AfterProtected AfterProtected ArrayFilters encrypted fields for an array of data objects
Protected ArrayOptional contextUser: UserInfoProtected BeforeProtected BeforeProtected BeforeProtected CheckProtected CreateProtected DeleteProtected EmitProtected FilterFilters encrypted field values before sending to the API client.
For each encrypted field in the entity:
Name of the entity
The data object containing field values
User context for encryption operations
The filtered data object
Protected GetProtected GetProtected ListenProtected MapMaps field names to their GraphQL-safe CodeNames and handles encryption for API responses.
For encrypted fields coming from raw SQL queries (not entity objects):
The entity name
The data object with field values
Optional contextUser: UserInfoOptional user context for decryption (required for encrypted fields)
The processed data object
Protected RunOptimized RunViewGenericInternal implementation with:
Protected RunOptimized implementation that:
Protected TestThis routine compares the OldValues property in the input object to the values in the DB that we just loaded. If there are differences, we need to check to see if the client is trying to update any of those fields (e.g. overlap). If there is overlap, we throw an error. If there is no overlap, we can proceed with the update even if the DB Values and the ClientOldValues are not 100% the same, so long as there is no overlap in the specific FIELDS that are different.
ASSUMES: input object has an OldValues___ property that is an array of Key/Value pairs that represent the old values of the record that the client is trying to update.
Protected UpdateRetrieves a list of all currently active SQL logging sessions.
Returns detailed information for each active session including:
GraphQL context (requires Owner privileges)
Promise resolving to array of active SqlLoggingSession objects
Error if user lacks Owner privileges
query {
activeSqlLoggingSessions {
id
sessionName
filePath
startTime
statementCount
filterByUserId
options {
prettyPrint
statementTypes
}
}
}
Private checkPrivate Validates that the current user has Owner-level privileges required for SQL logging operations.
This method performs authentication and authorization checks:
The GraphQL application context containing user authentication data
Promise resolving to the authenticated UserInfo object
Error if user is not authenticated, not found, or lacks Owner privileges
Protected createProtected createDebug query to check what the current user email is in the SQL provider. This helps diagnose user filtering issues when SQL statements aren't being captured.
Returns a comparison of the user email stored in the SQLServerDataProvider versus the user email from the GraphQL context, which helps identify mismatches that could prevent SQL filtering from working correctly.
GraphQL context containing user information
Formatted string showing both email values and whether they match
Error if user doesn't have Owner privileges
Private ensurePrivate Ensures the specified log directory exists, creating it if necessary.
This method:
Absolute path to the directory to ensure exists
Error if directory cannot be created due to permissions or other issues
Protected findProtected getProtected packageSPParamReads the contents of a specific SQL log file.
This method:
Unique identifier of the logging session
Maximum number of lines to read (optional, defaults to all)
GraphQL context (requires Owner privileges)
Promise resolving to the log file content
Error if session not found, file not accessible, or user lacks privileges
query {
readSqlLogFile(sessionId: "session-123", maxLines: 100)
}
Protected safeRetrieves the current SQL logging configuration and status information.
Returns comprehensive configuration details including:
GraphQL context (requires Owner privileges)
Promise resolving to complete SQL logging configuration
Error if user lacks Owner privileges
query {
sqlLoggingConfig {
enabled
activeSessionCount
maxActiveSessions
allowedLogDirectory
defaultOptions {
prettyPrint
statementTypes
}
}
}
Creates and starts a new SQL logging session with specified configuration.
This mutation:
Configuration for the new logging session
GraphQL context (requires Owner privileges)
Promise resolving to the created SqlLoggingSession object
Error if logging disabled, session limit reached, or invalid file path
mutation {
startSqlLogging(input: {
fileName: "debug-session.sql"
filterToCurrentUser: true
options: {
prettyPrint: true
statementTypes: "both"
sessionName: "Debug Session"
}
}) {
id
filePath
sessionName
}
}
Stops and disposes of all currently active SQL logging sessions.
This is a convenience method that:
GraphQL context (requires Owner privileges)
Promise resolving to true if all sessions were successfully stopped
Error if user lacks Owner privileges
mutation {
stopAllSqlLogging
}
Stops and disposes of a specific SQL logging session.
This mutation:
Unique identifier of the session to stop
GraphQL context (requires Owner privileges)
Promise resolving to true if session was successfully stopped
Error if session not found or user lacks Owner privileges
mutation {
stopSqlLogging(sessionId: "session-123-456")
}
Updates the default SQL logging options for new sessions.
Note: This updates runtime configuration only, not the static config file. Changes apply to new sessions but do not persist across server restarts. In a production system, consider persisting changes to a database.
New default options to apply (partial update supported)
GraphQL context (requires Owner privileges)
Promise resolving to the updated SqlLoggingOptions object
Error if SQL logging not configured or user lacks Owner privileges
mutation {
updateSqlLoggingDefaults(options: {
prettyPrint: true
statementTypes: "both"
logRecordChangeMetadata: false
}) {
prettyPrint
statementTypes
formatAsMigration
}
}
GraphQL resolver for SQL logging configuration and session management. Provides queries and mutations for controlling SQL logging functionality.
Security: All operations require Owner-level privileges.
Example