graphql-pg-subscriptions 3.0.5 → 3.1.2

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [2022] [graphql-pg-subscriptions]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # graphql-pg-subscriptions
2
+
3
+ A graphql subscriptions implementation using postgres and apollo's graphql-subscriptions.
4
+
5
+ This package implements the PubSubEngine Interface from the graphql-subscriptions package and also the new AsyncIterator interface. It allows you to connect your subscriptions manger to a postgres based Pub Sub mechanism to support multiple subscription manager instances.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm i graphql-pg-subscriptions
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ First of all, follow the instructions in [graphql-subscriptions](https://github.com/apollographql/graphql-subscriptions) to add subscriptions to your app.
16
+
17
+ Afterwards replace `PubSub` with `PostgresPubSub`:
18
+
19
+ ```js
20
+ // Before
21
+ import { PubSub } from "graphql-subscriptions";
22
+
23
+ export const pubsub = new PubSub();
24
+ ```
25
+
26
+ ```js
27
+ // After
28
+ import { PostgresPubSub } from "graphql-pg-subscriptions";
29
+
30
+ export const pubsub = new PostgresPubSub();
31
+ ```
32
+
33
+ This library uses [`node-postgres`](https://github.com/brianc/node-postgres) to connect to PostgreSQL. If you want to customize connection options, please refer to their [connection docs](https://node-postgres.com/features/connecting).
34
+
35
+ ```js
36
+ import { PostgresPubSub } from "graphql-postgres-subscriptions";
37
+ import { Client } from "pg";
38
+
39
+ const client = new Client({
40
+ user: 'dbuser',
41
+ host: 'database.server.com',
42
+ database: 'mydb',
43
+ password: 'secretpassword',
44
+ port: 3211,
45
+ });
46
+
47
+ client.connect();
48
+
49
+ const pubsub = new PostgresPubSub({ client, maxListeners: 15 });
50
+
51
+ //You can increase max event listeners if you need, default is 15
52
+ ```
53
+
54
+ **Important**: Don't pass clients from `pg`'s `Pool` to `PostgresPubSub`. As [node-postgres creator states in this StackOverflow answer](https://stackoverflow.com/questions/8484404/what-is-the-proper-way-to-use-the-node-js-postgresql-module), the client needs to be around and not shared so pg can properly handle `NOTIFY` messages (which this library uses under the hood)
55
+
56
+ ### commonMessageHandler
57
+
58
+ The second argument to `new PostgresPubSub()` is the `commonMessageHandler`. The common message handler gets called with the received message from PostgreSQL.
59
+ You can transform the message before it is passed to the individual filter/resolver methods of the subscribers.
60
+ This way it is for example possible to inject one instance of a [DataLoader](https://github.com/facebook/dataloader) which can be used in all filter/resolver methods.
61
+
62
+ ```javascript
63
+ const getDataLoader = () => new DataLoader(...)
64
+ const commonMessageHandler = ({attributes: {id}, data}) => ({id, dataLoader: getDataLoader()})
65
+ const pubsub = new PostgresPubSub({ client, commonMessageHandler });
66
+ ```
67
+
68
+ ```javascript
69
+ export const resolvers = {
70
+ Subscription: {
71
+ somethingChanged: {
72
+ resolve: ({ id, dataLoader }) => dataLoader.load(id)
73
+ }
74
+ }
75
+ };
76
+ ```
77
+
78
+ ## Error handling
79
+
80
+ `PostgresPubSub` instances emit a special event called `"error"`. This event's payload is an instance of Javascript's `Error`. You can get the error's text using `error.message`.
81
+
82
+ ```js
83
+ const ps = new PostgresPubSub({ client });
84
+
85
+ ps.subscribe("error", err => {
86
+ console.log(err.message); // -> "payload string too long"
87
+ }).then(() => ps.publish("a", "a".repeat(9000)));
88
+ ```
89
+
90
+ For example you can log all error messages (including stack traces and friends) using something like this:
91
+
92
+ ```js
93
+ ps.subscribe("error", console.error);
94
+ ```
95
+
96
+ This is a forked version of [GraphQLCollege/graphql-postgres-subscriptions](https://github.com/GraphQLCollege/graphql-postgres-subscriptions), where I add typescript and dependency error.
97
+
98
+ ## Stay in touch
99
+
100
+ - Author - [Siam Ahnaf](https://www.siamahnaf.com/)
101
+ - Website - [https://www.siamahnaf.com/](https://www.siamahnaf.com/)
102
+ - Twitter - [https://twitter.com/siamahnaf198](https://twitter.com/siamahnaf198)
103
+ - Github - [https://github.com/siamahnaf](https://github.com/siamahnaf)
@@ -11,6 +11,8 @@ declare class PostgresPubSub extends PubSubEngine {
11
11
  private subscriptions;
12
12
  private subIdCounter;
13
13
  private commonMessageHandler;
14
+ private deflate;
15
+ private inflate;
14
16
  constructor(options?: PostgresPubSubOptions);
15
17
  publish(triggerName: string, payload: any): Promise<void>;
16
18
  subscribe(triggerName: string, onMessage: (message: any) => void): Promise<number>;
@@ -20,6 +20,7 @@ const graphql_subscriptions_1 = require("graphql-subscriptions");
20
20
  const pg_ipc_1 = __importDefault(require("pg-ipc"));
21
21
  const pg_1 = require("pg");
22
22
  const event_emitter_to_async_iterator_1 = require("./event-emitter-to-async-iterator");
23
+ const fast_zlib_1 = require("fast-zlib");
23
24
  const defaultCommonMessageHandler = (message) => message;
24
25
  class PostgresPubSub extends graphql_subscriptions_1.PubSubEngine {
25
26
  constructor(options = {}) {
@@ -34,15 +35,24 @@ class PostgresPubSub extends graphql_subscriptions_1.PubSubEngine {
34
35
  this.subscriptions = {};
35
36
  this.subIdCounter = 0;
36
37
  this.commonMessageHandler = commonMessageHandler || defaultCommonMessageHandler;
38
+ this.deflate = new fast_zlib_1.Deflate();
39
+ this.inflate = new fast_zlib_1.Inflate();
37
40
  }
38
41
  publish(triggerName, payload) {
39
- return this.ee.notify(triggerName, payload);
42
+ const compressMessage = this.deflate.process(payload);
43
+ return this.ee.notify(triggerName, compressMessage);
40
44
  }
41
45
  subscribe(triggerName, onMessage) {
42
46
  const callback = (message) => {
43
- onMessage(message instanceof Error
44
- ? message
45
- : this.commonMessageHandler(message.payload));
47
+ try {
48
+ const decompressedMessage = this.inflate.process(message);
49
+ onMessage(decompressedMessage instanceof Error
50
+ ? decompressedMessage
51
+ : this.commonMessageHandler(decompressedMessage));
52
+ }
53
+ catch (error) {
54
+ onMessage(error);
55
+ }
46
56
  };
47
57
  this.ee.on(triggerName, callback);
48
58
  this.subIdCounter += 1;
@@ -1 +1 @@
1
- {"version":3,"file":"postgres-pubsub.js","sourceRoot":"","sources":["../../../src/pubsub/postgres-pubsub.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iEAAqD;AACrD,YAAY;AACZ,oDAA2B;AAC3B,2BAA0C;AAC1C,uFAA8E;AAE9E,MAAM,2BAA2B,GAAG,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO,CAAC;AAQ9D,MAAM,cAAe,SAAQ,oCAAY;IAOrC,YAAY,UAAiC,EAAE;QAC3C,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,YAAY,GAAG,EAAE,KAAmB,OAAO,EAArB,SAAS,UAAK,OAAO,EAA3E,kDAAiE,CAAU,CAAC;QAClF,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,IAAI,WAAM,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,IAAI,CAAC,MAAM,CAA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EAC5B,IAAI,CAAC,EAAE,EACP,QAAQ,EACR,IAAI,CAAC,oBAAoB,CACrB,CAAC;IACb,CAAC;CACJ;AAEQ,wCAAc"}
@@ -11,6 +11,8 @@ declare class PostgresPubSub extends PubSubEngine {
11
11
  private subscriptions;
12
12
  private subIdCounter;
13
13
  private commonMessageHandler;
14
+ private deflate;
15
+ private inflate;
14
16
  constructor(options?: PostgresPubSubOptions);
15
17
  publish(triggerName: string, payload: any): Promise<void>;
16
18
  subscribe(triggerName: string, onMessage: (message: any) => void): Promise<number>;
@@ -14,6 +14,7 @@ import { PubSubEngine } from "graphql-subscriptions";
14
14
  import pgIPC from "pg-ipc";
15
15
  import { Client } from "pg";
16
16
  import { eventEmitterAsyncIterator } from "./event-emitter-to-async-iterator";
17
+ import { Deflate, Inflate } from "fast-zlib";
17
18
  const defaultCommonMessageHandler = (message) => message;
18
19
  class PostgresPubSub extends PubSubEngine {
19
20
  constructor(options = {}) {
@@ -28,15 +29,24 @@ class PostgresPubSub extends PubSubEngine {
28
29
  this.subscriptions = {};
29
30
  this.subIdCounter = 0;
30
31
  this.commonMessageHandler = commonMessageHandler || defaultCommonMessageHandler;
32
+ this.deflate = new Deflate();
33
+ this.inflate = new Inflate();
31
34
  }
32
35
  publish(triggerName, payload) {
33
- return this.ee.notify(triggerName, payload);
36
+ const compressMessage = this.deflate.process(payload);
37
+ return this.ee.notify(triggerName, compressMessage);
34
38
  }
35
39
  subscribe(triggerName, onMessage) {
36
40
  const callback = (message) => {
37
- onMessage(message instanceof Error
38
- ? message
39
- : this.commonMessageHandler(message.payload));
41
+ try {
42
+ const decompressedMessage = this.inflate.process(message);
43
+ onMessage(decompressedMessage instanceof Error
44
+ ? decompressedMessage
45
+ : this.commonMessageHandler(decompressedMessage));
46
+ }
47
+ catch (error) {
48
+ onMessage(error);
49
+ }
40
50
  };
41
51
  this.ee.on(triggerName, callback);
42
52
  this.subIdCounter += 1;
@@ -1 +1 @@
1
- {"version":3,"file":"postgres-pubsub.js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O,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC1D,SAAS,CACL,mBAAmB,YAAY,KAAK;oBAChC,CAAC,CAAC,mBAAmB;oBACrB,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,CACvD,CAAC;YACN,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,SAAS,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACL,CAAC,CAAC;QACF,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAClC,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAChE,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9C,CAAC;IAED,WAAW,CAAC,KAAa;QACrB,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;IAED,aAAa,CAAI,QAA2B;QACxC,OAAO,yBAAyB,CAC5B,IAAI,CAAC,EAAE,EACP,QAAQ,EACR,IAAI,CAAC,oBAAoB,CACrB,CAAC;IACb,CAAC;CACJ;AAED,OAAO,EAAE,cAAc,EAAyB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "graphql-pg-subscriptions",
3
- "version": "3.0.5",
4
- "description": "A pubsub library for graphql subscriptions with postgree database.",
3
+ "version": "3.1.2",
4
+ "description": "A graphql subscriptions implementation using postgres and apollo's graphql-subscriptions.",
5
5
  "homepage": "https://github.com/siamahnaf/graphql-pg-subscriptions",
6
6
  "main": "dist/cjs/index.js",
7
7
  "module": "dist/esm/index.js",
@@ -36,6 +36,7 @@
36
36
  "graphql": "latest"
37
37
  },
38
38
  "dependencies": {
39
+ "fast-zlib": "^2.0.1",
39
40
  "graphql-subscriptions": "^2.0.0",
40
41
  "iterall": "^1.3.0",
41
42
  "pg-ipc": "^1.0.5"
@@ -47,4 +48,4 @@
47
48
  "pg": "^8.11.5",
48
49
  "typescript": "^5.4.5"
49
50
  }
50
- }
51
+ }