{"modulePath":"github.com/newstack-cloud/bluelink/libs/plugin-framework","version":"v0.17.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package transformutils\n\n## Constants\n\n```go\nconst (\n\t// AnnotationSourceAbstractName is the annotation key set by transformer plugins\n\t// to record the original abstract resource name that a concrete resource was\n\t// expanded from.\n\tAnnotationSourceAbstractName = \"bluelink.transform.source.abstractName\"\n\n\t// AnnotationSourceAbstractType is the annotation key set by transformer plugins\n\t// to record the original abstract resource type that a concrete resource was\n\t// expanded from.\n\tAnnotationSourceAbstractType = \"bluelink.transform.source.abstractType\"\n\n\t// AnnotationResourceCategory is the annotation key set by transformer plugins\n\t// to classify a concrete resource as either \"code-hosting\" or \"infrastructure\".\n\t// Used by the code-only auto-approval mechanism.\n\tAnnotationResourceCategory = \"bluelink.transform.resourceCategory\"\n\n\t// ResourceCategoryCodeHosting indicates a resource that hosts application code\n\t// (e.g. Lambda function, ECS task, API Gateway).\n\tResourceCategoryCodeHosting = \"code-hosting\"\n\n\t// ResourceCategoryInfrastructure indicates an infrastructure dependency\n\t// (e.g. DynamoDB table, S3 bucket, IAM role, VPC).\n\tResourceCategoryInfrastructure = \"infrastructure\"\n\n\t// AnnotationResourceRole is the annotation key set by transformer plugins to\n\t// describe the part an abstract resource plays in a deployment, as opposed\n\t// to what it is made of, which is what AnnotationResourceCategory records.\n\t//\n\t// Tools presenting a deployment use it to decide where a link belongs.\n\t// Defaults to \"component\" when absent.\n\tAnnotationResourceRole = \"bluelink.transform.resourceRole\"\n\n\t// ResourceRoleComponent indicates an abstract resource that is a part of the\n\t// application being deployed, such as an API, a handler or a datastore.\n\t// Links out of it describe the application's own wiring.\n\tResourceRoleComponent = \"component\"\n\n\t// ResourceRoleAmbient indicates an abstract resource that most of a\n\t// deployment sits inside or depends on, such as a VPC. Nearly everything\n\t// links out of it, so those links describe the environment rather than the\n\t// application, and say more about the resource at the other end. Tools are\n\t// expected to attribute them to that counterpart rather than collecting\n\t// them all under the ambient resource.\n\tResourceRoleAmbient = \"ambient\"\n)\n```\n\n## Functions\n\n```go\nfunc AppEnv(transformCtx transform.Context) string\n```\nAppEnv is a helper function to read the \"appEnv\" context variable, which is commonly used to determine the deployment environment (e.g., \"dev\", \"staging\", \"prod\"). It returns an empty string if the variable is not set.\n\n```go\nfunc Field(name string) *substitutions.SubstitutionPathItem\n```\nField is sugar for a literal field-name path item:\n\n\t\u0026SubstitutionPathItem{FieldName: name}.\n\n```go\nfunc GetAnnotation(\n\tresource *schema.Resource,\n\tkey string,\n\tfallbackKey string,\n) (*core.MappingNode, bool)\n```\nGetAnnotation retrieves an annotation from a resource using the provided key and fallback key.\n\nThis is particularly useful for transformer plugins that need to extract annotations before resolution as a part of the transformation logic while retaining unresolved substitutions. \\`pluginutils\\` provides equivalent helpers targeted at provider plugins that extract annotations from resources after substitutions have been resolved.\n\nProvide an empty string for fallbackKey if you don't want to use a fallback.\n\n```go\nfunc GetBoolAnnotation(\n\tresource *schema.Resource,\n\tkey string,\n\tfallbackKey string,\n\tdefaultValue bool,\n) (bool, bool)\n```\nGetBoolAnnotation retrieves an annotation as a boolean flag, using the provided key and fallback key, falling back to defaultValue and reporting whether a boolean was found.\n\n```go\nfunc Index(index int) *substitutions.SubstitutionPathItem\n```\nIndex is sugar for a literal array-index path item:\n\n\t\u0026SubstitutionPathItem{ArrayIndex: \u0026index}.\n\n```go\nfunc IsValidationContext(transformerCtx transform.Context) bool\n```\nIsValidationContext reports whether the transformer is being invoked for validation only (no change staging, deploy, or destroy will follow).\n\nPlugin authors should call this from transform, link validation and abstract-resource validation methods to branch on best-effort behaviour when external context required for actions (e.g. build manifests) is unavailable in this mode.\n\n```go\nfunc MakeRef(\n\tnewResourceName string,\n\tpath []*substitutions.SubstitutionPathItem,\n) *substitutions.Substitution\n```\nMakeRef is a low-level constructor that builds a SubstitutionResourceProperty pointing at newResourceName with the given path. The caller assembles the path explicitly from Field / Index items and (where useful) slices of ref.Path. Used for cases that don't fit RewriteFields' 1:1 model.\n\n```go\nfunc MustUse[T any](run *Run) T\n```\nMustUse is a helper to retrieve the same value as Use but panics if no value of type T has been provided on this run.\n\n```go\nfunc PathExact(\n\tref *substitutions.SubstitutionResourceProperty,\n\tfieldPathSegments ...string,\n) bool\n```\nPathExact returns true if the ref's path matches the given field names exactly (ignoring array indices between field names).\n\n```go\nfunc PathMatches(\n\tref *substitutions.SubstitutionResourceProperty,\n\tfieldPathSegments ...string,\n) bool\n```\nPathMatches returns true if the ref's path starts with the given field path segments, ignoring array indices. Useful for prefix matching on nested structures.\n\nFor example:\n\n\tref: spec.vpc.securityGroups[0].id\n\tfieldPathSegments: \"spec\", \"vpc\", \"securityGroups\"\n\treturns: true (matches the prefix of the path, ignoring indices)\n\n```go\nfunc Provide[T any](run *Run, value T)\n```\nProvide stores a typed value on the run, keyed by Go type. This is intended to be called from OnRun, but a phase can also provide values for later phases in the same run if needed.\n\nTwo values with the same Go type collide on the same key. If a plugin needs to distinguish (e.g. two \\[]string configs), use newtype wrappers (\\`type BuildManifestPath string\\`) to disambiguate.\n\n```go\nfunc RegisterEmit[T any, PR ResolvedPtr[T]](\n\treg *TransformerRegistry,\n\ttarget Target,\n\tfn func(\n\t\tctx context.Context,\n\t\trun *Run,\n\t\tr PR,\n\t\tresPropRewriter ResourcePropertyRewriter,\n\t) (*EmitResult, error),\n)\n```\nRegisterEmit is a generic helper to register an emitter for a specific target, ensuring type safety on the resolved type.\n\nThe registry is keyed by the pointer type \\*T (PR), not the value type T, because aggregators put \\*T values into EmitPlan.Primaries — so reflect.TypeOf(primary) at emit-lookup time is the pointer type, and the registration key must match.\n\n```go\nfunc RegisterRewriter[T any, PR ResolvedPtr[T]](\n\treg *TransformerRegistry,\n\ttarget Target,\n\tfn func(r PR) []ResourcePropertyRewriter,\n)\n```\nRegisterRewriter is a generic helper to register a rewrite factory for a specific target, ensuring type safety on the resolved type. Keyed by \\*T (PR) for the same reason as RegisterEmit — primaries are pointer-typed at lookup time.\n\n```go\nfunc ResourceConfigVariable(\n\ttransformCtx transform.Context,\n\tprefix string,\n\tresourceName string,\n\tkey string,\n) (*core.ScalarValue, error)\n```\nResourceConfigVariable reads a resource-scoped or service-scoped transformer config variable, preferring the resource-scoped form.\n\nFor prefix \"aws.dynamodb\", resourceName \"ordersTable\", key \"billingMode\":\n\n 1. tries \"aws.dynamodb.ordersTable.billingMode\"\n 2. falls back to \"aws.dynamodb.billingMode\"\n 3. returns (nil, error) if neither is set; caller decides default.\n\n```go\nfunc ResourceConfigVariableMap(\n\ttransformCtx transform.Context,\n\tprefix string,\n\tresourceName string,\n\tkey string,\n) (map[string]*core.ScalarValue, error)\n```\nResourceConfigVariableMap reads a resource-scoped or service-scoped prefix-keyed sub-map of transformer config variables, preferring the resource-scoped form. Sub-keys are single-segment; entries with deeper nesting under the same prefix are ignored.\n\nFor prefix \"aws.config\", resourceName \"primaryConfig\", key \"regionKMSKeys\":\n\n 1. collects every \"aws.config.primaryConfig.regionKMSKeys.\\\u003cregion\u003e\" entry\n 2. if none, collects every \"aws.config.regionKMSKeys.\\\u003cregion\u003e\" entry\n 3. returns (nil, error) if neither has entries; caller decides default.\n\n```go\nfunc ResourceConfigVariableSeq(\n\ttransformCtx transform.Context,\n\tprefix string,\n\tresourceName string,\n\tkey string,\n) ([]map[string]*core.ScalarValue, error)\n```\nResourceConfigVariableSeq reads a resource-scoped or service-scoped indexed sub-object sequence of transformer config variables, preferring the resource-scoped form. For each contiguous numeric index starting at 0, collects every \"\\\u003cprefix\u003e.\\\u003cresourceName\u003e.\\\u003ckey\u003e.\\\u003ci\u003e.\\\u003csubkey\u003e\" into one map; sub-keys are single-segment. Stops at the first index with no sub-keys; if the sequence does not start at 0 it is treated as absent.\n\nFor prefix \"aws.sns\", resourceName \"ordersTopic\", key \"statusLogging\":\n\n 1. collects every \"aws.sns.ordersTopic.statusLogging.0.\\\u003csubkey\u003e\", \"aws.sns.ordersTopic.statusLogging.1.\\\u003csubkey\u003e\", … until a gap\n 2. if the resource form yields no entries, repeats with \"aws.sns.statusLogging.\\\u003ci\u003e.\\\u003csubkey\u003e\"\n 3. returns (nil, error) if neither yields entries; caller decides default.\n\n```go\nfunc RetargetRef(\n\tref *substitutions.SubstitutionResourceProperty,\n\tnewResourceName string,\n) *substitutions.Substitution\n```\nRetargetRef returns a SubstitutionResourceProperty identical to ref but pointing at newResourceName. The path (including array indices) is preserved. Use when only the resource name changes.\n\n```go\nfunc RewriteBlueprintRefs(\n\tblueprint *schema.Blueprint,\n\tvisitor subwalk.SubstitutionVisitor,\n) *schema.Blueprint\n```\nRewriteBlueprintRefs returns a shallow copy of blueprint with every substitution-bearing top-level section walked by visitor. Sections walked:\n\n  - Exports\\[\\*]      — every value (direct field reference, not in ${..}) and description StringOrSubstitutions\n  - Values\\[\\*]       — every value and description StringOrSubstitutions\n  - Include\\[\\*]      — path, variables, metadata, description\n  - DataSources\\[\\*]  — filter search values, metadata, description\n  - Metadata        — top-level free-form mapping\n\nSections passed through unchanged (no substitution support as per spec):\n\n  - Variables, Version\n\nResources and Transform are also passed through here; the transformer owns those separately:\n\n  - Resources: spec-level rewrites happen inline during per-resource emit, where each emitter has access to resource-specific structural transformations (memory -\u003e memorySize, etc.). The driver replaces this section wholesale with emitted output.\n  - Transform: the transformer strips its own identifier from this list.\n\nReturns a shallow copy — the input blueprint is not mutated, but pointer-shared sub-trees that weren't rewritten remain shared.\n\n```go\nfunc RewriteFields(\n\tref *substitutions.SubstitutionResourceProperty,\n\tnewResourceName string,\n\tnewFields ...string,\n) *substitutions.Substitution\n```\nRewriteFields is a declarative high-level helper to be used by transformers when rewriting references to resource properties.\n\nIt can rename fields in ref.Path one-to-one, with N-dimensional array indices auto-preserved at their original relative positions. The i-th field-name item in ref.Path becomes newFields\\[i]; index items sandwiched between fields are kept at the same relative slot (between the renamed fields they followed). Source items beyond len(newFields) field positions are appended unchanged.\n\nExamples (paths shown logically; \"\\[i]\" stands for any source array index):\n\n\t.spec.memory                  -\u003e .spec.memorySize\n\t    newFields = \"spec\", \"memorySize\"\n\t.spec.routes[i].method        -\u003e .spec.paths[i].httpMethod\n\t    newFields = \"spec\", \"paths\", \"httpMethod\"     (one-dimensional)\n\t.spec.rules[i].targets[j].arn -\u003e .spec.rules[i].destinations[j].arn\n\t    newFields = \"spec\", \"rules\", \"destinations\", \"arn\"   (two-dimensional)\n\nExtra field names beyond the original path are appended. Use MakeRef when the rewrite needs to insert or remove fields, restructure nesting depth (e.g. environmentVariables -\u003e environment.variables), or introduce literal array indices that don't exist in the source path.\n\n```go\nfunc RewriteResourcePropertyRefs(rewriter ResourcePropertyRewriter) subwalk.SubstitutionVisitor\n```\nRewriteResourcePropertyRefs builds a SubstitutionVisitor from a ResourcePropertyRewriter. Only SubstitutionResourceProperty substitutions are passed to the rewriter; all other substitution types pass through.\n\n```go\nfunc RunTransformPipeline(\n\tctx context.Context,\n\tparams *RunTransformPipelineParams,\n) (*transform.SpecTransformerTransformOutput, error)\n```\nRunTransformPipeline drives the framework's transformer pipeline for plugins that don't provide their own TransformFunc implementation.\n\n```go\nfunc TransformerBaseAnnotations(\n\tinput *TransformerBaseAnnotationsInput,\n) *schema.StringOrSubstitutionsMap\n```\nTransformerBaseAnnotations returns base annotations to be used for concrete resources generated from an abstract resource type to maintain correlation between the abstract resource in your blueprint and the concrete resources that will be deployed.\n\n```go\nfunc Use[T any](run *Run) (T, bool)\n```\nUse retrieves a typed value previously stored by Provide. Returns (zero, false) of no value of type T has been provided on this run.\n\n```go\nfunc ValueRef(\n\tvalueName string,\n\tpath ...*substitutions.SubstitutionPathItem,\n) *substitutions.Substitution\n```\nValueRef returns a SubstitutionValueReference. With no path items it is the flat form ${values.\\\u003cname\u003e}; trailing path items target a nested field or array element when the transformer-generated value is a complex object or list. Path items are built with Field / Index, identical to resource refs.\n\nExamples:\n\n\tValueRef(\"ordersHandler_lambda_arn\")\n\t    -\u003e ${values.ordersHandler_lambda_arn}\n\tValueRef(\"ordersDb_connection\", Field(\"host\"))\n\t    -\u003e ${values.ordersDb_connection.host}\n\tValueRef(\"api_endpoints\", Index(0), Field(\"url\"))\n\t    -\u003e ${values.api_endpoints[0].url}\n\n## Types\n\n```go\ntype Aggregator func(ctx context.Context, run *Run, resolved []ResolvedResource) *EmitPlan\n```\nAggregator is a function that produces an emit plan from a list of resources resolved for a particular abstract resource type.\n\n```go\ntype Capabilities struct {\n\t// SupportedAbstractPaths is the set of dot notation abstract\n\t// property paths this (target, resource-type) pair handles.\n\t// This is generated from a PropertyMap.\n\tSupportedAbstractPaths []string\n}\n```\n\n```go\nfunc CapabilitiesFromPropertyMap(pm *PropertyMap) *Capabilities\n```\nCapabilitiesFromPropertyMap derives a Capabilities struct from a property map's rename and value reference paths.\n\n```go\ntype EmitPlan struct {\n\t// Primaries are the main resolved resources that will be emitted as concrete output.\n\tPrimaries []ResolvedResource\n\t// SharedParents allow aggregates to declare concrete output resources\n\t// that don't correspond to any single abstract input.\n\t// This lets  pre-primary emits populate shared parents incrementally so\n\t// partial-fold targets (e.g. Azure Function, Cloud Run, VPC Connector)\n\t// can produce per-resource outputs and shared resource output in the same\n\t// pass without giving up the the per-primary 1:1 mapping that a full fold\n\t// implementation would otherwise require.\n\tSharedParents []SharedParent\n}\n```\nEmitPlan represents the output of the aggregation phase that is fed into the concrete output emission phase.\n\n```go\ntype EmitResult struct {\n\tResources     map[string]*schema.Resource\n\tDerivedValues map[string]*schema.Value\n\t// Mapping of shared parent key to the contributions\n\t// from all resources that share this parent.\n\tSharedParentContributions map[string]*core.MappingNode\n\tDiagnostics               []*core.Diagnostic\n}\n```\nEmitResult represents the output of the emission phase for a single resolved resource.\n\n```go\ntype Emitter func(\n\tctx context.Context,\n\trun *Run,\n\tr ResolvedResource,\n\tresPropRewriter ResourcePropertyRewriter,\n) (*EmitResult, error)\n```\nEmitter produces concrete output for one resolved primary for a specific target.\n\n```go\ntype EmitterRegistration func(registry *TransformerRegistry, t Target)\n```\nEmitterRegistration is a deferred registration closure that captures the concrete resolved type. This is necessary to allow authors to write their emitters with concrete resolved types while maintaing a valid homogenous map value type for emitter storage in registries.\n\n```go\nfunc TypedEmitter[T any, PR ResolvedPtr[T]](\n\tfn func(\n\t\tctx context.Context,\n\t\trun *Run,\n\t\tr PR,\n\t\tresPropRewriter ResourcePropertyRewriter,\n\t) (*EmitResult, error),\n) EmitterRegistration\n```\nTypedEmitter is a generic helper to produce an EmitterRegistration for a specific target, ensuring type safety on the resolved type. This is intended for use in AbstractResourceDefinition.Emitters maps.\n\n```go\ntype OnRun func(ctx context.Context, run *Run) error\n```\nOnRun runs once per RunTransformPipeline call, before any phase. A non-nil error aborts the run; no phase registered on the plugin fires when OnRun returns an error.\n\n```go\ntype PropertyMap struct {\n\t// Renames contains simple 1:1 mappings of abstract property name to concrete property name.\n\t// The key is a dotted abstract path and value consists of concrete path\n\t// segments. Array indices in the abstract path are auto-preserved at their\n\t// original positions (RewriteFields semantics).\n\tRenames map[string][]string\n\n\t// ValueRefs contains mappings of abstract refs that should redirect to\n\t// a transformer-derived value. For example, a composite abstract value\n\t// derived from multiple concrete resource properties.\n\t// The key is a dotted abstract path and values describe the value reference.\n\tValueRefs map[string]*ValueRefSpec\n\n\t// Custom contains custom rules that don't fit into the rename\n\t// or value-ref categories.\n\tCustom []*PropertyRule\n}\n```\nPropertyMap is a declarative description of how an abstract resource's substitution-referenceable properties map to a target's concrete equivalents. The majority of cases will be 1:1 renames and value-ref redirects; a small number of cases will involve structural reshapes or literal index injections.\n\n```go\nfunc (pm *PropertyMap) Rewriter(abstractName, concreteName string) ResourcePropertyRewriter\n```\nRewriter materialises the PropertyMap as a ResourcePropertyRewriter closure parameterised with the abstract ↔ concrete name pair from one resolved primary.\n\nRenames / ValueRefs key splits and Custom MatchPaths patterns are pre-compiled once per closure so per-ref dispatch is O(rules) without repeated string parsing.\n\n```go\ntype PropertyRule struct {\n\t// MatchPaths is the path-pattern set this rule handles.\n\t// Patterns may contain \"[*]\" to match an array index (e.g. \"spec.vpc.securityGroups[*].id\").\n\t// MatchPaths is the single source of truth for both runtime matching and capabilitiy extraction.\n\tMatchPaths []string\n\n\t// Predicate is an optional further filter beyond the path match.\n\t// Most rules will only need match paths and leave this as nil.\n\t// When defined, the rule applies only if the substitution's path\n\t// matches one of MatchPaths AND Predicate returns true.\n\t// Predicate-conditional matches are intentionally outside the capabilities\n\t// scope (capabilities are purely path-based); document conditional\n\t// behaviour via abstract resource or link definitions for users and your\n\t// own developer guidance for future maintainers.\n\tPredicate func(*substitutions.SubstitutionResourceProperty) bool\n\n\t// Rewrite produces the new substitution if the rule matches.\n\tRewrite func(\n\t\tref *substitutions.SubstitutionResourceProperty,\n\t\trewriteCtx RewriteContext,\n\t) *substitutions.Substitution\n}\n```\nPropertyRule describes a custom rule for rewriting a resource property reference that doesn't fit into the rename or value-ref categories. The Match function determines whether the rule applies to a given reference, and the Rewrite function produces the new substitution if it does.\n\n```go\ntype ResolvedPtr[T any] interface {\n\t*T\n\tResolvedResource\n}\n```\nResolvedPtr is a generic helper interface to ensure type safety on resolved resource types. Concrete resolved types implement ResolvedResource with pointer receivers, so the constraint is expressed via ResolvedPtr\\[T]; \"PR is \\*T and \\*T satisfies ResolvedResource\".\n\n```go\ntype ResolvedResource interface {\n\tResourceName() string\n\tResourceType() string\n}\n```\nResolvedResource is the target-agnostic output of the resolve phase that is fed into aggregation, rewriting and emission. Concrete resource types (e.g. \\*ResolvedQueue, \\*ResolvedHandler) live in their resource packages and implement this interface.\n\n```go\ntype Resolver func(\n\tctx context.Context,\n\trun *Run,\n\tname string,\n\tresource *schema.Resource,\n\tlinkGraph linktypes.DeclaredLinkGraph,\n\tblueprint *schema.Blueprint,\n) (ResolvedResource, error)\n```\nResolver is a target-agnostic resolver for a single abstract resource type. These resolvers are keyed by abstract resource type in a transformer registry and are not tied to any specific target.\n\n```go\ntype ResourcePropertyRewriter func(\n\tref *substitutions.SubstitutionResourceProperty,\n) *substitutions.Substitution\n```\nResourcePropertyRewriter is called for each SubstitutionResourceProperty found during traversal. It receives the full SubstitutionResourceProperty (resource name, property path at any depth, template index) and returns: - A replacement \\*Substitution (any variant: resource ref, value ref, etc.) - nil to keep the original unchanged\n\n```go\nfunc ChainResourcePropertyRewriters(\n\trewriters ...ResourcePropertyRewriter,\n) ResourcePropertyRewriter\n```\nChainResourcePropertyRewriters combines multiple rewriters into one. The first rewriter to return a non-nil substitution wins.\n\n```go\ntype RewriteContext struct {\n\tAbstractName string\n\tConcreteName string\n}\n```\nRewriteContext provides contextual information for custom property rewrite rules.\n\n```go\ntype RewriteFactory func(r ResolvedResource) []ResourcePropertyRewriter\n```\nRewriteFactory produces a list of rewriters from on resolved primary. Returns multiple for compound primaries (e.g. a ResolvedService folding in N handlers + M apis, contributes to N+M rewriters).\n\n```go\ntype RewriterRegistration func(registry *TransformerRegistry, t Target)\n```\nRewriterRegistration is a deferred registration closure that captures the concrete resolved type for rewriters. This is necessary to allow authors to write their rewriters with concrete resolved types while maintaing a valid homogenous map value type for rewriter storage in registries.\n\n```go\nfunc RewriterFromPropertyMap[T any, PR ResolvedPtr[T]](\n\tpm *PropertyMap,\n\tconcreteName func(r PR) string,\n) RewriterRegistration\n```\nRewriterFromPropertyMap produces a RewriterRegistration that wraps a PropertyMap in a single-rewriter factory. The concreteName function derives the concrete resource name for one resolved primary; this is the per-target piece of information that the PropertyMap itself can't carry (different targets name the same abstract resource differently — \\_sqs, \\_lambda, \\_topic, etc.).\n\nSide effect: also registers a capability-matrix entry for (target, \\*T) derived from the same PropertyMap, so pre-emit reference validation and authoring docs see the supported abstract paths without authors having to do anything else. The capability matrix and the rewriter share the same PropertyMap as a single source of truth.\n\nUse this as the typical declarative path for AbstractResourceDefinition.Rewriters when the rewriting is fully described by a PropertyMap. For compound primaries or multi-rewriter contributions, use TypedRewriter with a hand-written factory instead — capability matrix entries for those cases must be supplied via the Registry overlay.\n\n```go\nfunc TypedRewriter[T any, PR ResolvedPtr[T]](\n\tfn func(r PR) []ResourcePropertyRewriter,\n) RewriterRegistration\n```\nTypedRewriter is a generic helper to produce a RewriterRegistration for a specific target, ensuring type safety on the resolved type. This is intended for use in AbstractResourceDefinition.Rewriters maps.\n\n```go\ntype Run struct {\n\t// TransformContext is the per-run transformer context.\n\t// Phases use it for config and context variables.\n\tTransformContext transform.Context\n\t// contains filtered or unexported fields\n}\n```\nRun holds per-pipeline-call state. The framework allocates one Run per RunTransformPipeline call, threads it as an explicit \\*Run parameter to every phase, and exposes typed Provide/Use helpers for arbitrary plugin-defined run-scoped values. Run is not shared across pipeline calls; each call allocates a fresh instance, so concurrent runs are isolated from each other.\n\n```go\ntype RunTransformPipelineParams struct {\n\tInputBlueprint   *schema.Blueprint\n\tLinkGraph        linktypes.DeclaredLinkGraph\n\tTarget           Target\n\tTransformerID    string\n\tRegistry         *TransformerRegistry\n\tOnRun            OnRun\n\tTransformContext transform.Context\n}\n```\n\n```go\ntype SharedParent struct {\n\tKey          string\n\tResourceName string\n\tResourceType string\n\t// Fills the resource's metadata.custom.\n\tAnnotations *core.MappingNode\n\t// Fills the resource's metadata.annotations, the link configuration a\n\t// provider link reads. Distinct from Annotations above, which despite the\n\t// name is arbitrary custom metadata.\n\tLinkAnnotations *schema.StringOrSubstitutionsMap\n\t// Labels this parent carries, for the resources that select it.\n\tLabels *schema.StringMap\n\t// What this parent selects, for a parent that has to take part in a link\n\t// rather than only be pointed at. An intermediary queue that must activate\n\t// the link to the function it feeds is the case this exists for.\n\tLinkSelector *schema.LinkSelector\n\tSeedSpec     *core.MappingNode\n}\n```\nSharedParent represents a declared concrete output resource that doesn't correspond to a single abstract input resource.\n\n```go\ntype Target string\n```\nTarget represents a deployment target such as \"aws-serverless\" or \"azure\".\n\n```go\ntype TransformerBaseAnnotationsInput struct {\n\t// AbstractResourceName is the name of the abstract resource in the blueprint.\n\tAbstractResourceName string\n\t// AbstractResourceType is the type of the abstract resource in the blueprint.\n\tAbstractResourceType string\n\t// ResourceCategory is the category of the resource, either \"code-hosting\" or \"infrastructure\".\n\tResourceCategory string\n\t// ResourceRole is the part the abstract resource plays in a deployment,\n\t// either \"component\" or \"ambient\". Leave empty for \"component\".\n\tResourceRole string\n}\n```\n\n```go\ntype TransformerRegistry struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewTransformerRegistry() *TransformerRegistry\n```\n\n```go\nfunc (r *TransformerRegistry) AggregatorFor(target Target) (Aggregator, bool)\n```\nAggregatorFor looks up the aggregator for a given target.\n\n```go\nfunc (r *TransformerRegistry) CapabilitiesFor(\n\ttarget Target,\n\tresolvedType reflect.Type,\n) (Capabilities, bool)\n```\nCapabilitiesFor looks up the capability matrix entry for a given target and resolved resource type. Used by pre-emit reference validation (Pillar 4) and tooling that renders authoring docs.\n\n```go\nfunc (r *TransformerRegistry) EmitterFor(\n\ttarget Target,\n\tresolvedType reflect.Type,\n) (Emitter, bool)\n```\nEmitterFor looks up the emitter for a given target and resolved resource type.\n\n```go\nfunc (r *TransformerRegistry) HasAggregators() bool\n```\nHasAggregators reports whether the registry has at least one aggregator registered. Used by the framework's first-use validation to confirm that a pipeline-mode plugin has at least one aggregator across the union of TransformerPluginDefinition.Aggregators and the Registry overlay.\n\n```go\nfunc (r *TransformerRegistry) IsEmpty() bool\n```\nIsEmpty reports whether the registry holds zero registrations across all dimensions (resolvers, aggregators, emitters, rewriters, capabilities). Used by the framework to decide whether a non-nil overlay registry actually contributes anything to the pipeline-detection signal.\n\n```go\nfunc (r *TransformerRegistry) MergeFrom(other *TransformerRegistry)\n```\nMergeFrom merges every registration from other into r. Collisions on any dimension (resolver abstract type, aggregator target, (target, resolved- type) emitter / rewriter / capability) panic with a \"duplicate registration\" message — this matches the original design's \"Registry overlay collides with auto-derived registration\" contract and keeps misconfig loud rather than silently overwriting one source with another.\n\nA nil receiver panics; a nil other is a no-op.\n\n```go\nfunc (r *TransformerRegistry) RegisterAggregator(\n\ttarget Target,\n\taggregator Aggregator,\n)\n```\nRegisterAggregator registers an aggregator function for a given deployment target.\n\n```go\nfunc (r *TransformerRegistry) RegisterResolver(\n\tabstractResourceType string,\n\tresolver Resolver,\n)\n```\nRegisterResolver registers a resolver function for a given abstract resource type.\n\n```go\nfunc (r *TransformerRegistry) ResolverFor(abstractResourceType string) (Resolver, bool)\n```\nResolverFor looks up the resolver for a given abstract resource type.\n\n```go\nfunc (r *TransformerRegistry) RewriteFactoryFor(\n\ttarget Target,\n\tresolvedType reflect.Type,\n) (RewriteFactory, bool)\n```\nRewriteFactoryFor looks up the rewrite factory for a given target and resolved resource type.\n\n```go\ntype ValueRefSpec struct {\n\t// Suffix appended to the concrete resource name to form the value name.\n\t// e.g. \"_arn\" -\u003e ${values.\u003cconcreteName\u003e_arn}\n\tSuffix string\n\t// Path is for complex derived values (e.g. {url, authType} objects).\n\t// The path descends into the value. Empty path is a flat ref.\n\tPath []*substitutions.SubstitutionPathItem\n}\n```\nValueRefSpec describes how to construct a value reference for a property that doesn't have a simple 1:1 mapping to a concrete resource property.\n\n","path":"github.com/newstack-cloud/bluelink/libs/plugin-framework/sdk/transformutils","name":"transformutils","synopsis":"","isRedistributable":true}
