Skip to content

Every package carries a dependencies.json — a serialized array of dependency edges recording, for each packaged resource, what it depends on and where in its JSON that dependency lives. The edges are not documentation: they are the machine input that drives the two hardest parts of an import. The remapping pass reads each edge’s path to know exactly which field to rewrite from a source-environment id to a target-environment id, and the topological sort reads the edge relation to decide creation order, so a resource is always written after everything it needs. A package whose resources lack matching edges still imports — but in arbitrary order, and with its cross-references left pointing at ids that do not exist in the target.

This page documents the edge format and how the import engine consumes it. The packaging overview covers the surrounding workflow and the live graph API served by dependency-service; the package format covers the archive that dependencies.json sits inside.

The graph is owned by dependency-service. It extracts edges from resource snapshots using a declarative schema per resource type, interpreted by a schema engine, plus custom extractors for the shapes a declarative rule cannot express, and rebuilds them event-driven as resources change. The node vocabulary is the ResourceType enum — eighteen values, defined. Note that this is the graph vocabulary, not the exportable set: Dashboard is a graph node but is never written to a package’s resources/ folder (see the package format).

Internally the service persists edges as flat MongoDB documents (fromType/fromId, toType/toId), which also carry a resourceVersion snapshot hash used for idempotent rebuilds. That flat shape never reaches a package. What dependencies.json contains is the nested wire DTO the service serves (docToEdge), captured at export time as the outbound closure of the exported selection: the exporter BFS-walks outgoing edges from the selected roots, and only hard edges expand the walk — soft edges are recorded but not followed.

The wire contract is the DependencyEdge interface. Two edges from a real view, one of each kind:

[
{
"from": { "type": "DataView", "id": "5f0c33…", "normalizedName": "open_tickets" },
"to": { "type": "DataEntity", "id": "a91d78…", "normalizedName": "ticket" },
"kind": "MEMBERSHIP",
"hard": true,
"path": "dataEntity",
"resolvedVia": "DIRECT_ID",
"fromActive": true,
"fromArchived": false
},
{
"from": { "type": "DataView", "id": "5f0c33…", "normalizedName": "open_tickets" },
"to": { "type": "DataCollection", "id": "c22e41…", "normalizedName": "priorities" },
"kind": "REFERENCE",
"hard": false,
"path": "dataSource.collection",
"resolvedVia": "DIRECT_ID"
}
]
FieldTypeMeaning
fromResourceRefThe resource that holds the reference — the dependent.
toResourceRefThe resource being depended on.
kindenumMEMBERSHIP or REFERENCE — see below.
hardbooleanWhether the target must exist for the source to be valid. Also blocks deletion of the target in the live graph.
pathstringJSON path in the source resource’s snapshot where the reference lives, e.g. "module" or "columns[0].entityId".
resolvedViaenumThe strategy that discovered the edge — see below.
fromActive / fromArchivedbooleanLifecycle flags of the source resource at extraction time.
metadataobjectKind-specific extra context; optional.

Both ends are ResourceRef objects: type (a ResourceType value) and id are the identity; normalizedName and the localized name are carried for display and for name-based matching at validation. Three optional flags qualify the node — isImplicit (system-managed, not exportable), isExternal (belongs to a different module than the one queried), and isService (a service-type entity). A fourth, withChildren, is only meaningful in export requests, where it asks for the ref’s MEMBERSHIP subtree to be expanded.

DependencyKind has exactly two values (enforced as the enum on the persisted document too):

  • MEMBERSHIP — the source belongs to the target: an Entity to its Module (path: "module"), a View to its Entity (path: "dataEntity", hard). Membership is what withChildren traverses when an export expands a Module or Entity into its subtree.
  • REFERENCE — a cross-reference from the source’s payload to an independent resource: a view’s dataSource.collection, a reaction’s target query, a widget’s entity id.

A hard edge is a validity requirement: the source cannot function without the target. Hard edges are the ones the export closure follows, the ones the import’s cascade-skip logic honors (skip or fail a resource and every hard dependent is cascade_skipped with it), and the ones the hard-only sorting pass keeps. A soft edge is a recorded preference: if the target has no mapping in the target space, the import nulls the value at the edge’s path rather than leaving a dangling source id — with deliberate exceptions such as dataSource.query, which is left intact so the data service can fail with a meaningful QUERY_NOT_FOUND instead of a type error.

