Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventGridDeserializer

Package version

EventGridDeserializer is used to aid in processing events delivered by EventGrid. It can deserialize a JSON encoded payload of either a single event or batch of events as well as be used to convert the result of JSON.parse into an EventGridEvent or CloudEvent like object.

Unlike normal JSON deseralization, EventGridDeserializer does some additional conversions:

  • The consumer parses the event time property into a Date object, for ease of use.
  • When deserializing an event in the CloudEvent schema, if the event contains binary data, it is base64 decoded and returned as an instance of the Uint8Array type.

Hierarchy

  • EventGridDeserializer

Index

Methods

deserializeCloudEvents

  • deserializeCloudEvents(encodedEvents: string): Promise<CloudEvent<unknown>[]>
  • deserializeCloudEvents(encodedEvents: Record<string, unknown>): Promise<CloudEvent<unknown>[]>
  • Deserializes events encoded in the Cloud Events 1.0 schema.

    Parameters

    • encodedEvents: string

      the JSON encoded representation of either a single event or an array of events, encoded in the Cloud Events 1.0 Schema.

    Returns Promise<CloudEvent<unknown>[]>

  • Deserializes events encoded in the Cloud Events 1.0 schema.

    Parameters

    • encodedEvents: Record<string, unknown>

      an object representing a single event, encoded in the Cloud Events 1.0 schema.

    Returns Promise<CloudEvent<unknown>[]>

deserializeEventGridEvents

  • deserializeEventGridEvents(encodedEvents: string): Promise<EventGridEvent<unknown>[]>
  • deserializeEventGridEvents(encodedEvents: Record<string, unknown>): Promise<EventGridEvent<unknown>[]>
  • Deserializes events encoded in the Event Grid schema.

    Parameters

    • encodedEvents: string

      the JSON encoded representation of either a single event or an array of events, encoded in the Event Grid Schema.

    Returns Promise<EventGridEvent<unknown>[]>

  • Deserializes events encoded in the Event Grid schema.

    Parameters

    • encodedEvents: Record<string, unknown>

      an object representing a single event, encoded in the Event Grid schema.

    Returns Promise<EventGridEvent<unknown>[]>

Generated using TypeDoc