🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@sanity/comlink

Package Overview
Dependencies
Maintainers
64
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/comlink - npm Package Compare versions

Comparing version

to
2.0.1

7

CHANGELOG.md
# Changelog
## [2.0.1](https://github.com/sanity-io/visual-editing/compare/comlink-v2.0.0...comlink-v2.0.1) (2024-12-05)
### Bug Fixes
* **comlink:** require data param if defined on post and fetch methods ([#2262](https://github.com/sanity-io/visual-editing/issues/2262)) ([d2491ad](https://github.com/sanity-io/visual-editing/commit/d2491ad3b7cb373936b9f77273773c7ce330a7f8))
## [2.0.0](https://github.com/sanity-io/visual-editing/compare/comlink-v1.1.4...comlink-v2.0.0) (2024-11-28)

@@ -4,0 +11,0 @@

3

dist/index.js

@@ -600,3 +600,4 @@ import { v4 } from "uuid";

}
const post = (type, data) => {
const post = (...params) => {
const [type, data] = params;
connections.forEach((connection) => {

@@ -603,0 +604,0 @@ connection.post(type, data);

{
"name": "@sanity/comlink",
"version": "2.0.1-release.3",
"version": "2.0.1",
"keywords": [

@@ -5,0 +5,0 @@ "sanity.io",

@@ -65,3 +65,5 @@ import {v4 as uuid} from 'uuid'

onStatus: (handler: (status: Status) => void) => () => void
post: <T extends S['type'], U extends Extract<S, {type: T}>>(type: T, data?: U['data']) => void
post: <T extends S['type'], U extends Extract<S, {type: T}>>(
...params: (U['data'] extends undefined ? [T] : never) | [T, U['data']]
) => void
setTarget: (target: MessageEventSource) => void

@@ -514,3 +516,6 @@ start: () => () => void

const post = <T extends S['type'], U extends Extract<S, {type: T}>>(type: T, data: U['data']) => {
const post = <T extends S['type'], U extends Extract<S, {type: T}>>(
type: T,
data?: U['data'],
) => {
const _data = {type, data} as WithoutResponse<U>

@@ -517,0 +522,0 @@ actor.send({type: 'post', data: _data})

@@ -32,3 +32,5 @@ import {

onStatus: (handler: (event: StatusEvent) => void) => void
post: <T extends S['type'], U extends Extract<S, {type: T}>>(type: T, data?: U['data']) => void
post: <T extends S['type'], U extends Extract<S, {type: T}>>(
...params: (U['data'] extends undefined ? [T] : never) | [T, U['data']]
) => void
start: () => () => void

@@ -202,3 +204,4 @@ stop: () => void

const post: ChannelInstance<S, R>['post'] = (type, data) => {
const post: ChannelInstance<S, R>['post'] = (...params) => {
const [type, data] = params
connections.forEach((connection) => {

@@ -205,0 +208,0 @@ connection.post(type, data)

@@ -65,5 +65,6 @@ import {v4 as uuid} from 'uuid'

fetch: <T extends S['type'], U extends Extract<S, {type: T}>>(
type: T,
data?: U['data'],
options?: {signal?: AbortSignal; suppressWarnings?: boolean},
...params:
| (U['data'] extends undefined ? [T] : never)
| [T, U['data']]
| [T, U['data'], {signal?: AbortSignal; suppressWarnings?: boolean}]
) => S extends U ? (S['type'] extends T ? Promise<S['response']> : never) : never

@@ -76,3 +77,5 @@ machine: NodeActorLogic<S, R>

onStatus: (handler: (status: Status) => void) => () => void
post: <T extends S['type'], U extends Extract<S, {type: T}>>(type: T, data?: U['data']) => void
post: <T extends S['type'], U extends Extract<S, {type: T}>>(
...params: (U['data'] extends undefined ? [T] : never) | [T, U['data']]
) => void
start: () => () => void

@@ -521,3 +524,6 @@ stop: () => void

const post = <T extends S['type'], U extends Extract<S, {type: T}>>(type: T, data: U['data']) => {
const post = <T extends S['type'], U extends Extract<S, {type: T}>>(
type: T,
data?: U['data'],
) => {
const _data = {type, data} as WithoutResponse<U>

@@ -529,3 +535,3 @@ actor.send({type: 'post', data: _data})

type: T,
data: U['data'],
data?: U['data'],
options?: {

@@ -532,0 +538,0 @@ responseTimeout?: number

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet