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

Function ReadonlyMap

packages/effect-app/src/Schema/ext.ts:369–393  ·  view source on GitHub ↗
(pair: {
  readonly key: KeySchema
  readonly value: ValueSchema
})

Source from the content-addressed store, hash-verified

367 * data:** a missing field may be data corruption, not an old-shape
368 * document; silently substituting an empty map hides the problem.
369 * Prefer an explicit, preferably versioned migration over a
370 * decode-time fallback. See file-level note.
371 */
372 withDecodingDefaultType: s.pipe(S.withDecodingDefaultType(Effect.sync(() => new Map())))
373 })
374 )
375
376/** Like the default Schema `NullOr` but with default helpers. */
377export const NullOr = <Schema extends S.Top>(self: Schema) =>
378 pipe(
379 S.NullOr(self),
380 (s) =>
381 Object.assign(s, {
382 /**
383 * Construction-only default `null`. Applied only when the field is
384 * omitted from `.make(...)` input. NOT applied during decode —
385 * cannot be used to JIT-migrate database fields. See file-level
386 * note.
387 */
388 withConstructorDefault: s.pipe(S.withConstructorDefault(Effect.succeed(null))),
389 /**
390 * Decode-time default `null`. **Discouraged for persisted data:** a
391 * missing field may be data corruption, not an old-shape document;
392 * silently substituting `null` hides the problem. Prefer an
393 * explicit, preferably versioned migration over a decode-time
394 * fallback. See file-level note.
395 */
396 withDecodingDefaultType: s.pipe(S.withDecodingDefaultType(Effect.succeed(null)))

Callers

nothing calls this directly

Calls 4

ReadonlyMapFromArrayFunction · 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…