@orion-js/graphql 3.0.17 → 3.0.24
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/LICENSE +1 -1
- package/lib/buildSchema/getArgs/getField.js +2 -1
- package/lib/buildSchema/getResolvers/index.d.ts +2 -1
- package/lib/resolversSchemas/ResolverParams.d.ts +8 -1
- package/lib/resolversSchemas/ResolverParams.js +6 -1
- package/lib/resolversSchemas/getBasicResultQuery.js +2 -1
- package/package.json +7 -7
package/LICENSE
CHANGED
|
@@ -8,6 +8,7 @@ const isArray_1 = __importDefault(require("lodash/isArray"));
|
|
|
8
8
|
const graphql_1 = require("graphql");
|
|
9
9
|
const schema_1 = require("@orion-js/schema");
|
|
10
10
|
const getScalar_1 = __importDefault(require("../getType/getScalar"));
|
|
11
|
+
const getStaticFields_1 = require("../../resolversSchemas/getStaticFields");
|
|
11
12
|
const storedModelInput = {};
|
|
12
13
|
const getModelInput = function (model, fields) {
|
|
13
14
|
if (storedModelInput[model.name]) {
|
|
@@ -32,7 +33,7 @@ function getParams(type) {
|
|
|
32
33
|
if (!model || !model.__isModel)
|
|
33
34
|
throw new Error(`A type is not a Model`);
|
|
34
35
|
const fields = {};
|
|
35
|
-
for (const field of
|
|
36
|
+
for (const field of (0, getStaticFields_1.getStaticFields)(model)) {
|
|
36
37
|
fields[field.key] = {
|
|
37
38
|
type: getParams(field.type)
|
|
38
39
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { GraphQLFieldConfig } from 'graphql';
|
|
1
2
|
export default function ({ resolvers, mutation, options }: {
|
|
2
3
|
resolvers: any;
|
|
3
4
|
mutation: any;
|
|
4
5
|
options: any;
|
|
5
|
-
}): Promise<
|
|
6
|
+
}): Promise<import("graphql/jsutils/ObjMap").ObjMap<GraphQLFieldConfig<any, any, any>>>;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { Model } from '@orion-js/models';
|
|
2
|
+
export interface ResolverMetaParam {
|
|
3
|
+
resolver: {
|
|
4
|
+
params: any;
|
|
5
|
+
returns: Model | any;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
declare const _default: Model;
|
|
2
9
|
export default _default;
|
|
@@ -7,6 +7,9 @@ const serializeSchema_1 = __importDefault(require("./serializeSchema"));
|
|
|
7
7
|
const getBasicResultQuery_1 = __importDefault(require("./getBasicResultQuery"));
|
|
8
8
|
const models_1 = require("@orion-js/models");
|
|
9
9
|
const resolvers_1 = require("@orion-js/resolvers");
|
|
10
|
+
const resolverReturnsIsModel = (returns) => {
|
|
11
|
+
return returns && returns.__isModel;
|
|
12
|
+
};
|
|
10
13
|
exports.default = (0, models_1.createModel)({
|
|
11
14
|
name: 'ResolverParams',
|
|
12
15
|
schema: {
|
|
@@ -30,7 +33,9 @@ exports.default = (0, models_1.createModel)({
|
|
|
30
33
|
basicResultQuery: (0, resolvers_1.resolver)({
|
|
31
34
|
returns: String,
|
|
32
35
|
resolve: async function ({ resolver }) {
|
|
33
|
-
return await (0, getBasicResultQuery_1.default)({
|
|
36
|
+
return await (0, getBasicResultQuery_1.default)({
|
|
37
|
+
type: resolverReturnsIsModel(resolver.returns) ? resolver.returns.getSchema() : ''
|
|
38
|
+
});
|
|
34
39
|
}
|
|
35
40
|
})
|
|
36
41
|
}
|
|
@@ -4,13 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const isArray_1 = __importDefault(require("lodash/isArray"));
|
|
7
|
+
const getStaticFields_1 = require("./getStaticFields");
|
|
7
8
|
async function getBasicQuery(field) {
|
|
8
9
|
if (!field.type)
|
|
9
10
|
return '';
|
|
10
11
|
if (((0, isArray_1.default)(field.type) && field.type[0].__model) || field.type.__model) {
|
|
11
12
|
const model = (0, isArray_1.default)(field.type) ? field.type[0].__model : field.type.__model;
|
|
12
13
|
const fields = [];
|
|
13
|
-
for (const field of
|
|
14
|
+
for (const field of (0, getStaticFields_1.getStaticFields)(model)) {
|
|
14
15
|
fields.push(await getBasicQuery(field));
|
|
15
16
|
}
|
|
16
17
|
const key = field.key ? `${field.key} ` : '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/graphql",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.24",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"author": "nicolaslopezj",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@orion-js/helpers": "^3.0.17",
|
|
17
|
-
"@orion-js/http": "^3.0.
|
|
18
|
-
"@orion-js/models": "^3.0.
|
|
19
|
-
"@orion-js/resolvers": "^3.0.
|
|
17
|
+
"@orion-js/http": "^3.0.24",
|
|
18
|
+
"@orion-js/models": "^3.0.24",
|
|
19
|
+
"@orion-js/resolvers": "^3.0.24",
|
|
20
20
|
"@orion-js/schema": "^3.0.17",
|
|
21
|
-
"@orion-js/typed-model": "^3.0.
|
|
21
|
+
"@orion-js/typed-model": "^3.0.24",
|
|
22
22
|
"apollo-server-core": "3.5.0",
|
|
23
23
|
"graphql-iso-date": "^3.6.1",
|
|
24
24
|
"graphql-subscriptions": "^2.0.0",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"typescript": "^4.4.4"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"graphql": "^
|
|
41
|
+
"graphql": "^16.0.1"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "5ac1c68e72af3dbeaf8eb5c2a04d5325da2a7e3f"
|
|
47
47
|
}
|