eas-cli 16.13.4 → 16.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +107 -79
  2. package/build/commands/env/create.d.ts +0 -1
  3. package/build/commands/env/create.js +1 -28
  4. package/build/commands/update/delete.js +2 -20
  5. package/build/commands/update/republish.js +2 -139
  6. package/build/commands/update/revert-update-rollout.d.ts +24 -0
  7. package/build/commands/update/revert-update-rollout.js +264 -0
  8. package/build/commands/update/roll-back-to-embedded.d.ts +0 -2
  9. package/build/commands/update/roll-back-to-embedded.js +13 -133
  10. package/build/credentials/ios/actions/AppleTeamUtils.js +1 -1
  11. package/build/credentials/ios/actions/SetUpTargetBuildCredentialsFromCredentialsJson.js +1 -1
  12. package/build/credentials/ios/api/GraphqlClient.d.ts +1 -1
  13. package/build/credentials/ios/api/GraphqlClient.js +14 -8
  14. package/build/credentials/ios/api/graphql/mutations/AppleTeamMutation.d.ts +3 -5
  15. package/build/credentials/ios/api/graphql/mutations/AppleTeamMutation.js +22 -6
  16. package/build/devices/manager.js +2 -15
  17. package/build/graphql/generated.d.ts +107 -137
  18. package/build/graphql/generated.js +15 -3
  19. package/build/graphql/mutations/EnvironmentVariableMutation.d.ts +0 -2
  20. package/build/graphql/mutations/EnvironmentVariableMutation.js +0 -48
  21. package/build/graphql/types/Update.js +1 -0
  22. package/build/project/publish.js +1 -0
  23. package/build/update/delete.d.ts +5 -0
  24. package/build/update/delete.js +24 -0
  25. package/build/update/queries.d.ts +13 -1
  26. package/build/update/queries.js +62 -1
  27. package/build/update/republish.d.ts +27 -0
  28. package/build/update/republish.js +242 -1
  29. package/build/update/roll-back-to-embedded.d.ts +18 -0
  30. package/build/update/roll-back-to-embedded.js +119 -0
  31. package/build/user/fetchUser.js +15 -13
  32. package/build/utils/statuspageService.js +1 -0
  33. package/oclif.manifest.json +78 -114
  34. package/package.json +3 -2
  35. package/build/commands/env/link.d.ts +0 -23
  36. package/build/commands/env/link.js +0 -128
  37. package/build/commands/env/unlink.d.ts +0 -22
  38. package/build/commands/env/unlink.js +0 -117
@@ -3,27 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const eas_json_1 = require("@expo/eas-json");
5
5
  const core_1 = require("@oclif/core");
6
- const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
7
6
  const queries_1 = require("../../branch/queries");
8
- const url_1 = require("../../build/utils/url");
9
7
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
10
8
  const flags_1 = require("../../commandUtils/flags");
11
9
  const pagination_1 = require("../../commandUtils/pagination");
12
- const fetch_1 = tslib_1.__importDefault(require("../../fetch"));
13
10
  const generated_1 = require("../../graphql/generated");
14
- const PublishMutation_1 = require("../../graphql/mutations/PublishMutation");
15
- const RuntimeQuery_1 = require("../../graphql/queries/RuntimeQuery");
16
- const log_1 = tslib_1.__importStar(require("../../log"));
17
- const ora_1 = require("../../ora");
18
11
  const projectUtils_1 = require("../../project/projectUtils");
19
12
  const publish_1 = require("../../project/publish");
20
13
  const configure_1 = require("../../update/configure");
21
- const utils_1 = require("../../update/utils");
14
+ const queries_2 = require("../../update/queries");
15
+ const roll_back_to_embedded_1 = require("../../update/roll-back-to-embedded");
22
16
  const code_signing_1 = require("../../utils/code-signing");
23
- const uniqBy_1 = tslib_1.__importDefault(require("../../utils/expodash/uniqBy"));
24
- const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
25
17
  const json_1 = require("../../utils/json");
