Internal Client deprecated

The internal client is deprecated and will be superseded by the new operations client.

Last supported version: 0.175.0

The operations client is based on the TypeScript client and gives you the same API. Unlike the internal client, it supports Typescript operations and can be used to call internal and public operations.

Migration

The internal client is used in the following places.

Queries

1
2
3
4
5
const { data, errors } = ctx.internalClient.queries.Country({
input: {
code: 'DE',
},
});

Becomes:

1
2
3
4
5
6
const { data, error } = ctx.operations.query({
operationsName: 'Country',
input: {
code: 'DE',
},
});

Mutations

1
2
3
4
5
const { data, errors } = ctx.internalClient.mutations.SetName({
input: {
name: 'Elliot',
},
});

Becomes:

1
2
3
4
5
6
const { data, error } = ctx.operations.mutate({
operationsName: 'SetName',
input: {
name: 'Elliot',
},
});

Subscriptions

Subscriptions are not supported by the internal client, but can be used with the operations client.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
export default createOperation.subscription({
handler: async function* ({ operations }) {
const updates = await operations.subscribe({
operationName: 'federation/PriceUpdates',
});
for await (const update of updates) {
const data = update.data?.federated_updatedPrice ?? undefined;
if (!data) {
continue;
}
yield {
name: data.name,
upc: data.upc,
weight: data.weight,
};
}
},
});

Was this article helpful to you?
Provide feedback

Edit this page