Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move createInfo to staticTypes #5443

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ export class StaticSchemaTypes {
});
}

public get createInfo(): ObjectTypeComposer {
return this.schemaBuilder.getOrCreateObjectType("CreateInfo", () => {
return {
fields: {
nodesCreated: this.schemaBuilder.types.int.NonNull,
relationshipsCreated: this.schemaBuilder.types.int.NonNull,
},
};
});
}

@Memoize()
public get sortDirection(): EnumTypeComposer {
return this.schemaBuilder.createEnumType("SortDirection", ["ASC", "DESC"]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,23 +303,11 @@ export class TopLevelEntitySchemaTypes {
public get createType(): ObjectTypeComposer {
return this.schemaBuilder.getOrCreateObjectType(this.entityTypeNames.createResponse, () => {
const nodeType = this.nodeType;
const info = this.createInfo;

return {
fields: {
[this.entityTypeNames.queryField]: nodeType.NonNull.List.NonNull,
info,
},
};
});
}

public get createInfo(): ObjectTypeComposer {
return this.schemaBuilder.getOrCreateObjectType(this.entityTypeNames.createInfo, () => {
return {
fields: {
nodesCreated: this.schemaBuilder.types.int.NonNull,
relationshipsCreated: this.schemaBuilder.types.int.NonNull,
info: this.schemaTypes.staticTypes.createInfo,
},
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ describe("@default on array fields", () => {
equals: Boolean
}

type CreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

\\"\\"\\"A date and time, represented as an ISO-8601 string\\"\\"\\"
scalar DateTime

Expand Down Expand Up @@ -84,11 +89,6 @@ describe("@default on array fields", () => {
pageInfo: PageInfo
}

type MovieCreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

input MovieCreateInput {
node: MovieCreateNode!
}
Expand All @@ -103,7 +103,7 @@ describe("@default on array fields", () => {
}

type MovieCreateResponse {
info: MovieCreateInfo
info: CreateInfo
movies: [Movie!]!
}

Expand Down
12 changes: 6 additions & 6 deletions packages/graphql/tests/api-v6/schema/directives/default.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ describe("@default on fields", () => {
equals: Boolean
}

type CreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

\\"\\"\\"A date and time, represented as an ISO-8601 string\\"\\"\\"
scalar DateTime

Expand Down Expand Up @@ -119,11 +124,6 @@ describe("@default on fields", () => {
node: MovieSort
}

type MovieCreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

input MovieCreateInput {
node: MovieCreateNode!
}
Expand All @@ -138,7 +138,7 @@ describe("@default on fields", () => {
}

type MovieCreateResponse {
info: MovieCreateInfo
info: CreateInfo
movies: [Movie!]!
}

Expand Down
12 changes: 6 additions & 6 deletions packages/graphql/tests/api-v6/schema/directives/relayId.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ describe("RelayId", () => {
mutation: Mutation
}

type CreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

input GlobalIdWhere {
equals: String
}
Expand Down Expand Up @@ -70,11 +75,6 @@ describe("RelayId", () => {
node: MovieSort
}

type MovieCreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

input MovieCreateInput {
node: MovieCreateNode!
}
Expand All @@ -85,7 +85,7 @@ describe("RelayId", () => {
}

type MovieCreateResponse {
info: MovieCreateInfo
info: CreateInfo
movies: [Movie!]!
}

Expand Down
38 changes: 14 additions & 24 deletions packages/graphql/tests/api-v6/schema/relationship.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ describe("Relationships", () => {
node: ActorSort
}

type ActorCreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

input ActorCreateInput {
node: ActorCreateNode!
}
Expand All @@ -74,7 +69,7 @@ describe("Relationships", () => {

type ActorCreateResponse {
actors: [Actor!]!
info: ActorCreateInfo
info: CreateInfo
}

type ActorEdge {
Expand Down Expand Up @@ -158,6 +153,11 @@ describe("Relationships", () => {
name: StringWhere
}

type CreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

type Movie {
actors(where: MovieActorsOperationWhere): MovieActorsOperation
title: String
Expand Down Expand Up @@ -225,11 +225,6 @@ describe("Relationships", () => {
node: MovieSort
}

type MovieCreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

input MovieCreateInput {
node: MovieCreateNode!
}
Expand All @@ -239,7 +234,7 @@ describe("Relationships", () => {
}

type MovieCreateResponse {
info: MovieCreateInfo
info: CreateInfo
movies: [Movie!]!
}

Expand Down Expand Up @@ -361,11 +356,6 @@ describe("Relationships", () => {
node: ActorSort
}

type ActorCreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

input ActorCreateInput {
node: ActorCreateNode!
}
Expand All @@ -376,7 +366,7 @@ describe("Relationships", () => {

type ActorCreateResponse {
actors: [Actor!]!
info: ActorCreateInfo
info: CreateInfo
}

type ActorEdge {
Expand Down Expand Up @@ -463,6 +453,11 @@ describe("Relationships", () => {
name: StringWhere
}

type CreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

input IntWhere {
AND: [IntWhere!]
NOT: IntWhere
Expand Down Expand Up @@ -545,11 +540,6 @@ describe("Relationships", () => {
node: MovieSort
}

type MovieCreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

input MovieCreateInput {
node: MovieCreateNode!
}
Expand All @@ -559,7 +549,7 @@ describe("Relationships", () => {
}

type MovieCreateResponse {
info: MovieCreateInfo
info: CreateInfo
movies: [Movie!]!
}

Expand Down
43 changes: 19 additions & 24 deletions packages/graphql/tests/api-v6/schema/simple.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ describe("Simple Aura-API", () => {
mutation: Mutation
}

type CreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

type Movie {
title: String
}
Expand All @@ -53,11 +58,6 @@ describe("Simple Aura-API", () => {
node: MovieSort
}

type MovieCreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

input MovieCreateInput {
node: MovieCreateNode!
}
Expand All @@ -67,7 +67,7 @@ describe("Simple Aura-API", () => {
}

type MovieCreateResponse {
info: MovieCreateInfo
info: CreateInfo
movies: [Movie!]!
}

Expand Down Expand Up @@ -164,11 +164,6 @@ describe("Simple Aura-API", () => {
node: ActorSort
}

type ActorCreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

input ActorCreateInput {
node: ActorCreateNode!
}
Expand All @@ -179,7 +174,7 @@ describe("Simple Aura-API", () => {

type ActorCreateResponse {
actors: [Actor!]!
info: ActorCreateInfo
info: CreateInfo
}

type ActorEdge {
Expand Down Expand Up @@ -209,6 +204,11 @@ describe("Simple Aura-API", () => {
name: StringWhere
}

type CreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

type Movie {
title: String
}
Expand All @@ -222,11 +222,6 @@ describe("Simple Aura-API", () => {
node: MovieSort
}

type MovieCreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

input MovieCreateInput {
node: MovieCreateNode!
}
Expand All @@ -236,7 +231,7 @@ describe("Simple Aura-API", () => {
}

type MovieCreateResponse {
info: MovieCreateInfo
info: CreateInfo
movies: [Movie!]!
}

Expand Down Expand Up @@ -322,6 +317,11 @@ describe("Simple Aura-API", () => {
mutation: Mutation
}

type CreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

type Movie {
title: String
}
Expand All @@ -335,11 +335,6 @@ describe("Simple Aura-API", () => {
node: MovieSort
}

type MovieCreateInfo {
nodesCreated: Int!
relationshipsCreated: Int!
}

input MovieCreateInput {
node: MovieCreateNode!
}
Expand All @@ -349,7 +344,7 @@ describe("Simple Aura-API", () => {
}

type MovieCreateResponse {
info: MovieCreateInfo
info: CreateInfo
movies: [Movie!]!
}

Expand Down
Loading
Loading