eas-cli 2.0.0 → 2.2.0

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 (321) hide show
  1. package/README.md +8 -1034
  2. package/build/branch/queries.d.ts +10 -2
  3. package/build/branch/queries.js +27 -24
  4. package/build/branch/utils.d.ts +4 -0
  5. package/build/branch/utils.js +15 -0
  6. package/build/build/android/build.js +3 -3
  7. package/build/build/android/graphql.js +2 -1
  8. package/build/build/android/prepareJob.js +4 -3
  9. package/build/build/android/syncProjectConfiguration.d.ts +2 -1
  10. package/build/build/android/syncProjectConfiguration.js +2 -2
  11. package/build/build/build.js +15 -4
  12. package/build/build/configure.js +2 -2
  13. package/build/build/createContext.d.ts +5 -1
  14. package/build/build/createContext.js +8 -14
  15. package/build/build/ios/build.js +2 -1
  16. package/build/build/ios/credentials.js +1 -1
  17. package/build/build/ios/graphql.js +2 -1
  18. package/build/build/ios/prepareJob.js +4 -3
  19. package/build/build/ios/syncProjectConfiguration.d.ts +2 -1
  20. package/build/build/ios/syncProjectConfiguration.js +2 -2
  21. package/build/build/local.js +1 -1
  22. package/build/build/metadata.js +1 -2
  23. package/build/build/queries.d.ts +9 -0
  24. package/build/build/queries.js +51 -0
  25. package/build/build/runBuildAndSubmit.d.ts +3 -1
  26. package/build/build/runBuildAndSubmit.js +15 -7
  27. package/build/build/utils/repository.js +5 -1
  28. package/build/channel/queries.d.ts +17 -0
  29. package/build/channel/queries.js +137 -0
  30. package/build/channel/utils.d.ts +22 -0
  31. package/build/channel/utils.js +87 -0
  32. package/build/commandUtils/EasCommand.d.ts +68 -7
  33. package/build/commandUtils/EasCommand.js +60 -79
  34. package/build/commandUtils/context/ActorContextField.d.ts +5 -0
  35. package/build/commandUtils/context/ActorContextField.js +11 -0
  36. package/build/commandUtils/context/ContextField.d.ts +6 -0
  37. package/build/commandUtils/context/ContextField.js +5 -0
  38. package/build/commandUtils/context/DynamicProjectConfigContextField.d.ts +11 -0
  39. package/build/commandUtils/context/DynamicProjectConfigContextField.js +27 -0
  40. package/build/commandUtils/context/OptionalProjectConfigContextField.d.ts +13 -0
  41. package/build/commandUtils/context/OptionalProjectConfigContextField.js +37 -0
  42. package/build/commandUtils/context/ProjectConfigContextField.d.ts +13 -0
  43. package/build/commandUtils/context/ProjectConfigContextField.js +23 -0
  44. package/build/commandUtils/context/ProjectDirContextField.d.ts +4 -0
  45. package/build/commandUtils/context/ProjectDirContextField.js +11 -0
  46. package/build/commandUtils/context/contextUtils/ensureLoggedInAsync.d.ts +21 -0
  47. package/build/commandUtils/context/contextUtils/ensureLoggedInAsync.js +75 -0
  48. package/build/commandUtils/context/contextUtils/findProjectDirAndVerifyProjectSetupAsync.d.ts +17 -0
  49. package/build/commandUtils/context/contextUtils/findProjectDirAndVerifyProjectSetupAsync.js +102 -0
  50. package/build/commandUtils/context/contextUtils/getProjectIdAsync.d.ts +24 -0
  51. package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +108 -0
  52. package/build/commandUtils/flags.d.ts +10 -0
  53. package/build/commandUtils/flags.js +23 -0
  54. package/build/commandUtils/pagination.d.ts +7 -4
  55. package/build/commandUtils/pagination.js +11 -15
  56. package/build/commands/account/login.d.ts +0 -2
  57. package/build/commands/account/login.js +2 -7
  58. package/build/commands/account/logout.d.ts +0 -2
  59. package/build/commands/account/logout.js +0 -5
  60. package/build/commands/account/view.d.ts +0 -2
  61. package/build/commands/account/view.js +0 -5
  62. package/build/commands/analytics.d.ts +0 -1
  63. package/build/commands/analytics.js +0 -4
  64. package/build/commands/branch/create.d.ts +4 -0
  65. package/build/commands/branch/create.js +18 -18
  66. package/build/commands/branch/delete.d.ts +4 -0
  67. package/build/commands/branch/delete.js +29 -26
  68. package/build/commands/branch/list.d.ts +5 -2
  69. package/build/commands/branch/list.js +13 -8
  70. package/build/commands/branch/rename.d.ts +5 -1
  71. package/build/commands/branch/rename.js +15 -13
  72. package/build/commands/branch/view.d.ts +5 -2
  73. package/build/commands/branch/view.js +31 -13
  74. package/build/commands/build/cancel.d.ts +7 -0
  75. package/build/commands/build/cancel.js +50 -23
  76. package/build/commands/build/configure.d.ts +3 -0
  77. package/build/commands/build/configure.js +12 -7
  78. package/build/commands/build/index.d.ts +7 -2
  79. package/build/commands/build/index.js +77 -15
  80. package/build/commands/build/inspect.d.ts +5 -0
  81. package/build/commands/build/inspect.js +12 -3
  82. package/build/commands/build/list.d.ts +7 -2
  83. package/build/commands/build/list.js +36 -59
  84. package/build/commands/build/version/set.d.ts +5 -0
  85. package/build/commands/build/version/set.js +22 -14
  86. package/build/commands/build/version/sync.d.ts +5 -0
  87. package/build/commands/build/version/sync.js +22 -13
  88. package/build/commands/build/view.d.ts +3 -0
  89. package/build/commands/build/view.js +20 -14
  90. package/build/commands/channel/create.d.ts +4 -0
  91. package/build/commands/channel/create.js +32 -25
  92. package/build/commands/channel/delete.d.ts +3 -0
  93. package/build/commands/channel/delete.js +36 -59
  94. package/build/commands/channel/edit.d.ts +7 -7
  95. package/build/commands/channel/edit.js +39 -72
  96. package/build/commands/channel/list.d.ts +6 -0
  97. package/build/commands/channel/list.js +20 -76
  98. package/build/commands/channel/rollout.d.ts +5 -1
  99. package/build/commands/channel/rollout.js +34 -35
  100. package/build/commands/channel/view.d.ts +6 -33
  101. package/build/commands/channel/view.js +31 -132
  102. package/build/commands/config.d.ts +6 -2
  103. package/build/commands/config.js +22 -13
  104. package/build/commands/credentials.d.ts +4 -0
  105. package/build/commands/credentials.js +10 -1
  106. package/build/commands/device/create.d.ts +4 -0
  107. package/build/commands/device/create.js +15 -3
  108. package/build/commands/device/delete.d.ts +13 -8
  109. package/build/commands/device/delete.js +81 -129
  110. package/build/commands/device/list.d.ts +7 -0
  111. package/build/commands/device/list.js +42 -63
  112. package/build/commands/device/view.d.ts +3 -0
  113. package/build/commands/device/view.js +10 -5
  114. package/build/commands/diagnostics.d.ts +3 -1
  115. package/build/commands/diagnostics.js +10 -8
  116. package/build/commands/metadata/pull.d.ts +4 -0
  117. package/build/commands/metadata/pull.js +13 -8
  118. package/build/commands/metadata/push.d.ts +4 -0
  119. package/build/commands/metadata/push.js +13 -8
  120. package/build/commands/open.d.ts +8 -0
  121. package/build/commands/open.js +42 -0
  122. package/build/commands/project/info.d.ts +3 -0
  123. package/build/commands/project/info.js +9 -6
  124. package/build/commands/project/init.d.ts +12 -0
  125. package/build/commands/project/init.js +155 -8
  126. package/build/commands/secret/create.d.ts +6 -0
  127. package/build/commands/secret/create.js +87 -30
  128. package/build/commands/secret/delete.d.ts +4 -0
  129. package/build/commands/secret/delete.js +28 -19
  130. package/build/commands/secret/list.d.ts +3 -0
  131. package/build/commands/secret/list.js +19 -13
  132. package/build/commands/submit.d.ts +5 -0
  133. package/build/commands/submit.js +16 -7
  134. package/build/commands/update/configure.d.ts +3 -0
  135. package/build/commands/update/configure.js +24 -18
  136. package/build/commands/update/delete.d.ts +1 -0
  137. package/build/commands/update/delete.js +5 -8
  138. package/build/commands/update/index.d.ts +8 -12
  139. package/build/commands/update/index.js +90 -166
  140. package/build/commands/update/list.d.ts +8 -2
  141. package/build/commands/update/list.js +51 -81
  142. package/build/commands/update/view.d.ts +0 -4
  143. package/build/commands/update/view.js +14 -51
  144. package/build/commands/webhook/create.d.ts +4 -0
  145. package/build/commands/webhook/create.js +10 -5
  146. package/build/commands/webhook/delete.d.ts +6 -0
  147. package/build/commands/webhook/delete.js +26 -14
  148. package/build/commands/webhook/list.d.ts +3 -0
  149. package/build/commands/webhook/list.js +13 -9
  150. package/build/commands/webhook/update.d.ts +1 -0
  151. package/build/commands/webhook/update.js +3 -1
  152. package/build/credentials/android/actions/BuildCredentialsUtils.js +2 -6
  153. package/build/credentials/android/actions/CreateFcm.d.ts +2 -3
  154. package/build/credentials/android/actions/CreateGoogleServiceAccountKey.d.ts +2 -3
  155. package/build/credentials/android/actions/CreateKeystore.d.ts +2 -3
  156. package/build/credentials/android/actions/CreateKeystore.js +1 -2
  157. package/build/credentials/android/actions/RemoveGoogleServiceAccountKey.d.ts +2 -3
  158. package/build/credentials/android/actions/UseExistingGoogleServiceAccountKey.d.ts +2 -3
  159. package/build/credentials/android/api/GraphqlClient.d.ts +6 -7
  160. package/build/credentials/context.d.ts +8 -4
  161. package/build/credentials/context.js +8 -23
  162. package/build/credentials/ios/IosCredentialsProvider.js +11 -6
  163. package/build/credentials/ios/actions/AppleTeamFormatting.d.ts +2 -0
  164. package/build/credentials/ios/actions/AppleTeamFormatting.js +7 -0
  165. package/build/credentials/ios/actions/AppleTeamUtils.d.ts +1 -2
  166. package/build/credentials/ios/actions/AppleTeamUtils.js +1 -5
  167. package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +3 -4
  168. package/build/credentials/ios/actions/AscApiKeyUtils.js +2 -2
  169. package/build/credentials/ios/actions/AssignAscApiKey.d.ts +1 -1
  170. package/build/credentials/ios/actions/AssignPushKey.d.ts +1 -1
  171. package/build/credentials/ios/actions/BuildCredentialsUtils.d.ts +3 -3
  172. package/build/credentials/ios/actions/BuildCredentialsUtils.js +8 -12
  173. package/build/credentials/ios/actions/ConfigureProvisioningProfile.d.ts +4 -2
  174. package/build/credentials/ios/actions/ConfigureProvisioningProfile.js +5 -2
  175. package/build/credentials/ios/actions/CreateAscApiKey.d.ts +2 -3
  176. package/build/credentials/ios/actions/CreateDistributionCertificate.d.ts +2 -2
  177. package/build/credentials/ios/actions/CreateProvisioningProfile.d.ts +4 -2
  178. package/build/credentials/ios/actions/CreateProvisioningProfile.js +3 -2
  179. package/build/credentials/ios/actions/CreatePushKey.d.ts +2 -3
  180. package/build/credentials/ios/actions/DeviceUtils.d.ts +0 -1
  181. package/build/credentials/ios/actions/DeviceUtils.js +3 -19
  182. package/build/credentials/ios/actions/DistributionCertificateUtils.d.ts +3 -4
  183. package/build/credentials/ios/actions/DistributionCertificateUtils.js +2 -2
  184. package/build/credentials/ios/actions/ProvisioningProfileUtils.d.ts +2 -1
  185. package/build/credentials/ios/actions/ProvisioningProfileUtils.js +4 -2
  186. package/build/credentials/ios/actions/PushKeyUtils.d.ts +2 -3
  187. package/build/credentials/ios/actions/PushKeyUtils.js +2 -2
  188. package/build/credentials/ios/actions/RemoveAscApiKey.d.ts +2 -3
  189. package/build/credentials/ios/actions/RemoveDistributionCertificate.d.ts +3 -4
  190. package/build/credentials/ios/actions/RemoveProvisioningProfile.d.ts +1 -1
  191. package/build/credentials/ios/actions/RemovePushKey.d.ts +2 -3
  192. package/build/credentials/ios/actions/SetUpAdhocProvisioningProfile.d.ts +9 -3
  193. package/build/credentials/ios/actions/SetUpAdhocProvisioningProfile.js +30 -18
  194. package/build/credentials/ios/actions/SetUpAscApiKey.d.ts +1 -1
  195. package/build/credentials/ios/actions/SetUpBuildCredentials.js +1 -0
  196. package/build/credentials/ios/actions/SetUpDistributionCertificate.d.ts +1 -1
  197. package/build/credentials/ios/actions/SetUpInternalProvisioningProfile.d.ts +9 -3
  198. package/build/credentials/ios/actions/SetUpInternalProvisioningProfile.js +6 -12
  199. package/build/credentials/ios/actions/SetUpProvisioningProfile.d.ts +4 -2
  200. package/build/credentials/ios/actions/SetUpProvisioningProfile.js +8 -5
  201. package/build/credentials/ios/actions/SetUpPushKey.d.ts +1 -1
  202. package/build/credentials/ios/actions/SetUpSubmissionCredentials.d.ts +1 -1
  203. package/build/credentials/ios/actions/SetUpTargetBuildCredentials.d.ts +3 -1
  204. package/build/credentials/ios/actions/SetUpTargetBuildCredentials.js +5 -5
  205. package/build/credentials/ios/actions/SetUpTargetBuildCredentialsFromCredentialsJson.d.ts +1 -1
  206. package/build/credentials/ios/api/GraphqlClient.d.ts +9 -15
  207. package/build/credentials/ios/api/graphql/mutations/AppleTeamMutation.d.ts +2 -3
  208. package/build/credentials/ios/api/graphql/mutations/AppleTeamMutation.js +3 -1
  209. package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.d.ts +3 -3
  210. package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +20 -6
  211. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.d.ts +2 -2
  212. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +8 -7
  213. package/build/credentials/ios/api/graphql/types/AppLookupParams.d.ts +7 -0
  214. package/build/credentials/ios/api/graphql/types/AppLookupParams.js +2 -0
  215. package/build/credentials/ios/appstore/AppStoreApi.d.ts +7 -4
  216. package/build/credentials/ios/appstore/AppStoreApi.js +8 -8
  217. package/build/credentials/ios/appstore/Credentials.types.d.ts +0 -14
  218. package/build/credentials/ios/appstore/Credentials.types.js +0 -6
  219. package/build/credentials/ios/appstore/constants.d.ts +1 -0
  220. package/build/credentials/ios/appstore/constants.js +6 -0
  221. package/build/credentials/ios/appstore/distributionCertificate.js +1 -1
  222. package/build/credentials/ios/appstore/provisioningProfile.d.ts +5 -3
  223. package/build/credentials/ios/appstore/provisioningProfile.js +30 -7
  224. package/build/credentials/ios/appstore/provisioningProfileAdhoc.d.ts +3 -1
  225. package/build/credentials/ios/appstore/provisioningProfileAdhoc.js +10 -10
  226. package/build/credentials/ios/types.d.ts +2 -3
  227. package/build/credentials/ios/utils/printCredentials.d.ts +1 -1
  228. package/build/credentials/ios/validators/validateProvisioningProfile.d.ts +3 -2
  229. package/build/credentials/ios/validators/validateProvisioningProfile.js +6 -4
  230. package/build/credentials/manager/HelperActions.d.ts +4 -1
  231. package/build/credentials/manager/ManageAndroid.js +4 -14
  232. package/build/credentials/manager/ManageIos.js +20 -20
  233. package/build/credentials/manager/SelectBuildProfileFromEasJson.d.ts +1 -1
  234. package/build/credentials/manager/SelectBuildProfileFromEasJson.js +3 -3
  235. package/build/credentials/manager/SelectPlatform.d.ts +5 -1
  236. package/build/credentials/manager/SelectPlatform.js +5 -3
  237. package/build/devices/actions/create/action.d.ts +2 -3
  238. package/build/devices/actions/create/developerPortalMethod.js +2 -2
  239. package/build/devices/context.d.ts +3 -5
  240. package/build/devices/context.js +2 -11
  241. package/build/devices/manager.d.ts +4 -5
  242. package/build/devices/manager.js +9 -16
  243. package/build/devices/queries.d.ts +21 -0
  244. package/build/devices/queries.js +121 -0
  245. package/build/devices/utils/errors.d.ts +3 -0
  246. package/build/devices/utils/errors.js +9 -0
  247. package/build/devices/utils/formatDevice.d.ts +3 -3
  248. package/build/devices/utils/formatDevice.js +8 -3
  249. package/build/graphql/generated.d.ts +1141 -192
  250. package/build/graphql/generated.js +13 -2
  251. package/build/graphql/mutations/EnvironmentSecretMutation.d.ts +3 -1
  252. package/build/graphql/queries/AppQuery.d.ts +1 -0
  253. package/build/graphql/queries/AppQuery.js +19 -0
  254. package/build/graphql/queries/BranchQuery.d.ts +5 -6
  255. package/build/graphql/queries/BranchQuery.js +44 -3
  256. package/build/graphql/queries/BuildQuery.d.ts +2 -20
  257. package/build/graphql/queries/BuildQuery.js +2 -2
  258. package/build/graphql/queries/ChannelQuery.d.ts +5 -2
  259. package/build/graphql/queries/ChannelQuery.js +45 -19
  260. package/build/graphql/queries/EnvironmentSecretsQuery.d.ts +5 -3
  261. package/build/graphql/queries/EnvironmentSecretsQuery.js +14 -28
  262. package/build/graphql/queries/UpdateQuery.d.ts +4 -6
  263. package/build/graphql/queries/UpdateQuery.js +59 -50
  264. package/build/graphql/queries/UserQuery.js +8 -1
  265. package/build/graphql/types/Account.d.ts +1 -0
  266. package/build/graphql/types/Account.js +17 -0
  267. package/build/graphql/types/App.js +7 -0
  268. package/build/graphql/types/EnvironmentSecret.d.ts +7 -0
  269. package/build/graphql/types/EnvironmentSecret.js +16 -1
  270. package/build/graphql/types/Update.d.ts +1 -0
  271. package/build/graphql/types/Update.js +30 -0
  272. package/build/graphql/types/UpdateBranch.js +4 -15
  273. package/build/metadata/context.d.ts +1 -1
  274. package/build/metadata/context.js +7 -9
  275. package/build/project/android/applicationId.d.ts +2 -1
  276. package/build/project/android/applicationId.js +7 -7
  277. package/build/project/android/versions.js +1 -1
  278. package/build/project/applicationIdentifier.d.ts +2 -1
  279. package/build/project/applicationIdentifier.js +2 -2
  280. package/build/project/expoConfig.d.ts +3 -3
  281. package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.d.ts +22 -0
  282. package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +93 -0
  283. package/build/project/ios/bundleIdentifier.d.ts +2 -1
  284. package/build/project/ios/bundleIdentifier.js +7 -7
  285. package/build/project/ios/scheme.d.ts +1 -1
  286. package/build/project/ios/target.d.ts +7 -0
  287. package/build/project/ios/target.js +26 -1
  288. package/build/project/projectUtils.d.ts +4 -31
  289. package/build/project/projectUtils.js +13 -123
  290. package/build/project/remoteVersionSource.d.ts +2 -2
  291. package/build/project/remoteVersionSource.js +8 -7
  292. package/build/project/workflow.js +3 -1
  293. package/build/submit/android/ServiceAccountSource.js +1 -2
  294. package/build/submit/context.d.ts +3 -1
  295. package/build/submit/context.js +12 -14
  296. package/build/submit/ios/CredentialsServiceSource.js +1 -2
  297. package/build/submit/utils/builds.js +3 -1
  298. package/build/update/android/UpdatesModule.d.ts +1 -1
  299. package/build/update/android/UpdatesModule.js +2 -3
  300. package/build/update/ios/UpdatesModule.d.ts +1 -1
  301. package/build/update/ios/UpdatesModule.js +2 -3
  302. package/build/update/queries.d.ts +16 -1
  303. package/build/update/queries.js +96 -30
  304. package/build/update/utils.d.ts +21 -8
  305. package/build/update/utils.js +75 -14
  306. package/build/user/actions.d.ts +2 -8
  307. package/build/user/actions.js +4 -63
  308. package/build/utils/profiles.d.ts +3 -3
  309. package/build/utils/profiles.js +6 -5
  310. package/build/vcs/clients/git.d.ts +1 -1
  311. package/build/vcs/clients/git.js +5 -2
  312. package/build/vcs/clients/gitNoCommit.js +2 -1
  313. package/build/vcs/vcs.d.ts +1 -1
  314. package/build/webhooks/input.d.ts +2 -1
  315. package/build/webhooks/input.js +10 -1
  316. package/oclif.manifest.json +1 -1
  317. package/package.json +6 -5
  318. package/build/project/ensureProjectExists.d.ts +0 -21
  319. package/build/project/ensureProjectExists.js +0 -88
  320. package/build/user/Account.d.ts +0 -3
  321. package/build/user/Account.js +0 -7
