Skip to content
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
6 changes: 6 additions & 0 deletions .changeset/three-actors-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@apollo/composition": minor
"@apollo/federation-internals": minor
---

Added isSuccess argument to @connect and @source
6 changes: 4 additions & 2 deletions composition-js/src/__tests__/connectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ describe("connect spec and join__directive", () => {
queryParams: ""
}
errors: { message: "" extensions: "" }
isSuccess: ""
)

type Query {
Expand All @@ -579,6 +580,7 @@ describe("connect spec and join__directive", () => {
}
batch: { maxSize: 5 }
errors: { message: "" extensions: "" }
isSuccess: ""
selection: ""
) {
id: ID!
Expand Down Expand Up @@ -624,7 +626,7 @@ describe("connect spec and join__directive", () => {
@join__directive(graphs: [WITH_CONNECTORS_V0_1_], name: \\"link\\", args: {url: \\"https://specs.apollo.dev/connect/v0.1\\", import: [\\"@connect\\", \\"@source\\"]})
@join__directive(graphs: [WITH_CONNECTORS_V0_3_], name: \\"link\\", args: {url: \\"https://specs.apollo.dev/connect/v0.3\\", import: [\\"@connect\\", \\"@source\\"]})
@join__directive(graphs: [WITH_CONNECTORS_V0_1_], name: \\"source\\", args: {name: \\"v1\\", http: {baseURL: \\"http://v1\\"}})
@join__directive(graphs: [WITH_CONNECTORS_V0_3_], name: \\"source\\", args: {name: \\"v1\\", http: {baseURL: \\"http://v1\\", path: \\"\\", queryParams: \\"\\"}, errors: {message: \\"\\", extensions: \\"\\"}})
@join__directive(graphs: [WITH_CONNECTORS_V0_3_], name: \\"source\\", args: {name: \\"v1\\", http: {baseURL: \\"http://v1\\", path: \\"\\", queryParams: \\"\\"}, errors: {message: \\"\\", extensions: \\"\\"}, isSuccess: \\"\\"})
{
query: Query
}
Expand Down Expand Up @@ -694,7 +696,7 @@ describe("connect spec and join__directive", () => {

type Resource
@join__type(graph: WITH_CONNECTORS_V0_3_, key: \\"id\\")
@join__directive(graphs: [WITH_CONNECTORS_V0_3_], name: \\"connect\\", args: {id: \\"conn_id\\", source: \\"v1\\", http: {GET: \\"/resources\\", path: \\"\\", queryParams: \\"\\"}, batch: {maxSize: 5}, errors: {message: \\"\\", extensions: \\"\\"}, selection: \\"\\"})
@join__directive(graphs: [WITH_CONNECTORS_V0_3_], name: \\"connect\\", args: {id: \\"conn_id\\", source: \\"v1\\", http: {GET: \\"/resources\\", path: \\"\\", queryParams: \\"\\"}, batch: {maxSize: 5}, errors: {message: \\"\\", extensions: \\"\\"}, isSuccess: \\"\\", selection: \\"\\"})
{
id: ID!
name: String!
Expand Down
4 changes: 4 additions & 0 deletions internals-js/src/specs/connectSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class ConnectSpecDefinition extends FeatureDefinition {
selection: JSONSelection!
entity: Boolean = false
errors: ConnectorErrors
isSuccess: JSONSelection
) repeatable on FIELD_DEFINITION
| OBJECT # added in v0.2, validation enforced in rust
*/
Expand Down Expand Up @@ -164,12 +165,14 @@ export class ConnectSpecDefinition extends FeatureDefinition {

connect.addArgument('selection', new NonNullType(JSONSelection));
connect.addArgument('entity', schema.booleanType(), false);
connect.addArgument('isSuccess', JSONSelection);

/*
directive @source(
name: String!
http: ConnectHTTP
errors: ConnectorErrors
isSuccess: JSONSelection
) repeatable on SCHEMA
*/
const source = this.addDirective(schema, SOURCE).addLocations(
Expand Down Expand Up @@ -201,6 +204,7 @@ export class ConnectSpecDefinition extends FeatureDefinition {

source.addArgument('http', new NonNullType(SourceHTTP));
source.addArgument('errors', ConnectorErrors);
source.addArgument('isSuccess', JSONSelection);

return [];
}
Expand Down