@graphql-yoga/subscription 0.0.1-beta.0 → 0.0.2-canary-7506883.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export {};
package/index.js CHANGED
@@ -37,8 +37,13 @@ const createPubSub = (config) => {
37
37
  const target = (_a = config === null || config === void 0 ? void 0 : config.eventTarget) !== null && _a !== void 0 ? _a : new EventTarget();
38
38
  return {
39
39
  publish(routingKey, ...args) {
40
- const event = new Event(routingKey);
41
- event.data = args[0];
40
+ var _a;
41
+ const payload = (_a = args[1]) !== null && _a !== void 0 ? _a : args[0];
42
+ const topic = args[1] === undefined
43
+ ? routingKey
44
+ : `${routingKey}:${args[0]}`;
45
+ const event = new Event(topic);
46
+ event.data = payload;
42
47
  target.dispatchEvent(event);
43
48
  },
44
49
  subscribe(...[routingKey, id]) {
package/index.mjs CHANGED
@@ -34,8 +34,13 @@ const createPubSub = (config) => {
34
34
  const target = (_a = config === null || config === void 0 ? void 0 : config.eventTarget) !== null && _a !== void 0 ? _a : new EventTarget();
35
35
  return {
36
36
  publish(routingKey, ...args) {
37
- const event = new Event(routingKey);
38
- event.data = args[0];
37
+ var _a;
38
+ const payload = (_a = args[1]) !== null && _a !== void 0 ? _a : args[0];
39
+ const topic = args[1] === undefined
40
+ ? routingKey
41
+ : `${routingKey}:${args[0]}`;
42
+ const event = new Event(topic);
43
+ event.data = payload;
39
44
  target.dispatchEvent(event);
40
45
  },
41
46
  subscribe(...[routingKey, id]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-yoga/subscription",
3
- "version": "0.0.1-beta.0",
3
+ "version": "0.0.2-canary-7506883.0",
4
4
  "description": "",
5
5
  "dependencies": {
6
6
  "@repeaterjs/repeater": "^3.0.4",