@@ -2,15 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doUDIDsMatch = exports.SetUpAdhocProvisioningProfile = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const apple_utils_1 = require("@expo/apple-utils");
5
6
  const assert_1 = tslib_1.__importDefault(require("assert"));
6
7
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
8
  const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
8
9
  const action_1 = tslib_1.__importStar(require("../../../devices/actions/create/action"));
9
10
  const generated_1 = require("../../../graphql/generated");
10
11
  const log_1 = tslib_1.__importDefault(require("../../../log"));
12
+ const target_1 = require("../../../project/ios/target");
11
13
  const prompts_1 = require("../../../prompts");
12
14
  const differenceBy_1 = tslib_1.__importDefault(require("../../../utils/expodash/differenceBy"));
13
15
  const errors_1 = require("../../errors");
16
+ const constants_1 = require("../appstore/constants");
14
17
  const validateProvisioningProfile_1 = require("../validators/validateProvisioningProfile");
15
18
  const AppleTeamUtils_1 = require("./AppleTeamUtils");
16
19
  const BuildCredentialsUtils_1 = require("./BuildCredentialsUtils");
@@ -23,21 +26,22 @@ var ReuseAction;
23
26
  ReuseAction[ReuseAction["No"] = 2] = "No";
24
27
  })(ReuseAction || (ReuseAction = {}));