26
- const relay_1 = require("../../utils/relay");
27
18
  const statuspageService_1 = require("../../utils/statuspageService");
28
19
  class UpdateRollBackToEmbedded extends EasCommand_1.default {
29
20
  static description = 'roll back to the embedded update';
@@ -116,134 +107,23 @@ class UpdateRollBackToEmbedded extends EasCommand_1.default {
116
107
  branchName,
117
108
  });
118
109
  const selectedRuntime = runtimeVersionArg ??
119
- (await UpdateRollBackToEmbedded.selectRuntimeAsync(graphqlClient, {
110
+ (await (0, queries_2.selectRuntimeOnBranchAsync)(graphqlClient, {
120
111
  appId: projectId,
121
112
  branchName,
122
113
  }))?.version;
123
114
  if (!selectedRuntime) {
124
115
  core_1.Errors.error('Must select a runtime or provide the --runtimeVersion flag', { exit: 1 });
125
116
  }
126
- const runtimeToPlatformsAndFingerprintInfoMapping = (0, publish_1.getRuntimeToPlatformsAndFingerprintInfoMappingFromRuntimeVersionInfoObjects)(realizedPlatforms.map(platform => ({
127
- platform,
128
- runtimeVersionInfo: {
129
- runtimeVersion: selectedRuntime,
130
- expoUpdatesRuntimeFingerprint: null,
131
- expoUpdatesRuntimeFingerprintHash: null,
132
- },
133
- })));
134
- let newUpdates;
135
- const publishSpinner = (0, ora_1.ora)('Publishing...').start();
136
- try {
137
- newUpdates = await this.publishRollbacksAsync({
138
- graphqlClient,
139
- updateMessage,
140
- branchId: branch.id,
141
- codeSigningInfo,
142
- runtimeToPlatformsAndFingerprintInfoMapping,
143
- realizedPlatforms,
144
- });
145
- publishSpinner.succeed('Published!');
146
- }
147
- catch (e) {
148
- publishSpinner.fail('Failed to publish updates');
149
- throw e;
150
- }
151
- if (jsonFlag) {
152
- (0, json_1.printJsonOnlyOutput)((0, utils_1.getUpdateJsonInfosForUpdates)(newUpdates));
153
- }
154
- else {
155
- log_1.default.addNewLineIfNone();
156
- for (const runtime of (0, uniqBy_1.default)(runtimeToPlatformsAndFingerprintInfoMapping, version => version.runtimeVersion)) {
157
- const newUpdatesForRuntimeVersion = newUpdates.filter(update => update.runtimeVersion === runtime.runtimeVersion);
158
- if (newUpdatesForRuntimeVersion.length === 0) {
159
- throw new Error(`Publish response is missing updates with runtime ${runtime.runtimeVersion}.`);
160
- }
161
- const platforms = newUpdatesForRuntimeVersion.map(update => update.platform);
162
- const newAndroidUpdate = newUpdatesForRuntimeVersion.find(update => update.platform === 'android');
163
- const newIosUpdate = newUpdatesForRuntimeVersion.find(update => update.platform === 'ios');
164
- const updateGroupId = newUpdatesForRuntimeVersion[0].group;
165
- const projectName = exp.slug;
166
- const accountName = (await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId)).name;
167
- const updateGroupUrl = (0, url_1.getUpdateGroupUrl)(accountName, projectName, updateGroupId);
168
- const updateGroupLink = (0, log_1.link)(updateGroupUrl, { dim: false });
169
- log_1.default.log((0, formatFields_1.default)([
170
- { label: 'Branch', value: branchName },
171
- { label: 'Runtime version', value: runtime.runtimeVersion },
172
- { label: 'Platform', value: platforms.join(', ') },
173
- { label: 'Update group ID', value: updateGroupId },
174
- ...(newAndroidUpdate
175
- ? [{ label: 'Android update ID', value: newAndroidUpdate.id }]
176
- : []),
177
- ...(newIosUpdate ? [{ label: 'iOS update ID', value: newIosUpdate.id }] : []),
178
- { label: 'Message', value: updateMessage ?? '' },
179
- { label: 'EAS Dashboard', value: updateGroupLink },
180
- ]));
181
- log_1.default.addNewLineIfNone();
182
- }
183
- }
184
- }
185
- async publishRollbacksAsync({ graphqlClient, updateMessage, branchId, codeSigningInfo, runtimeToPlatformsAndFingerprintInfoMapping, realizedPlatforms, }) {
186
- const rollbackInfoGroups = Object.fromEntries(realizedPlatforms.map(platform => [platform, true]));
187
- // Sort the updates into different groups based on their platform specific runtime versions
188
- const updateGroups = runtimeToPlatformsAndFingerprintInfoMapping.map(({ runtimeVersion, platforms }) => {
189
- const localRollbackInfoGroup = Object.fromEntries(platforms.map(platform => [platform, rollbackInfoGroups[platform]]));
190
- return {
191
- branchId,
192
- rollBackToEmbeddedInfoGroup: localRollbackInfoGroup,
193
- runtimeVersion,
194
- message: updateMessage,
195
- awaitingCodeSigningInfo: !!codeSigningInfo,
196
- };
197
- });
198
- const newUpdates = await PublishMutation_1.PublishMutation.publishUpdateGroupAsync(graphqlClient, updateGroups);
199
- if (codeSigningInfo) {
200
- log_1.default.log('🔒 Signing roll back');
201
- const updatesTemp = [...newUpdates];
202
- const updateGroupsAndTheirUpdates = updateGroups.map(updateGroup => {
203
- const newUpdates = updatesTemp.splice(0, Object.keys((0, nullthrows_1.default)(updateGroup.rollBackToEmbeddedInfoGroup)).length);
204
- return {
205
- updateGroup,
206
- newUpdates,
207
- };
208
- });
209
- await Promise.all(updateGroupsAndTheirUpdates.map(async ({ newUpdates }) => {
210
- await Promise.all(newUpdates.map(async (newUpdate) => {
211
- const response = await (0, fetch_1.default)(newUpdate.manifestPermalink, {
212
- method: 'GET',
213
- headers: { accept: 'multipart/mixed' },
214
- });
215
- const directiveBody = (0, nullthrows_1.default)(await (0, code_signing_1.getDirectiveBodyAsync)(response));
216
- (0, code_signing_1.checkDirectiveBodyAgainstUpdateInfoGroup)(directiveBody);
217
- const directiveSignature = (0, code_signing_1.signBody)(directiveBody, codeSigningInfo);
218
- await PublishMutation_1.PublishMutation.setCodeSigningInfoAsync(graphqlClient, newUpdate.id, {
219
- alg: codeSigningInfo.codeSigningMetadata.alg,
220
- keyid: codeSigningInfo.codeSigningMetadata.keyid,
221
- sig: directiveSignature,
222
- });
223
- }));
224
- }));
225
- }
226
- return newUpdates;
227
- }
228
- static async selectRuntimeAsync(graphqlClient, { appId, branchName, batchSize = 5, }) {
229
- const queryAsync = async (queryParams) => {
230
- return await RuntimeQuery_1.RuntimeQuery.getRuntimesOnBranchAsync(graphqlClient, {
231
- appId,
232
- name: branchName,
233
- first: queryParams.first,
234
- after: queryParams.after,
235
- last: queryParams.last,
236
- before: queryParams.before,
237
- });
238
- };
239
- const getTitleAsync = async (runtime) => {
240
- return runtime.version;
241
- };
242
- return await (0, relay_1.selectPaginatedAsync)({
243
- queryAsync,
244
- getTitleAsync,
245
- printedType: 'target runtime',
246
- pageSize: batchSize,
117
+ await (0, roll_back_to_embedded_1.publishRollBackToEmbeddedUpdateAsync)({
118
+ graphqlClient,
119
+ projectId,
120
+ exp,
121
+ updateMessage,
122
+ branch,
123
+ codeSigningInfo,
124
+ platforms: realizedPlatforms,
125
+ runtimeVersion: selectedRuntime,
126
+ json: jsonFlag,
247
127
  });
248
128
  }
249
129
  sanitizeFlags(flags) {
@@ -5,7 +5,7 @@ async function resolveAppleTeamIfAuthenticatedAsync(ctx, app) {
5
5
  if (!ctx.appStore.authCtx) {
6
6
  return null;
7
7
  }
8
- return await ctx.ios.createOrGetExistingAppleTeamAsync(ctx.graphqlClient, app.account, {
8
+ return await ctx.ios.createOrGetExistingAppleTeamAndUpdateNameIfChangedAsync(ctx.graphqlClient, app.account.id, {
9
9
  appleTeamIdentifier: ctx.appStore.authCtx.team.id,
10
10
  appleTeamName: ctx.appStore.authCtx.team.name,
11
11
  });
@@ -26,7 +26,7 @@ class SetUpTargetBuildCredentialsFromCredentialsJson {
26
26
  const appInfo = `@${this.app.account.name}/${this.app.projectName} (${this.app.bundleIdentifier})`;
27
27
  // new credentials from local json
28
28
  const appleTeamFromProvisioningProfile = (0, provisioningProfile_1.readAppleTeam)(this.targetCredentials.provisioningProfile);
29
- const appleTeam = await ctx.ios.createOrGetExistingAppleTeamAsync(ctx.graphqlClient, this.app.account, {
29
+ const appleTeam = await ctx.ios.createOrGetExistingAppleTeamAndUpdateNameIfChangedAsync(ctx.graphqlClient, this.app.account.id, {
30
30
  appleTeamIdentifier: appleTeamFromProvisioningProfile.teamId,
31
31
  appleTeamName: appleTeamFromProvisioningProfile.teamName,
32
32
  });
@@ -24,7 +24,7 @@ export declare function updateIosAppCredentialsAsync(graphqlClient: ExpoGraphqlC
24
24
  applePushKeyId?: string;
25
25
  ascApiKeyIdForSubmissions?: string;
26
26
  }): Promise<CommonIosAppCredentialsFragment>;
27
- export declare function createOrGetExistingAppleTeamAsync(graphqlClient: ExpoGraphqlClient, account: AccountFragment, { appleTeamIdentifier, appleTeamName }: {
27
+ export declare function createOrGetExistingAppleTeamAndUpdateNameIfChangedAsync(graphqlClient: ExpoGraphqlClient, accountId: string, { appleTeamIdentifier, appleTeamName }: {
28
28
  appleTeamIdentifier: string;
29
29
  appleTeamName?: string;
30
30
  }): Promise<AppleTeamFragment>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteAscApiKeyAsync = exports.getAscApiKeyForAppSubmissionsAsync = exports.getAscApiKeysForAccountAsync = exports.createAscApiKeyAsync = exports.deletePushKeyAsync = exports.getPushKeyForAppAsync = exports.getPushKeysForAccountAsync = exports.createPushKeyAsync = exports.deleteDistributionCertificateAsync = exports.createDistributionCertificateAsync = exports.getDistributionCertificatesForAccountAsync = exports.getDistributionCertificateForAppAsync = exports.deleteProvisioningProfilesAsync = exports.updateProvisioningProfileAsync = exports.getProvisioningProfileAsync = exports.createProvisioningProfileAsync = exports.getDevicesForAppleTeamAsync = exports.createOrGetExistingAppleAppIdentifierAsync = exports.createOrGetExistingAppleTeamAsync = exports.updateIosAppCredentialsAsync = exports.createOrGetIosAppCredentialsWithCommonFieldsAsync = exports.getIosAppCredentialsWithCommonFieldsAsync = exports.getIosAppCredentialsWithBuildCredentialsAsync = exports.createOrUpdateIosAppBuildCredentialsAsync = void 0;
3
+ exports.deleteAscApiKeyAsync = exports.getAscApiKeyForAppSubmissionsAsync = exports.getAscApiKeysForAccountAsync = exports.createAscApiKeyAsync = exports.deletePushKeyAsync = exports.getPushKeyForAppAsync = exports.getPushKeysForAccountAsync = exports.createPushKeyAsync = exports.deleteDistributionCertificateAsync = exports.createDistributionCertificateAsync = exports.getDistributionCertificatesForAccountAsync = exports.getDistributionCertificateForAppAsync = exports.deleteProvisioningProfilesAsync = exports.updateProvisioningProfileAsync = exports.getProvisioningProfileAsync = exports.createProvisioningProfileAsync = exports.getDevicesForAppleTeamAsync = exports.createOrGetExistingAppleAppIdentifierAsync = exports.createOrGetExistingAppleTeamAndUpdateNameIfChangedAsync = exports.updateIosAppCredentialsAsync = exports.createOrGetIosAppCredentialsWithCommonFieldsAsync = exports.getIosAppCredentialsWithCommonFieldsAsync = exports.getIosAppCredentialsWithBuildCredentialsAsync = exports.createOrUpdateIosAppBuildCredentialsAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const apple_utils_1 = require("@expo/apple-utils");
6
6
  const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
@@ -117,16 +117,22 @@ async function createOrGetExistingIosAppCredentialsWithBuildCredentialsAsync(gra
117
117
  }));
118
118
  }
119
119
  }
120
- async function createOrGetExistingAppleTeamAsync(graphqlClient, account, { appleTeamIdentifier, appleTeamName }) {
121
- const appleTeam = await AppleTeamQuery_1.AppleTeamQuery.getByAppleTeamIdentifierAsync(graphqlClient, account.id, appleTeamIdentifier);
120
+ async function createOrGetExistingAppleTeamAndUpdateNameIfChangedAsync(graphqlClient, accountId, { appleTeamIdentifier, appleTeamName }) {
121
+ const appleTeam = await AppleTeamQuery_1.AppleTeamQuery.getByAppleTeamIdentifierAsync(graphqlClient, accountId, appleTeamIdentifier);
122
122
  if (appleTeam) {
123
+ const didAppleTeamNameChange = appleTeamName && appleTeam && appleTeamName !== appleTeam.appleTeamName;
124
+ if (didAppleTeamNameChange) {
125
+ return await AppleTeamMutation_1.AppleTeamMutation.updateAppleTeamAsync(graphqlClient, {
126
+ appleTeamName,
127
+ }, appleTeam.id);
128
+ }
123
129
  return appleTeam;
124
130
  }
125
131
  else {
126
- return await AppleTeamMutation_1.AppleTeamMutation.createAppleTeamAsync(graphqlClient, { appleTeamIdentifier, appleTeamName }, account.id);
132
+ return await AppleTeamMutation_1.AppleTeamMutation.createAppleTeamAsync(graphqlClient, { appleTeamIdentifier, appleTeamName }, accountId);
127
133
  }
128
134
  }
129
- exports.createOrGetExistingAppleTeamAsync = createOrGetExistingAppleTeamAsync;
135
+ exports.createOrGetExistingAppleTeamAndUpdateNameIfChangedAsync = createOrGetExistingAppleTeamAndUpdateNameIfChangedAsync;
130
136
  async function createOrGetExistingAppleAppIdentifierAsync(graphqlClient, { account, projectName, bundleIdentifier, parentBundleIdentifier }, appleTeam) {
131
137
  const appleAppIdentifier = await AppleAppIdentifierQuery_1.AppleAppIdentifierQuery.byBundleIdentifierAsync(graphqlClient, account.name, bundleIdentifier);
132
138
  if (appleAppIdentifier) {
@@ -188,7 +194,7 @@ async function getDistributionCertificatesForAccountAsync(graphqlClient, account
188
194
  }
189
195
  exports.getDistributionCertificatesForAccountAsync = getDistributionCertificatesForAccountAsync;
190
196
  async function createDistributionCertificateAsync(graphqlClient, account, distCert) {
191
- const appleTeam = await createOrGetExistingAppleTeamAsync(graphqlClient, account, {
197
+ const appleTeam = await createOrGetExistingAppleTeamAndUpdateNameIfChangedAsync(graphqlClient, account.id, {
192
198
  appleTeamIdentifier: distCert.teamId,
193
199
  appleTeamName: distCert.teamName,
194
200
  });
@@ -206,7 +212,7 @@ async function deleteDistributionCertificateAsync(graphqlClient, distributionCer
206
212
  }
207
213
  exports.deleteDistributionCertificateAsync = deleteDistributionCertificateAsync;
208
214
  async function createPushKeyAsync(graphqlClient, account, pushKey) {
209
- const appleTeam = await createOrGetExistingAppleTeamAsync(graphqlClient, account, {
215
+ const appleTeam = await createOrGetExistingAppleTeamAndUpdateNameIfChangedAsync(graphqlClient, account.id, {
210
216
  appleTeamIdentifier: pushKey.teamId,
211
217
  appleTeamName: pushKey.teamName,
212
218
  });
@@ -232,7 +238,7 @@ async function deletePushKeyAsync(graphqlClient, pushKeyId) {
232
238
  exports.deletePushKeyAsync = deletePushKeyAsync;
233
239
  async function createAscApiKeyAsync(graphqlClient, account, ascApiKey) {
234
240
  const maybeAppleTeam = ascApiKey.teamId
235
- ? await createOrGetExistingAppleTeamAsync(graphqlClient, account, {
241
+ ? await createOrGetExistingAppleTeamAndUpdateNameIfChangedAsync(graphqlClient, account.id, {
236
242
  appleTeamIdentifier: ascApiKey.teamId,
237
243
  appleTeamName: ascApiKey.teamName,
238
244
  })
@@ -1,8 +1,6 @@
1
1
  import { ExpoGraphqlClient } from '../../../../../commandUtils/context/contextUtils/createGraphqlClient';
2
- import { AccountFragment, AppleTeamFragment, AppleTeamInput } from '../../../../../graphql/generated';
3
- export type AppleTeamMutationResult = AppleTeamFragment & {
4
- account: AccountFragment;
5
- };
2
+ import { AppleTeamFragment, AppleTeamInput, AppleTeamUpdateInput } from '../../../../../graphql/generated';
6
3
  export declare const AppleTeamMutation: {
7
- createAppleTeamAsync(graphqlClient: ExpoGraphqlClient, appleTeamInput: AppleTeamInput, accountId: string): Promise<AppleTeamMutationResult>;
4
+ createAppleTeamAsync(graphqlClient: ExpoGraphqlClient, appleTeamInput: AppleTeamInput, accountId: string): Promise<AppleTeamFragment>;
5
+ updateAppleTeamAsync(graphqlClient: ExpoGraphqlClient, appleTeamInput: AppleTeamUpdateInput, appleTeamEntityId: string): Promise<AppleTeamFragment>;
8
6
  };
@@ -5,7 +5,6 @@ const tslib_1 = require("tslib");
5
5
  const graphql_1 = require("graphql");
6
6
  const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
7
7
  const client_1 = require("../../../../../graphql/client");
8
- const Account_1 = require("../../../../../graphql/types/Account");
9
8
  const AppleTeam_1 = require("../../../../../graphql/types/credentials/AppleTeam");
10
9
  exports.AppleTeamMutation = {
11
10
  async createAppleTeamAsync(graphqlClient, appleTeamInput, accountId) {
@@ -16,15 +15,10 @@ exports.AppleTeamMutation = {
16
15
  createAppleTeam(appleTeamInput: $appleTeamInput, accountId: $accountId) {
17
16
  id
18
17
  ...AppleTeamFragment
19
- account {
20
- id
21
- ...AccountFragment
22
- }
23
18
  }
24
19
  }
25
20
  }
26
21
  ${(0, graphql_1.print)(AppleTeam_1.AppleTeamFragmentNode)}
27
- ${(0, graphql_1.print)(Account_1.AccountFragmentNode)}
28
22
  `, {
29
23
  appleTeamInput,
30
24
  accountId,
@@ -32,4 +26,26 @@ exports.AppleTeamMutation = {
32
26
  .toPromise());
33
27
  return data.appleTeam.createAppleTeam;
34
28
  },
29
+ async updateAppleTeamAsync(graphqlClient, appleTeamInput, appleTeamEntityId) {
30
+ const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
31
+ .mutation((0, graphql_tag_1.default) `
32
+ mutation UpdateAppleTeamMutation(
33
+ $appleTeamInput: AppleTeamUpdateInput!
34
+ $appleTeamEntityId: ID!
35
+ ) {
36
+ appleTeam {
37
+ updateAppleTeam(appleTeamUpdateInput: $appleTeamInput, id: $appleTeamEntityId) {
38
+ id
39
+ ...AppleTeamFragment
40
+ }
41
+ }
42
+ }
43
+ ${(0, graphql_1.print)(AppleTeam_1.AppleTeamFragmentNode)}
44
+ `, {
45
+ appleTeamInput,
46
+ appleTeamEntityId,
47
+ })
48
+ .toPromise());
49
+ return data.appleTeam.updateAppleTeam;
50
+ },
35
51
  };
@@ -5,8 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const assert_1 = tslib_1.__importDefault(require("assert"));
6
6
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
7
  const action_1 = tslib_1.__importDefault(require("./actions/create/action"));
8
- const AppleTeamMutation_1 = require("../credentials/ios/api/graphql/mutations/AppleTeamMutation");
9
- const AppleTeamQuery_1 = require("../credentials/ios/api/graphql/queries/AppleTeamQuery");
8
+ const GraphqlClient_1 = require("../credentials/ios/api/GraphqlClient");
10
9
  const log_1 = tslib_1.__importDefault(require("../log"));
11
10
  const projectUtils_1 = require("../project/projectUtils");
12
11
  const prompts_1 = require("../prompts");
@@ -27,7 +26,7 @@ class DeviceManager {
27
26
  log_1.default.addNewLineIfNone();
28
27
  const account = await this.resolveAccountAsync();
29
28
  const appleAuthCtx = await this.ctx.appStore.ensureAuthenticatedAsync();
30
- const appleTeam = await ensureAppleTeamExistsAsync(this.ctx.graphqlClient, account.id, {
29
+ const appleTeam = await (0, GraphqlClient_1.createOrGetExistingAppleTeamAndUpdateNameIfChangedAsync)(this.ctx.graphqlClient, account.id, {
31
30
  appleTeamIdentifier: appleAuthCtx.team.id,
32
31
  appleTeamName: appleAuthCtx.team.name,
33
32
  });
@@ -81,15 +80,3 @@ class AccountResolver {
81
80
  }
82
81
  }
83
82
  exports.AccountResolver = AccountResolver;
84
- async function ensureAppleTeamExistsAsync(graphqlClient, accountId, { appleTeamIdentifier, appleTeamName }) {
85
- const appleTeam = await AppleTeamQuery_1.AppleTeamQuery.getByAppleTeamIdentifierAsync(graphqlClient, accountId, appleTeamIdentifier);
86
- if (appleTeam) {
87
- return appleTeam;
88
- }
89
- else {
90
- return await AppleTeamMutation_1.AppleTeamMutation.createAppleTeamAsync(graphqlClient, {
91
- appleTeamIdentifier,
92
- appleTeamName,
93
- }, accountId);
94
- }
95
- }