Compare commits

...
Author SHA1 Message Date
Quinlan Jung 819f0b4c6f sdf 2023-07-18 12:52:23 -07:00
Quinlan Jung 9ffd3a096b fix test 2023-07-18 11:52:51 -07:00
Quinlan Jung e3ff26e1ca update CHANGELOG.md 2023-07-18 17:56:15 +00:00
Quinlan Jung bbd26a8030 [eas-cli] bump urql graphql client 2023-07-18 10:42:44 -07:00
7 changed files with 102 additions and 30 deletions

No files matched your search

+1
View File
@@ -17,6 +17,7 @@ This is the log of notable changes to EAS CLI and related packages.
### 🧹 Chores ### 🧹 Chores
- Limit project file upload size to 2GB. ([#1928](https://github.com/expo/eas-cli/pull/1928) by [@khamilowicz](https://github.com/khamilowicz)) - Limit project file upload size to 2GB. ([#1928](https://github.com/expo/eas-cli/pull/1928) by [@khamilowicz](https://github.com/khamilowicz))
- Bump urql graphql client major version. ([#1936](https://github.com/expo/eas-cli/pull/1936) by [@quinlanj](https://github.com/quinlanj))
## [3.15.1](https://github.com/expo/eas-cli/releases/tag/v3.15.1) - 2023-07-11 ## [3.15.1](https://github.com/expo/eas-cli/releases/tag/v3.15.1) - 2023-07-11
+3 -2
View File
@@ -32,8 +32,9 @@
"@oclif/core": "1.23.2", "@oclif/core": "1.23.2",
"@oclif/plugin-autocomplete": "1.3.10", "@oclif/plugin-autocomplete": "1.3.10",
"@segment/ajv-human-errors": "^2.1.2", "@segment/ajv-human-errors": "^2.1.2",
"@urql/core": "3.1.1", "@urql/core": "4.0.11",
"@urql/exchange-retry": "1.0.0", "@urql/exchange-graphcache": "6.1.4",
"@urql/exchange-retry": "1.2.0",
"ajv": "8.11.0", "ajv": "8.11.0",
"ajv-formats": "2.1.1", "ajv-formats": "2.1.1",
"better-opn": "3.0.2", "better-opn": "3.0.2",
@@ -27,12 +27,18 @@ beforeEach(() => {
const EXPECTED_STRINGIFIED_GRAPHQL_ERROR_JSON = `[ const EXPECTED_STRINGIFIED_GRAPHQL_ERROR_JSON = `[
{ {
"name": "GraphQLError",
"extensions": {},
"message": "Error 1" "message": "Error 1"
}, },
{ {
"name": "GraphQLError",
"extensions": {},
"message": "Error 2" "message": "Error 2"
}, },
{ {
"name": "GraphQLError",
"extensions": {},
"message": "Error 3" "message": "Error 3"
} }
]`; ]`;
@@ -0,0 +1,8 @@
export class ListChannels {
constructor() {}
async runAsync(): Promise<void> {}
// TODO return channels fragment
async listChannelsAsync(): Promise<void> {}
}
@@ -3,13 +3,14 @@ import {
Client, Client,
OperationContext, OperationContext,
OperationResult, OperationResult,
PromisifiedSource, OperationResultSource,
TypedDocumentNode, TypedDocumentNode,
cacheExchange,
createClient as createUrqlClient, createClient as createUrqlClient,
dedupExchange, cacheExchange as defaultCacheExchange,
fetchExchange, fetchExchange,
} from '@urql/core'; } from '@urql/core';
import { cacheExchange as graphqlCacheExchange } from '@urql/exchange-graphcache';
import { relayPagination } from '@urql/exchange-graphcache/extras';
import { retryExchange } from '@urql/exchange-retry'; import { retryExchange } from '@urql/exchange-retry';
import { DocumentNode } from 'graphql'; import { DocumentNode } from 'graphql';
import fetch from 'node-fetch'; import fetch from 'node-fetch';
@@ -22,18 +23,28 @@ export interface ExpoGraphqlClient extends Client {
query: DocumentNode | TypedDocumentNode<Data, Variables> | string, query: DocumentNode | TypedDocumentNode<Data, Variables> | string,
variables: Variables, variables: Variables,
context: Partial<OperationContext> & { additionalTypenames: string[] } context: Partial<OperationContext> & { additionalTypenames: string[] }
): PromisifiedSource<OperationResult<Data, Variables>>; ): OperationResultSource<OperationResult<Data, Variables>>;
} }
export function createGraphqlClient(authInfo: { // TODO: plumb this down, maybe use a feature gate for this?
export function createGraphqlClient(
authInfo: {
accessToken: string | null; accessToken: string | null;
sessionSecret: string | null; sessionSecret: string | null;
}): ExpoGraphqlClient { },
_options: { useGraphqlCachePolicy?: boolean } = {}
): ExpoGraphqlClient {
return createUrqlClient({ return createUrqlClient({
url: getExpoApiBaseUrl() + '/graphql', url: getExpoApiBaseUrl() + '/graphql',
exchanges: [ exchanges: [
dedupExchange, //options.useGraphqlCachePolicy ? graphqlCacheExchange() : defaultCacheExchange,
cacheExchange, graphqlCacheExchange({
resolvers: {
App: {
updateChannels: relayPagination(),
},
},
}),
retryExchange({ retryExchange({
maxDelayMs: 4000, maxDelayMs: 4000,
retryIf: (err, operation) => { retryIf: (err, operation) => {
@@ -106,6 +106,41 @@ export const ChannelQuery = {
throw new Error(`Could not find channels on project with id ${appId}`); throw new Error(`Could not find channels on project with id ${appId}`);
} }
return updateChannels;
},
async viewUpdateChannelsPaginatedOnAppAsync(
graphqlClient: ExpoGraphqlClient,
{ appId, limit, offset }: ViewUpdateChannelsOnAppQueryVariables
): Promise<UpdateChannelObject[]> {
const response = await withErrorHandlingAsync(
graphqlClient
.query<ViewUpdateChannelsOnAppQuery, ViewUpdateChannelsOnAppQueryVariables>(
gql`
query ViewUpdateChannelsOnApp($appId: String!, $offset: Int!, $limit: Int!) {
app {
byId(appId: $appId) {
id
updateChannels(offset: $offset, limit: $limit) {
id
name
branchMapping
}
}
}
}
${print(UpdateFragmentNode)}
`,
{ appId, offset, limit },
{ additionalTypenames: ['UpdateChannel', 'UpdateBranch', 'Update'] }
)
.toPromise()
);
const { updateChannels } = response.app.byId;
if (!updateChannels) {
throw new Error(`Could not find channels on project with id ${appId}`);
}
return updateChannels; return updateChannels;
}, },
}; };
Generated
+30 -20
View File
@@ -2,6 +2,11 @@
# yarn lockfile v1 # yarn lockfile v1
"@0no-co/graphql.web@^1.0.1":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@0no-co/graphql.web/-/graphql.web-1.0.4.tgz#9606eb651955499525d068ce0ad8bea596286ce2"
integrity sha512-W3ezhHGfO0MS1PtGloaTpg0PbaT8aZSmmaerL7idtU5F7oCI+uu25k+MsMS31BVFlp4aMkHSrNRxiD72IlK8TA==
"@ampproject/remapping@^2.1.0": "@ampproject/remapping@^2.1.0":
version "2.2.0" version "2.2.0"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d"
@@ -4537,20 +4542,30 @@
"@typescript-eslint/types" "5.33.0" "@typescript-eslint/types" "5.33.0"
eslint-visitor-keys "^3.3.0" eslint-visitor-keys "^3.3.0"
"@urql/core@3.1.1", "@urql/core@>=3.0.0": "@urql/core@4.0.11", "@urql/core@>=4.0.0":
version "3.1.1" version "4.0.11"
resolved "https://registry.yarnpkg.com/@urql/core/-/core-3.1.1.tgz#a49cd572360d01f2469a786b294fba2269a65e53" resolved "https://registry.yarnpkg.com/@urql/core/-/core-4.0.11.tgz#b4e8bf3a3ff1a2519bb3aec38c7be99d2523308d"
integrity sha512-Mnxtq4I4QeFJsgs7Iytw+HyhiGxISR6qtyk66c9tipozLZ6QVxrCiUPF2HY4BxNIabaxcp+rivadvm8NAnXj4Q== integrity sha512-FFdY97vF5xnUrElcGw9erOLvtu+KGMLfwrLNDfv4IPgdp2IBsiGe+Kb7Aypfd3kH//BETewVSLm3+y2sSzjX6A==
dependencies: dependencies:
wonka "^6.1.2" "@0no-co/graphql.web" "^1.0.1"
wonka "^6.3.2"
"@urql/exchange-[email protected]": "@urql/exchange-[email protected]":
version "1.0.0" version "6.1.4"
resolved "https://registry.yarnpkg.com/@urql/exchange-retry/-/exchange-retry-1.0.0.tgz#25a48ef0c2f6854f5617e2ca4ea25ae240f1fcbc" resolved "https://registry.yarnpkg.com/@urql/exchange-graphcache/-/exchange-graphcache-6.1.4.tgz#5d69c838f7a1d313018f63abb8ead79f8c1ea133"
integrity sha512-UGyyGAMXzop9C/fIoe7Ij63DkPSy1uMw2jipB5dnB8R3kl80za7LYzVnA1HvBEt2ZPWfMuwez/VGLOQ7XX4bTA== integrity sha512-GQ1scnYjMVoUHrPoYOlw3ZfU2nXuLTEhWhKzPquhZz87GliVpZPuFMf+o64cI1dKy9xDlbU7aQnKiSaGeT248w==
dependencies: dependencies:
"@urql/core" ">=3.0.0" "@0no-co/graphql.web" "^1.0.1"
wonka "^6.0.0" "@urql/core" ">=4.0.0"
wonka "^6.3.2"
"@urql/[email protected]":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@urql/exchange-retry/-/exchange-retry-1.2.0.tgz#23d3ec711754e3c67a843e0106f2cabddff2e5ff"
integrity sha512-1O/biKiVhhn0EtvDF4UOvz325K4RrLupfL8rHcmqD2TBLv4qVDWQuzx4JGa1FfqjjRb+C9TNZ6w19f32Mq85Ug==
dependencies:
"@urql/core" ">=4.0.0"
wonka "^6.3.2"
"@whatwg-node/[email protected]", "@whatwg-node/fetch@^0.5.0": "@whatwg-node/[email protected]", "@whatwg-node/fetch@^0.5.0":
version "0.5.4" version "0.5.4"
@@ -13616,15 +13631,10 @@ widest-line@^3.1.0:
dependencies: dependencies:
string-width "^4.0.0" string-width "^4.0.0"
wonka@^6.0.0: wonka@^6.3.2:
version "6.1.0" version "6.3.2"
resolved "https://registry.yarnpkg.com/wonka/-/wonka-6.1.0.tgz#65297ebf7031ae46d4b0c56da93950fb3ae5baaa" resolved "https://registry.yarnpkg.com/wonka/-/wonka-6.3.2.tgz#6f32992b332251d7b696b038990f4dc284b3b33d"
integrity sha512-VgiMCz7BXOiDbgpVhf5iNhK7hurteY5Jv0fDJewUkY0s4fbxQD2iKqfGxNXNTwp2v3bgT8QVu2l5H7YdkZ5WIA== integrity sha512-2xXbQ1LnwNS7egVm1HPhW2FyKrekolzhpM3mCwXdQr55gO+tAiY76rhb32OL9kKsW8taj++iP7C6hxlVzbnvrw==
wonka@^6.1.2:
version "6.1.2"
resolved "https://registry.yarnpkg.com/wonka/-/wonka-6.1.2.tgz#2c66fa5b26a12f002a03619b988258313d0b5352"
integrity sha512-zNrXPMccg/7OEp9tSfFkMgTvhhowqasiSHdJ3eCZolXxVTV/aT6HUTofoZk9gwRbGoFey/Nss3JaZKUMKMbofg==
word-wrap@^1.2.3: word-wrap@^1.2.3:
version "1.2.3" version "1.2.3"