@coderich/autograph 0.11.6 → 0.12.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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coderich/autograph",
|
|
3
3
|
"author": "Richard Livolsi (coderich)",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.2",
|
|
5
5
|
"description": "AutoGraph",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"graphql",
|
|
@@ -19,31 +19,29 @@
|
|
|
19
19
|
"index.js"
|
|
20
20
|
],
|
|
21
21
|
"engines": {
|
|
22
|
-
"node": ">=
|
|
22
|
+
"node": ">=22.0.0"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"start": "APP_ROOT_PATH=$(pwd) node ./test/server",
|
|
26
|
-
"test": "
|
|
27
|
-
"
|
|
28
|
-
"lint": "
|
|
29
|
-
"inspect": "APP_ROOT_PATH=$(pwd) node --expose-gc --inspect=9222 ./src/server",
|
|
30
|
-
"ratchet": "ratchet"
|
|
26
|
+
"test": "jest --config=jest.config.js",
|
|
27
|
+
"dev": "coderich-dev",
|
|
28
|
+
"lint": "eslint ./"
|
|
31
29
|
},
|
|
32
30
|
"dependencies": {
|
|
33
|
-
"@coderich/util": "
|
|
31
|
+
"@coderich/util": "2.0.1",
|
|
34
32
|
"@hapi/boom": "^9.1.0",
|
|
35
33
|
"dataloader": "^2.0.0",
|
|
36
34
|
"deepmerge": "^4.2.2",
|
|
37
35
|
"fill-range": "^7.0.1",
|
|
38
|
-
"glob": "
|
|
36
|
+
"glob": "10.4.5",
|
|
39
37
|
"graphql-fields": "^2.0.3",
|
|
40
38
|
"lodash": "^4.17.21",
|
|
41
|
-
"mongodb": "6.
|
|
39
|
+
"mongodb": "6.9.0",
|
|
42
40
|
"object-hash": "^3.0.0",
|
|
43
41
|
"picomatch": "^2.1.1"
|
|
44
42
|
},
|
|
45
43
|
"devDependencies": {
|
|
46
|
-
"@coderich/
|
|
44
|
+
"@coderich/dev": "0.5.1",
|
|
47
45
|
"@graphql-tools/schema": "^9.0.1",
|
|
48
46
|
"graphql": "^15.5.0",
|
|
49
47
|
"mongodb-memory-server": "10.0.0",
|
|
@@ -56,4 +54,4 @@
|
|
|
56
54
|
"type": "git",
|
|
57
55
|
"url": "git@github.com:coderich/autograph.git"
|
|
58
56
|
}
|
|
59
|
-
}
|
|
57
|
+
}
|
package/src/driver/index.js
CHANGED
package/src/graphql/ast/Node.js
CHANGED
|
@@ -50,7 +50,7 @@ module.exports = class Schema extends TypeDefApi {
|
|
|
50
50
|
try {
|
|
51
51
|
const ast = typeof td === 'object' ? td : parse(td);
|
|
52
52
|
return ast.definitions;
|
|
53
|
-
} catch
|
|
53
|
+
} catch {
|
|
54
54
|
return null;
|
|
55
55
|
}
|
|
56
56
|
}), ['loc']).filter(Boolean).flat();
|
|
@@ -70,10 +70,10 @@ module.exports = class Schema extends TypeDefApi {
|
|
|
70
70
|
* Asynchronously load files from a given glob pattern and merge each schema
|
|
71
71
|
*/
|
|
72
72
|
mergeSchemaFromFiles(globPattern, options) {
|
|
73
|
-
return Glob(globPattern, options).then((files) => {
|
|
73
|
+
return Glob.glob(globPattern, options).then((files) => {
|
|
74
74
|
return Promise.all(files.sort().map((file) => {
|
|
75
75
|
return new Promise((res) => {
|
|
76
|
-
if (file.endsWith('.js')) res(require(file));
|
|
76
|
+
if (file.endsWith('.js')) res(require(file));
|
|
77
77
|
else res(FS.readFileSync(file, 'utf8'));
|
|
78
78
|
}).then(schema => this.mergeSchema(schema, options));
|
|
79
79
|
}));
|
|
@@ -150,7 +150,7 @@ module.exports = (schema) => {
|
|
|
150
150
|
|
|
151
151
|
if (model.isEntity() && model.hasGQLScope('s')) {
|
|
152
152
|
prev[`${model.getName()}SubscriptionQuery`] = {
|
|
153
|
-
__resolveType: root => root.__typename,
|
|
153
|
+
__resolveType: root => root.__typename,
|
|
154
154
|
...fieldResolvers,
|
|
155
155
|
};
|
|
156
156
|
prev[`${model.getName()}Create`] = fieldResolvers;
|
|
@@ -167,7 +167,7 @@ module.exports = (schema) => {
|
|
|
167
167
|
});
|
|
168
168
|
}, {
|
|
169
169
|
Node: {
|
|
170
|
-
__resolveType: (doc, args, context, info) => doc.__typename,
|
|
170
|
+
__resolveType: (doc, args, context, info) => doc.__typename,
|
|
171
171
|
},
|
|
172
172
|
|
|
173
173
|
Query: entityModels.reduce((prev, model) => {
|
|
@@ -179,7 +179,7 @@ module.exports = (schema) => {
|
|
|
179
179
|
const model = schema.getModel(modelName);
|
|
180
180
|
return resolver.get(context, model, args, false, info).then((result) => {
|
|
181
181
|
if (result == null) return result;
|
|
182
|
-
result.__typename = modelName;
|
|
182
|
+
result.__typename = modelName;
|
|
183
183
|
return result;
|
|
184
184
|
});
|
|
185
185
|
},
|