@coderich/autograph 0.10.9 → 0.10.11

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.9",
4
+ "version": "0.10.11",
5
5
  "description": "AutoGraph",
6
6
  "keywords": [
7
7
  "graphql",
@@ -34,6 +34,7 @@
34
34
  "dataloader": "^2.0.0",
35
35
  "deepmerge": "^4.2.2",
36
36
  "fill-range": "^7.0.1",
37
+ "flat": "^5.0.2",
37
38
  "glob": "^7.1.6",
38
39
  "graphql-fields": "^2.0.3",
39
40
  "lodash": "^4.17.21",
@@ -1,4 +1,5 @@
1
1
  const Util = require('util');
2
+ const Flat = require('flat');
2
3
  const { get } = require('lodash');
3
4
  const { MongoClient, ObjectId } = require('mongodb');
4
5
  const { map, ensureArray, proxyDeep, toKeyObj, globToRegex, proxyPromise, isScalarDataType, promiseRetry } = require('../service/app.service');
@@ -64,12 +65,11 @@ module.exports = class MongoDriver {
64
65
  }
65
66
 
66
67
  createOne({ model, input, options, flags }) {
67
- // console.log(JSON.stringify(input, null, 2));
68
68
  return this.query(model, 'insertOne', input, options, flags).then(result => Object.assign(input, { id: result.insertedId }));
69
69
  }
70
70
 
71
71
  updateOne({ model, where, $doc, options, flags }) {
72
- const $update = { $set: $doc };
72
+ const $update = { $set: Flat.flatten($doc, { safe: true }) };
73
73
  return this.query(model, 'updateOne', where, $update, options, flags).then(() => $doc);
74
74
  }
75
75
 
@@ -59,6 +59,13 @@ 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
62
69
  ) on FIELD_DEFINITION
63
70
 
64
71
  directive @index(