MCPcopy Create free account
hub / github.com/arktypeio/arktype / UnreadArkIssues

Class UnreadArkIssues

ark/schema/shared/issues.ts:350–440  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348 findsOnRead ?
349 // named apart, as one bundle may hold both and a name is one class's
350 class UnreadArkIssues
351 implements StandardSchemaV1.FailureResult, FailureContext
352 {
353 declare _p: PropertyKey[]
354 declare _a: CompactApply | undefined
355 declare _d: unknown
356 declare _f: ArkIssue[] | undefined
357
358 constructor(data?: unknown, config?: unknown, apply?: CompactApply) {
359 this._p = []
360 this._a = apply
361 this._d = data
362 }
363
364 get _(): ArkIssue[] {
365 if (!this._f) {
366 this._f = []
367 if (this._a && (this._a(this._d, this), !this._f.length))
368 this._e(this._d, "predicate", "valid", "is invalid")
369 }
370 return this._f
371 }
372
373 get count(): number {
374 return this._.length
375 }
376
377 get issues(): readonly WrittenIssue[] {
378 return serializableIssues(this._)
379 }
380
381 _e(
382 data: unknown,
383 code: ArkErrorCode,
384 expected?: string,
385 message?: string,
386 text?: SiteContext["text"]
387 ): true | undefined {
388 this._.push({ code, path: this._p.slice(), data, expected, message })
389 if (callsSiteText) text?.(this._[this._.length - 1])
390 return undefined
391 }
392
393 _k(
394 apply: CompactApply,
395 data: unknown,
396 key: PropertyKey,
397 ...missing: MissingText
398 ): boolean | undefined {
399 this._p.push(key)
400 const stops =
401 missing.length && !(key in (data as object)) ?
402 this._e(data, "required", ...missing)
403 : !apply((data as Keyed)[key], this)
404 this._p.pop()
405 return stops
406 }
407

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected