BaseQuery
Defined in: packages/core/application/base.query.ts:31
Base class for application CQRS queries.
Query options and authentication context are pipeline metadata rather than request payload. They are stored as non-enumerable properties so Zod validation and cache-key serialization operate only on the query payload.
Type Param
Section titled “Type Param”TSessionUser
Application-specific principal/session metadata type.
Example
Section titled “Example”export class GetUserQuery extends BaseQuery<SessionUser> { constructor( public readonly id: string, options?: Partial<IQueryOptions>, sessionUser?: SessionUser, ) { super(options, sessionUser); }}
const query = new GetUserQuery(userId, { hydrate: true }, sessionUser);Type Parameters
Section titled “Type Parameters”TSessionPrincipal
Section titled “TSessionPrincipal”TSessionPrincipal = unknown
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BaseQuery<
TSessionPrincipal>(options?,sessionPrincipal?):BaseQuery<TSessionPrincipal>
Defined in: packages/core/application/base.query.ts:44
Parameters
Section titled “Parameters”options?
Section titled “options?”sessionPrincipal?
Section titled “sessionPrincipal?”TSessionPrincipal
Returns
Section titled “Returns”BaseQuery<TSessionPrincipal>
Properties
Section titled “Properties”hydrate?
Section titled “hydrate?”
readonlyoptionalhydrate?:boolean
Defined in: packages/core/application/base.query.ts:34
Query metadata for repositories that read it. FromCache does not: it rehydrates every hit whenever a hydrator applies.
Default
Section titled “Default”falseImplementation of
Section titled “Implementation of”refresh?
Section titled “refresh?”
readonlyoptionalrefresh?:boolean
Defined in: packages/core/application/base.query.ts:35
Bypass read-through cache lookup and fill, forcing an authoritative read directly from underlying persistence.
Default
Section titled “Default”falseImplementation of
Section titled “Implementation of”sessionPrincipal?
Section titled “sessionPrincipal?”
readonlyoptionalsessionPrincipal?:TSessionPrincipal
Defined in: packages/core/application/base.query.ts:36
sessionUser?
Section titled “sessionUser?”
readonlyoptionalsessionUser?:TSessionPrincipal
Defined in: packages/core/application/base.query.ts:37
Accessors
Section titled “Accessors”[REQUEST_KIND]
Section titled “[REQUEST_KIND]”Get Signature
Section titled “Get Signature”get [REQUEST_KIND]():
"query"
Defined in: packages/core/application/base.query.ts:40
The kind a pipeline reads from this request: 'query'.
Returns
Section titled “Returns”"query"
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON():
Record<string,unknown>
Defined in: packages/core/application/base.query.ts:64
Serializes enumerable query payload fields to a plain object.
hydrate, refresh, sessionPrincipal and sessionUser are non-enumerable metadata and stay
out of the payload.
Returns
Section titled “Returns”Record<string, unknown>
The query payload with undefined fields omitted.