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

Function assertOptionalExactKeys

packages/runtime-host/src/protocol/usage-pricing.ts:1131–1139  ·  view source on GitHub ↗
(
  record: Record<string, unknown>,
  label: string,
  required: readonly string[],
  optional: readonly string[],
)

Source from the content-addressed store, hash-verified

1129}
1130
1131function assertOptionalExactKeys(
1132 record: Record<string, unknown>,
1133 label: string,
1134 required: readonly string[],
1135 optional: readonly string[],
1136): void {
1137 requireFields(record, required);
1138 assertAllowedKeys(record, new Set([...required, ...optional]), label);
1139}
1140
1141function assertJsonBytes(value: unknown, maxBytes: number, label: string): void {
1142 if (Buffer.byteLength(JSON.stringify(value), 'utf8') > maxBytes) {

Callers 1

decodeUsageQueryInputFunction · 0.70

Calls 2

requireFieldsFunction · 0.85
assertAllowedKeysFunction · 0.70

Tested by

no test coverage detected