Virtual entities: model, API and internals
Section titled “Virtual entities: model, API and internals”This page is for integrators and developers who create or read virtual entities through the API, write through a proxy entity, or need to know exactly how virtual entries are built and kept in sync.
Kinds and storage
Section titled “Kinds and storage”The three virtual entity kinds are, distinguished by DataEntity.type (DataEntityTypeEnum):
| Kind | DataEntity.type | Enum value | What it does |
|---|---|---|---|
| Proxy | VirtualProxy | 50 | 1:1 proxy of a single source entity. Each qualifying source entry is materialised as a proxy entry in a backing collection. Since 1.10, write-capable when bound to a governing Proxy view that permits it. |
| Joiner | JoinerProxy | 51 | Proxy that also exposes related entities joined through relations (scope). Read-only projection. |
| Aggregator | VirtualAggregator | 52 | Entity assembled by aggregating/joining several sources with explicit field mappings. Read-only projection. |
All three share the same DataEntity document shape: the derivation rules live in DataEntity.typeOptions, whose concrete type depends on the entity type (VirtualProxyEntityOptions for proxy and joiner, AggregatorVirtualEntityOptions for the aggregator).
How virtual entities stay in sync
Section titled “How virtual entities stay in sync”Every virtual entity records which source entries each of its entries was built from. When a source entry is created, updated, archived, or deleted — or when a query that feeds a virtual entity changes — OSOS refreshes the affected virtual entries. Aggregator entities additionally recompute when their sources change. This synchronization runs in the background, so a virtual entity always reflects the current state of its sources. The mechanics for proxy entities are detailed under Lifecycle.
Type options data model
Section titled “Type options data model”Proxy and joiner: VirtualProxyEntityOptions
Section titled “Proxy and joiner: VirtualProxyEntityOptions”typeOptions for VirtualProxy and JoinerProxy entities is a flat list of sources. The first/primary source is the root; every other source references its parent through scope.
interface VirtualProxyEntityOptions { sources: VirtualProxyEntityOptionsSource[];}
interface VirtualProxyEntityOptionsSource { alias: string | null; // unique; used as field-name prefix "alias$fieldNormalizedName" type: VirtualProxyEntitySourceTypeEnum; // Primary = 0 | Additional = 1 sourceEntityNormalizedName: string; sourceQuery?: string | null; // legacy; VirtualProxy pre-migration fallback only — see below sourceViewId?: string | null; // VirtualProxy only, Since 1.10 — the bound Proxy view; see below scope: { alias: string | null; relation: string } | null; // join to a parent source via a relation level: number; // Primary = 1; child = parent.level + 1 isMandatory?: boolean; // default false}Verified field semantics (from the model decorators and JSDoc in virtual-proxy-entity-options-source.model.ts and the @osos/shared interface):
alias— for aPrimarysource the alias equals the source entity’s normalized name; forAdditionalsources it is the relation’s normalized name plus a disambiguating suffix. It is the prefix for joined field normalized names, in the formalias + "$" + fieldNormalizedName.type—VirtualProxyEntitySourceTypeEnum.Primary(0) orAdditional(1). Exactly onePrimarysource is expected; the handlers locate it withsources.find(x => x.type === Primary).sourceViewId(VirtualProxyprimary source only,Since 1.10) — the id of the boundkind: Proxyview that governs this entity’s capability ceiling and, when the view is query-sourced, its materialisation scope. See Proxy view governance. Required on everyVirtualProxyprimary source created or rebound going forward.sourceQuery(VirtualProxyprimary source, legacy) — aDataQueryid.Since 1.10, a new or reboundVirtualProxyprimary source that still carries asourceQueryis refused — see Binding. It survives only as a pre-migration fallback: an entity that predates 1.10 and has not yet been bound to asourceViewIdstill resolves its materialisation scope from this field.JoinerProxyadditional/scoped sources still usesourceQueryas before — the retirement is specific to aVirtualProxyprimary source.scope—{ alias, relation }links anAdditionalsource to a parent source through a named relation (relation= the relation’s normalized name).nullfor the primary source. Modelled byVirtualProxyEntityOptionsSourceScope.level— depth in the source tree;Primaryis1, each child isparent.level + 1.
Aggregator: AggregatorVirtualEntityOptions
Section titled “Aggregator: AggregatorVirtualEntityOptions”interface AggregatorVirtualEntityOptions { sources: AggregatorVirtualEntityOptionsSource[]; // [0] is the primary source}
interface AggregatorVirtualEntityOptionsSource { alias: string | null; type: VirtualProxyEntitySourceTypeEnum; // Primary | Additional sourceEntityNormalizedName: string; sourceQuery: string | null; includedFields: string[]; // default [] fieldMappings: AggregatorEntityFieldMapping[]; // required}
interface AggregatorEntityFieldMapping { normalizedName: string; // field in THIS (aggregator) entity type: AggregatorEntityFieldMappingType; // Fixed=0 | Dynamic=1 | NotSet=2 | Expression=3 value: string | null | unknown; // source field name, fixed value, expression, or null optionsMappings?: OptionsMapping[]; // category option-id remapping}
interface OptionsMapping { sourceOptionId: string; // option id in the SOURCE category field targetOptionId: string | null; // corresponding option id in THIS entity}Field-mapping type values (AggregatorEntityFieldMappingType) drive how value is interpreted:
type | Value | Meaning of value |
|---|---|---|
Fixed | 0 | A fixed literal written into every aggregated entry. |
Dynamic | 1 | The normalized name of a field in the source entity to copy from. |
NotSet | 2 | The field is left unset. |
Expression | 3 | An expression evaluated to produce the value. |
optionsMappings (Since 1.6) lets an aggregator map category-field option ids when the source and target entities use different option ids for the same semantic value. Each OptionsMapping maps a sourceOptionId to a targetOptionId (nullable). It is only required when aggregating category fields whose option ids differ across the source and target.
The aggregator sources are a positional array — sources[0] is the primary entity where aggregation starts; the remaining entries are additional sources joined into it.
Proxy view governance: capability ceilings Since 1.10
Section titled “Proxy view governance: capability ceilings Since 1.10”Since 1.10, a VirtualProxy entity’s write capability — whether it can be created, edited, archived, restored, or saved as a draft at all, and through which fields — is governed entirely by a Proxy view bound to it, not by anything stored on the entity itself. The governing rule: the ceiling is derived fresh on every read, never cached — a proxy entity carries no stored record of what it is currently allowed to do, so revoking a capability on the governing view takes effect immediately everywhere the proxy is used.
The kind: Proxy view and its restricted editor surface
Section titled “The kind: Proxy view and its restricted editor surface”A data view gains a third kind: Implicit (system-built), UserDefined (an ordinary view), and Proxy — a view built specifically to govern a VirtualProxy entity. A view’s kind is fixed once set; it cannot be changed later, even by a payload that simply omits it.
A kind: Proxy view’s admin editor is deliberately narrower than an ordinary view’s. Every save is projected onto an allow-list — identity (name, icon, description), the source entity/query, the field list, the Create/Edit/Archive operation toggles (each with its own field list), and the create-as-draft option — and every other property is silently reset to its default on save, server-side, not merely hidden in the UI. In particular a Proxy view has no publish state, no anonymous/authenticated access settings, and no permissions of its own — its sharing always matches the host entity’s — because access to the entity it governs is controlled through the entity’s own permissions, not through the governing view.
When a VirtualProxy entity is created without naming an existing governing view, OSOS auto-creates a default one: read-only (no operations enabled), scoped to every field the source entity currently has, presented as a Table. An admin enables Create/Edit/Archive on it afterward to make the proxy write-capable.
Binding a proxy entity to its source view Since 1.10
Section titled “Binding a proxy entity to its source view Since 1.10”Binding (or rebinding) a VirtualProxy entity to a governing view is validated on every create and every update:
- The named view must actually be
kind: Proxy, and must govern the same source entity the proxy entity is on — a proxy cannot bind to a view built for a different entity. - The entity’s source cannot still carry a legacy
sourceQuery— see Type options above. - The binding cannot form a cycle, cannot chain more than 10 views deep, and must ultimately resolve to a real, non-proxy host — a Proxy view is allowed to itself govern another
VirtualProxyentity (a proxy bound to a proxy), as long as the chain eventually bottoms out on genuine source data.
The field ceiling is enforced from both directions: narrowing a governing view’s field list is refused if a bound proxy entity still needs one of the dropped fields, and narrowing a proxy entity’s own field selection is refused if it would exceed what its governing view still covers.
Once bound, a VirtualProxy entity cannot be unbound — an update that omits the governing view on an already-bound entity is refused outright; the only way to change it is to rebind to a different kind: Proxy view.
Deriving capabilities
Section titled “Deriving capabilities”At read time, OSOS resolves the proxy’s capability ceiling by walking its binding chain (through every intermediate proxy-bound-to-proxy hop) and intersecting the capabilities each bound view grants — a longer chain can only ever narrow what is permitted, never widen it. Any failure along the way — an unresolvable entity, a chain that never reaches a real host, or any other error — resolves to a fully closed ceiling: nothing granted, no fields exposed. There is no “unrestricted by default” fallback.
The resolved ceiling covers:
| Capability | Meaning |
|---|---|
bound | false only when the binding chain could not be resolved at all. |
fields | The intersected set of field paths the proxy may expose. |
| Screens (entries list / entry details / dashboard) | Which screens the chain permits at all. |
allowCreateEntryAsDraft | Whether a draft can be started on the proxy. |
| Create / Edit / Archive | Whether each operation is granted — an operation absent from every view in the chain grants nothing; there is no separate override. |
| Save-invalid on create / edit | Whether a write that fails validation is still accepted, per operation. |
| Show invalid entries, and its two filters | Gated together — the two filters can only ever be on when the invalid-entries view itself is. |
Any view actually bound to the proxy entity — the one an end user opens to work with its entries — has this same ceiling clamped onto it before it is ever served: its field list is filtered down to the ceiling, its operations are filtered to only what the ceiling grants, and each surviving operation’s own field list is intersected with the ceiling too, so a view that declares “all fields” for an operation still cannot exceed what the proxy is actually allowed. This is what makes the ceiling enforced, not just advisory — every read path that resolves a view over a proxy entity applies it, not only the admin editor.
Since 1.10, reading a VirtualProxy entity’s details (single-entity read only — not the entries list) also returns this resolved ceiling as a proxyCapabilities field, so a caller can tell up front what it is allowed to do without probing. The field is absent on a non-proxy entity, and is present with bound: false on a proxy whose binding could not be resolved — the two cases are deliberately distinguishable. See Calling the HTTP API for the endpoint.
Field-ceiling-driven picker cascade
Section titled “Field-ceiling-driven picker cascade”The same ceiling also narrows what an admin sees while building a Proxy entity’s own field list: any field the governing view’s ceiling withholds is dropped from the pickers used to configure the proxy entity itself (and from anything built on top of that field list, such as table columns or an operation’s own field list). A display-only field at the top level is left alone — it never actually reads or writes data — but every field nested inside a Block is checked regardless, because the save-time guard checks the same way; a field silently exempted only in the picker would otherwise fail to save for a reason the picker never showed. See Data Views & Faces for how the view designer itself surfaces this narrowing while building the governing view.
All endpoints are on the data-service DataEntitiesController (/v1/entities/...). The bodies below are the verified DTO shapes.
Create a virtual entity
Section titled “Create a virtual entity”POST /v1/entities/virtual
Request body (CreateVirtualDataEntityDtoModel):
| Field | Type | Required | Notes |
|---|---|---|---|
name | LocalizedValue | yes | |
description | NullableLocalizedValue | no | |
normalizedName | string | yes | unique; validated against NormalizedNameValidation (length + pattern). Restricted names are rejected. |
permissions | Permission[] | no | stored into access rights, not the entity doc. |
type | DataEntityTypeEnum | yes | must be one of VirtualProxy (50), JoinerProxy (51), VirtualAggregator (52). |
typeOptions | see below | yes | |
icon | Icon | yes | |
module | UUID | yes | must not be the core module id (ImplicitModuleException otherwise). |
entryNames | DataEntityEntryNames | yes | |
displayOption | DataEntityDisplayOptionEnum | no | defaults to KeyValue. |
typeOptions accepts two shapes (handled in createVirtual):
- Flat / interactive —
{ sourceEntityNormalizedName, sourceQuery?, sourceViewId? }(sourceViewIdaddedSince 1.10,VirtualProxyonly — see Proxy binding, at create time below). The controller wraps this into a singlePrimaryVirtualProxyEntityOptionsSource(alias: null,type: Primary,scope: null). - Persisted / passthrough —
{ sources: [...] }. IftypeOptions.sourcesis an array it is passed through untouched. This path is used by packaging import to replay a previously exported entity (proxy/joiner sources withscope, or aggregator sources withfieldMappings); rebuilding it as aVirtualProxyEntityOptionswould strip aggregator-specific fields.
OSOS creates the entity directly and returns it.
Minimal example (interactive proxy of a tickets entity, with no governing view named — OSOS auto-creates one):
POST /v1/entities/virtual{ "name": { "en": "Open Tickets" }, "normalizedName": "open_tickets", "type": 50, "typeOptions": { "sourceEntityNormalizedName": "tickets" }, "icon": { "...": "..." }, "module": "…module-uuid…", "entryNames": { "...": "..." }}Proxy binding, at create time Since 1.10
Section titled “Proxy binding, at create time Since 1.10”For a VirtualProxy create specifically, OSOS resolves the governing view before the entity itself is created, from the primary source’s sourceViewId/sourceQuery:
- You name a
sourceViewId. The named view must exist and pass the binding checks above. No default view is created. - You name neither a
sourceViewIdnor asourceQuery. A default read-only Proxy view is auto-created, scoped to every field the source entity currently has, and bound to the new entity. If the entity create that follows then fails, the auto-created view is deleted again — unless the entity actually persisted despite the error, in which case the view is deliberately kept rather than leaving a persisted entity with a dangling binding. - You name a legacy inline
sourceQuerywith nosourceViewId. Refused outright for a new entity. The one exception is a packaging import replaying a package built before 1.9, which may still carrysourceQueryinline — that import is accepted and left for a migration to relocate onto a bound view, rather than failing.
sourceViewId is rejected outright on a JoinerProxy/VirtualAggregator create — binding is VirtualProxy-only.
Update a virtual entity
Section titled “Update a virtual entity”PUT /v1/entities/virtual/{id}
Request body (UpdateVirtualDataEntityDtoModel): name, description, permissions?, typeOptions? (VirtualProxyEntityOptions | AggregatorVirtualEntityOptions), icon, entryNames, displayOption?, fields[], internalEntities[], internalCollections[], templates?, and a required updateIdentifier.
Concurrency / safety checks performed before the update command is sent:
- Implicit entities cannot be edited (
ImplicitEntityUpdateException). updateIdentifiermust equal the stored one, elseUpdateIdentifierConflictException(optimistic concurrency).- The entity must not be locked by another user (
LockedObjectException).
Emits UpdateVirtualDataEntityCommand and returns the entity.
Since 1.10, if typeOptions on a VirtualProxy update names a new sourceViewId, the same binding checks run again against the new view — including a check that the entity’s own (possibly also-updated) field selection still fits the new view’s ceiling. Omitting sourceViewId on an update to an already-bound entity is refused: an already-bound proxy cannot be unbound through an update.
Read entity details
Section titled “Read entity details”GET on the entity-details endpoint returns a DataEntityDto whose typeDetails is resolved from typeOptions:
VirtualAggregator→DataEntityAggregatorDetailsDtowithprimarySource,additionalSources[], andmappedSources(computed byDataEntityService.getVirtualEntityMappedSources).JoinerProxy/VirtualProxy→DataEntityJoinerDetailsDtowithprimarySourceand, for each source that has ascope.relation, a resolvedsources[]entry carrying the relation DTO.
If an entity has no typeOptions.sources, a warning is logged and details are returned with empty typeDetails.
Since 1.10, a VirtualProxy entity’s details additionally carry proxyCapabilities — see Deriving capabilities above.
Delete
Section titled “Delete”DELETE /v1/entities/{id} archives the entity (shared delete endpoint, not virtual-specific). Since 1.10 a system administrator can also remove a virtual entity for good with DELETE /v1/entities/{id}/permanent — see Admin operations.
Scoping: which source entries are proxied
Section titled “Scoping: which source entries are proxied”Since 1.10, the effective scope for a VirtualProxy entity is resolved through its bound Proxy view, not through a query attached to the entity directly:
- Bound (
sourceViewIdset — the normal case since 1.10) — the bound view is loaded. If the view is Query-sourced, that view’s own query is the effective scope. If the view is Store-sourced, there is no filter — every source entry is proxied. A Query-sourced view that names no query, or a binding that no longer resolves at all, is treated as “refresh/write nothing” rather than “no filter” — a broken binding fails closed; it never silently widens to mirror the whole source. - Not yet bound (pre-1.10 entity only) — falls back to the legacy
sourceQueryfield directly (nullmeaning “all entries”), exactly as before this release.
Once the effective query id (or null, or the “nothing” sentinel) is resolved, OSOS builds the fetch criteria the same way as before:
- If a specific source entry id is given, it filters to that entry.
- If a scoping query is in effect, the query’s criteria is loaded and AND-ed in.
- If neither is given, all source entries are returned.
Source entries are fetched without resolving relations or categories, selecting only the fields the proxy actually needs: id, entity, value, lifecycle status, state, state history, store, invalid flag/reason, and creation/update info.
The same scope also gates every write made through the proxy — see Write-through.
How a proxy entry is built
Section titled “How a proxy entry is built”For VirtualProxy entities, ProxyDataEntryService.refreshEntry turns each qualifying source entry into a proxy DataEntry:
- Deterministic id —
hashId(normalizedName, sourceId)=Utils.hashString("${dataEntity.normalizedName}_${sourceEntry.id}"). This makes the proxy id stable and idempotent per (proxy-entity, source-entry) pair. entryType=EntryTypeEnum.Virtual(1).basedOn= a singleReferenceProperty { dataEntity, dataEntry }pointing back at the source entry (used later to find proxy entries for a given source entry via the entity indexbasedOn.dataEntry).value— copied field-by-field from the source entry usingcopyValuesByPathsoverdataEntity.getAllFieldsPaths(). The copier walks dotted paths and recurses into arrays, so nested and array-valued fields are reconstructed on the target.- Mirrored from source —
isInvalid,invalidReason,state,stateHistory,store, andcreationInfo/updateInfoactor info (doneBy/delegatee, falling back tocreationInfowhenupdateInfois absent).entityVersionis set to the proxy entity’sversion. - When an
originalEntryis passed, that instance is refreshed in place instead of creating a new one (so id,basedOn, andcreationInfoare preserved on update).
Write-through: entry writes on a proxy entity Since 1.10
Section titled “Write-through: entry writes on a proxy entity Since 1.10”Since 1.10, when a VirtualProxy entity’s capability ceiling grants it, writes made directly against the proxy are redirected onto the host (source) entity rather than refused. Nothing below is available on an unbound proxy, or one whose binding could not be resolved.
What routes through to the host
Section titled “What routes through to the host”| Operation | Routes through? |
|---|---|
| Single-entry create (a plain entry create, or through a data view; also reached from a reaction’s Create Data Entry action) | Yes |
| Batch create | Yes for the main row; a batch create’s related rows are refused outright — they would need to reference the proxy row before the host write’s own materialisation event has produced it. |
Full update (PUT) and patch (PATCH, JSON-Patch ops) | Yes — the incoming value is diffed/translated and applied as a write on the host. |
| Bulk patch | Yes, row by row, inside the same transaction as the rest of the batch. |
| Archive, and restore — single and bulk | Yes — the proxy row is resolved back to its host entry, and that host entry is archived/restored. |
| Draft create/update | Yes, gated separately on the ceiling’s own draft flag. A new draft’s store and workflow are seeded from the host entity, since a proxy has neither of its own. |
| Permanent delete | Not established by this guide — do not assume either behaviour without checking current release notes. |
JoinerProxy / VirtualAggregator create, archive, restore, batch-create | No — write-through is VirtualProxy-only; the other two virtual kinds remain read-only projections. Patch is the one long-standing exception: an Aggregator entry has always supported patch, translated through its field mappings rather than through a ceiling. |
How a redirected write is scoped
Section titled “How a redirected write is scoped”Every write-through path follows the same shape:
- The relevant capability (create/edit/archive) must be granted by the ceiling, or the write is refused outright.
- The write is narrowed to the allowed field set — the ceiling’s fields, further narrowed by whatever view the caller actually used to make the write.
- Anything outside that field set is refused, never silently dropped. (One narrow, deliberate exception: the handful of workflow/ordering metadata fields an ordinary edit form always re-submits are exempt from the ceiling check — but only when they are restored verbatim from the stored entry, and only on the ordinary edit path; a caller supplying its own override of that metadata gets no exemption.)
- The write is checked against the proxy’s effective scope — evaluated against the value the write would actually produce, before anything is persisted. A write that would land, or move an entry, outside the governing view’s scope is refused rather than silently written out of bounds or silently dropped.
- The write lands on the host entity under the host’s own id space — the proxy’s governing view has no bearing on the host write’s own view-level rules.
No new sync logic is introduced by write-through: the host’s own create/update/archive/restore events are what refresh the proxy row afterward, exactly as for any other source change — see Lifecycle. The one exception is the HTTP response to a create, which includes a proxy-shaped preview of the just-written row immediately, without waiting for that refresh to land — the real, persisted proxy row is still the one the refresh handler writes once the event arrives.
Field sync: keeping a proxy’s cloned field definitions in step Since 1.10
Section titled “Field sync: keeping a proxy’s cloned field definitions in step Since 1.10”A VirtualProxy entity’s field definitions are cloned from its source at the time the proxy entity itself is created or its field set is updated — they are not a live reference. Since 1.10, OSOS also keeps that clone in step when the source field definition changes later: before this, a field turned required on the host stayed optional on every proxy cloned from it, and a write through the proxy could be refused by a requirement its own form never showed.
Only a deliberately narrow set of properties is re-synced from the source — the data type, validations, render options, and (for the unique flag specifically) the one part of a field’s display options that is a correctness rule rather than a display choice. Everything else — every display setting, and any workflow requirement — stays the proxy’s own; a requirement in particular is never inherited, because a proxy entity has no workflow of its own to enforce it against.
A one-time repair pass applies this same rule in bulk to every VirtualProxy entity that had already drifted before this fix, without generating change notifications of its own — it only catches up stored field definitions that ordinary indexing already picks up on the entity’s next update.
Source-workflow lock state on a Proxy entry Since 1.10
Section titled “Source-workflow lock state on a Proxy entry Since 1.10”A VirtualProxy entity carries no workflow of its own — like every virtual entity — so a proxy row shows no workflow state at all unless OSOS derives one. Since 1.10, it does: a proxy row’s edit lock now follows its source entry’s active workflow, the same way an Aggregator entry’s Edit visibility already follows its source workflow.
- If the source’s workflow has reached a terminal state, every non-Block field on the proxy is locked.
- If an active workflow step exists but the current user isn’t its owner, every field is locked too.
- Otherwise, the source’s own step requirements and the governing view’s own required-fields rules apply, and any proxy field whose source counterpart is hidden or locked is locked to match — this only ever adds locks on top of the governing view’s own, never removes one.
- A row whose source cannot be resolved, or whose source has no workflow at all, is left at the governing view’s own lock state; nothing is derived.
Lifecycle: keeping proxy entries in sync
Section titled “Lifecycle: keeping proxy entries in sync”VirtualProxy entries are materialised and kept in sync by event handlers on the service bus. Each handler discovers affected proxy entities with a query of the form:
where: { type: DataEntityTypeEnum.VirtualProxy, 'typeOptions.sources.sourceEntityNormalizedName': <sourceEntity.normalizedName>,}| Trigger event | Handler | Behaviour |
|---|---|---|
Source entity created (type VirtualProxy) | RefreshProxyEntriesOnDataEntityCreatedHandler | Resolves the primary source entity, fetches all matching source entries, refreshEntrys each and createAlls them into the proxy collection; publishes DataEntryCreatedEvent per entry. Fails the message if the source entity is missing. |
| Source entry created | RefreshProxyEntryOnDataEntryCreated | For every proxy entity on that source: if the proxy’s effective scope doesn’t match the new entry, skip; otherwise create the proxy entry and publish DataEntryCreatedEvent. |
| Source entry updated | RefreshProxyEntryOnDataEntryUpdated | Uses the entity index (basedOn.dataEntry) to find the existing proxy entry, then reconciles: create if newly-matching, delete if it no longer matches the effective scope, else refresh in place. Publishes Created/Updated/Deleted accordingly. |
| Source entry permanently deleted | DeleteProxyEntryOnDataEntryPermanentlyDeleted | Finds proxy entries via basedOn.dataEntry and cascade-deletes them plus their index rows. |
| Source query updated (criteria changed) | RefreshProxyEntriesOnQueryUpdatedHandler | Only runs when criteriaChanged. For each proxy entity bound to that query it rebuilds the whole set: deletes all proxy entries, recreates from the current query result, and publishes Created/Updated/Deleted events by diffing ids. |
Additional entry handlers exist for archive / delete / invalidate transitions (refresh-proxy-entry-on-data-entry-archived, -deleted, -invalidated, -data-entries-archived) that propagate those state changes to the proxy copies.
Error-handling convention across handlers: ENTITY_NOT_FOUND is treated as non-fatal (logged and skipped / message failed); other errors are logged and rethrown so the bus can retry.
How joiner entries are materialized
Section titled “How joiner entries are materialized”While the proxy refresh handlers above filter type: VirtualProxy only, JoinerProxy entries are materialized by a separate service (JoinerDataEntryService). Its buildJoinerStages compiles a MongoDB aggregation pipeline that is executed with a trailing $out stage (DataEntryRepository.refreshVirtualEntity appends {$out: <normalizedName>}), overwriting the joiner’s backing collection with the freshly joined rows.
The pipeline is built from the joiner’s flat sources list:
$lookupper additional source — the primary source is joined to each additional source through itsscoperelation. For a level-0 (non-array) link the lookup useslocalField/foreignField; for an array-valued link it uses alet+$exprpipeline instead.$unwindper array level — one unwind is emitted for each array level along the joined path (block-, field-, and multi-value–aware).destructTargetFieldis applied when the target field is repeatable but not when it is multi-value.- Inner vs left join — an
isMandatoryadditional source (or an additional-id filter) setspreserveNullAndEmptyArrays: false, i.e. only entries with a match on that source are kept (inner join). Otherwise it istrue, so entries are kept even without a match (left join). This is the read-side realisation of the mandatory/optional choice made when creating a joiner. - Provenance — each joined row records the source entries it was built from in
basedOn[], usingincludeArrayIndexso the generated ids are deterministic.
Like proxy entries, joiner entries are refreshed on source entity/entry changes and on saved-query updates (a joiner can be driven by a query), and removed when a source entry is permanently deleted — via bus handlers under joiner-entity/*, joiner-entries/*, and refresh-joiner-entries-on-query-updated.
How aggregator entries are materialized
Section titled “How aggregator entries are materialized”Aggregator entries are materialized the same way as joiner entries: a
dedicated service (AggregatorDataEntryService) runs its own MongoDB
aggregation pipeline — built from the aggregator’s primary and additional
sources and their field mappings — and refreshes the aggregator’s backing
collection from it, in parallel to ProxyDataEntryService for VirtualProxy
and JoinerDataEntryService for JoinerProxy.
Like a joiner’s, an aggregator’s rebuild now matches source entries in state
Active or Archived (still excluding Draft), not Active only — see
Archive/restore state propagation for
why that matters.
Archive/restore state propagation, for every virtual entity type Since 1.8
Section titled “Archive/restore state propagation, for every virtual entity type Since 1.8”Since 1.8, archiving and restoring a source entry correctly propagates its lifecycle state to projections of all three virtual entity types — Proxy, Joiner, and Aggregator — not just Proxy. This is distinct from population/materialisation (each type has its own materialisation path, as above); it is specifically about keeping an already-materialised (or joined/aggregated) row’s archived/restored state faithful to its source.
flowchart LR
A[Source entry archived] --> B{Virtual entity type}
B -->|Proxy / Aggregator| C["Projection's state, stateHistory,
isInvalid, invalidReason
mirrored from source"]
B -->|Joiner| D["Joined row updated in place
to the source's lifecycle state"]
C --> E[Source entry restored]
D --> E
E --> F["Matching projection(s) restored,
including the Obsolete / isInvalid flag"]
- Proxy and aggregator archive handling now mirrors the full lifecycle, not
just
state. Before 1.8, archiving a proxy’s or an aggregator’s source entry only flippedstate: Archivedon the projection. It now writesstate,stateHistory,isInvalid, andinvalidReasonstraight from the source entry — matching exactly what the restore path writes back — so an entry that had become obsolete before being archived, for example, carries that through correctly. - Joiner rows are updated in place instead of being deleted. Archiving a source used to hard-delete the corresponding joiner row (and its index entry), which meant a restore had nothing left to bring back. The joiner row is now updated in place to the source’s lifecycle state instead.
- A restore handler now exists for every type. Proxy, Joiner, and Aggregator projections are each restored — including the obsolete/invalid flag — when their source entry is restored.
- Rebuilds no longer drop archived rows. A joiner’s or aggregator’s rebuild (triggered by editing any field on it, not only a source remap) now matches source entries in state Active or Archived, not Active only. Before this, rebuilding a joiner or aggregator entity permanently dropped every row whose source was archived.
- A joiner row is only “live” when every one of its participating sources is. A joiner row can combine several sources. If any participating source is archived, the row’s own state is now downgraded to Archived (adopting that source’s state history) even if the primary source is still active — the first archived participant wins deterministically when more than one source qualifies.
Aggregate-entry Edit visibility follows the source workflow Since 1.8
Section titled “Aggregate-entry Edit visibility follows the source workflow Since 1.8”An aggregator entry has no workflow of its own to inspect: the aggregator
entity carries no workflows, and a projected/aggregated entry carries no
current-step metadata. The workflow that actually governs editability runs
on the source entry — which tracks with the fact that editing an
aggregate row only ever redirects to the source entry’s own edit page.
Since 1.8, the platform resolves that source workflow’s terminal state and uses it to hide the Edit action once the source workflow has completed — both for a single opened entry and per-row in list views (the admin Entity Manage list and the public view portal’s data view) — matching what the source entry’s own view/list already does.
Admin operations on virtual entities Since 1.10
Section titled “Admin operations on virtual entities Since 1.10”The entity-level admin features of 1.10 are documented once, in Data Modeling: Entities. This table records only how they treat the three virtual kinds — proxy, joiner and aggregator:
| Feature | On a virtual entity |
|---|---|
| Move to another module (single and bulk) | Supported. The move changes nothing but the module, keeps the installed-package and archive checks, and publishes the usual module-change event. Before 1.10 moving any virtual entity failed with a 500. |
| Permanent delete | Supported for all three kinds, with the same “unlink first” dependency check as any other entity. |
| Custom indexes (Indexes tab) | Not supported — a virtual entity has no collection of its own to index. The tab is not offered, index-paths answers [], and sending custom indexes is refused with ENTITY_INDEXES_NOT_SUPPORTED. For the same reason the 1.10 collated list-read indexes are not added to virtual entities. |
| Export templates | Since 1.6. Templates can be managed on a virtual entity that is not implicit (or whose implicitOptions.allowEdit is true), and are saved through the virtual-entity update. A template export includes the rows the user selected. |
Two repairs in the same release concern virtual entities that had silently stopped refreshing; both run once as upgrade migrations and need no action:
group_assignments. The pipeline behind this built-in virtual entity could produce duplicate ids for a user with two main assignments under one ancestor, which froze the materialised collection (and every grant derived from it) at its last good state. The pipeline is replaced and every virtual entity rebuilt.- Aggregator sources without field mappings. Aggregators created interactively
could store a source with no
fieldMappings, and such an aggregate was skipped by every refresh. Those sources get an empty mapping list and the aggregates are rebuilt.
Editability of virtual entries
Section titled “Editability of virtual entries”Once created, every virtual entity behaves like any other entity for reading: you can build views on it, add it as the source of a reference field, filter and search it, and use it in queries, statistics, and reports.
For writing, the three kinds differ:
- Joiner and Aggregator entries stay computed read models — to change what they show, change their source data or their configuration, not the entry itself.
- A Proxy entry can be created, edited, archived, and restored directly, exactly like an ordinary entry — when its governing view’s capability ceiling allows it (see Proxy view governance). A freshly created Proxy entity is read-only by default; an admin must explicitly turn on Create/Edit/Archive on its governing view before end users can write through it.
Version notes
Section titled “Version notes”- The proxy/aggregator source model (
VirtualProxyEntitySourceTypeEnum,scope,isMandatory,level) andProxyDataEntryServiceare foundational and Long-standing — they predate the 1.2 milestone scheme, so no milestone badge is assigned. - The
JoinerProxy(51) andVirtualAggregator(52) entity types andAggregatorEntityFieldMappingTypeare likewise Long-standing (predate 1.2). - Since 1.6 —
OptionsMapping(category option-id remapping on aggregator field mappings) was introduced. - Since 1.8 — cascade permanent-delete of proxy entries (
DeleteProxyEntryOnDataEntryPermanentlyDeleted). - Since 1.8 — archive/restore lifecycle-state propagation (
state,stateHistory,isInvalid,invalidReason) extended from Proxy alone to Joiner and Aggregator as well; see Archive/restore state propagation. - Since 1.8 — the aggregate-entry Edit action is hidden once the source workflow completes, both for a single entry and per-row in list views; see Aggregate-entry Edit visibility.
- Since 1.10 — Proxy view governance and entry write-through: the
kind: Proxyview, its restricted editor surface, capability-ceiling derivation and enforcement, binding/cycle guards, theproxyCapabilitiesentity-response field, and create/update/patch/archive/restore/batch-create write-through for Proxy entries. See Proxy view governance and Write-through. - Since 1.10 — move (single and bulk) and permanent delete work on all three virtual kinds; custom indexes are not supported; see Admin operations.
- Since 1.10 — field sync between a proxy’s cloned fields and their source; see Field sync.
- Since 1.10 — source-workflow-derived lock state on a Proxy entry; see Source-workflow lock state.
- Since 1.10 —
sourceQueryon aVirtualProxyprimary source is retired in favor of view-based scoping, surviving only as a pre-migration fallback; see Type options and Scoping.
Behaviour history
Section titled “Behaviour history”- Virtual entity creation is synchronous. Earlier versions of this
documentation described creation as emitting a
CreateVirtualDataEntityCommandover the service bus. That indirection has been retired in favour of a direct, synchronous call — there is no bus round trip on the create path.
Platform 1.10.0 · Backend 1.11.0-alpha.11 · Frontend 1.11.0-alpha.6 · Mobile 1.10.2 · Chart 1.11.8 · Gateway 2.6.11 · MCP 0.2.0 · Grafana DS 1.2.0Docs build 2026-11-27