Detalhes do pacote

@sanity/message-protocol

sanity-io391.7kMIT0.15.0

Message protocols for the Sanity platform

readme (leia-me)

@sanity/message-protocol

This library provides messaging protocols for communication between the Sanity Dashboard platform and embedded applications using @sanity/comlink.

Example

import {createNode} from '@sanity/comlink'
import {
  SDK_CHANNEL_NAME,
  SDK_NODE_NAME,
  type FrameMessages,
  type WindowMessages,
} from '@sanity/message-protocol'

const node = createNode<FrameMessages, WindowMessages>({
  name: SDK_NODE_NAME,
  connectTo: SDK_CHANNEL_NAME,
})

node.post('dashboard/v1/events/favorite', {
  eventType: 'added',
  document: {
    id: '123',
    type: 'movie',
  },
})