MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / validateRuntimeNotification

Function validateRuntimeNotification

projects/runtime-protocol/src/protocol.ts:450–458  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

448}
449
450export function validateRuntimeNotification(value: unknown): RuntimeValidationResult<RuntimeNotification> {
451 if (!isRecord(value)) return validationError("$", "Runtime notification must be an object")
452 if ("id" in value) return validationError("$.id", "Runtime notification must not include an id")
453 if (typeof value.method !== "string" || value.method.length < 1) {
454 return validationError("$.method", "Runtime notification method must be a non-empty string")
455 }
456 if ("cursor" in value && typeof value.cursor !== "string") return validationError("$.cursor", "Runtime notification cursor must be a string")
457 return { ok: true, value: value as unknown as RuntimeNotification }
458}
459
460export function validateRuntimeScope(value: unknown): RuntimeValidationResult<RuntimeScope> {
461 if (!isRecord(value)) return validationError("$", "Runtime scope must be an object")

Callers 1

isRuntimeNotificationFunction · 0.85

Calls 2

validationErrorFunction · 0.85
isRecordFunction · 0.70

Tested by

no test coverage detected