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

Function validateJsonObjectPayload

src/commands/management/runtime/apps.ts:330–340  ·  view source on GitHub ↗
(
  payload: Record<string, unknown>,
  field: string,
  maxBytes: number,
)

Source from the content-addressed store, hash-verified

328}
329
330function validateJsonObjectPayload(
331 payload: Record<string, unknown>,
332 field: string,
333 maxBytes: number,
334): void {
335 assertJsonObject(payload, field);
336 const payloadBytes = Buffer.byteLength(stringifyJsonObject(payload, field), 'utf8');
337 if (payloadBytes > maxBytes) {
338 throw new AppError('INVALID_ARGS', `${field} exceeds ${maxBytes} bytes`);
339 }
340}
341
342function assertJsonObject(payload: Record<string, unknown>, field: string): void {
343 if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {

Callers 2

resolvePushInputFunction · 0.85
assertPayloadFunction · 0.85

Calls 2

assertJsonObjectFunction · 0.85
stringifyJsonObjectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…