@coderich/autograph 0.10.11 → 0.10.14

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coderich/autograph",
3
3
  "author": "Richard Livolsi (coderich)",
4
- "version": "0.10.11",
4
+ "version": "0.10.14",
5
5
  "description": "AutoGraph",
6
6
  "keywords": [
7
7
  "graphql",
@@ -7,6 +7,7 @@ const { map, ensureArray, proxyDeep, toKeyObj, globToRegex, proxyPromise, isScal
7
7
  module.exports = class MongoDriver {
8
8
  constructor(config) {
9
9
  this.config = config;
10
+ this.config.query = this.config.query || {};
10
11
  this.connection = this.connect();
11
12
  this.getDirectives = () => get(config, 'directives', {});
12
13
  }
@@ -49,15 +50,15 @@ module.exports = class MongoDriver {
49
50
 
50
51
  findMany(query) {
51
52
  const { model, options = {}, flags } = query;
52
- Object.assign(options, this.config.query || {});
53
- return this.query(model, 'aggregate', MongoDriver.aggregateQuery(query), options, flags).then(cursor => cursor.stream());
53
+ const $options = { ...this.config.query, ...options };
54
+ return this.query(model, 'aggregate', MongoDriver.aggregateQuery(query), $options, flags).then(cursor => cursor.stream());
54
55
  }
55
56
 
56
57
  count(query) {
57
58
  const { model, options = {}, flags } = query;
58
- Object.assign(options, this.config.query || {});
59
+ const $options = { ...this.config.query, ...options };
59
60
 
60
- return this.query(model, 'aggregate', MongoDriver.aggregateQuery(query, true), options, flags).then((cursor) => {
61
+ return this.query(model, 'aggregate', MongoDriver.aggregateQuery(query, true), $options, flags).then((cursor) => {
61
62
  return cursor.next().then((doc) => {
62
63
  return doc ? doc.count : 0;
63
64
  });
@@ -65,6 +66,7 @@ module.exports = class MongoDriver {
65
66
  }
66
67
 
67
68
  createOne({ model, input, options, flags }) {
69
+ // console.log(JSON.stringify(input, null, 2));
68
70
  return this.query(model, 'insertOne', input, options, flags).then(result => Object.assign(input, { id: result.insertedId }));
69
71
  }
70
72
 
@@ -59,13 +59,6 @@ module.exports = (schema) => {
59
59
  to: AutoGraphMixed # The MODEL to link to (default's to modelRef)
60
60
  by: AutoGraphMixed! # The FIELD to match yourself by
61
61
  use: AutoGraphMixed # The VALUE to use (default's to @link'd value); useful for many-to-many relationships
62
-
63
- # These are needed for Apollo Federation
64
- # Adding these here in an attempt to avoid collision and need for dynamic rewrite
65
- as: AutoGraphMixed
66
- url: AutoGraphMixed
67
- import: AutoGraphMixed
68
- for: AutoGraphMixed
69
62
  ) on FIELD_DEFINITION
70
63
 
71
64
  directive @index(
package/CHANGELOG.md DELETED
@@ -1,41 +0,0 @@
1
- # CHANGELOG
2
-
3
- ## v0.10.x
4
- - Replaced ResultSet -> POJOs
5
- - Removed all $field methods (auto populated)
6
- - Removed .toObject()
7
- - $model $save remove $delete $lookup $cursor $pageInfo
8
- - Removed embedded API completely
9
- - Removed Directives
10
- - embedApi -> no replacement
11
- - enforce -> use pipeline methods
12
- - resolve -> use graphql resolvers
13
- - @value -> use @field.instruct directive
14
- - Removed Model.tform() -> use Model.shapeObject(shape, data)
15
- - Removed Transformer + Rule -> use Pipeline
16
- - Removed many pre-defined rules + transformers
17
- - Moved "validator" to dev dependency -> isEmail
18
- - Added QueryBuilder.resolve() terminal command
19
- - Exported SchemaDecorator -> Schema
20
- - Removed embedded schema SystemEvents (internal emitter also removed)
21
- - Removed spread of arguments in QueryBuilder terminal commands (must pass in array)
22
- - Mutate "merged" instead of "input"
23
- - Validate "payload"
24
-
25
- ## v0.9.x
26
- - Subscriptions API
27
- - postMutation no longer mutates "doc" and adds "result"
28
- - Added onDelete defer option
29
-
30
- ## v0.8.x
31
- - Engine 14+
32
-
33
- ## v0.7.x
34
- - Complete overhaul of Query to Mongo Driver (pagination, sorting, counts, etc)
35
- - Removed countModel Queries from the API (now available as `count` property on `Connetion` types)
36
- - Dropped Neo4J (temporarily)
37
-
38
- ## v0.6.x
39
- - Mongo driver no longer checks for `version` directive
40
- - Models no longer share a Connection type; removing the need to use `... on Model` for GraphQL queries
41
- - Added `@field(connection: Boolean)` parameter to specifically indicate fields that should return a Connection type
package/src/.DS_Store DELETED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file