import type { components } from "../generated/api-types"; /** * A derivation rule: a transformation that produces one attribute's value from * another's, applied when a query resolves the target attribute. * * `warnings` is populated on create and update responses and empty on reads — * list and get do not compute them. `fidelity_note` arrives as an explicit * `null` when the rule has no note rather than being omitted. */ export type Derivation = components["schemas"]["DerivationResponse"]; /** The list endpoint's envelope. */ export type DerivationsResponse = components["schemas"]["DerivationsResponse"]; /** * Which companies besides the owner may have a rule applied to their data. A * rule grants a single thing, so there is one `use` dimension. Only Narrative * can share a rule with `all` companies or with everyone outside an * `exclusion` set. */ export type DerivationCollaborators = components["schemas"]["DerivationCollaborators"]; /** * The transformation itself. Expressions reach the source attribute's shape * through `$source` — a rule from `raw_email` to `sha256_hashed_email` maps * `value` to `SHA2(NORMALIZE_EMAIL($source.value), 256)`. * * Same shape as a dataset mapping except that `cached_mapping` is not allowed: * a cached mapping reads out of a stored dataset, so there would be nothing to * substitute `$source` into. */ export type DerivationMapping = components["schemas"]["DerivationMapping"]; /** * Something worth knowing that did not stop the rule from being written. The * only kind today is `cyclic_derivation`, which lists the attribute ids on the * cycle the rule closes. */ export type DerivationWarning = components["schemas"]["DerivationWarning"]; /** Breaks ties when several rules reach the same target attribute — cheapest wins. */ export type DerivationCost = components["schemas"]["DerivationCost"]; /** Body of `POST /derivations`. */ export type DerivationCreateRequest = components["schemas"]["DerivationCreateRequest"]; /** * Body of `PATCH /derivations/{id}`. Only the keys present change. Sending * `fidelity_note: null` clears it; leaving the key out keeps it. A rule's * source and target attributes are immutable — create a new rule instead. */ export type DerivationUpdateRequest = components["schemas"]["DerivationUpdateRequest"]; /** * Filters for the list endpoint. Both accept several ids, which the client * repeats in the query string (`?source_attribute_id=1&source_attribute_id=2`) * — the form the route's multi-value matcher reads. */ export interface ListDerivationsParams { /** Only return rules reading from these attributes. */ source_attribute_id?: number[]; /** Only return rules producing these attributes. */ target_attribute_id?: number[]; }