MCPcopy Create free account
hub / github.com/Effect-TS/effect / RedactedFromValue

Function RedactedFromValue

packages/effect/src/Schema.ts:10222–10241  ·  view source on GitHub ↗
(value: S, options?: {
  readonly label?: string | undefined
  readonly disallowEncode?: boolean | undefined
})

Source from the content-addressed store, hash-verified

10220 * @since 4.0.0
10221 */
10222export function RedactedFromValue<S extends Constraint>(value: S, options?: {
10223 readonly label?: string | undefined
10224 readonly disallowEncode?: boolean | undefined
10225}): RedactedFromValue<S> {
10226 return decodeTo<Redacted<toType<S>>, S>(
10227 Redacted(toType(value), {
10228 label: options?.label,
10229 disallowJsonEncode: options?.disallowEncode
10230 }),
10231 {
10232 decode: SchemaGetter.transform((t) => Redacted_.make(t, { label: options?.label })),
10233 encode: options?.disallowEncode ?
10234 SchemaGetter.forbidden((oe) =>
10235 "Cannot encode Redacted" +
10236 (Option_.isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")
10237 ) :
10238 SchemaGetter.transform(Redacted_.value)
10239 }
10240 )(value)
10241}
10242
10243/**
10244 * Type-level representation returned by {@link CauseReason}.

Callers

nothing calls this directly

Calls 5

toTypeInterface · 0.85
decodeToFunction · 0.70
RedactedFunction · 0.70
transformMethod · 0.65
makeMethod · 0.65

Tested by

no test coverage detected