25
28
  class SetUpAdhocProvisioningProfile {
26
- constructor(app) {
27
- this.app = app;
29
+ constructor(options) {
30
+ this.options = options;
28
31
  }
29
32
  async runAsync(ctx) {
30
- const distCert = await new SetUpDistributionCertificate_1.SetUpDistributionCertificate(this.app, generated_1.IosDistributionType.AdHoc).runAsync(ctx);
33
+ const { app } = this.options;
34
+ const distCert = await new SetUpDistributionCertificate_1.SetUpDistributionCertificate(app, generated_1.IosDistributionType.AdHoc).runAsync(ctx);
31
35
  const areBuildCredentialsSetup = await this.areBuildCredentialsSetupAsync(ctx);
32
36
  if (ctx.nonInteractive) {
33
37
  if (areBuildCredentialsSetup) {
34
- return (0, nullthrows_1.default)(await (0, BuildCredentialsUtils_1.getBuildCredentialsAsync)(ctx, this.app, generated_1.IosDistributionType.AdHoc));
38
+ return (0, nullthrows_1.default)(await (0, BuildCredentialsUtils_1.getBuildCredentialsAsync)(ctx, app, generated_1.IosDistributionType.AdHoc));
35
39
  }
36
40
  else {
37
41
  throw new errors_1.MissingCredentialsNonInteractiveError('Provisioning profile is not configured correctly. Run this command again in interactive mode.');
38
42
  }
39
43
  }
40
- const currentBuildCredentials = await (0, BuildCredentialsUtils_1.getBuildCredentialsAsync)(ctx, this.app, generated_1.IosDistributionType.AdHoc);
44
+ const currentBuildCredentials = await (0, BuildCredentialsUtils_1.getBuildCredentialsAsync)(ctx, app, generated_1.IosDistributionType.AdHoc);
41
45
  if (areBuildCredentialsSetup) {
42
46
  const buildCredentials = (0, nullthrows_1.default)(currentBuildCredentials);
43
47
  if (await this.shouldUseExistingProfileAsync(ctx, buildCredentials)) {
@@ -48,16 +52,17 @@ class SetUpAdhocProvisioningProfile {
48
52
  }
49
53
  async runWithDistributionCertificateAsync(ctx, distCert) {
50
54
  var _a, _b, _c, _d, _e;
51
- const currentBuildCredentials = await (0, BuildCredentialsUtils_1.getBuildCredentialsAsync)(ctx, this.app, generated_1.IosDistributionType.AdHoc);
55
+ const { app, target } = this.options;
56
+ const currentBuildCredentials = await (0, BuildCredentialsUtils_1.getBuildCredentialsAsync)(ctx, app, generated_1.IosDistributionType.AdHoc);
52
57
  // 1. Resolve Apple Team
53
58
  let appleTeam = (_c = (_a = distCert.appleTeam) !== null && _a !== void 0 ? _a : (_b = currentBuildCredentials === null || currentBuildCredentials === void 0 ? void 0 : currentBuildCredentials.provisioningProfile) === null || _b === void 0 ? void 0 : _b.appleTeam) !== null && _c !== void 0 ? _c : null;
54
59
  if (!appleTeam) {
55
60
  await ctx.appStore.ensureAuthenticatedAsync();
56
- appleTeam = await (0, AppleTeamUtils_1.resolveAppleTeamIfAuthenticatedAsync)(ctx, this.app);
61
+ appleTeam = await (0, AppleTeamUtils_1.resolveAppleTeamIfAuthenticatedAsync)(ctx, app);
57
62
  }
58
63
  (0, assert_1.default)(appleTeam, 'Apple Team must be defined here');
59
64
  // 2. Fetch devices registered on EAS servers
60
- let registeredAppleDevices = await ctx.ios.getDevicesForAppleTeamAsync(this.app, appleTeam);
65
+ let registeredAppleDevices = await ctx.ios.getDevicesForAppleTeamAsync(app, appleTeam);
61
66
  if (registeredAppleDevices.length === 0) {
62
67
  const shouldRegisterDevices = await (0, prompts_1.confirmAsync)({
63
68
  message: `You don't have any registered devices yet. Would you like to register them now?`,
@@ -74,9 +79,13 @@ class SetUpAdhocProvisioningProfile {
74
79
  const provisionedDeviceIdentifiers = ((_e = (_d = currentBuildCredentials === null || currentBuildCredentials === void 0 ? void 0 : currentBuildCredentials.provisioningProfile) === null || _d === void 0 ? void 0 : _d.appleDevices) !== null && _e !== void 0 ? _e : []).map(i => i.identifier);
75
80
  const chosenDevices = await (0, DeviceUtils_1.chooseDevicesAsync)(registeredAppleDevices, provisionedDeviceIdentifiers);
76
81
  // 4. Reuse or create the profile on Apple Developer Portal
77
- const provisioningProfileStoreInfo = await ctx.appStore.createOrReuseAdhocProvisioningProfileAsync(chosenDevices.map(({ identifier }) => identifier), this.app.bundleIdentifier, distCert.serialNumber);
82
+ const applePlatform = await (0, target_1.getApplePlatformFromSdkRoot)(target);
83
+ const profileType = applePlatform === constants_1.ApplePlatform.TV_OS
84
+ ? apple_utils_1.ProfileType.TVOS_APP_ADHOC
85
+ : apple_utils_1.ProfileType.IOS_APP_ADHOC;
86
+ const provisioningProfileStoreInfo = await ctx.appStore.createOrReuseAdhocProvisioningProfileAsync(chosenDevices.map(({ identifier }) => identifier), app.bundleIdentifier, distCert.serialNumber, profileType);
78
87
  // 5. Create or update the profile on servers
79
- const appleAppIdentifier = await ctx.ios.createOrGetExistingAppleAppIdentifierAsync(this.app, appleTeam);
88
+ const appleAppIdentifier = await ctx.ios.createOrGetExistingAppleAppIdentifierAsync(app, appleTeam);
80
89
  let appleProvisioningProfile = null;
81
90
  if (currentBuildCredentials === null || currentBuildCredentials === void 0 ? void 0 : currentBuildCredentials.provisioningProfile) {
82
91
  if (currentBuildCredentials.provisioningProfile.developerPortalIdentifier !==
@@ -84,7 +93,7 @@ class SetUpAdhocProvisioningProfile {
84
93
  await ctx.ios.deleteProvisioningProfilesAsync([
85
94
  currentBuildCredentials.provisioningProfile.id,
86
95
  ]);
87
- appleProvisioningProfile = await ctx.ios.createProvisioningProfileAsync(this.app, appleAppIdentifier, {
96
+ appleProvisioningProfile = await ctx.ios.createProvisioningProfileAsync(app, appleAppIdentifier, {
88
97
  appleProvisioningProfile: provisioningProfileStoreInfo.provisioningProfile,
89
98
  developerPortalIdentifier: provisioningProfileStoreInfo.provisioningProfileId,
90
99
  });
@@ -94,23 +103,25 @@ class SetUpAdhocProvisioningProfile {
94
103
  }
95
104
  }
96
105
  else {
97
- appleProvisioningProfile = await ctx.ios.createProvisioningProfileAsync(this.app, appleAppIdentifier, {
106
+ appleProvisioningProfile = await ctx.ios.createProvisioningProfileAsync(app, appleAppIdentifier, {
98
107
  appleProvisioningProfile: provisioningProfileStoreInfo.provisioningProfile,
99
108
  developerPortalIdentifier: provisioningProfileStoreInfo.provisioningProfileId,
100
109
  });
101
110
  }
102
111
  // 6. Create (or update) app build credentials
103
112
  (0, assert_1.default)(appleProvisioningProfile);
104
- return await (0, BuildCredentialsUtils_1.assignBuildCredentialsAsync)(ctx, this.app, generated_1.IosDistributionType.AdHoc, distCert, appleProvisioningProfile, appleTeam);
113
+ return await (0, BuildCredentialsUtils_1.assignBuildCredentialsAsync)(ctx, app, generated_1.IosDistributionType.AdHoc, distCert, appleProvisioningProfile, appleTeam);
105
114
  }
106
115
  async areBuildCredentialsSetupAsync(ctx) {
107
- const buildCredentials = await (0, BuildCredentialsUtils_1.getBuildCredentialsAsync)(ctx, this.app, generated_1.IosDistributionType.AdHoc);
108
- return await (0, validateProvisioningProfile_1.validateProvisioningProfileAsync)(ctx, this.app, buildCredentials);
116
+ const { app, target } = this.options;
117
+ const buildCredentials = await (0, BuildCredentialsUtils_1.getBuildCredentialsAsync)(ctx, app, generated_1.IosDistributionType.AdHoc);
118
+ return await (0, validateProvisioningProfile_1.validateProvisioningProfileAsync)(ctx, target, app, buildCredentials);
109
119
  }
110
120
  async shouldUseExistingProfileAsync(ctx, buildCredentials) {
121
+ const { app } = this.options;
111
122
  const provisioningProfile = (0, nullthrows_1.default)(buildCredentials.provisioningProfile);
112
123
  const appleTeam = (0, nullthrows_1.default)(provisioningProfile.appleTeam);
113
- const registeredAppleDevices = await ctx.ios.getDevicesForAppleTeamAsync(this.app, appleTeam);
124
+ const registeredAppleDevices = await ctx.ios.getDevicesForAppleTeamAsync(app, appleTeam);
114
125
  const provisionedDevices = provisioningProfile.appleDevices;
115
126
  const allRegisteredDevicesAreProvisioned = doUDIDsMatch(registeredAppleDevices.map(({ identifier }) => identifier), provisionedDevices.map(({ identifier }) => identifier));
116
127
  if (allRegisteredDevicesAreProvisioned) {
@@ -170,7 +181,8 @@ class SetUpAdhocProvisioningProfile {
170
181
  return selected;
171
182
  }
172
183
  async registerDevicesAsync(ctx, appleTeam) {
173
- const action = new action_1.default(ctx.appStore, this.app.account, appleTeam);
184
+ const { app } = this.options;
185
+ const action = new action_1.default(ctx.appStore, app.account, appleTeam);
174
186
  const method = await action.runAsync();
175
187
  while (true) {
176
188
  if (method === action_1.RegistrationMethod.WEBSITE) {
@@ -179,7 +191,7 @@ class SetUpAdhocProvisioningProfile {
179
191
  await (0, prompts_1.pressAnyKeyToContinueAsync)();
180
192
  }
181
193
  log_1.default.newLine();
182
- const devices = await ctx.ios.getDevicesForAppleTeamAsync(this.app, appleTeam, {
194
+ const devices = await ctx.ios.getDevicesForAppleTeamAsync(app, appleTeam, {
183
195
  useCache: false,
184
196
  });
185
197
  if (devices.length === 0) {
@@ -1,6 +1,6 @@
1
1
  import { CommonIosAppCredentialsFragment } from '../../../graphql/generated';
2
2
  import { CredentialsContext } from '../../context';
3
- import { AppLookupParams } from '../api/GraphqlClient';
3
+ import { AppLookupParams } from '../api/graphql/types/AppLookupParams';
4
4
  import { AppStoreApiKeyPurpose } from './AscApiKeyUtils';
5
5
  export declare enum SetupAscApiKeyChoice {
6
6
  GENERATE = "GENERATE",
@@ -39,6 +39,7 @@ class SetUpBuildCredentials {
39
39
  enterpriseProvisioning: this.options.enterpriseProvisioning,
40
40
  distribution: this.options.distribution,
41
41
  entitlements: target.entitlements,
42
+ target,
42
43
  app: {
43
44
  ...this.options.app,
44
45
  bundleIdentifier: target.bundleIdentifier,
@@ -1,6 +1,6 @@
1
1
  import { AppleDistributionCertificate, AppleDistributionCertificateFragment, IosDistributionType } from '../../../graphql/generated';
2
2
  import { CredentialsContext } from '../../context';
3
- import { AppLookupParams } from '../api/GraphqlClient';
3
+ import { AppLookupParams } from '../api/graphql/types/AppLookupParams';
4
4
  export declare class SetUpDistributionCertificate {
5
5
  private app;
6
6
  private distributionType;
@@ -1,6 +1,7 @@
1
1
  import { IosAppBuildCredentialsFragment } from '../../../graphql/generated';
2
2
  import { CredentialsContext } from '../../context';
3
- import { AppLookupParams } from '../api/GraphqlClient';
3
+ import { AppLookupParams } from '../api/graphql/types/AppLookupParams';
4
+ import { Target } from '../types';
4
5
  /**
5
6
  * It's used when setting up credentials for internal distribution but `enterpriseProvisioning` is not set.
6
7
  *
@@ -8,11 +9,16 @@ import { AppLookupParams } from '../api/GraphqlClient';
8
9
  * to choose if they want to set up an adhoc or universal distribution provisioning profile. Otherwise, always
9
10
  * set up an adhoc provisioning profile.
10
11
  */
12
+ interface Options {
13
+ app: AppLookupParams;
14
+ target: Target;
15
+ }
11
16
  export declare class SetUpInternalProvisioningProfile {
12
- private app;
13
- constructor(app: AppLookupParams);
17
+ private options;
18
+ constructor(options: Options);
14
19
  runAsync(ctx: CredentialsContext): Promise<IosAppBuildCredentialsFragment>;
15
20
  private setupAdhocProvisioningProfileAsync;
16
21
  private setupUniversalProvisioningProfileAsync;
17
22
  private askForDistributionTypeAndSetupAsync;
18
23
  }
24
+ export {};
@@ -8,19 +8,12 @@ const prompts_1 = require("../../../prompts");
8
8
  const BuildCredentialsUtils_1 = require("./BuildCredentialsUtils");
9
9
  const SetUpAdhocProvisioningProfile_1 = require("./SetUpAdhocProvisioningProfile");
10
10
  const SetUpProvisioningProfile_1 = require("./SetUpProvisioningProfile");
11
- /**
12
- * It's used when setting up credentials for internal distribution but `enterpriseProvisioning` is not set.
13
- *
14
- * TLDR: If the user authenticates with an account with Apple Developer Enterprise Program membership we ask them
15
- * to choose if they want to set up an adhoc or universal distribution provisioning profile. Otherwise, always
16
- * set up an adhoc provisioning profile.
17
- */
18
11
  class SetUpInternalProvisioningProfile {
19
- constructor(app) {
20
- this.app = app;
12
+ constructor(options) {
13
+ this.options = options;
21
14
  }
22
15
  async runAsync(ctx) {
23
- const buildCredentials = await (0, BuildCredentialsUtils_1.getAllBuildCredentialsAsync)(ctx, this.app);
16
+ const buildCredentials = await (0, BuildCredentialsUtils_1.getAllBuildCredentialsAsync)(ctx, this.options.app);
24
17
  const adhocBuildCredentialsExist = buildCredentials.filter(({ iosDistributionType }) => iosDistributionType === generated_1.IosDistributionType.AdHoc).length > 0;
25
18
  const enterpriseBuildCredentialsExist = buildCredentials.filter(({ iosDistributionType }) => iosDistributionType === generated_1.IosDistributionType.Enterprise).length > 0;
26
19
  if (!ctx.nonInteractive) {
@@ -73,10 +66,11 @@ class SetUpInternalProvisioningProfile {
73
66
  }
74
67
  }
75
68
  async setupAdhocProvisioningProfileAsync(ctx) {
76
- return await new SetUpAdhocProvisioningProfile_1.SetUpAdhocProvisioningProfile(this.app).runAsync(ctx);
69
+ const { app, target } = this.options;
70
+ return await new SetUpAdhocProvisioningProfile_1.SetUpAdhocProvisioningProfile({ app, target }).runAsync(ctx);
77
71
  }
78
72
  async setupUniversalProvisioningProfileAsync(ctx) {
79
- return await new SetUpProvisioningProfile_1.SetUpProvisioningProfile(this.app, generated_1.IosDistributionType.Enterprise).runAsync(ctx);
73
+ return await new SetUpProvisioningProfile_1.SetUpProvisioningProfile(this.options.app, this.options.target, generated_1.IosDistributionType.Enterprise).runAsync(ctx);
80
74
  }
81
75
  async askForDistributionTypeAndSetupAsync(ctx, message) {
82
76
  const { distributionType } = await (0, prompts_1.promptAsync)({
@@ -1,13 +1,15 @@
1
1
  import { AppleDistributionCertificateFragment, AppleProvisioningProfileFragment, IosAppBuildCredentialsFragment, IosDistributionType } from '../../../graphql/generated';
2
2
  import { CredentialsContext } from '../../context';
3
- import { AppLookupParams } from '../api/GraphqlClient';
3
+ import { AppLookupParams } from '../api/graphql/types/AppLookupParams';
4
+ import { Target } from '../types';
4
5
  /**
5
6
  * Sets up either APP_STORE or ENTERPRISE provisioning profiles
6
7
  */
7
8
  export declare class SetUpProvisioningProfile {
8
9
  private app;
10
+ private target;
9
11
  private distributionType;
10
- constructor(app: AppLookupParams, distributionType: IosDistributionType);
12
+ constructor(app: AppLookupParams, target: Target, distributionType: IosDistributionType);
11
13
  areBuildCredentialsSetupAsync(ctx: CredentialsContext): Promise<boolean>;
12
14
  assignNewAndDeleteOldProfileAsync(ctx: CredentialsContext, distCert: AppleDistributionCertificateFragment, currentProfile: AppleProvisioningProfileFragment): Promise<IosAppBuildCredentialsFragment>;
13
15
  createAndAssignProfileAsync(ctx: CredentialsContext, distCert: AppleDistributionCertificateFragment): Promise<IosAppBuildCredentialsFragment>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SetUpProvisioningProfile = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
6
+ const target_1 = require("../../../project/ios/target");
6
7
  const prompts_1 = require("../../../prompts");
7
8
  const errors_1 = require("../../errors");
8
9
  const validateProvisioningProfile_1 = require("../validators/validateProvisioningProfile");
@@ -15,13 +16,14 @@ const SetUpDistributionCertificate_1 = require("./SetUpDistributionCertificate")
15
16
  * Sets up either APP_STORE or ENTERPRISE provisioning profiles
16
17
  */
17
18
  class SetUpProvisioningProfile {
18
- constructor(app, distributionType) {
19
+ constructor(app, target, distributionType) {
19
20
  this.app = app;
21
+ this.target = target;
20
22
  this.distributionType = distributionType;
21
23
  }
22
24
  async areBuildCredentialsSetupAsync(ctx) {
23
25
  const buildCredentials = await (0, BuildCredentialsUtils_1.getBuildCredentialsAsync)(ctx, this.app, this.distributionType);
24
- return await (0, validateProvisioningProfile_1.validateProvisioningProfileAsync)(ctx, this.app, buildCredentials);
26
+ return await (0, validateProvisioningProfile_1.validateProvisioningProfileAsync)(ctx, this.target, this.app, buildCredentials);
25
27
  }
26
28
  async assignNewAndDeleteOldProfileAsync(ctx, distCert, currentProfile) {
27
29
  const buildCredentials = await this.createAndAssignProfileAsync(ctx, distCert);
@@ -30,11 +32,11 @@ class SetUpProvisioningProfile {
30
32
  return buildCredentials;
31
33
  }
32
34
  async createAndAssignProfileAsync(ctx, distCert) {
33
- const provisioningProfile = await new CreateProvisioningProfile_1.CreateProvisioningProfile(this.app, distCert).runAsync(ctx);
35
+ const provisioningProfile = await new CreateProvisioningProfile_1.CreateProvisioningProfile(this.app, this.target, distCert).runAsync(ctx);
34
36
  return await (0, BuildCredentialsUtils_1.assignBuildCredentialsAsync)(ctx, this.app, this.distributionType, distCert, provisioningProfile);
35
37
  }
36
38
  async configureAndAssignProfileAsync(ctx, distCert, originalProvisioningProfile) {
37
- const profileConfigurator = new ConfigureProvisioningProfile_1.ConfigureProvisioningProfile(this.app, distCert, originalProvisioningProfile);
39
+ const profileConfigurator = new ConfigureProvisioningProfile_1.ConfigureProvisioningProfile(this.app, this.target, distCert, originalProvisioningProfile);
38
40
  const updatedProvisioningProfile = await profileConfigurator.runAsync(ctx);
39
41
  if (!updatedProvisioningProfile) {
40
42
  return null;
@@ -55,7 +57,8 @@ class SetUpProvisioningProfile {
55
57
  return await this.createAndAssignProfileAsync(ctx, distCert);
56
58
  }
57
59
  // See if the profile we have exists on the Apple Servers
58
- const existingProfiles = await ctx.appStore.listProvisioningProfilesAsync(this.app.bundleIdentifier);
60
+ const applePlatform = await (0, target_1.getApplePlatformFromSdkRoot)(this.target);
61
+ const existingProfiles = await ctx.appStore.listProvisioningProfilesAsync(this.app.bundleIdentifier, applePlatform);
59
62
  const currentProfileFromServer = this.getCurrentProfileStoreInfo(existingProfiles, currentProfile);
60
63
  if (!currentProfileFromServer) {
61
64
  return await this.assignNewAndDeleteOldProfileAsync(ctx, distCert, currentProfile);
@@ -1,6 +1,6 @@
1
1
  import { CommonIosAppCredentialsFragment } from '../../../graphql/generated';
2
2
  import { CredentialsContext } from '../../context';
3
- import { AppLookupParams } from '../api/GraphqlClient';
3
+ import { AppLookupParams } from '../api/graphql/types/AppLookupParams';
4
4
  export declare class SetUpPushKey {
5
5
  private app;
6
6
  constructor(app: AppLookupParams);
@@ -1,6 +1,6 @@
1
1
  import { CommonIosAppCredentialsFragment } from '../../../graphql/generated';
2
2
  import { CredentialsContext } from '../../context';
3
- import { AppLookupParams } from '../api/GraphqlClient';
3
+ import { AppLookupParams } from '../api/graphql/types/AppLookupParams';
4
4
  export declare const PROMPT_FOR_APP_SPECIFIC_PASSWORD = "PROMPT_FOR_APP_SPECIFIC_PASSWORD";
5
5
  export declare class SetUpSubmissionCredentials {
6
6
  private setupAscApiKeyAction;
@@ -2,12 +2,14 @@ import { DistributionType, IosEnterpriseProvisioning } from '@expo/eas-json';
2
2
  import { JSONObject } from '@expo/json-file';
3
3
  import { IosAppBuildCredentialsFragment } from '../../../graphql/generated';
4
4
  import { CredentialsContext } from '../../context';
5
- import { AppLookupParams as GraphQLAppLookupParams } from '../api/GraphqlClient';
5
+ import { AppLookupParams as GraphQLAppLookupParams } from '../api/graphql/types/AppLookupParams';
6
+ import { Target } from '../types';
6
7
  interface Options {
7
8
  app: GraphQLAppLookupParams;
8
9
  distribution: DistributionType;
9
10
  enterpriseProvisioning?: IosEnterpriseProvisioning;
10
11
  entitlements: JSONObject;
12
+ target: Target;
11
13
  }
12
14
  export declare class SetUpTargetBuildCredentials {
13
15
  private options;
@@ -30,20 +30,20 @@ class SetUpTargetBuildCredentials {
30
30
  }
31
31
  }
32
32
  async setupBuildCredentialsAsync(ctx) {
33
- const { app, distribution, enterpriseProvisioning } = this.options;
33
+ const { app, distribution, enterpriseProvisioning, target } = this.options;
34
34
  if (distribution === 'internal') {
35
35
  if (enterpriseProvisioning === 'adhoc') {
36
- return await new SetUpAdhocProvisioningProfile_1.SetUpAdhocProvisioningProfile(app).runAsync(ctx);
36
+ return await new SetUpAdhocProvisioningProfile_1.SetUpAdhocProvisioningProfile({ app, target }).runAsync(ctx);
37
37
  }
38
38
  else if (enterpriseProvisioning === 'universal') {
39
- return await new SetUpProvisioningProfile_1.SetUpProvisioningProfile(app, generated_1.IosDistributionType.Enterprise).runAsync(ctx);
39
+ return await new SetUpProvisioningProfile_1.SetUpProvisioningProfile(app, target, generated_1.IosDistributionType.Enterprise).runAsync(ctx);
40
40
  }
41
41
  else {
42
- return await new SetUpInternalProvisioningProfile_1.SetUpInternalProvisioningProfile(app).runAsync(ctx);
42
+ return await new SetUpInternalProvisioningProfile_1.SetUpInternalProvisioningProfile({ app, target }).runAsync(ctx);
43
43
  }
44
44
  }
45
45
  else {
46
- return await new SetUpProvisioningProfile_1.SetUpProvisioningProfile(app, generated_1.IosDistributionType.AppStore).runAsync(ctx);
46
+ return await new SetUpProvisioningProfile_1.SetUpProvisioningProfile(app, target, generated_1.IosDistributionType.AppStore).runAsync(ctx);
47
47
  }
48
48
  }
49
49
  }
@@ -1,7 +1,7 @@
1
1
  import { AppleDistributionCertificateFragment, AppleProvisioningProfileFragment, AppleTeamFragment, IosAppBuildCredentialsFragment, IosDistributionType } from '../../../graphql/generated';
2
2
  import { CredentialsContext } from '../../context';
3
3
  import { IosTargetCredentials } from '../../credentialsJson/types';
4
- import { AppLookupParams } from '../api/GraphqlClient';
4
+ import { AppLookupParams } from '../api/graphql/types/AppLookupParams';
5
5
  export declare class SetUpTargetBuildCredentialsFromCredentialsJson {
6
6
  private app;
7
7
  private distributionType;
@@ -1,16 +1,10 @@
1
- import { AppStoreConnectApiKeyFragment, AppleAppIdentifierFragment, AppleDeviceFragment, AppleDistributionCertificateFragment, ApplePushKeyFragment, AppleTeamFragment, CommonIosAppCredentialsFragment, IosAppBuildCredentialsFragment, IosDistributionType } from '../../../graphql/generated';
2
- import { Account } from '../../../user/Account';
1
+ import { AccountFragment, AppStoreConnectApiKeyFragment, AppleAppIdentifierFragment, AppleDeviceFragment, AppleDistributionCertificateFragment, ApplePushKeyFragment, AppleTeamFragment, CommonIosAppCredentialsFragment, IosAppBuildCredentialsFragment, IosDistributionType } from '../../../graphql/generated';
3
2
  import { DistributionCertificate, PushKey } from '../appstore/Credentials.types';
4
3
  import { MinimalAscApiKey } from '../credentials';
5
4
  import { AppleDistributionCertificateMutationResult } from './graphql/mutations/AppleDistributionCertificateMutation';
6
5
  import { AppleProvisioningProfileMutationResult } from './graphql/mutations/AppleProvisioningProfileMutation';
7
6
  import { AppleProvisioningProfileQueryResult } from './graphql/queries/AppleProvisioningProfileQuery';
8
- export interface AppLookupParams {
9
- account: Account;
10
- projectName: string;
11
- bundleIdentifier: string;
12
- parentBundleIdentifier?: string;
13
- }
7
+ import { AppLookupParams } from './graphql/types/AppLookupParams';
14
8
  export declare function createOrUpdateIosAppBuildCredentialsAsync(appLookupParams: AppLookupParams, { appleTeam, appleAppIdentifierId, iosDistributionType, appleProvisioningProfileId, appleDistributionCertificateId, }: {
15
9
  appleTeam: AppleTeamFragment;
16
10
  appleAppIdentifierId: string;
@@ -29,7 +23,7 @@ export declare function updateIosAppCredentialsAsync(appCredentials: CommonIosAp
29
23
  applePushKeyId?: string;
30
24
  ascApiKeyIdForSubmissions?: string;
31
25
  }): Promise<CommonIosAppCredentialsFragment>;
32
- export declare function createOrGetExistingAppleTeamAsync(account: Account, { appleTeamIdentifier, appleTeamName }: {
26
+ export declare function createOrGetExistingAppleTeamAsync(account: AccountFragment, { appleTeamIdentifier, appleTeamName }: {
33
27
  appleTeamIdentifier: string;
34
28
  appleTeamName?: string;
35
29
  }): Promise<AppleTeamFragment>;
@@ -52,14 +46,14 @@ export declare function deleteProvisioningProfilesAsync(appleProvisioningProfile
52
46
  export declare function getDistributionCertificateForAppAsync(appLookupParams: AppLookupParams, iosDistributionType: IosDistributionType, { appleTeam }?: {
53
47
  appleTeam: AppleTeamFragment | null;
54
48
  }): Promise<AppleDistributionCertificateFragment | null>;
55
- export declare function getDistributionCertificatesForAccountAsync(account: Account): Promise<AppleDistributionCertificateFragment[]>;
56
- export declare function createDistributionCertificateAsync(account: Account, distCert: DistributionCertificate): Promise<AppleDistributionCertificateMutationResult>;
49
+ export declare function getDistributionCertificatesForAccountAsync(account: AccountFragment): Promise<AppleDistributionCertificateFragment[]>;
50
+ export declare function createDistributionCertificateAsync(account: AccountFragment, distCert: DistributionCertificate): Promise<AppleDistributionCertificateMutationResult>;
57
51
  export declare function deleteDistributionCertificateAsync(distributionCertificateId: string): Promise<void>;
58
- export declare function createPushKeyAsync(account: Account, pushKey: PushKey): Promise<ApplePushKeyFragment>;
59
- export declare function getPushKeysForAccountAsync(account: Account): Promise<ApplePushKeyFragment[]>;
52
+ export declare function createPushKeyAsync(account: AccountFragment, pushKey: PushKey): Promise<ApplePushKeyFragment>;
53
+ export declare function getPushKeysForAccountAsync(account: AccountFragment): Promise<ApplePushKeyFragment[]>;
60
54
  export declare function getPushKeyForAppAsync(appLookupParams: AppLookupParams): Promise<ApplePushKeyFragment | null>;
61
55
  export declare function deletePushKeyAsync(pushKeyId: string): Promise<void>;
62
- export declare function createAscApiKeyAsync(account: Account, ascApiKey: MinimalAscApiKey): Promise<AppStoreConnectApiKeyFragment>;
63
- export declare function getAscApiKeysForAccountAsync(account: Account): Promise<AppStoreConnectApiKeyFragment[]>;
56
+ export declare function createAscApiKeyAsync(account: AccountFragment, ascApiKey: MinimalAscApiKey): Promise<AppStoreConnectApiKeyFragment>;
57
+ export declare function getAscApiKeysForAccountAsync(account: AccountFragment): Promise<AppStoreConnectApiKeyFragment[]>;
64
58
  export declare function getAscApiKeyForAppSubmissionsAsync(appLookupParams: AppLookupParams): Promise<AppStoreConnectApiKeyFragment | null>;
65
59
  export declare function deleteAscApiKeyAsync(ascApiKeyId: string): Promise<void>;
@@ -1,7 +1,6 @@
1
- import { AppleTeamFragment, AppleTeamInput } from '../../../../../graphql/generated';
2
- import { Account } from '../../../../../user/Account';
1
+ import { AccountFragment, AppleTeamFragment, AppleTeamInput } from '../../../../../graphql/generated';
3
2
  export declare type AppleTeamMutationResult = AppleTeamFragment & {
4
- account: Account;
3
+ account: AccountFragment;
5
4
  };
6
5
  export declare const AppleTeamMutation: {
7
6
  createAppleTeamAsync(appleTeamInput: AppleTeamInput, accountId: string): Promise<AppleTeamMutationResult>;
@@ -5,6 +5,7 @@ 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");
8
9
  const AppleTeam_1 = require("../../../../../graphql/types/credentials/AppleTeam");
9
10
  exports.AppleTeamMutation = {
10
11
  async createAppleTeamAsync(appleTeamInput, accountId) {
@@ -17,12 +18,13 @@ exports.AppleTeamMutation = {
17
18
  ...AppleTeamFragment
18
19
  account {
19
20
  id
20
- name
21
+ ...AccountFragment
21
22
  }
22
23
  }
23
24
  }
24
25
  }
25
26
  ${(0, graphql_1.print)(AppleTeam_1.AppleTeamFragmentNode)}
27
+ ${(0, graphql_1.print)(Account_1.AccountFragmentNode)}
26
28
  `, {
27
29
  appleTeamInput,
28
30
  accountId,
@@ -1,4 +1,4 @@
1
- import { AppleDevice, AppleDeviceFragment, AppleTeamFragment } from '../../../../../graphql/generated';
1
+ import { AppleDevice, AppleDeviceFragment, AppleDevicesByTeamIdentifierQueryVariables, AppleTeamFragment } from '../../../../../graphql/generated';
2
2
  export declare type AppleDeviceFragmentWithAppleTeam = AppleDeviceFragment & {
3
3
  appleTeam: AppleTeamFragment;
4
4
  };
@@ -13,6 +13,6 @@ export declare const AppleDeviceQuery: {
13
13
  getAllByAppleTeamIdentifierAsync(accountId: string, appleTeamIdentifier: string, { useCache }?: {
14
14
  useCache?: boolean | undefined;
15
15
  }): Promise<AppleDeviceFragmentWithAppleTeam[]>;
16
- getAllForAppleTeamAsync(accountName: string, appleTeamIdentifier: string): Promise<AppleDevicesByTeamIdentifierQueryResult | null>;
17
- getByDeviceIdentifierAsync(accountName: string, identifier: string): Promise<AppleDevicesByIdentifierQueryResult | null>;
16
+ getAllForAppleTeamAsync({ accountName, appleTeamIdentifier, offset, limit, }: AppleDevicesByTeamIdentifierQueryVariables): Promise<AppleDeviceFragment[]>;
17
+ getByDeviceIdentifierAsync(accountName: string, identifier: string): Promise<AppleDevicesByIdentifierQueryResult>;
18
18
  };
@@ -5,9 +5,11 @@ const tslib_1 = require("tslib");
5
5
  const assert_1 = tslib_1.__importDefault(require("assert"));
6
6
  const graphql_1 = require("graphql");
7
7
  const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
8
+ const errors_1 = require("../../../../../devices/utils/errors");
8
9
  const client_1 = require("../../../../../graphql/client");
9
10
  const AppleDevice_1 = require("../../../../../graphql/types/credentials/AppleDevice");
10
11
  const AppleTeam_1 = require("../../../../../graphql/types/credentials/AppleTeam");
12
+ const AppleTeamFormatting_1 = require("../../../actions/AppleTeamFormatting");
11
13
  exports.AppleDeviceQuery = {
12
14
  async getAllByAppleTeamIdentifierAsync(accountId, appleTeamIdentifier, { useCache = true } = {}) {
13
15
  const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
@@ -43,12 +45,14 @@ exports.AppleDeviceQuery = {
43
45
  (0, assert_1.default)(appleDevices, 'Apple Devices should be defined in this context - enforced by GraphQL');
44
46
  return appleDevices;
45
47
  },
46
- async getAllForAppleTeamAsync(accountName, appleTeamIdentifier) {
48
+ async getAllForAppleTeamAsync({ accountName, appleTeamIdentifier, offset, limit, }) {
47
49
  const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
48
50
  .query((0, graphql_tag_1.default) `
49
51
  query AppleDevicesByTeamIdentifier(
50
52
  $accountName: String!
51
53
  $appleTeamIdentifier: String!
54
+ $offset: Int
55
+ $limit: Int
52
56
  ) {
53
57
  account {
54
58
  byName(accountName: $accountName) {
@@ -57,25 +61,30 @@ exports.AppleDeviceQuery = {
57
61
  id
58
62
  appleTeamIdentifier
59
63
  appleTeamName
60
- appleDevices {
64
+ appleDevices(offset: $offset, limit: $limit) {
61
65
  id
62
66
  identifier
63
67
  name
64
68
  deviceClass
65
69
  enabled
70
+ model
66
71
  }
67
72
  }
68
73
  }
69
74
  }
70
75
  }
71
- `, { accountName, appleTeamIdentifier }, {
76
+ `, { accountName, appleTeamIdentifier, offset, limit }, {
72
77
  additionalTypenames: ['AppleDevice', 'AppleTeam'],
73
78
  })
74
79
  .toPromise());
75
- return data.account.byName.appleTeams[0];
80
+ const [appleTeam] = data.account.byName.appleTeams;
81
+ const { appleDevices } = appleTeam;
82
+ if (!appleDevices) {
83
+ throw new Error(`Could not find devices on Apple team -- ${(0, AppleTeamFormatting_1.formatAppleTeam)(appleTeam)}`);
84
+ }
85
+ return appleDevices;
76
86
  },
77
87
  async getByDeviceIdentifierAsync(accountName, identifier) {
78
- var _a;
79
88
  const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
80
89
  .query((0, graphql_tag_1.default) `
81
90
  query AppleDevicesByIdentifier($accountName: String!, $identifier: String!) {
@@ -84,6 +93,7 @@ exports.AppleDeviceQuery = {
84
93
  id
85
94
  appleDevices(identifier: $identifier) {
86
95
  id
96
+ model
87
97
  identifier
88
98
  name
89
99
  deviceClass
@@ -101,6 +111,10 @@ exports.AppleDeviceQuery = {
101
111
  additionalTypenames: ['AppleDevice', 'AppleTeam'],
102
112
  })
103
113
  .toPromise());
104
- return (_a = data.account.byName.appleDevices[0]) !== null && _a !== void 0 ? _a : null;
114
+ const device = data.account.byName.appleDevices[0];
115
+ if (!device) {
116
+ throw new errors_1.DeviceNotFoundError(`Device with id ${identifier} was not found on account ${accountName}.`);
117
+ }
118
+ return device;
105
119
  },
106
120
  };
@@ -1,5 +1,5 @@
1
- import { AppleTeamFragment } from '../../../../../graphql/generated';
1
+ import { AppleTeamFragment, AppleTeamsByAccountNameQueryVariables } from '../../../../../graphql/generated';
2
2
  export declare const AppleTeamQuery: {
3
- getAllForAccountAsync(accountName: string): Promise<AppleTeamFragment[]>;
3
+ getAllForAccountAsync({ accountName, offset, limit, }: AppleTeamsByAccountNameQueryVariables): Promise<AppleTeamFragment[]>;
4
4
  getByAppleTeamIdentifierAsync(accountId: string, appleTeamIdentifier: string): Promise<AppleTeamFragment | null>;
5
5
  };
@@ -7,26 +7,27 @@ const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
7
7
  const client_1 = require("../../../../../graphql/client");
8
8
  const AppleTeam_1 = require("../../../../../graphql/types/credentials/AppleTeam");
9
9
  exports.AppleTeamQuery = {
10
- async getAllForAccountAsync(accountName) {
10
+ async getAllForAccountAsync({ accountName, offset, limit, }) {
11
+ var _a;
11
12
  const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
12
13
  .query((0, graphql_tag_1.default) `
13
- query AppleTeamsByAccountName($accountName: String!) {
14
+ query AppleTeamsByAccountName($accountName: String!, $offset: Int, $limit: Int) {
14
15
  account {
15
16
  byName(accountName: $accountName) {
16
17
  id
17
- appleTeams {
18
+ appleTeams(offset: $offset, limit: $limit) {
18
19
  id
19
- appleTeamName
20
- appleTeamIdentifier
20
+ ...AppleTeamFragment
21
21
  }
22
22
  }
23
23
  }
24
24
  }
25
- `, { accountName }, {
25
+ ${(0, graphql_1.print)(AppleTeam_1.AppleTeamFragmentNode)}
26
+ `, { accountName, offset, limit }, {
26
27
  additionalTypenames: ['AppleTeam'],
27
28
  })
28
29
  .toPromise());
29
- return data.account.byName.appleTeams;
30
+ return (_a = data.account.byName.appleTeams) !== null && _a !== void 0 ? _a : [];
30
31
  },
31
32
  async getByAppleTeamIdentifierAsync(accountId, appleTeamIdentifier) {
32
33
  var _a;
@@ -0,0 +1,7 @@
1
+ import { AccountFragment } from '../../../../../graphql/generated';
2
+ export interface AppLookupParams {
3
+ account: AccountFragment;
4
+ projectName: string;
5
+ bundleIdentifier: string;
6
+ parentBundleIdentifier?: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });