MCPcopy Create free account
hub / github.com/callstack/agent-device / assertAllowedKeys

Function assertAllowedKeys

src/commands/command-input.ts:509–519  ·  view source on GitHub ↗
(
  record: Record<string, unknown>,
  allowedKeys: readonly string[],
  label: string,
)

Source from the content-addressed store, hash-verified

507}
508
509export function assertAllowedKeys(
510 record: Record<string, unknown>,
511 allowedKeys: readonly string[],
512 label: string,
513): void {
514 const allowed = new Set(allowedKeys);
515 const unknownKeys = Object.keys(record).filter((key) => !allowed.has(key));
516 if (unknownKeys.length > 0) {
517 throw new Error(`${label} has unknown field(s): ${unknownKeys.join(', ')}.`);
518 }
519}
520
521export function compactRecord(record: Record<string, unknown>): Record<string, unknown> {
522 return Object.fromEntries(Object.entries(record).filter(([, value]) => value !== undefined));

Callers 1

readBatchStepFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…