@graphql-mesh/mongoose 0.12.0 → 0.12.1-alpha-20221207154300-4e93bfafd

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/cjs/index.js CHANGED
@@ -27,7 +27,7 @@ const modelMutationOperations = [
27
27
  'removeMany',
28
28
  ];
29
29
  class MongooseHandler {
30
- constructor({ config, baseDir, pubsub, importFn }) {
30
+ constructor({ config, baseDir, pubsub, importFn, }) {
31
31
  this.config = config;
32
32
  this.baseDir = baseDir;
33
33
  this.pubsub = pubsub;
@@ -40,7 +40,11 @@ class MongooseHandler {
40
40
  useNewUrlParser: true,
41
41
  useUnifiedTopology: true,
42
42
  }).catch(e => console.error(e));
43
- await this.pubsub.subscribe('destroy', () => (0, mongoose_1.disconnect)());
43
+ const id = this.pubsub.subscribe('destroy', () => {
44
+ (0, mongoose_1.disconnect)()
45
+ .catch(e => console.error(e))
46
+ .finally(() => this.pubsub.unsubscribe(id));
47
+ });
44
48
  }
45
49
  const schemaComposer = new graphql_compose_1.SchemaComposer();
46
50
  const typeMergingOptions = {};
package/esm/index.js CHANGED
@@ -25,7 +25,7 @@ const modelMutationOperations = [
25
25
  'removeMany',
26
26
  ];
27
27
  export default class MongooseHandler {
28
- constructor({ config, baseDir, pubsub, importFn }) {
28
+ constructor({ config, baseDir, pubsub, importFn, }) {
29
29
  this.config = config;
30
30
  this.baseDir = baseDir;
31
31
  this.pubsub = pubsub;
@@ -38,7 +38,11 @@ export default class MongooseHandler {
38
38
  useNewUrlParser: true,
39
39
  useUnifiedTopology: true,
40
40
  }).catch(e => console.error(e));
41
- await this.pubsub.subscribe('destroy', () => disconnect());
41
+ const id = this.pubsub.subscribe('destroy', () => {
42
+ disconnect()
43
+ .catch(e => console.error(e))
44
+ .finally(() => this.pubsub.unsubscribe(id));
45
+ });
42
46
  }
43
47
  const schemaComposer = new SchemaComposer();
44
48
  const typeMergingOptions = {};
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@graphql-mesh/mongoose",
3
- "version": "0.12.0",
3
+ "version": "0.12.1-alpha-20221207154300-4e93bfafd",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "*",
7
7
  "mongoose": "*"
8
8
  },
9
9
  "dependencies": {
10
- "@graphql-mesh/types": "0.88.0",
11
- "@graphql-mesh/utils": "0.43.0",
10
+ "@graphql-mesh/types": "0.88.1-alpha-20221207154300-4e93bfafd",
11
+ "@graphql-mesh/utils": "0.43.1-alpha-20221207154300-4e93bfafd",
12
12
  "graphql-compose": "9.0.10",
13
13
  "graphql-compose-connection": "8.2.1",
14
14
  "graphql-compose-mongoose": "9.7.2",
@@ -4,6 +4,6 @@ export default class MongooseHandler implements MeshHandler {
4
4
  private baseDir;
5
5
  private pubsub;
6
6
  private importFn;
7
- constructor({ config, baseDir, pubsub, importFn }: MeshHandlerOptions<YamlConfig.MongooseHandler>);
7
+ constructor({ config, baseDir, pubsub, importFn, }: MeshHandlerOptions<YamlConfig.MongooseHandler>);
8
8
  getMeshSource(): Promise<MeshSource>;
9
9
  }
@@ -4,6 +4,6 @@ export default class MongooseHandler implements MeshHandler {
4
4
  private baseDir;
5
5
  private pubsub;
6
6
  private importFn;
7
- constructor({ config, baseDir, pubsub, importFn }: MeshHandlerOptions<YamlConfig.MongooseHandler>);
7
+ constructor({ config, baseDir, pubsub, importFn, }: MeshHandlerOptions<YamlConfig.MongooseHandler>);
8
8
  getMeshSource(): Promise<MeshSource>;
9
9
  }