MCPcopy Index your code
hub / github.com/simstudioai/sim / toEffectiveStage

Function toEffectiveStage

apps/sim/lib/billing/retention.ts:47–55  ·  view source on GitHub ↗

* Expand a stored stage policy into its effective form. A stage redacts nothing * unless it is enabled AND names at least one entity type. "Redact all" is not an * expressible policy (the checkbox UI has no such control, and the contract * rejects enabled-with-no-types), so an empty entity list a

(policy: PiiStagePolicy | undefined)

Source from the content-addressed store, hash-verified

45 * consistent across the UI, the contract, and the masking layer.
46 */
47function toEffectiveStage(policy: PiiStagePolicy | undefined): EffectivePiiStage {
48 const types = sanitizeEntityTypes(policy?.entityTypes)
49 if (!policy?.enabled || types.length === 0) return DISABLED_STAGE
50 return {
51 enabled: true,
52 entityTypes: types,
53 language: coercePiiLanguage(policy.language) ?? DEFAULT_PII_LANGUAGE,
54 }
55}
56
57/**
58 * Resolve the effective per-stage PII redaction policy for a workspace from the

Callers 1

Calls 2

coercePiiLanguageFunction · 0.90
sanitizeEntityTypesFunction · 0.85

Tested by

no test coverage detected