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

Function snapshotSchema

packages/effect/src/ui/Query.ts:3529–3550  ·  view source on GitHub ↗
(
  query: { readonly [TypeId]: unknown },
  label: string,
  log = false
)

Source from the content-addressed store, hash-verified

3527 * @internal
3528 */
3529export const snapshotSchema = (
3530 query: { readonly [TypeId]: unknown },
3531 label: string,
3532 log = false
3533): Schema.Top => {
3534 const def = defOf(query)
3535 return Schema.make(
3536 new SchemaAST.Declaration(
3537 [def.args.ast, def.success.ast, def.error.ast],
3538 snapshotRun(def, label, true),
3539 {
3540 expected: "a query result " + quote(label) + " of " + quote(def.name),
3541 toCodecJson: snapshotJson(def, label, log)
3542 } as Schema.Annotations.Annotations,
3543 undefined,
3544 undefined,
3545 undefined,
3546 undefined,
3547 snapshotRun(def, label, false)
3548 )
3549 )
3550}
3551
3552const isSnapshotOf = (def: QueryDef, label: string) => (u: unknown): u is SnapshotImpl =>
3553 u instanceof SnapshotImpl && u[SnapshotTypeId].def.name === def.name &&

Callers

nothing calls this directly

Calls 5

defOfFunction · 0.85
snapshotRunFunction · 0.85
snapshotJsonFunction · 0.85
quoteFunction · 0.70
makeMethod · 0.65

Tested by

no test coverage detected