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
@@ -1,14 +1,12 @@
1
- import { ExpoConfig } from '@expo/config';
2
1
  import AppStoreApi from '../credentials/ios/appstore/AppStoreApi';
3
2
  import { Actor } from '../user/User';
4
3
  export interface DeviceManagerContext {
5
4
  appStore: AppStoreApi;
6
- exp: ExpoConfig | null;
7
- projectDir: string | null;
8
5
  user: Actor;
6
+ projectId: string | null;
9
7
  }
10
- export declare function createContextAsync({ appStore, cwd, user, }: {
8
+ export declare function createContextAsync({ appStore, user, projectId, }: {
11
9
  appStore: AppStoreApi;
12
- cwd?: string;
13
10
  user: Actor;
11
+ projectId: string | undefined;
14
12
  }): Promise<DeviceManagerContext>;
@@ -1,20 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createContextAsync = void 0;
4
- const config_1 = require("@expo/config");
5
- const projectUtils_1 = require("../project/projectUtils");
6
- async function createContextAsync({ appStore, cwd, user, }) {
7
- const projectDir = await (0, projectUtils_1.findProjectRootAsync)({ cwd });
8
- let exp = null;
9
- if (projectDir) {
10
- const config = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
11
- exp = config.exp;
12
- }
4
+ async function createContextAsync({ appStore, user, projectId, }) {
13
5
  return {
14
6
  appStore,
15
- projectDir,
16
- exp,
17
7
  user,
8
+ projectId: projectId !== null && projectId !== void 0 ? projectId : null,
18
9
  };
19
10
  }
20
11
  exports.createContextAsync = createContextAsync;
@@ -1,5 +1,4 @@
1
- import { ExpoConfig } from '@expo/config';
2
- import { Account } from '../user/Account';
1
+ import { AccountFragment } from '../graphql/generated';
3
2
  import { Actor } from '../user/User';
4
3
  import { DeviceManagerContext } from './context';
5
4
  export default class DeviceManager {
@@ -9,10 +8,10 @@ export default class DeviceManager {
9
8
  private resolveAccountAsync;
10
9
  }
11
10
  export declare class AccountResolver {
12
- private exp;
11
+ private projectId;
13
12
  private user;
14
- constructor(exp: ExpoConfig | null, user: Actor);
15
- resolveAccountAsync(): Promise<Account>;
13
+ constructor(projectId: string | null, user: Actor);
14
+ resolveAccountAsync(): Promise<AccountFragment>;
16
15
  private resolveProjectAccountAsync;
17
16
  private promptForAccountAsync;
18
17
  }
@@ -9,11 +9,9 @@ const AppleTeamQuery_1 = require("../credentials/ios/api/graphql/queries/AppleTe
9
9
  const log_1 = tslib_1.__importDefault(require("../log"));
10
10
  const projectUtils_1 = require("../project/projectUtils");
11
11
  const prompts_1 = require("../prompts");
12
- const Account_1 = require("../user/Account");
13
- const User_1 = require("../user/User");
14
12
  const action_1 = tslib_1.__importDefault(require("./actions/create/action"));
15
13
  const CREATE_COMMAND_DESCRIPTION = `This command lets you register your Apple devices (iPhones and iPads) for internal distribution of your app.
16
- Internal distribution means that you won't need upload your app archive to App Store / Testflight.
14
+ Internal distribution means that you won't need to upload your app archive to App Store / Testflight.
17
15
  Your app archive (.ipa) will be installable on your equipment as long as you sign your application with an adhoc provisiong profile.
18
16
  The provisioning profile needs to contain the UDIDs (unique identifiers) of your iPhones and iPads.
19
17
 
@@ -36,18 +34,18 @@ class DeviceManager {
36
34
  await action.runAsync();
37
35
  }
38
36
  async resolveAccountAsync() {
39
- const resolver = new AccountResolver(this.ctx.exp, this.ctx.user);
37
+ const resolver = new AccountResolver(this.ctx.projectId, this.ctx.user);
40
38
  return await resolver.resolveAccountAsync();
41
39
  }
42
40
  }
43
41
  exports.default = DeviceManager;
44
42
  class AccountResolver {
45
- constructor(exp, user) {
46
- this.exp = exp;
43
+ constructor(projectId, user) {
44
+ this.projectId = projectId;
47
45
  this.user = user;
48
46
  }
49
47
  async resolveAccountAsync() {
50
- if (this.exp) {
48
+ if (this.projectId) {
51
49
  const account = await this.resolveProjectAccountAsync();
52
50
  if (account) {
53
51
  return account;
@@ -56,17 +54,12 @@ class AccountResolver {
56
54
  return await this.promptForAccountAsync();
57
55
  }
58
56
  async resolveProjectAccountAsync() {
59
- (0, assert_1.default)(this.exp, 'expo config is not set');
60
- const projectAccountName = await (0, projectUtils_1.getProjectAccountNameAsync)(this.exp);
61
- const projectAccount = (0, Account_1.findAccountByName)(this.user.accounts, projectAccountName);
62
- if (!projectAccount) {
63
- log_1.default.warn(`Your account (${(0, User_1.getActorDisplayName)(this.user)}) doesn't have access to the ${chalk_1.default.bold(projectAccountName)} account`);
64
- return;
65
- }
57
+ (0, assert_1.default)(this.projectId, 'expo config is not set');
58
+ const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(this.projectId);
66
59
  const useProjectAccount = await (0, prompts_1.confirmAsync)({
67
- message: `You're inside the project directory. Would you like to use ${chalk_1.default.underline(projectAccountName)} account?`,
60
+ message: `You're inside the project directory. Would you like to use the ${chalk_1.default.underline(account.name)} account?`,
68
61
  });
69
- return useProjectAccount ? projectAccount : undefined;
62
+ return useProjectAccount ? account : undefined;
70
63
  }
71
64
  async promptForAccountAsync() {
72
65
  const choices = this.user.accounts.map(account => ({
@@ -0,0 +1,21 @@
1
+ import { PaginatedQueryOptions } from '../commandUtils/pagination';
2
+ import { AppleDeviceFragment, AppleTeamFragment } from '../graphql/generated';
3
+ import { AppleTeamIdAndName } from './utils/formatDevice';
4
+ export declare const TEAMS_LIMIT = 50;
5
+ export declare const DEVICES_LIMIT = 50;
6
+ export declare function selectAppleTeamOnAccountAsync({ accountName, selectionPromptTitle, paginatedQueryOptions, }: {
7
+ accountName: string;
8
+ selectionPromptTitle: string;
9
+ paginatedQueryOptions: PaginatedQueryOptions;
10
+ }): Promise<AppleTeamFragment>;
11
+ export declare function selectAppleDeviceOnAppleTeamAsync({ accountName, appleTeamIdentifier, selectionPromptTitle, paginatedQueryOptions, }: {
12
+ accountName: string;
13
+ appleTeamIdentifier: string;
14
+ selectionPromptTitle: string;
15
+ paginatedQueryOptions: PaginatedQueryOptions;
16
+ }): Promise<AppleDeviceFragment>;
17
+ export declare function listAndRenderAppleDevicesOnAppleTeamAsync({ accountName, appleTeam, paginatedQueryOptions, }: {
18
+ accountName: string;
19
+ appleTeam: AppleTeamIdAndName;
20
+ paginatedQueryOptions: PaginatedQueryOptions;
21
+ }): Promise<void>;
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listAndRenderAppleDevicesOnAppleTeamAsync = exports.selectAppleDeviceOnAppleTeamAsync = exports.selectAppleTeamOnAccountAsync = exports.DEVICES_LIMIT = exports.TEAMS_LIMIT = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
+ const AppleTeamFormatting_1 = require("../credentials/ios/actions/AppleTeamFormatting");
7
+ const DeviceUtils_1 = require("../credentials/ios/actions/DeviceUtils");
8
+ const AppleDeviceQuery_1 = require("../credentials/ios/api/graphql/queries/AppleDeviceQuery");
9
+ const AppleTeamQuery_1 = require("../credentials/ios/api/graphql/queries/AppleTeamQuery");
10
+ const log_1 = tslib_1.__importDefault(require("../log"));
11
+ const json_1 = require("../utils/json");
12
+ const queries_1 = require("../utils/queries");
13
+ const formatDevice_1 = tslib_1.__importDefault(require("./utils/formatDevice"));
14
+ exports.TEAMS_LIMIT = 50;
15
+ exports.DEVICES_LIMIT = 50;
16
+ async function selectAppleTeamOnAccountAsync({ accountName, selectionPromptTitle, paginatedQueryOptions, }) {
17
+ var _a;
18
+ if (paginatedQueryOptions.nonInteractive) {
19
+ throw new Error('Unable to select an Apple team in non-interactive mode.');
20
+ }
21
+ else {
22
+ const selectedAppleTeam = await (0, queries_1.paginatedQueryWithSelectPromptAsync)({
23
+ limit: (_a = paginatedQueryOptions.limit) !== null && _a !== void 0 ? _a : exports.TEAMS_LIMIT,
24
+ offset: paginatedQueryOptions.offset,
25
+ queryToPerform: (limit, offset) => AppleTeamQuery_1.AppleTeamQuery.getAllForAccountAsync({
26
+ accountName,
27
+ limit,
28
+ offset,
29
+ }),
30
+ promptOptions: {
31
+ title: selectionPromptTitle,
32
+ createDisplayTextForSelectionPromptListItem: appleTeam => appleTeam.appleTeamName
33
+ ? `${appleTeam.appleTeamName} (ID: ${appleTeam.appleTeamIdentifier})`
34
+ : appleTeam.appleTeamIdentifier,
35
+ getIdentifierForQueryItem: appleTeam => appleTeam.id,
36
+ },
37
+ });
38
+ if (!selectedAppleTeam) {
39
+ throw new Error(`Couldn't find any teams for the account ${accountName}`);
40
+ }
41
+ return selectedAppleTeam;
42
+ }
43
+ }
44
+ exports.selectAppleTeamOnAccountAsync = selectAppleTeamOnAccountAsync;
45
+ async function selectAppleDeviceOnAppleTeamAsync({ accountName, appleTeamIdentifier, selectionPromptTitle, paginatedQueryOptions, }) {
46
+ var _a;
47
+ if (paginatedQueryOptions.nonInteractive) {
48
+ throw new Error('Unable to select an Apple device in non-interactive mode.');
49
+ }
50
+ else {
51
+ const selectedAppleDevice = await (0, queries_1.paginatedQueryWithSelectPromptAsync)({
52
+ limit: (_a = paginatedQueryOptions.limit) !== null && _a !== void 0 ? _a : exports.DEVICES_LIMIT,
53
+ offset: paginatedQueryOptions.offset,
54
+ queryToPerform: (limit, offset) => AppleDeviceQuery_1.AppleDeviceQuery.getAllForAppleTeamAsync({
55
+ accountName,
56
+ appleTeamIdentifier,
57
+ limit,
58
+ offset,
59
+ }),
60
+ promptOptions: {
61
+ title: selectionPromptTitle,
62
+ createDisplayTextForSelectionPromptListItem: appleDevice => (0, DeviceUtils_1.formatDeviceLabel)(appleDevice),
63
+ getIdentifierForQueryItem: appleTeam => appleTeam.id,
64
+ },
65
+ });
66
+ if (!selectedAppleDevice) {
67
+ throw new Error(`Couldn't find any devices on the Apple team with the id ${appleTeamIdentifier}`);
68
+ }
69
+ return selectedAppleDevice;
70
+ }
71
+ }
72
+ exports.selectAppleDeviceOnAppleTeamAsync = selectAppleDeviceOnAppleTeamAsync;
73
+ async function listAndRenderAppleDevicesOnAppleTeamAsync({ accountName, appleTeam, paginatedQueryOptions, }) {
74
+ var _a;
75
+ if (paginatedQueryOptions.nonInteractive) {
76
+ const devices = await AppleDeviceQuery_1.AppleDeviceQuery.getAllForAppleTeamAsync({
77
+ accountName,
78
+ appleTeamIdentifier: appleTeam.appleTeamIdentifier,
79
+ offset: paginatedQueryOptions.offset,
80
+ limit: paginatedQueryOptions.limit,
81
+ });
82
+ renderPageOfAppleDevices({ devices, appleTeam, paginatedQueryOptions });
83
+ }
84
+ else {
85
+ await (0, queries_1.paginatedQueryWithConfirmPromptAsync)({
86
+ limit: (_a = paginatedQueryOptions.limit) !== null && _a !== void 0 ? _a : exports.DEVICES_LIMIT,
87
+ offset: paginatedQueryOptions.offset,
88
+ queryToPerform: (limit, offset) => AppleDeviceQuery_1.AppleDeviceQuery.getAllForAppleTeamAsync({
89
+ accountName,
90
+ appleTeamIdentifier: appleTeam.appleTeamIdentifier,
91
+ limit,
92
+ offset,
93
+ }),
94
+ promptOptions: {
95
+ title: 'Load more devices?',
96
+ renderListItems: devices => renderPageOfAppleDevices({ devices, appleTeam, paginatedQueryOptions }),
97
+ },
98
+ });
99
+ }
100
+ }
101
+ exports.listAndRenderAppleDevicesOnAppleTeamAsync = listAndRenderAppleDevicesOnAppleTeamAsync;
102
+ function renderPageOfAppleDevices({ devices, appleTeam, paginatedQueryOptions, }) {
103
+ if (paginatedQueryOptions.json) {
104
+ (0, json_1.printJsonOnlyOutput)(devices);
105
+ }
106
+ else {
107
+ if (devices.length === 0) {
108
+ log_1.default.log(`Could not find devices on Apple team -- ${(0, AppleTeamFormatting_1.formatAppleTeam)({
109
+ appleTeamIdentifier: appleTeam.appleTeamIdentifier,
110
+ appleTeamName: appleTeam.appleTeamName,
111
+ })}`);
112
+ }
113
+ else {
114
+ const list = devices
115
+ .map(device => (0, formatDevice_1.default)(device, appleTeam))
116
+ .join(`\n\n${chalk_1.default.dim('———')}\n\n`);
117
+ log_1.default.log(`\n${list}`);
118
+ log_1.default.addNewLineIfNone();
119
+ }
120
+ }
121
+ }
@@ -0,0 +1,3 @@
1
+ export declare class DeviceNotFoundError extends Error {
2
+ constructor(message?: string);
3
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeviceNotFoundError = void 0;
4
+ class DeviceNotFoundError extends Error {
5
+ constructor(message) {
6
+ super(message !== null && message !== void 0 ? message : 'Device not found.');
7
+ }
8
+ }
9
+ exports.DeviceNotFoundError = DeviceNotFoundError;
@@ -1,5 +1,5 @@
1
1
  import { AppleDevice, AppleTeam } from '../../graphql/generated';
2
- declare type Device = Pick<AppleDevice, 'id' | 'identifier' | 'name' | 'deviceClass' | 'enabled'>;
3
- declare type Team = Pick<AppleTeam, 'appleTeamIdentifier' | 'appleTeamName'>;
4
- export default function formatDevice(device: Device, team?: Team): string;
2
+ declare type Device = Pick<AppleDevice, 'id' | 'identifier' | 'name' | 'deviceClass' | 'enabled' | 'model'>;
3
+ export declare type AppleTeamIdAndName = Pick<AppleTeam, 'appleTeamIdentifier' | 'appleTeamName'>;
4
+ export default function formatDevice(device: Device, team?: AppleTeamIdAndName): string;
5
5
  export {};
@@ -3,17 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
5
5
  function formatDevice(device, team) {
6
- var _a, _b, _c;
6
+ var _a, _b;
7
7
  const fields = [
8
8
  { label: 'ID', value: device.id },
9
9
  { label: 'Name', value: (_a = device.name) !== null && _a !== void 0 ? _a : 'Unknown' },
10
- { label: 'Class', value: (_b = device.deviceClass) !== null && _b !== void 0 ? _b : 'Unknown' },
10
+ {
11
+ label: 'Class',
12
+ value: device.deviceClass
13
+ ? `${device.deviceClass}${device.model ? ` ${device.model}` : ''}`
14
+ : 'Unknown',
15
+ },
11
16
  { label: 'UDID', value: device.identifier },
12
17
  ];
13
18
  if (team) {
14
19
  fields.push(...[
15
20
  { label: 'Apple Team ID', value: team.appleTeamIdentifier },
16
- { label: 'Apple Team Name', value: (_c = team.appleTeamName) !== null && _c !== void 0 ? _c : 'Unknown' },
21
+ { label: 'Apple Team Name', value: (_b = team.appleTeamName) !== null && _b !== void 0 ? _b : 'Unknown' },
17
22
  ]);
18
23
  }
19
24
  return (0, formatFields_1.default)(fields);