@contember/engine-content-api 1.4.0-alpha.1 → 1.4.0-alpha.3
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/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mapper/select/Path.d.ts +1 -1
- package/dist/src/mapper/select/Path.d.ts.map +1 -1
- package/dist/src/mapper/select/Path.js +3 -3
- package/dist/src/mapper/select/Path.js.map +1 -1
- package/dist/src/resolvers/GraphQlQueryAstFactory.d.ts.map +1 -1
- package/dist/src/resolvers/GraphQlQueryAstFactory.js +2 -2
- package/dist/src/resolvers/GraphQlQueryAstFactory.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/tests/cases/integration/graphQlSchema/model.js +2 -1
- package/dist/tests/cases/integration/graphQlSchema/model.js.map +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/src/index.ts +1 -0
- package/src/mapper/select/Path.ts +8 -5
- package/src/resolvers/GraphQlQueryAstFactory.ts +7 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/engine-content-api",
|
|
3
|
-
"version": "1.4.0-alpha.
|
|
3
|
+
"version": "1.4.0-alpha.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"typings": "dist/src/index.d.ts",
|
|
@@ -13,26 +13,26 @@
|
|
|
13
13
|
"test": "vitest --dir ./tests/cases --no-threads"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@contember/database": "1.4.0-alpha.
|
|
17
|
-
"@contember/dic": "1.4.0-alpha.
|
|
18
|
-
"@contember/graphql-utils": "1.4.0-alpha.
|
|
19
|
-
"@contember/logger": "1.4.0-alpha.
|
|
20
|
-
"@contember/schema": "1.4.0-alpha.
|
|
21
|
-
"@contember/schema-definition": "1.4.0-alpha.
|
|
22
|
-
"@contember/schema-utils": "1.4.0-alpha.
|
|
16
|
+
"@contember/database": "1.4.0-alpha.3",
|
|
17
|
+
"@contember/dic": "1.4.0-alpha.3",
|
|
18
|
+
"@contember/graphql-utils": "1.4.0-alpha.3",
|
|
19
|
+
"@contember/logger": "1.4.0-alpha.3",
|
|
20
|
+
"@contember/schema": "1.4.0-alpha.3",
|
|
21
|
+
"@contember/schema-definition": "1.4.0-alpha.3",
|
|
22
|
+
"@contember/schema-utils": "1.4.0-alpha.3",
|
|
23
23
|
"fast-deep-equal": "^3.1.3"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@contember/database-tester": "1.4.0-alpha.
|
|
27
|
-
"@contember/engine-api-tester": "1.4.0-alpha.
|
|
28
|
-
"@contember/schema-definition": "1.4.0-alpha.
|
|
29
|
-
"@graphql-codegen/cli": "^
|
|
30
|
-
"@graphql-codegen/typescript": "^
|
|
31
|
-
"@graphql-codegen/typescript-operations": "^
|
|
32
|
-
"@graphql-codegen/typescript-resolvers": "^
|
|
33
|
-
"@types/node": "^
|
|
34
|
-
"graphql": "^16.
|
|
35
|
-
"pg": "^8.
|
|
26
|
+
"@contember/database-tester": "1.4.0-alpha.3",
|
|
27
|
+
"@contember/engine-api-tester": "1.4.0-alpha.3",
|
|
28
|
+
"@contember/schema-definition": "1.4.0-alpha.3",
|
|
29
|
+
"@graphql-codegen/cli": "^5.0.0",
|
|
30
|
+
"@graphql-codegen/typescript": "^4.0.1",
|
|
31
|
+
"@graphql-codegen/typescript-operations": "^4.0.1",
|
|
32
|
+
"@graphql-codegen/typescript-resolvers": "^4.0.1",
|
|
33
|
+
"@types/node": "^20.9.0",
|
|
34
|
+
"graphql": "^16.8.1",
|
|
35
|
+
"pg": "^8.11.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"graphql": ">= 14.6.0",
|
package/src/index.ts
CHANGED
|
@@ -25,16 +25,19 @@ export class PathFactory {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export class Path {
|
|
28
|
-
public readonly alias
|
|
28
|
+
public readonly alias: string
|
|
29
29
|
|
|
30
|
-
public get fullAlias() {
|
|
31
|
-
return this.rootAlias + this.path.join('_')
|
|
32
|
-
}
|
|
33
30
|
constructor(
|
|
34
31
|
public readonly path: string[],
|
|
35
32
|
private readonly aliasContext: AliasContext,
|
|
36
33
|
public readonly rootAlias = 'root_',
|
|
37
|
-
) {
|
|
34
|
+
) {
|
|
35
|
+
this.alias = this.createAlias()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public get fullAlias() {
|
|
39
|
+
return this.rootAlias + this.path.join('_')
|
|
40
|
+
}
|
|
38
41
|
|
|
39
42
|
public back() {
|
|
40
43
|
const newPath = [...this.path]
|
|
@@ -3,9 +3,11 @@ import {
|
|
|
3
3
|
FieldNode as GraphQlFieldNode,
|
|
4
4
|
FragmentSpreadNode,
|
|
5
5
|
getArgumentValues,
|
|
6
|
+
GraphQLInterfaceType,
|
|
6
7
|
GraphQLObjectType,
|
|
7
8
|
GraphQLOutputType,
|
|
8
9
|
GraphQLResolveInfo,
|
|
10
|
+
isInterfaceType,
|
|
9
11
|
isListType,
|
|
10
12
|
isNonNullType,
|
|
11
13
|
isObjectType,
|
|
@@ -29,7 +31,7 @@ export class GraphQlQueryAstFactory {
|
|
|
29
31
|
|
|
30
32
|
private createFromNode(
|
|
31
33
|
info: GraphQLResolveInfo,
|
|
32
|
-
parentType: GraphQLObjectType,
|
|
34
|
+
parentType: GraphQLObjectType | GraphQLInterfaceType,
|
|
33
35
|
node: GraphQlFieldNode,
|
|
34
36
|
path: string[],
|
|
35
37
|
filter: NodeFilter,
|
|
@@ -60,7 +62,7 @@ export class GraphQlQueryAstFactory {
|
|
|
60
62
|
|
|
61
63
|
private processSelectionSet(
|
|
62
64
|
info: GraphQLResolveInfo,
|
|
63
|
-
parentType: GraphQLObjectType,
|
|
65
|
+
parentType: GraphQLObjectType | GraphQLInterfaceType,
|
|
64
66
|
selectionSet: SelectionSetNode,
|
|
65
67
|
path: string[],
|
|
66
68
|
filter: NodeFilter,
|
|
@@ -80,12 +82,12 @@ export class GraphQlQueryAstFactory {
|
|
|
80
82
|
}
|
|
81
83
|
const typeName = fragmentDefinition.typeCondition.name.value
|
|
82
84
|
const subField = info.schema.getType(typeName)
|
|
83
|
-
if (!isObjectType(subField)) {
|
|
84
|
-
throw new Error('GraphQlQueryAstFactory: subfield is expected to be GraphQLObjectType')
|
|
85
|
+
if (!isObjectType(subField) && !isInterfaceType(subField)) {
|
|
86
|
+
throw new Error('GraphQlQueryAstFactory: subfield is expected to be GraphQLObjectType or GraphQLInterfaceType')
|
|
85
87
|
}
|
|
86
88
|
const fragmentSelection = this.processSelectionSet(
|
|
87
89
|
info,
|
|
88
|
-
subField
|
|
90
|
+
subField,
|
|
89
91
|
fragmentDefinition.selectionSet,
|
|
90
92
|
path,
|
|
91
93
|
filter,
|