MCPcopy Create free account
hub / github.com/apache/maka / requireString

Function requireString

packages/runtime-host/src/protocol/codec.ts:51–56  ·  view source on GitHub ↗
(value: unknown, label: string, maxLength: number)

Source from the content-addressed store, hash-verified

49}
50
51export function requireString(value: unknown, label: string, maxLength: number): string {
52 if (typeof value !== 'string' || value.length === 0 || value.length > maxLength) {
53 throw invalidProtocolFrame(`Invalid ${label}`);
54 }
55 return value;
56}
57
58export function requireId(value: unknown, label: string): string {
59 return requireString(value, label, 128);

Callers 15

requireIdFunction · 0.70
decodeMessageContentFunction · 0.70
decodeTurnSnapshotFunction · 0.70
quotaWindowFunction · 0.70
decodeHostRegistrationFunction · 0.70
requireHostCompositionIdFunction · 0.70
requireHostRootIdFunction · 0.70
operationGrantsFunction · 0.70

Calls 1

invalidProtocolFrameFunction · 0.85

Tested by

no test coverage detected