The Reframe GraphQL API has been redesigned with a unified query approach, consolidating 5 separate queries into a single, powerful messages query. This migration guide explains the changes and how to update your existing queries.
- Single Unified Query: All functionality now available through the
messagesquery - Union Type Response: Returns either
MessageConnection(list mode) orAggregationResult(aggregate mode) - PathFilter Support: Dynamic field filtering using dot notation
- Enhanced Sorting: Sort by any field in ascending or descending order
- Mode Detection: Automatically switches between list and aggregate modes based on parameters
The following queries have been deprecated and removed:
message(id)- Single message lookupsearchMessages(query)- Text searchstats- Statistics queryaggregate- Separate aggregation query
Before:
query {
message(id: "msg-123") {
id
payload
errors { code message }
}
}After:
query {
messages(filter: { path: [{ field: "id", value: { string: { eq: "msg-123" } } }] }, limit: 1) {
... on MessageConnection {
messages {
id
payload
errors { code message }
}
}
}
}Before:
query {
searchMessages(query: "payment", limit: 10) {
id
context
}
}After:
query {
messages(filter: { search: "payment" }, limit: 10) {
... on MessageConnection {
messages {
id
context
}
}
}
}Before:
query {
stats {
totalMessages
successCount
failureCount
successRate
}
}After:
query {
messages(
groupBy: [{ field: "success" }],
metrics: [
{ field: "id", function: COUNT, as: "count" }
]
) {
... on AggregationResult {
data {
group
metrics
}
}
}
}Before:
query {
aggregate(
filter: { hasErrors: true },
groupBy: [{ field: "packageId" }],
metrics: [{ field: "id", function: COUNT, as: "error_count" }]
) {
data {
group
metrics
}
}
}After:
query {
messages(
filter: { path: [{ field: "errors", value: { exists: true } }] },
groupBy: [{ field: "packageId" }],
metrics: [{ field: "id", function: COUNT, as: "error_count" }]
) {
... on AggregationResult {
data {
group
metrics
}
}
}
}filter: Filter criteria (MessageFilter)sort: Array of sort configurationslimit: Maximum messages to return (default: 50, max: 1000)offset: Pagination offset (default: 0)recomputeCustomFields: Force recalculation (default: false)
filter: Filter criteriagroupBy: Array of grouping configurationsmetrics: Array of metric calculations (REQUIRED for aggregation mode)sort: Sort aggregated resultslimit: Maximum groups to return
input MessageFilter {
messageType: String
direction: String
success: Boolean
dateFrom: DateTime
dateTo: DateTime
search: String
packageId: String
customFieldFilters: JSON
path: [PathFilter] # Dynamic field filtering
}input PathFilter {
field: String! # Dot notation path (e.g., "context.metadata.direction")
value: FilterValue!
}
input FilterValue {
string: StringFilter
number: NumberFilter
boolean: Boolean
date: DateFilter
exists: Boolean
}query {
messages(
filter: { success: true, direction: "outgoing" },
sort: [{ field: "timestamp", direction: DESC }],
limit: 20
) {
... on MessageConnection {
messages {
id
packageId
timestamp
}
totalCount
hasNextPage
}
}
}query {
messages(
groupBy: [{
field: "timestamp",
timeBucket: { interval: "1h" }
}],
metrics: [
{ field: "id", function: COUNT, as: "messages_per_hour" }
]
) {
... on AggregationResult {
data {
group
metrics
}
totalGroups
executionTimeMs
}
}
}query {
messages(
filter: {
path: [
{ field: "context.metadata.direction", value: { string: { eq: "outgoing" } } },
{ field: "errors", value: { exists: false } }
]
}
) {
... on MessageConnection {
messages { id }
totalCount
}
}
}-
Always use inline fragments with the Union type response:
... on MessageConnectionfor list results... on AggregationResultfor aggregation results
-
Include
__typenameto identify the response type programmatically:messages(...) { __typename ... on MessageConnection { ... } ... on AggregationResult { ... } }
-
Mode Detection: The query automatically switches to aggregation mode when
metricsparameter is provided. -
Performance: Use specific filters and limits to optimize query performance.
-
Pagination: Use
offsetandlimitfor paginating through large result sets in list mode.
- Aggregation with dot notation: Currently, MongoDB aggregation doesn't support dot notation in field paths for groupBy. Use top-level fields or consider data structure adjustments.
For questions or issues with the migration, please refer to the documentation or open an issue on GitHub.