@coderich/autograph 0.10.30 → 0.10.31

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.30",
4
+ "version": "0.10.31",
5
5
  "description": "AutoGraph",
6
6
  "keywords": [
7
7
  "graphql",
@@ -40,7 +40,7 @@ exports.isIdValue = value => exports.isScalarValue(value) || value instanceof Ob
40
40
  exports.mergeDeep = (...args) => DeepMerge.all(args, { isMergeableObject: obj => (exports.isPlainObject(obj) || Array.isArray(obj)), arrayMerge: smartMerge });
41
41
  exports.uniq = arr => [...new Set(arr.map(a => `${a}`))];
42
42
  exports.timeout = ms => new Promise(res => setTimeout(res, ms));
43
- exports.hashObject = obj => ObjectHash(obj, { respectType: false, respectFunctionNames: false, respectFunctionProperties: false, unorderedArrays: true, ignoreUnknown: true, replacer: r => (r instanceof ObjectId ? `${r}` : r) });
43
+ exports.hashObject = obj => ObjectHash(obj, { respectType: false, respectFunctionNames: false, respectFunctionProperties: false, unorderedArrays: true, ignoreUnknown: true, replacer: r => (ObjectId.isValid(r) ? `${r}` : r) });
44
44
  exports.globToRegex = (glob, options = {}) => PicoMatch.makeRe(glob, { ...options, expandRange: (a, b) => `(${FillRange(a, b, { toRegex: true })})` });
45
45
  exports.globToRegexp = (glob, options = {}) => PicoMatch.toRegex(exports.globToRegex(glob, options));
46
46
  exports.toGUID = (model, id) => Buffer.from(`${model},${`${id}`}`).toString('base64');
@@ -3,53 +3,6 @@
3
3
  // https://graphql.org/graphql-js/utilities/
4
4
 
5
5
  const { uniqWith } = require('lodash');
6
- const { GraphQLScalarType, GraphQLObjectType, GraphQLInterfaceType, GraphQLUnionType, GraphQLEnumType, GraphQLInputObjectType } = require('graphql');
7
-
8
- exports.getSchemaData = (schema) => {
9
- const operations = ['Query', 'Mutation', 'Subscription'];
10
-
11
- return Object.entries(schema.getTypeMap()).reduce((prev, [key, value]) => {
12
- let type;
13
-
14
- if (value instanceof GraphQLScalarType) {
15
- type = 'scalars';
16
- } else if (value instanceof GraphQLEnumType) {
17
- type = 'enums';
18
- } else if (value instanceof GraphQLUnionType) {
19
- type = 'unions';
20
- } else if (value instanceof GraphQLInterfaceType) {
21
- type = 'interfaces';
22
- } else if (value instanceof GraphQLInputObjectType) {
23
- type = 'inputs';
24
- } else if (value instanceof GraphQLObjectType) {
25
- if (operations.includes(key)) {
26
- type = 'operations';
27
- } else {
28
- type = 'models';
29
- }
30
- }
31
-
32
- if (type) {
33
- if (!key.startsWith('__')) {
34
- prev[type][key] = value;
35
- }
36
- } else {
37
- console.log(`Unknown schema type { ${key}: ${value} }`);
38
- }
39
-
40
- return prev;
41
- }, {
42
- enums: {},
43
- models: {},
44
- inputs: {},
45
- unions: {},
46
- scalars: {},
47
- operations: {},
48
- directives: {},
49
- interfaces: {},
50
- enumerations: {},
51
- });
52
- };
53
6
 
54
7
  exports.identifyOnDeletes = (models, parentModel) => {
55
8
  return models.reduce((prev, model) => {