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
2
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 0.2.0-canary-2a0ce5e.0 to 0.2.0-canary-33f4891.0

operator/filter.spec.d.ts

15

createPubSub.d.ts

@@ -28,9 +28,16 @@ import { Repeater } from '@repeaterjs/repeater';

};
export declare type PubSub<TPubSubPublishArgsByKey extends PubSubPublishArgsByKey> = {
/**
* Publish a value for a given topic.
*/
publish<TKey extends Extract<keyof TPubSubPublishArgsByKey, string>>(routingKey: TKey, ...args: TPubSubPublishArgsByKey[TKey]): void;
/**
* Subscribe to a topic.
*/
subscribe<TKey extends Extract<keyof TPubSubPublishArgsByKey, string>>(...[routingKey, id]: TPubSubPublishArgsByKey[TKey][1] extends undefined ? [TKey] : [TKey, TPubSubPublishArgsByKey[TKey][0]]): Repeater<TPubSubPublishArgsByKey[TKey][1] extends undefined ? TPubSubPublishArgsByKey[TKey][0] : TPubSubPublishArgsByKey[TKey][1]>;
};
/**
* Utility for publishing and subscribing to events.
*/
export declare const createPubSub: <TPubSubPublishArgsByKey extends PubSubPublishArgsByKey>(config?: ChannelPubSubConfig<TPubSubPublishArgsByKey> | undefined) => {
publish<TKey extends Extract<keyof TPubSubPublishArgsByKey, string>>(routingKey: TKey, ...args: TPubSubPublishArgsByKey[TKey]): void;
subscribe<TKey_1 extends Extract<keyof TPubSubPublishArgsByKey, string>>(...[routingKey, id]: TPubSubPublishArgsByKey[TKey_1][1] extends undefined ? [TKey_1] : [TKey_1, TPubSubPublishArgsByKey[TKey_1][0]]): Repeater<TPubSubPublishArgsByKey[TKey_1][1] extends undefined ? TPubSubPublishArgsByKey[TKey_1][0] : TPubSubPublishArgsByKey[TKey_1][1], any, unknown>;
};
export declare const createPubSub: <TPubSubPublishArgsByKey extends PubSubPublishArgsByKey>(config?: ChannelPubSubConfig<TPubSubPublishArgsByKey> | undefined) => PubSub<TPubSubPublishArgsByKey>;
export {};
export { Repeater } from '@repeaterjs/repeater';
export { createPubSub } from './createPubSub';
export { createPubSub, PubSub } from './createPubSub';
export type { PubSubEventTarget, PubSubEvent } from './createPubSub';

@@ -4,0 +4,0 @@ export { map } from './operator/map';

@@ -63,8 +63,12 @@ 'use strict';

const map = (mapper) => (source) => new repeater.Repeater(async (push, stop) => {
const iterable = source[Symbol.asyncIterator]();
stop.then(() => {
source.return();
var _a;
(_a = iterable.return) === null || _a === void 0 ? void 0 : _a.call(iterable);
});
for await (const value of source) {
push(await mapper(value));
let latest;
while ((latest = await iterable.next()).done === false) {
await push(await mapper(latest.value));
}
stop();
});

@@ -74,10 +78,14 @@

return (source) => new repeater.Repeater(async (push, stop) => {
const iterable = source[Symbol.asyncIterator]();
stop.then(() => {
source.return();
var _a;
(_a = iterable.return) === null || _a === void 0 ? void 0 : _a.call(iterable);
});
for await (const value of source) {
if (filter(value)) {
push(value);
let latest;
while ((latest = await iterable.next()).done === false) {
if (filter(latest.value)) {
await push(latest.value);
}
}
stop();
});

@@ -84,0 +92,0 @@ }

@@ -5,3 +5,3 @@ import { Repeater } from '@repeaterjs/repeater';

*/
export declare function filter<T, U extends T>(filter: (input: T) => input is U): (source: Repeater<T>) => Repeater<U, void, unknown>;
export declare function filter<T>(filter: (input: T) => boolean): (source: Repeater<T>) => Repeater<T, void, unknown>;
export declare function filter<T, U extends T>(filter: (input: T) => input is U): (source: AsyncIterable<T>) => Repeater<U, void, unknown>;
export declare function filter<T>(filter: (input: T) => boolean): (source: AsyncIterable<T>) => Repeater<T, void, unknown>;

@@ -5,2 +5,2 @@ import { Repeater } from '@repeaterjs/repeater';

*/
export declare const map: <T, O>(mapper: (input: T) => O | Promise<O>) => (source: Repeater<T, any, unknown>) => Repeater<O, any, unknown>;
export declare const map: <T, O>(mapper: (input: T) => O | Promise<O>) => (source: AsyncIterable<T>) => Repeater<O, any, unknown>;
{
"name": "@graphql-yoga/subscription",
"version": "0.2.0-canary-2a0ce5e.0",
"version": "0.2.0-canary-33f4891.0",
"description": "",
"dependencies": {
"@repeaterjs/repeater": "^3.0.4"
"@repeaterjs/repeater": "^3.0.4",
"tslib": "^2.3.1"
},

@@ -35,4 +36,5 @@ "repository": {

"import": "./*.mjs"
}
},
"./package.json": "./package.json"
}
}

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