Μετάβαση στο περιεχόμενο

BaseCommand

Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.

Defined in: packages/core/application/base.command.ts:14

Base class for application CQRS commands.

Encapsulates non-enumerable session/authentication metadata and reports which of a declared set of fields this command actually carries, via getUpdateFields.

TSessionPrincipal = any

new BaseCommand<TSessionPrincipal>(sessionPrincipal?): BaseCommand<TSessionPrincipal>

Defined in: packages/core/application/base.command.ts:23

TSessionPrincipal

BaseCommand<TSessionPrincipal>

readonly optional sessionPrincipal?: TSessionPrincipal

Defined in: packages/core/application/base.command.ts:15


readonly optional sessionUser?: TSessionPrincipal

Defined in: packages/core/application/base.command.ts:16

get [REQUEST_KIND](): "command"

Defined in: packages/core/application/base.command.ts:19

The kind a pipeline reads from this request: 'command'.

"command"

getUpdateFields(updatableFields): string[]

Defined in: packages/core/application/base.command.ts:63

Returns the declared updatable fields that are actually present on this command.

A field counts as present when its value is not undefined. null therefore counts as an intentional mutation, which is important for nullable fields such as clearing a department.

Use this with field-level authorization so the authorization surface is an explicit list owned by the command type.

readonly string[]

Allowed updatable field names for this command.

string[]

Only fields present in the current command payload.

// updatableFields: the fields this command type declares updatable.
const fields = command.getUpdateFields(updatableFields);
authorizer.authorize('update', user, fields);

toJSON(): Record<string, unknown>

Defined in: packages/core/application/base.command.ts:39

Serializes enumerable command payload fields to a plain object.

Non-enumerable metadata such as sessionPrincipal and sessionUser is excluded, and fields whose value is undefined are omitted. This makes the result suitable for stable cache/idempotency fingerprinting.

Record<string, unknown>

The command payload without pipeline/session metadata.