MCPcopy Create free account
hub / github.com/effect-app/libs / ReadonlySet

Function ReadonlySet

packages/effect-app/src/Schema/ext.ts:341–366  ·  view source on GitHub ↗
(value: ValueSchema)

Source from the content-addressed store, hash-verified

339
340/** Like the default Schema `ReadonlySet` but from Array, with default helpers. */
341export const ReadonlySet = <ValueSchema extends S.Top>(value: ValueSchema) =>
342 pipe(
343 ReadonlySetFromArray(value),
344 (s) =>
345 Object.assign(s, {
346 /**
347 * Construction-only default `new Set()`. Applied only when the field
348 * is omitted from `.make(...)` input. NOT applied during decode —
349 * cannot be used to JIT-migrate database fields. See file-level
350 * note.
351 */
352 withConstructorDefault: s.pipe(
353 S.withConstructorDefault(Effect.sync(() => new Set<ValueSchema["Type"]>()))
354 ),
355 /**
356 * Decode-time default `new Set()`. **Discouraged for persisted
357 * data:** a missing field may be data corruption, not an old-shape
358 * document; silently substituting an empty set hides the problem.
359 * Prefer an explicit, preferably versioned migration over a
360 * decode-time fallback. See file-level note.
361 */
362 withDecodingDefaultType: s.pipe(
363 S.withDecodingDefaultType(Effect.sync(() => new Set<ValueSchema["Type"]>()))
364 )
365 })
366 )
367
368/** Like the default Schema `ReadonlyMap` but from Array, with default helpers. */
369export const ReadonlyMap = <KeySchema extends S.Top, ValueSchema extends S.Top>(pair: {

Callers

nothing calls this directly

Calls 4

ReadonlySetFromArrayFunction · 0.85
syncMethod · 0.80
pipeMethod · 0.65
pipeFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…