Skip to content

file-derivatives

Declares the derivativeRenderer extension point. ctx.derivatives.variant(fileRefId, spec, name) derives a variant of a tracked FileRef the first time it’s requested and reuses the stored result afterwards (derive-on-first-use, keyed by a hash of the spec). Mount at least one derivatives-* renderer feature alongside this one — without a registered renderer for the FileRef’s MIME type, every variant(...) call throws. Also declares the derivativePublicPredicate extension point (r.useExtension(EXT_DERIVATIVE_PUBLIC_PREDICATE, '<entityType>', { isPublic })) and, when createFileDerivativesFeature({resolveApexTenant}) is passed a host-resolver, mounts an anonymous GET {basePath}/:fileRefId/:variant route that serves any variant name the FileRef’s field declared in its variants for a FileRef whose entityType has a registered predicate returning true — default-deny (404) otherwise, same as an unknown FileRef or an undeclared variant name. The route’s only rate-limit (per: "ip") trusts the first x-forwarded-for hop — deployers must ensure their ingress overwrites rather than appends to that header, or the throttle is bypassable by rotating it.

What this feature needs to run (Requires).

flowchart TB
  n_file_derivatives["file-derivatives"]
  subgraph how_reqs["Requires"]
    n_file_foundation["file-foundation"]
    n_files["files"]
  end
  n_file_foundation --> n_file_derivatives
  n_files --> n_file_derivatives