Skip to content

Commit cc1142e

Browse files
committed
Use generated EmbeddedUpdate type, add query variable generics, add CHANGELOG entry
1 parent 01b997d commit cc1142e

2 files changed

Lines changed: 22 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This is the log of notable changes to EAS CLI and related packages.
99
### 🎉 New features
1010

1111
- [eas-cli] Add `eas update:embedded:upload` command. ([#3720](https://github.com/expo/eas-cli/pull/3720) by [@gwdp](https://github.com/gwdp))
12+
- [eas-cli] Add `eas update:embedded:view` command. ([#3721](https://github.com/expo/eas-cli/pull/3721) by [@gwdp](https://github.com/gwdp))
1213

1314
### 🐛 Bug fixes
1415

packages/eas-cli/src/graphql/queries/EmbeddedUpdateQuery.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { CombinedError } from '@urql/core';
22
import gql from 'graphql-tag';
33

44
import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
5-
import { AppPlatform } from '../generated';
5+
import { AppPlatform, EmbeddedUpdate } from '../generated';
66
import { Connection } from '../../utils/relay';
77
import { withErrorHandlingAsync } from '../client';
88

@@ -13,20 +13,24 @@ export function isEmbeddedUpdateNotFoundError(error: unknown): boolean {
1313
);
1414
}
1515

16-
export type EmbeddedUpdateFragment = {
17-
id: string;
18-
platform: AppPlatform;
19-
runtimeVersion: string;
20-
channel: string;
21-
createdAt: string;
22-
};
16+
// Query result types are defined manually because the embeddedUpdates query fields
17+
// are not yet included in the GraphQL codegen schema.
18+
export type EmbeddedUpdateFragment = Pick<
19+
EmbeddedUpdate,
20+
'id' | 'platform' | 'runtimeVersion' | 'channel' | 'createdAt'
21+
>;
2322

2423
type ViewEmbeddedUpdateByIdQueryResult = {
2524
embeddedUpdates: {
2625
byId: EmbeddedUpdateFragment;
2726
};
2827
};
2928

29+
type ViewEmbeddedUpdateByIdQueryVariables = {
30+
embeddedUpdateId: string;
31+
appId: string;
32+
};
33+
3034
type ViewEmbeddedUpdatesPaginatedQueryResult = {
3135
app: {
3236
byId: {
@@ -43,6 +47,13 @@ type ViewEmbeddedUpdatesPaginatedQueryResult = {
4347
};
4448
};
4549

50+
type ViewEmbeddedUpdatesPaginatedQueryVariables = {
51+
appId: string;
52+
first: number;
53+
after?: string;
54+
filter?: EmbeddedUpdateFilter;
55+
};
56+
4657
export type EmbeddedUpdateFilter = {
4758
platform?: AppPlatform;
4859
runtimeVersion?: string;
@@ -56,7 +67,7 @@ export const EmbeddedUpdateQuery = {
5667
): Promise<EmbeddedUpdateFragment> {
5768
const data = await withErrorHandlingAsync(
5869
graphqlClient
59-
.query<ViewEmbeddedUpdateByIdQueryResult>(
70+
.query<ViewEmbeddedUpdateByIdQueryResult, ViewEmbeddedUpdateByIdQueryVariables>(
6071
gql`
6172
query ViewEmbeddedUpdateById($embeddedUpdateId: ID!, $appId: ID!) {
6273
embeddedUpdates {
@@ -94,7 +105,7 @@ export const EmbeddedUpdateQuery = {
94105
): Promise<Connection<EmbeddedUpdateFragment>> {
95106
const data = await withErrorHandlingAsync(
96107
graphqlClient
97-
.query<ViewEmbeddedUpdatesPaginatedQueryResult>(
108+
.query<ViewEmbeddedUpdatesPaginatedQueryResult, ViewEmbeddedUpdatesPaginatedQueryVariables>(
98109
gql`
99110
query ViewEmbeddedUpdatesPaginated(
100111
$appId: String!

0 commit comments

Comments
 (0)