Since dev one family of soft edges leaving the package is no longer nulled silently: a page widget’s reference to a view or other resource outside the package is declared at publish and offered to the installer as an optional mapping; only when it is left unmapped is it nulled (isMappablePageWidgetReference; see Page widgets pointing outside the package).

Hardness is declared per rule in the extraction schemas, and it gets tuned when reality disagrees: a query-type view’s dataSource.query edge is today declared hard precisely because shipping it soft produced packages that imported a view without its source query.

path is a JSON path into the source resource’s packaged snapshot, in the lodash.get/set dialect — "module", "dataSource.collection", "columns[0].entityId". It is the single piece of information that makes precise remapping possible: without it the importer would have to guess which of a payload’s string fields are ids. An edge without a path still participates in ordering and cascade-skip, but cannot drive a rewrite.

resolvedVia — how the edge was discovered

Section titled “resolvedVia — how the edge was discovered”

DependencyResolution records the extraction strategy. It is informational on import — remapping treats all strategies alike — but useful when auditing why an edge exists:

ValueStrategy
DIRECT_IDThe payload holds the target’s UUID directly at path.
NORMALIZED_NAMEThe target was resolved from a name at path rather than an id.
REFERENCE_PROPERTYThe value at path is a reference-property object ({dataEntity, dataEntry}); the edge targets the entity while the entry id is handled by the value-reference pipeline.
PIPELINE_STAGEDeclared in the enum, but no extractor currently emits it.

The aggregate node and its two edges Since 1.10

Section titled “The aggregate node and its two edges Since 1.10”

DataEntityAggregate — the resource behind an entity’s Aggregator list — is the newest node type, and the two edges added with it are the clearest worked example of the hard/soft distinction above, because the two directions were chosen for opposite reasons.

flowchart LR
  V["DataView"] -. "soft REFERENCE<br/>viewConfiguration.aggregates[i]" .-> A["DataEntityAggregate"]
  A == "hard MEMBERSHIP<br/>dataEntity" ==> E["DataEntity"]

The entity edge is hard. An aggregate belongs to exactly one entity and means nothing without it, so DataEntityAggregate.dataEntity → DataEntity is a MEMBERSHIP edge marked hard. The consequences are the ones hardness always carries: exporting an entity with its children pulls its aggregates along, and the entity cannot be deleted out from under them.

The view edge is deliberately soft. DataView.viewConfiguration.aggregates[] → DataEntityAggregate is a REFERENCE edge, and it is soft on purpose: deleting an aggregate must silently drop it from every view that had it enabled, and a hard edge would block that delete instead — the opposite of the required behaviour. The edge exists purely so that an import can remap the enabled ids onto the target space’s own aggregates. When one of those ids has no mapping, the usual soft-edge treatment applies and the id is dropped from the array, so the view shows one aggregate fewer rather than failing.

The array is what makes this edge structurally new: its elements are the target ids, a shape neither of the existing rule primitives could express — a direct-id rule returns early on an array, and array-iteration walks objects. A new DirectIdArray primitive covers it, emitting one edge per element with the usual indexed path convention (viewConfiguration.aggregates[0]).

Operator consequence, and it is easy to miss: a graph built before this change will not show aggregates at all until it is rebuilt. The graph is maintained incrementally from resource lifecycle events, and adding a rule does not retroactively rewrite edges that were already computed. Until a rebuild runs, an entity’s dependency view simply omits its aggregates and a view shows no dependency on the aggregates it displays — which looks like the feature is absent rather than stale.

The 1.10 line taught the graph about two new node types and several reaction actions. Each row changes what an export pulls in and what an import remaps; and, exactly as for the aggregate edges above, a graph built before the change shows none of them until it is rebuilt.

Edge (source path → target)KindHard?What it means
QuickFilterGroup.dataEntity → DataEntityMembershipHardA quick-filter group belongs to its entity and travels with it.
TagGroup.dataEntity → DataEntityMembershipHardLikewise for a tag group.
DataQuery.quickFilterGroup → QuickFilterGroupReferenceSoftDeleting a group just ungroups its queries.
DataQuery.tag.tagGroup → TagGroupReferenceSoftDeleting a group leaves the tag ungrouped.
CounterWidget.value.moduleId → DataModuleMembershipHardA counter widget now belongs to its module.
Reaction Execute Function: options.functionId → FunctionReferenceHardThe function the action runs.
Reaction Execute custom action: options.customActionId → DataReactionReferenceHardThe reaction it runs; reaction-service refuses a create whose id does not resolve.
Same action: options.entryToRun.relationId → DataRelation, options.entryToRun.targetEntityId → DataEntityReferenceSoftBoth optional.
Same action: options.parameters[].value → entriesReferenceSoftEntry values, under the same rules as the create/update actions.
Reaction Delete archived entry: options.relation.relationId, options.querySourceReferenceSoftThe same rules as Archive entry.
Reaction Set permission / Remove permission: options.resource.entitlementId → module, entity, view, page or reportReferenceHardTyped from the entitlement type; there is no edge for a System entitlement.
Same actions, Fixed principal: options.principal.source.value → the USER or GROUP entityReferenceSoftRemapped through the value-reference pipeline, as for User activation toggle.
Reaction Send SMS and Send WhatsApp, Fixed user or group recipient: options.recipients[].source.value → the USER or GROUP entityReferenceSoftOne rule serves both actions. Before it covered Send WhatsApp, a WhatsApp reaction’s fixed recipients left no edge and the reaction was missing from exported notifications. Remapped through the value-reference pipeline.

Two smaller corrections ride along. Field default-value and currency edges now record the full field path, so remapping rewrites exactly the field that holds the reference. And the old rule for an Update data entity reaction action is gone, because the create/update data-entity actions never ran and were removed from the product.

At execution, the importer groups the package’s edges by from.id, giving each resource its outgoing edge list, and builds an id map that pre-assigns a target id to every resource it will create — which is what allows references to be rewritten before the referenced resource physically exists. Then RemappingService.remap walks each resource’s outgoing edges:

  1. Deep-clone the payload (an override, if one was saved, has already replaced the packaged original at this point — overrides are applied before remapping).
  2. For each edge with a path: read the value at path; look up to.id in the id map; if the current value exactly equals the source id, write the mapped id back at path. A value that does not match is logged and skipped — the exact-match guard is what prevents corrupting a field that merely resembles an id.
  3. Reference-property objects get special handling: when the value at path is a {dataEntity, …} object, only its dataEntity member is remapped; the embedded entry UUID belongs to the value-reference pipeline.
  4. A soft edge whose target has no mapping has its path set to null (minus the exceptions above); the resource’s own id is remapped last.

Two scoped fallbacks then catch what the path-based pass missed: an exact-match rewrite over the ids this resource’s outgoing edges name (covering edges whose recorded array index has drifted), and the unmapped-dependency replacements the user configured. Both replace whole-string exact matches only — never substrings.

The consequences for anyone producing or transforming a package: an id you change in a payload without a matching edge stays unrewritten, and an edge whose path no longer points at the id it names is skipped, silently, by design.

index.json’s orderedResources is written topologically sorted by the exporter — but the importer does not trust it. It re-sorts on every execution, using the package’s edges, because older packages were exported unsorted (step 4e).

The sort itself is Kahn’s algorithm, run in up to three passes:

  1. All edges, hard and soft. The ideal order: even optional targets are written before their referrers, so a soft reference resolves rather than getting nulled.
  2. Hard-only fallback. If pass 1 detects a cycle (two resources soft-referencing each other), soft edges are dropped and the sort re-runs — breaking a soft cycle is safe precisely because soft references are nullable at remap time.
  3. SCC collapse. A residual hard cycle is collapsed into a strongly-connected component (Tarjan) so the cycle as a whole is still ordered before its dependents. Hard entity-to-entity cycles are then broken at execution by stubbing one member and patching the cross-cycle references in once every member exists.

The same edge relation, reversed, powers cascade skip: before any writes, the importer builds a reverse-dependency index from the edges and marks every hard dependent of a skipped or failed resource as cascade_skipped, transitively (buildReverseDeps / applyCascadeSkip).

Everything above compresses into four rules for anyone generating or transforming dependencies.json — the practical paths for doing so are on Generating a package:

  1. Every internal cross-reference needs an edge, with from, to, and the exact path of the referencing field. No edge, no rewrite, no ordering guarantee.
  2. Mark hardness truthfully. A hard edge to something absent from both package and target does not fail loudly — it cascade-skips the dependent subtree. A soft edge to something absent gets nulled.
  3. Keep path synchronized with the payload. If a transformation moves an array element, the recorded index in path must move with it; the exact-match guard will otherwise skip the rewrite without failing the import.
  4. Do not rely on orderedResources alone. The importer re-derives order from the edges; an internally consistent edge set matters more than the order you wrote the index in.

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