compose static method

Iterable<GovernanceEntry<Governance, dynamic>> compose(
  1. GovernanceEntry<Governance, dynamic>? resolver(
    1. Provenance dimension
    )
)

Generates a comprehensive Signal Manifest by synthesising a value for every defined dimension in the Provenance ontology.

This method serves as the primary factory for creating the initial Static Blueprint of a signal's metadata. It iterates through all available provenance keys—both Static Pillars and Fluid Boundaries— to build a complete semantic profile for a Pulse.

When to use

  • You don't call this directly. It's an internal utility used by the PulseContext factories (like userAction, regulated, aiInference) to build the initial context. Your day‑to‑day interaction with Provenance is through PulseContext and its factories.
  • Only if you're building a custom context factory that needs to generate a full manifest from scratch. For most code, the existing PulseContext factories are sufficient.

How it works

  • The method iterates over every Provenance enum value.
  • For each, it calls your resolver function.
  • If the resolver returns a GovernanceEntry, it's included in the result.
  • If the resolver returns null, that dimension is omitted.
  • The result is an iterable of entries that can be used to build a PulseContext via PulseContext.fromEntries().

Example

// Internal use – building a user action context
final entries = Provenance.compose((dimension) {
  switch (dimension) {
    case Provenance.actor: return Provenance.actor.entry('admin_01');
    case Provenance.reason: return Provenance.reason.entry('Manual override');
    case Provenance.priority: return Provenance.priority.entry(80);
    default: return null; // Omit other dimensions
  }
});
final context = PulseContext.fromEntries(entries);

Parameters:

Returns:

An Iterable<GovernanceEntry> containing a synthesised entry for every applicable provenance dimension.

Implementation

static Iterable<GovernanceEntry> compose(
    GovernanceEntry? Function(Provenance dimension) resolver) {
  final entries = values.map((g) => resolver(g)).where((en) => en != null);
  return entries.cast();
}