Runtime Decorators
Define feature flags, experiments, progressive rollouts, tenant boundaries, scheduling, and resource quotas with AxilJS semantic decorators.
Runtime Decorators
Runtime decorators describe operational policies that affect feature availability, tenant boundaries, scheduling, and resource consumption.
They express runtime intent as metadata. A cloud platform, scheduler, or other runtime consumer can interpret that metadata and apply the corresponding policy without coupling application code to a specific runtime implementation.
@tFeatureFlag
Declares that an operation is gated by a feature flag.
Feature flags allow runtime consumers to control whether functionality is available without changing the method's implementation.
@tExperiment
Declares an A/B or multivariate experiment.
The decorator describes the experiment and its variants so an external runtime or experimentation system can determine how execution should be assigned.
@tRollout
Declares a progressive rollout percentage for a feature or operation.
This allows a runtime consumer to gradually expose functionality rather than enabling it for every request at once.
@tTenant
Declares that an operation requires a tenant context.
The tenant context can be resolved according to the strategy understood by the runtime consumer.
@tTenantBoundary
Declares a tenant isolation boundary for an operation.
Boundary levels
| Level | Description |
|---|---|
'strict' | Cross-tenant access is forbidden |
'soft' | Cross-tenant access is logged |
'admin' | Cross-tenant access is allowed for administrators |
This makes the intended tenant boundary explicit at the operation level.
@tCrossTenant
Explicitly declares that an operation is authorized to access data across tenant boundaries.
Because cross-tenant operations are sensitive, they can be composed with audit semantics.
The reason documents why cross-tenant access is permitted, while tAudit provides an explicit audit requirement for the operation.
@tSchedule
Declares that a method should run according to a cron schedule or interval.
Scheduling semantics remain separate from the scheduler implementation. A runtime scheduler can consume the metadata and determine when the operation should execute.
@tQuota
Declares a tenant resource quota that an operation consumes.
Quotas can represent API calls, AI tokens, or other runtime-managed resources.
@tResource
Declares resource requirements for an operation.
A runtime scheduler can use these requirements when deciding where and how the operation should execute.
@tInterval
Declares a recurring execution interval.
The value represents the requested interval in milliseconds.
@tDelay
Declares a delay before execution.
The delay is expressed in milliseconds.
@tRunAt
Declares a specific execution time.
The timestamp is declared as metadata so a scheduling consumer can determine when the operation should run.
Combining Runtime Semantics
Runtime decorators can be composed when an operation has multiple independent runtime requirements.
For example, a scheduled operation can also consume a tenant quota:
Each decorator describes a separate concern. A scheduler can consume the scheduling metadata, while a quota system can consume the resource constraint.
Semantic Consumer Model
AxilJS decorators do not need to own the runtime implementation.
The application declares intent:
Independent consumers can interpret these declarations:
- A feature-flag system evaluates
tFeatureFlag. - A rollout system evaluates
tRollout. - A quota system evaluates
tQuota. - A scheduler consumes
tSchedule,tInterval,tDelay, ortRunAt. - A tenant-aware runtime evaluates
tTenant,tTenantBoundary, andtCrossTenant.
This separation keeps runtime semantics explicit while avoiding unnecessary coupling between application code and a particular infrastructure implementation.
Reference
| Decorator | Purpose |
|---|---|
tFeatureFlag | Gate functionality behind a feature flag |
tExperiment | Declare an A/B or multivariate experiment |
tRollout | Define progressive rollout percentage |
tTenant | Require tenant context |
tTenantBoundary | Define tenant isolation behavior |
tCrossTenant | Authorize explicit cross-tenant access |
tSchedule | Declare cron-based scheduling |
tQuota | Declare resource quota consumption |
tResource | Declare runtime resource requirements |
tInterval | Define recurring execution interval |
tDelay | Define an execution delay |
tRunAt | Define a specific execution timestamp |
Runtime decorators turn operational requirements into explicit, machine-readable semantics. The application describes what an operation requires; runtime infrastructure can decide how those requirements are enforced.