New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-yoga/subscription

Package Overview
Dependencies
Maintainers
0
Versions
1280
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-yoga/subscription - npm Package Compare versions

Comparing version 5.1.0-alpha-20241004071346-375af0c2 to 5.1.0-alpha-20241004073709-b5c42658

26

cjs/create-pub-sub.js

@@ -31,11 +31,21 @@ "use strict";

}
function publish(...args) {
let payload;
let topic;
if (typeof args[0] === 'string') {
payload = args[2] ?? args[1] ?? null;
topic = args[2] === undefined ? args[0] : `${args[0]}:${args[1]}`;
}
else {
const arg = args[0];
payload = arg.payload;
topic = arg.id === undefined ? arg.topic : `${arg.topic}:${arg.id}`;
}
const event = new events_1.CustomEvent(topic, {
detail: payload,
});
target.dispatchEvent(event);
}
return {
publish(routingKey, ...args) {
const payload = args[1] ?? args[0] ?? null;
const topic = args[1] === undefined ? routingKey : `${routingKey}:${args[0]}`;
const event = new events_1.CustomEvent(topic, {
detail: payload,
});
target.dispatchEvent(event);
},
publish,
subscribe,

@@ -42,0 +52,0 @@ };

@@ -28,13 +28,23 @@ import { Repeater } from '@repeaterjs/repeater';

}
function publish(...args) {
let payload;
let topic;
if (typeof args[0] === 'string') {
payload = args[2] ?? args[1] ?? null;
topic = args[2] === undefined ? args[0] : `${args[0]}:${args[1]}`;
}
else {
const arg = args[0];
payload = arg.payload;
topic = arg.id === undefined ? arg.topic : `${arg.topic}:${arg.id}`;
}
const event = new CustomEvent(topic, {
detail: payload,
});
target.dispatchEvent(event);
}
return {
publish(routingKey, ...args) {
const payload = args[1] ?? args[0] ?? null;
const topic = args[1] === undefined ? routingKey : `${routingKey}:${args[0]}`;
const event = new CustomEvent(topic, {
detail: payload,
});
target.dispatchEvent(event);
},
publish,
subscribe,
};
};
{
"name": "@graphql-yoga/subscription",
"version": "5.1.0-alpha-20241004071346-375af0c2",
"version": "5.1.0-alpha-20241004073709-b5c42658",
"description": "",

@@ -5,0 +5,0 @@ "sideEffects": true,

@@ -22,3 +22,13 @@ import type { TypedEventTarget } from '@graphql-yoga/typed-event-target';

*/
publish<TKey extends Extract<keyof TPubSubPublishArgsByKey, string>>(routingKey: TKey, ...args: TPubSubPublishArgsByKey[TKey]): void;
publish<TKey extends Extract<keyof TPubSubPublishArgsByKey, string>>(...args: [
args: {
topic: TKey;
} & (TPubSubPublishArgsByKey[TKey][1] extends undefined ? {
id?: void;
payload: TPubSubPublishArgsByKey[TKey][0];
} : {
id: TPubSubPublishArgsByKey[TKey][0];
payload: TPubSubPublishArgsByKey[TKey][1];
})
] | [routingKey: TKey, ...args: TPubSubPublishArgsByKey[TKey]]): void;
/**

@@ -25,0 +35,0 @@ * Subscribe to a topic.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc