@contember/engine-content-api 1.4.0-alpha.2 → 1.4.0-alpha.4

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@contember/engine-content-api",
3
- "version": "1.4.0-alpha.2",
3
+ "version": "1.4.0-alpha.4",
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.2",
17
- "@contember/dic": "1.4.0-alpha.2",
18
- "@contember/graphql-utils": "1.4.0-alpha.2",
19
- "@contember/logger": "1.4.0-alpha.2",
20
- "@contember/schema": "1.4.0-alpha.2",
21
- "@contember/schema-definition": "1.4.0-alpha.2",
22
- "@contember/schema-utils": "1.4.0-alpha.2",
16
+ "@contember/database": "1.4.0-alpha.4",
17
+ "@contember/dic": "1.4.0-alpha.4",
18
+ "@contember/graphql-utils": "1.4.0-alpha.4",
19
+ "@contember/logger": "1.4.0-alpha.4",
20
+ "@contember/schema": "1.4.0-alpha.4",
21
+ "@contember/schema-definition": "1.4.0-alpha.4",
22
+ "@contember/schema-utils": "1.4.0-alpha.4",
23
23
  "fast-deep-equal": "^3.1.3"
24
24
  },
25
25
  "devDependencies": {
26
- "@contember/database-tester": "1.4.0-alpha.2",
27
- "@contember/engine-api-tester": "1.4.0-alpha.2",
28
- "@contember/schema-definition": "1.4.0-alpha.2",
29
- "@graphql-codegen/cli": "^2.6.2",
30
- "@graphql-codegen/typescript": "^2.5.1",
31
- "@graphql-codegen/typescript-operations": "^2.4.2",
32
- "@graphql-codegen/typescript-resolvers": "^2.6.6",
33
- "@types/node": "^18",
34
- "graphql": "^16.5.0",
35
- "pg": "^8.9.0"
26
+ "@contember/database-tester": "1.4.0-alpha.4",
27
+ "@contember/engine-api-tester": "1.4.0-alpha.4",
28
+ "@contember/schema-definition": "1.4.0-alpha.4",
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
@@ -31,3 +31,4 @@ export {
31
31
  ExecutionContainerHook,
32
32
  ExecutionContainerArgs,
33
33
  } from './mapper'
34
+ export * from './utils/uniqueWhereFields'
@@ -25,16 +25,19 @@ export class PathFactory {
25
25
  }
26
26
 
27
27
  export class Path {
28
- public readonly alias = this.createAlias()
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 as GraphQLObjectType,
90
+ subField,
89
91
  fragmentDefinition.selectionSet,
90
92
  path,
91
93
  filter,