eas-cli 2.3.0 → 2.4.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.
- package/README.md +47 -47
- package/build/ApiV2Error.d.ts +15 -0
- package/build/ApiV2Error.js +14 -0
- package/build/api.d.ts +10 -16
- package/build/api.js +52 -59
- package/build/branch/queries.d.ts +3 -2
- package/build/branch/queries.js +7 -7
- package/build/build/android/build.js +3 -3
- package/build/build/android/syncProjectConfiguration.d.ts +2 -1
- package/build/build/android/syncProjectConfiguration.js +2 -2
- package/build/build/android/version.d.ts +2 -1
- package/build/build/android/version.js +4 -4
- package/build/build/build.d.ts +2 -1
- package/build/build/build.js +5 -5
- package/build/build/context.d.ts +2 -0
- package/build/build/createContext.d.ts +3 -1
- package/build/build/createContext.js +4 -2
- package/build/build/ios/build.js +3 -3
- package/build/build/ios/syncProjectConfiguration.d.ts +2 -1
- package/build/build/ios/syncProjectConfiguration.js +2 -2
- package/build/build/ios/version.d.ts +2 -1
- package/build/build/ios/version.js +4 -4
- package/build/build/local.js +1 -1
- package/build/build/queries.d.ts +2 -1
- package/build/build/queries.js +3 -3
- package/build/build/runBuildAndSubmit.d.ts +2 -1
- package/build/build/runBuildAndSubmit.js +9 -6
- package/build/channel/queries.d.ts +4 -3
- package/build/channel/queries.js +13 -13
- package/build/commandUtils/EasCommand.d.ts +24 -3
- package/build/commandUtils/EasCommand.js +36 -6
- package/build/commandUtils/context/ContextField.d.ts +2 -0
- package/build/commandUtils/context/DynamicProjectConfigContextField.d.ts +1 -1
- package/build/commandUtils/context/DynamicProjectConfigContextField.js +2 -2
- package/build/commandUtils/context/LoggedInContextField.d.ts +12 -0
- package/build/commandUtils/context/LoggedInContextField.js +15 -0
- package/build/commandUtils/context/MaybeLoggedInContextField.d.ts +12 -0
- package/build/commandUtils/context/MaybeLoggedInContextField.js +17 -0
- package/build/commandUtils/context/OptionalProjectConfigContextField.d.ts +1 -1
- package/build/commandUtils/context/OptionalProjectConfigContextField.js +2 -2
- package/build/commandUtils/context/ProjectConfigContextField.d.ts +1 -1
- package/build/commandUtils/context/ProjectConfigContextField.js +2 -2
- package/build/commandUtils/context/SessionManagementContextField.d.ts +5 -0
- package/build/commandUtils/context/SessionManagementContextField.js +10 -0
- package/build/commandUtils/context/contextUtils/createGraphqlClient.d.ts +11 -0
- package/build/commandUtils/context/contextUtils/createGraphqlClient.js +43 -0
- package/build/commandUtils/context/contextUtils/getProjectIdAsync.d.ts +2 -1
- package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +11 -7
- package/build/commands/account/login.d.ts +3 -0
- package/build/commands/account/login.js +7 -2
- package/build/commands/account/logout.d.ts +3 -0
- package/build/commands/account/logout.js +7 -2
- package/build/commands/account/view.d.ts +3 -0
- package/build/commands/account/view.js +8 -3
- package/build/commands/branch/create.d.ts +3 -1
- package/build/commands/branch/create.js +6 -5
- package/build/commands/branch/delete.d.ts +1 -0
- package/build/commands/branch/delete.js +10 -9
- package/build/commands/branch/list.d.ts +1 -0
- package/build/commands/branch/list.js +3 -2
- package/build/commands/branch/rename.d.ts +1 -0
- package/build/commands/branch/rename.js +6 -5
- package/build/commands/branch/view.d.ts +1 -0
- package/build/commands/branch/view.js +4 -3
- package/build/commands/build/cancel.d.ts +3 -1
- package/build/commands/build/cancel.js +14 -13
- package/build/commands/build/configure.d.ts +1 -0
- package/build/commands/build/configure.js +4 -3
- package/build/commands/build/index.d.ts +1 -1
- package/build/commands/build/index.js +3 -3
- package/build/commands/build/inspect.d.ts +1 -1
- package/build/commands/build/inspect.js +2 -2
- package/build/commands/build/list.d.ts +1 -0
- package/build/commands/build/list.js +4 -3
- package/build/commands/build/version/set.d.ts +1 -1
- package/build/commands/build/version/set.js +4 -4
- package/build/commands/build/version/sync.d.ts +1 -1
- package/build/commands/build/version/sync.js +2 -2
- package/build/commands/build/view.d.ts +1 -0
- package/build/commands/build/view.js +5 -4
- package/build/commands/channel/create.d.ts +3 -1
- package/build/commands/channel/create.js +8 -7
- package/build/commands/channel/delete.d.ts +1 -0
- package/build/commands/channel/delete.js +7 -6
- package/build/commands/channel/edit.d.ts +3 -1
- package/build/commands/channel/edit.js +12 -8
- package/build/commands/channel/list.d.ts +1 -0
- package/build/commands/channel/list.js +3 -2
- package/build/commands/channel/rollout.d.ts +1 -0
- package/build/commands/channel/rollout.js +15 -14
- package/build/commands/channel/view.d.ts +1 -0
- package/build/commands/channel/view.js +4 -3
- package/build/commands/credentials.d.ts +1 -1
- package/build/commands/credentials.js +2 -2
- package/build/commands/device/create.d.ts +1 -1
- package/build/commands/device/create.js +2 -1
- package/build/commands/device/delete.d.ts +3 -1
- package/build/commands/device/delete.js +9 -8
- package/build/commands/device/list.d.ts +1 -0
- package/build/commands/device/list.js +5 -4
- package/build/commands/device/view.d.ts +1 -0
- package/build/commands/device/view.js +4 -3
- package/build/commands/metadata/pull.d.ts +1 -1
- package/build/commands/metadata/pull.js +2 -1
- package/build/commands/metadata/push.d.ts +1 -1
- package/build/commands/metadata/push.js +2 -1
- package/build/commands/open.d.ts +1 -0
- package/build/commands/open.js +3 -2
- package/build/commands/project/info.d.ts +1 -0
- package/build/commands/project/info.js +5 -4
- package/build/commands/project/init.d.ts +1 -1
- package/build/commands/project/init.js +5 -5
- package/build/commands/secret/create.d.ts +1 -0
- package/build/commands/secret/create.js +10 -9
- package/build/commands/secret/delete.d.ts +1 -0
- package/build/commands/secret/delete.js +4 -3
- package/build/commands/secret/list.d.ts +1 -0
- package/build/commands/secret/list.js +3 -2
- package/build/commands/submit.d.ts +1 -1
- package/build/commands/submit.js +4 -3
- package/build/commands/update/configure.d.ts +1 -0
- package/build/commands/update/configure.js +4 -3
- package/build/commands/update/delete.d.ts +3 -0
- package/build/commands/update/delete.js +9 -3
- package/build/commands/update/index.d.ts +3 -1
- package/build/commands/update/index.js +23 -17
- package/build/commands/update/list.d.ts +1 -0
- package/build/commands/update/list.js +6 -5
- package/build/commands/update/view.d.ts +3 -0
- package/build/commands/update/view.js +7 -1
- package/build/commands/webhook/create.d.ts +1 -0
- package/build/commands/webhook/create.js +3 -2
- package/build/commands/webhook/delete.d.ts +1 -0
- package/build/commands/webhook/delete.js +7 -6
- package/build/commands/webhook/list.d.ts +1 -0
- package/build/commands/webhook/list.js +4 -3
- package/build/commands/webhook/update.d.ts +3 -0
- package/build/commands/webhook/update.js +8 -2
- package/build/commands/webhook/view.d.ts +3 -0
- package/build/commands/webhook/view.js +7 -1
- package/build/credentials/android/actions/AssignFcm.js +2 -2
- package/build/credentials/android/actions/AssignGoogleServiceAccountKey.js +2 -2
- package/build/credentials/android/actions/BuildCredentialsUtils.js +12 -12
- package/build/credentials/android/actions/CreateFcm.js +1 -1
- package/build/credentials/android/actions/CreateGoogleServiceAccountKey.js +1 -1
- package/build/credentials/android/actions/CreateKeystore.js +4 -4
- package/build/credentials/android/actions/RemoveFcm.js +2 -2
- package/build/credentials/android/actions/RemoveGoogleServiceAccountKey.js +2 -2
- package/build/credentials/android/actions/RemoveKeystore.js +1 -1
- package/build/credentials/android/actions/SetUpBuildCredentials.js +3 -3
- package/build/credentials/android/actions/SetUpBuildCredentialsFromCredentialsJson.js +3 -3
- package/build/credentials/android/actions/SetUpGoogleServiceAccountKey.js +3 -3
- package/build/credentials/android/actions/UseExistingGoogleServiceAccountKey.js +1 -1
- package/build/credentials/android/api/GraphqlClient.d.ts +19 -18
- package/build/credentials/android/api/GraphqlClient.js +45 -45
- package/build/credentials/android/api/graphql/mutations/AndroidAppBuildCredentialsMutation.d.ts +3 -2
- package/build/credentials/android/api/graphql/mutations/AndroidAppBuildCredentialsMutation.js +4 -4
- package/build/credentials/android/api/graphql/mutations/AndroidAppCredentialsMutation.d.ts +4 -3
- package/build/credentials/android/api/graphql/mutations/AndroidAppCredentialsMutation.js +6 -6
- package/build/credentials/android/api/graphql/mutations/AndroidFcmMutation.d.ts +3 -2
- package/build/credentials/android/api/graphql/mutations/AndroidFcmMutation.js +4 -4
- package/build/credentials/android/api/graphql/mutations/AndroidKeystoreMutation.d.ts +3 -2
- package/build/credentials/android/api/graphql/mutations/AndroidKeystoreMutation.js +4 -4
- package/build/credentials/android/api/graphql/mutations/GoogleServiceAccountKeyMutation.d.ts +3 -2
- package/build/credentials/android/api/graphql/mutations/GoogleServiceAccountKeyMutation.js +4 -4
- package/build/credentials/android/api/graphql/queries/AndroidAppCredentialsQuery.d.ts +2 -1
- package/build/credentials/android/api/graphql/queries/AndroidAppCredentialsQuery.js +2 -2
- package/build/credentials/android/api/graphql/queries/GoogleServiceAccountKeyQuery.d.ts +2 -1
- package/build/credentials/android/api/graphql/queries/GoogleServiceAccountKeyQuery.js +2 -2
- package/build/credentials/android/utils/keystore.d.ts +2 -1
- package/build/credentials/android/utils/keystore.js +6 -6
- package/build/credentials/context.d.ts +3 -0
- package/build/credentials/context.js +1 -0
- package/build/credentials/credentialsJson/update.js +1 -1
- package/build/credentials/ios/actions/AppleTeamUtils.js +1 -1
- package/build/credentials/ios/actions/AscApiKeyUtils.js +1 -1
- package/build/credentials/ios/actions/AssignAscApiKey.js +2 -2
- package/build/credentials/ios/actions/AssignPushKey.js +2 -2
- package/build/credentials/ios/actions/BuildCredentialsUtils.js +5 -5
- package/build/credentials/ios/actions/ConfigureProvisioningProfile.js +1 -1
- package/build/credentials/ios/actions/CreateAscApiKey.js +1 -1
- package/build/credentials/ios/actions/CreateDistributionCertificate.js +1 -1
- package/build/credentials/ios/actions/CreateProvisioningProfile.js +2 -2
- package/build/credentials/ios/actions/CreatePushKey.js +1 -1
- package/build/credentials/ios/actions/DistributionCertificateUtils.js +2 -2
- package/build/credentials/ios/actions/PushKeyUtils.js +1 -1
- package/build/credentials/ios/actions/RemoveAscApiKey.js +1 -1
- package/build/credentials/ios/actions/RemoveDistributionCertificate.js +1 -1
- package/build/credentials/ios/actions/RemoveProvisioningProfile.js +1 -1
- package/build/credentials/ios/actions/RemovePushKey.js +1 -1
- package/build/credentials/ios/actions/SetUpAdhocProvisioningProfile.js +8 -8
- package/build/credentials/ios/actions/SetUpAscApiKey.js +2 -2
- package/build/credentials/ios/actions/SetUpDistributionCertificate.js +2 -2
- package/build/credentials/ios/actions/SetUpProvisioningProfile.js +1 -1
- package/build/credentials/ios/actions/SetUpPushKey.js +4 -4
- package/build/credentials/ios/actions/SetUpTargetBuildCredentialsFromCredentialsJson.js +5 -5
- package/build/credentials/ios/api/GraphqlClient.d.ts +25 -24
- package/build/credentials/ios/api/GraphqlClient.js +73 -73
- package/build/credentials/ios/api/graphql/mutations/AppStoreConnectApiKeyMutation.d.ts +3 -2
- package/build/credentials/ios/api/graphql/mutations/AppStoreConnectApiKeyMutation.js +4 -4
- package/build/credentials/ios/api/graphql/mutations/AppleAppIdentifierMutation.d.ts +2 -1
- package/build/credentials/ios/api/graphql/mutations/AppleAppIdentifierMutation.js +2 -2
- package/build/credentials/ios/api/graphql/mutations/AppleDeviceMutation.d.ts +3 -2
- package/build/credentials/ios/api/graphql/mutations/AppleDeviceMutation.js +4 -4
- package/build/credentials/ios/api/graphql/mutations/AppleDeviceRegistrationRequestMutation.d.ts +2 -1
- package/build/credentials/ios/api/graphql/mutations/AppleDeviceRegistrationRequestMutation.js +2 -2
- package/build/credentials/ios/api/graphql/mutations/AppleDistributionCertificateMutation.d.ts +3 -2
- package/build/credentials/ios/api/graphql/mutations/AppleDistributionCertificateMutation.js +4 -4
- package/build/credentials/ios/api/graphql/mutations/AppleProvisioningProfileMutation.d.ts +4 -3
- package/build/credentials/ios/api/graphql/mutations/AppleProvisioningProfileMutation.js +6 -6
- package/build/credentials/ios/api/graphql/mutations/ApplePushKeyMutation.d.ts +3 -2
- package/build/credentials/ios/api/graphql/mutations/ApplePushKeyMutation.js +4 -4
- package/build/credentials/ios/api/graphql/mutations/AppleTeamMutation.d.ts +2 -1
- package/build/credentials/ios/api/graphql/mutations/AppleTeamMutation.js +2 -2
- package/build/credentials/ios/api/graphql/mutations/IosAppBuildCredentialsMutation.d.ts +4 -3
- package/build/credentials/ios/api/graphql/mutations/IosAppBuildCredentialsMutation.js +6 -6
- package/build/credentials/ios/api/graphql/mutations/IosAppCredentialsMutation.d.ts +4 -3
- package/build/credentials/ios/api/graphql/mutations/IosAppCredentialsMutation.js +6 -6
- package/build/credentials/ios/api/graphql/queries/AppStoreConnectApiKeyQuery.d.ts +2 -1
- package/build/credentials/ios/api/graphql/queries/AppStoreConnectApiKeyQuery.js +2 -2
- package/build/credentials/ios/api/graphql/queries/AppleAppIdentifierQuery.d.ts +2 -1
- package/build/credentials/ios/api/graphql/queries/AppleAppIdentifierQuery.js +2 -2
- package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.d.ts +4 -3
- package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +6 -6
- package/build/credentials/ios/api/graphql/queries/AppleDistributionCertificateQuery.d.ts +3 -2
- package/build/credentials/ios/api/graphql/queries/AppleDistributionCertificateQuery.js +4 -4
- package/build/credentials/ios/api/graphql/queries/AppleProvisioningProfileQuery.d.ts +2 -1
- package/build/credentials/ios/api/graphql/queries/AppleProvisioningProfileQuery.js +2 -2
- package/build/credentials/ios/api/graphql/queries/ApplePushKeyQuery.d.ts +2 -1
- package/build/credentials/ios/api/graphql/queries/ApplePushKeyQuery.js +2 -2
- package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.d.ts +3 -2
- package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +4 -4
- package/build/credentials/ios/api/graphql/queries/IosAppBuildCredentialsQuery.d.ts +2 -1
- package/build/credentials/ios/api/graphql/queries/IosAppBuildCredentialsQuery.js +2 -2
- package/build/credentials/ios/api/graphql/queries/IosAppCredentialsQuery.d.ts +3 -2
- package/build/credentials/ios/api/graphql/queries/IosAppCredentialsQuery.js +4 -4
- package/build/credentials/manager/HelperActions.d.ts +2 -0
- package/build/credentials/manager/ManageAndroid.js +4 -3
- package/build/credentials/manager/ManageIos.js +4 -3
- package/build/credentials/manager/SelectAndroidBuildCredentials.js +2 -2
- package/build/credentials/manager/SelectPlatform.d.ts +3 -1
- package/build/credentials/manager/SelectPlatform.js +2 -1
- package/build/devices/actions/create/action.d.ts +3 -1
- package/build/devices/actions/create/action.js +5 -4
- package/build/devices/actions/create/developerPortalMethod.d.ts +2 -1
- package/build/devices/actions/create/developerPortalMethod.js +9 -9
- package/build/devices/actions/create/inputMethod.d.ts +2 -1
- package/build/devices/actions/create/inputMethod.js +4 -4
- package/build/devices/actions/create/registrationUrlMethod.d.ts +2 -1
- package/build/devices/actions/create/registrationUrlMethod.js +4 -4
- package/build/devices/context.d.ts +4 -1
- package/build/devices/context.js +2 -1
- package/build/devices/manager.d.ts +3 -1
- package/build/devices/manager.js +9 -8
- package/build/devices/queries.d.ts +4 -3
- package/build/devices/queries.js +7 -7
- package/build/graphql/client.d.ts +1 -8
- package/build/graphql/client.js +1 -39
- package/build/graphql/mutations/AppMutation.d.ts +2 -1
- package/build/graphql/mutations/AppMutation.js +2 -2
- package/build/graphql/mutations/AppVersionMutation.d.ts +2 -1
- package/build/graphql/mutations/AppVersionMutation.js +2 -2
- package/build/graphql/mutations/BuildMutation.d.ts +3 -2
- package/build/graphql/mutations/BuildMutation.js +4 -4
- package/build/graphql/mutations/EnvironmentSecretMutation.d.ts +4 -3
- package/build/graphql/mutations/EnvironmentSecretMutation.js +6 -6
- package/build/graphql/mutations/KeystoreGenerationUrlMutation.d.ts +2 -1
- package/build/graphql/mutations/KeystoreGenerationUrlMutation.js +2 -2
- package/build/graphql/mutations/PublishMutation.d.ts +4 -3
- package/build/graphql/mutations/PublishMutation.js +6 -6
- package/build/graphql/mutations/SubmissionMutation.d.ts +3 -2
- package/build/graphql/mutations/SubmissionMutation.js +4 -4
- package/build/graphql/mutations/UploadSessionMutation.d.ts +2 -1
- package/build/graphql/mutations/UploadSessionMutation.js +2 -2
- package/build/graphql/mutations/WebhookMutation.d.ts +4 -3
- package/build/graphql/mutations/WebhookMutation.js +6 -6
- package/build/graphql/queries/AppQuery.d.ts +3 -2
- package/build/graphql/queries/AppQuery.js +4 -4
- package/build/graphql/queries/AppVersionQuery.d.ts +2 -1
- package/build/graphql/queries/AppVersionQuery.js +2 -2
- package/build/graphql/queries/BranchQuery.d.ts +4 -3
- package/build/graphql/queries/BranchQuery.js +6 -6
- package/build/graphql/queries/BuildQuery.d.ts +4 -3
- package/build/graphql/queries/BuildQuery.js +6 -6
- package/build/graphql/queries/ChannelQuery.d.ts +3 -2
- package/build/graphql/queries/ChannelQuery.js +4 -4
- package/build/graphql/queries/EnvironmentSecretsQuery.d.ts +3 -2
- package/build/graphql/queries/EnvironmentSecretsQuery.js +4 -4
- package/build/graphql/queries/PublishQuery.d.ts +3 -2
- package/build/graphql/queries/PublishQuery.js +4 -4
- package/build/graphql/queries/StatuspageServiceQuery.d.ts +2 -1
- package/build/graphql/queries/StatuspageServiceQuery.js +2 -2
- package/build/graphql/queries/SubmissionQuery.d.ts +3 -2
- package/build/graphql/queries/SubmissionQuery.js +4 -4
- package/build/graphql/queries/UpdateQuery.d.ts +4 -3
- package/build/graphql/queries/UpdateQuery.js +6 -6
- package/build/graphql/queries/UserQuery.d.ts +2 -1
- package/build/graphql/queries/UserQuery.js +2 -2
- package/build/graphql/queries/WebhookQuery.d.ts +3 -2
- package/build/graphql/queries/WebhookQuery.js +4 -4
- package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.d.ts +3 -2
- package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +5 -5
- package/build/project/projectUtils.d.ts +3 -2
- package/build/project/projectUtils.js +4 -4
- package/build/project/publish.d.ts +3 -2
- package/build/project/publish.js +7 -7
- package/build/submit/ArchiveSource.d.ts +2 -1
- package/build/submit/ArchiveSource.js +30 -30
- package/build/submit/android/AndroidSubmitter.js +2 -2
- package/build/submit/context.d.ts +3 -0
- package/build/submit/context.js +3 -2
- package/build/submit/ios/IosSubmitter.js +2 -2
- package/build/submit/submit.d.ts +2 -1
- package/build/submit/submit.js +2 -2
- package/build/submit/utils/builds.d.ts +2 -1
- package/build/submit/utils/builds.js +2 -2
- package/build/submit/utils/errors.d.ts +3 -0
- package/build/submit/utils/errors.js +15 -67
- package/build/submit/utils/files.d.ts +2 -1
- package/build/submit/utils/files.js +2 -2
- package/build/submit/utils/wait.d.ts +2 -1
- package/build/submit/utils/wait.js +2 -2
- package/build/update/android/UpdatesModule.d.ts +2 -1
- package/build/update/android/UpdatesModule.js +2 -2
- package/build/update/ios/UpdatesModule.d.ts +2 -1
- package/build/update/ios/UpdatesModule.js +2 -2
- package/build/update/queries.d.ts +4 -3
- package/build/update/queries.js +22 -12
- package/build/uploads.d.ts +2 -1
- package/build/uploads.js +2 -2
- package/build/user/SessionManager.d.ts +70 -0
- package/build/user/SessionManager.js +258 -0
- package/build/user/User.d.ts +0 -9
- package/build/user/User.js +1 -60
- package/build/user/fetchSessionSecretAndUser.d.ts +9 -0
- package/build/user/fetchSessionSecretAndUser.js +43 -0
- package/build/utils/statuspageService.d.ts +2 -1
- package/build/utils/statuspageService.js +4 -4
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
- package/build/commandUtils/context/ActorContextField.d.ts +0 -5
- package/build/commandUtils/context/ActorContextField.js +0 -11
- package/build/commandUtils/context/contextUtils/ensureLoggedInAsync.d.ts +0 -21
- package/build/commandUtils/context/contextUtils/ensureLoggedInAsync.js +0 -75
- package/build/user/otp.d.ts +0 -29
- package/build/user/otp.js +0 -119
- package/build/user/sessionStorage.d.ts +0 -11
- package/build/user/sessionStorage.js +0 -36
package/build/uploads.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Response } from 'node-fetch';
|
|
2
|
+
import { ExpoGraphqlClient } from './commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
3
|
import { UploadSessionType } from './graphql/generated';
|
|
3
4
|
import { PresignedPost } from './graphql/mutations/UploadSessionMutation';
|
|
4
5
|
import { ProgressHandler } from './utils/progress';
|
|
5
|
-
export declare function uploadFileAtPathToS3Async(type: UploadSessionType, path: string, handleProgressEvent: ProgressHandler): Promise<{
|
|
6
|
+
export declare function uploadFileAtPathToS3Async(graphqlClient: ExpoGraphqlClient, type: UploadSessionType, path: string, handleProgressEvent: ProgressHandler): Promise<{
|
|
6
7
|
url: string;
|
|
7
8
|
bucketKey: string;
|
|
8
9
|
}>;
|
package/build/uploads.js
CHANGED
|
@@ -10,8 +10,8 @@ const promise_retry_1 = tslib_1.__importDefault(require("promise-retry"));
|
|
|
10
10
|
const url_1 = require("url");
|
|
11
11
|
const fetch_1 = tslib_1.__importDefault(require("./fetch"));
|
|
12
12
|
const UploadSessionMutation_1 = require("./graphql/mutations/UploadSessionMutation");
|
|
13
|
-
async function uploadFileAtPathToS3Async(type, path, handleProgressEvent) {
|
|
14
|
-
const presignedPost = await UploadSessionMutation_1.UploadSessionMutation.createUploadSessionAsync(type);
|
|
13
|
+
async function uploadFileAtPathToS3Async(graphqlClient, type, path, handleProgressEvent) {
|
|
14
|
+
const presignedPost = await UploadSessionMutation_1.UploadSessionMutation.createUploadSessionAsync(graphqlClient, type);
|
|
15
15
|
(0, assert_1.default)(presignedPost.fields.key, 'key is not specified in in presigned post');
|
|
16
16
|
const response = await uploadWithPresignedPostWithProgressAsync(path, presignedPost, handleProgressEvent);
|
|
17
17
|
const location = (0, nullthrows_1.default)(response.headers.get('location'), `location does not exist in response headers (make sure you're uploading to AWS S3)`);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { CurrentUserQuery } from '../graphql/generated';
|
|
2
|
+
export declare enum UserSecondFactorDeviceMethod {
|
|
3
|
+
AUTHENTICATOR = "authenticator",
|
|
4
|
+
SMS = "sms"
|
|
5
|
+
}
|
|
6
|
+
declare type LoggedInAuthenticationInfo = {
|
|
7
|
+
accessToken: string;
|
|
8
|
+
sessionSecret: null;
|
|
9
|
+
} | {
|
|
10
|
+
accessToken: null;
|
|
11
|
+
sessionSecret: string;
|
|
12
|
+
};
|
|
13
|
+
declare type Actor = NonNullable<CurrentUserQuery['meActor']>;
|
|
14
|
+
export default class SessionManager {
|
|
15
|
+
private currentUser;
|
|
16
|
+
getAccessToken(): string | null;
|
|
17
|
+
getSessionSecret(): string | null;
|
|
18
|
+
private getSession;
|
|
19
|
+
private setSessionAsync;
|
|
20
|
+
logoutAsync(): Promise<void>;
|
|
21
|
+
getUserAsync(): Promise<Actor | undefined>;
|
|
22
|
+
/**
|
|
23
|
+
* Ensure that there is a logged-in actor. Show a login prompt if not.
|
|
24
|
+
*
|
|
25
|
+
* @param nonInteractive whether the log-in prompt if logged-out should be interactive
|
|
26
|
+
* @returns logged-in Actor
|
|
27
|
+
*/
|
|
28
|
+
ensureLoggedInAsync({ nonInteractive, }: {
|
|
29
|
+
nonInteractive: boolean;
|
|
30
|
+
}): Promise<{
|
|
31
|
+
actor: Actor;
|
|
32
|
+
authenticationInfo: LoggedInAuthenticationInfo;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Prompt the user to log in.
|
|
36
|
+
*
|
|
37
|
+
* @deprecated Should not be used outside of context functions, except in the AccountLogin command.
|
|
38
|
+
*/
|
|
39
|
+
showLoginPromptAsync({ nonInteractive, printNewLine, }?: {
|
|
40
|
+
nonInteractive?: boolean | undefined;
|
|
41
|
+
printNewLine?: boolean | undefined;
|
|
42
|
+
}): Promise<void>;
|
|
43
|
+
private loginAsync;
|
|
44
|
+
/**
|
|
45
|
+
* Prompt for an OTP with the option to cancel the question by answering empty (pressing return key).
|
|
46
|
+
*/
|
|
47
|
+
private promptForOTPAsync;
|
|
48
|
+
/**
|
|
49
|
+
* Prompt for user to choose a backup OTP method. If selected method is SMS, a request
|
|
50
|
+
* for a new OTP will be sent to that method. Then, prompt for the OTP, and retry the user login.
|
|
51
|
+
*/
|
|
52
|
+
private promptForBackupOTPAsync;
|
|
53
|
+
/**
|
|
54
|
+
* Handle the special case error indicating that a second-factor is required for
|
|
55
|
+
* authentication.
|
|
56
|
+
*
|
|
57
|
+
* There are three cases we need to handle:
|
|
58
|
+
* 1. User's primary second-factor device was SMS, OTP was automatically sent by the server to that
|
|
59
|
+
* device already. In this case we should just prompt for the SMS OTP (or backup code), which the
|
|
60
|
+
* user should be receiving shortly. We should give the user a way to cancel and the prompt and move
|
|
61
|
+
* to case 3 below.
|
|
62
|
+
* 2. User's primary second-factor device is authenticator. In this case we should prompt for authenticator
|
|
63
|
+
* OTP (or backup code) and also give the user a way to cancel and move to case 3 below.
|
|
64
|
+
* 3. User doesn't have a primary device or doesn't have access to their primary device. In this case
|
|
65
|
+
* we should show a picker of the SMS devices that they can have an OTP code sent to, and when
|
|
66
|
+
* the user picks one we show a prompt() for the sent OTP.
|
|
67
|
+
*/
|
|
68
|
+
private retryUsernamePasswordAuthWithOTPAsync;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserSecondFactorDeviceMethod = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const json_file_1 = tslib_1.__importDefault(require("@expo/json-file"));
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
|
+
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
8
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
9
|
+
const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
|
|
10
|
+
const ApiV2Error_1 = require("../ApiV2Error");
|
|
11
|
+
const Analytics = tslib_1.__importStar(require("../analytics/rudderstackClient"));
|
|
12
|
+
const api_1 = require("../api");
|
|
13
|
+
const createGraphqlClient_1 = require("../commandUtils/context/contextUtils/createGraphqlClient");
|
|
14
|
+
const UserQuery_1 = require("../graphql/queries/UserQuery");
|
|
15
|
+
const log_1 = tslib_1.__importStar(require("../log"));
|
|
16
|
+
const prompts_1 = require("../prompts");
|
|
17
|
+
const paths_1 = require("../utils/paths");
|
|
18
|
+
const User_1 = require("./User");
|
|
19
|
+
const fetchSessionSecretAndUser_1 = require("./fetchSessionSecretAndUser");
|
|
20
|
+
var UserSecondFactorDeviceMethod;
|
|
21
|
+
(function (UserSecondFactorDeviceMethod) {
|
|
22
|
+
UserSecondFactorDeviceMethod["AUTHENTICATOR"] = "authenticator";
|
|
23
|
+
UserSecondFactorDeviceMethod["SMS"] = "sms";
|
|
24
|
+
})(UserSecondFactorDeviceMethod = exports.UserSecondFactorDeviceMethod || (exports.UserSecondFactorDeviceMethod = {}));
|
|
25
|
+
class SessionManager {
|
|
26
|
+
getAccessToken() {
|
|
27
|
+
var _a;
|
|
28
|
+
return (_a = process.env.EXPO_TOKEN) !== null && _a !== void 0 ? _a : null;
|
|
29
|
+
}
|
|
30
|
+
getSessionSecret() {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
return (_b = (_a = this.getSession()) === null || _a === void 0 ? void 0 : _a.sessionSecret) !== null && _b !== void 0 ? _b : null;
|
|
33
|
+
}
|
|
34
|
+
getSession() {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
try {
|
|
37
|
+
return (_b = (_a = json_file_1.default.read((0, paths_1.getStateJsonPath)())) === null || _a === void 0 ? void 0 : _a.auth) !== null && _b !== void 0 ? _b : null;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error.code === 'ENOENT') {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async setSessionAsync(sessionData) {
|
|
47
|
+
await json_file_1.default.setAsync((0, paths_1.getStateJsonPath)(), 'auth', sessionData, {
|
|
48
|
+
default: {},
|
|
49
|
+
ensureDir: true,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async logoutAsync() {
|
|
53
|
+
this.currentUser = undefined;
|
|
54
|
+
await this.setSessionAsync(undefined);
|
|
55
|
+
}
|
|
56
|
+
async getUserAsync() {
|
|
57
|
+
if (!this.currentUser && (this.getAccessToken() || this.getSessionSecret())) {
|
|
58
|
+
const authenticationInfo = {
|
|
59
|
+
accessToken: this.getAccessToken(),
|
|
60
|
+
sessionSecret: this.getSessionSecret(),
|
|
61
|
+
};
|
|
62
|
+
const user = await UserQuery_1.UserQuery.currentUserAsync((0, createGraphqlClient_1.createGraphqlClient)(authenticationInfo));
|
|
63
|
+
this.currentUser = user !== null && user !== void 0 ? user : undefined;
|
|
64
|
+
if (user) {
|
|
65
|
+
await Analytics.setUserDataAsync(user.id, {
|
|
66
|
+
username: (0, User_1.getActorDisplayName)(user),
|
|
67
|
+
user_id: user.id,
|
|
68
|
+
user_type: user.__typename,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return this.currentUser;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Ensure that there is a logged-in actor. Show a login prompt if not.
|
|
76
|
+
*
|
|
77
|
+
* @param nonInteractive whether the log-in prompt if logged-out should be interactive
|
|
78
|
+
* @returns logged-in Actor
|
|
79
|
+
*/
|
|
80
|
+
async ensureLoggedInAsync({ nonInteractive, }) {
|
|
81
|
+
let actor;
|
|
82
|
+
try {
|
|
83
|
+
actor = await this.getUserAsync();
|
|
84
|
+
}
|
|
85
|
+
catch { }
|
|
86
|
+
if (!actor) {
|
|
87
|
+
log_1.default.warn('An Expo user account is required to proceed.');
|
|
88
|
+
await this.showLoginPromptAsync({ nonInteractive, printNewLine: true });
|
|
89
|
+
actor = await this.getUserAsync();
|
|
90
|
+
}
|
|
91
|
+
const accessToken = this.getAccessToken();
|
|
92
|
+
const authenticationInfo = accessToken
|
|
93
|
+
? {
|
|
94
|
+
accessToken,
|
|
95
|
+
sessionSecret: null,
|
|
96
|
+
}
|
|
97
|
+
: {
|
|
98
|
+
accessToken: null,
|
|
99
|
+
sessionSecret: (0, nullthrows_1.default)(this.getSessionSecret()),
|
|
100
|
+
};
|
|
101
|
+
return { actor: (0, nullthrows_1.default)(actor), authenticationInfo };
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Prompt the user to log in.
|
|
105
|
+
*
|
|
106
|
+
* @deprecated Should not be used outside of context functions, except in the AccountLogin command.
|
|
107
|
+
*/
|
|
108
|
+
async showLoginPromptAsync({ nonInteractive = false, printNewLine = false, } = {}) {
|
|
109
|
+
if (nonInteractive) {
|
|
110
|
+
core_1.Errors.error(`Either log in with ${chalk_1.default.bold('eas login')} or set the ${chalk_1.default.bold('EXPO_TOKEN')} environment variable if you're using EAS CLI on CI (${(0, log_1.learnMore)('https://docs.expo.dev/accounts/programmatic-access/', { dim: false })})`);
|
|
111
|
+
}
|
|
112
|
+
if (printNewLine) {
|
|
113
|
+
log_1.default.newLine();
|
|
114
|
+
}
|
|
115
|
+
log_1.default.log('Log in to EAS');
|
|
116
|
+
const { username, password } = await (0, prompts_1.promptAsync)([
|
|
117
|
+
{
|
|
118
|
+
type: 'text',
|
|
119
|
+
name: 'username',
|
|
120
|
+
message: 'Email or username',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
type: 'password',
|
|
124
|
+
name: 'password',
|
|
125
|
+
message: 'Password',
|
|
126
|
+
},
|
|
127
|
+
]);
|
|
128
|
+
try {
|
|
129
|
+
await this.loginAsync({
|
|
130
|
+
username,
|
|
131
|
+
password,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
catch (e) {
|
|
135
|
+
if (e instanceof ApiV2Error_1.ApiV2Error && e.expoApiV2ErrorCode === 'ONE_TIME_PASSWORD_REQUIRED') {
|
|
136
|
+
await this.retryUsernamePasswordAuthWithOTPAsync(username, password, e.expoApiV2ErrorMetadata);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
throw e;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
async loginAsync(input) {
|
|
144
|
+
const { sessionSecret, id, username } = await (0, fetchSessionSecretAndUser_1.fetchSessionSecretAndUserAsync)(input);
|
|
145
|
+
await this.setSessionAsync({
|
|
146
|
+
sessionSecret,
|
|
147
|
+
userId: id,
|
|
148
|
+
username,
|
|
149
|
+
currentConnection: 'Username-Password-Authentication',
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Prompt for an OTP with the option to cancel the question by answering empty (pressing return key).
|
|
154
|
+
*/
|
|
155
|
+
async promptForOTPAsync(cancelBehavior) {
|
|
156
|
+
const enterMessage = cancelBehavior === 'cancel'
|
|
157
|
+
? `press ${chalk_1.default.bold('Enter')} to cancel`
|
|
158
|
+
: `press ${chalk_1.default.bold('Enter')} for more options`;
|
|
159
|
+
const { otp } = await (0, prompts_1.promptAsync)({
|
|
160
|
+
type: 'text',
|
|
161
|
+
name: 'otp',
|
|
162
|
+
message: `One-time password or backup code (${enterMessage}):`,
|
|
163
|
+
});
|
|
164
|
+
if (!otp) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
return otp;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Prompt for user to choose a backup OTP method. If selected method is SMS, a request
|
|
171
|
+
* for a new OTP will be sent to that method. Then, prompt for the OTP, and retry the user login.
|
|
172
|
+
*/
|
|
173
|
+
async promptForBackupOTPAsync(username, password, secondFactorDevices) {
|
|
174
|
+
const nonPrimarySecondFactorDevices = secondFactorDevices.filter(device => !device.is_primary);
|
|
175
|
+
if (nonPrimarySecondFactorDevices.length === 0) {
|
|
176
|
+
throw new Error('No other second-factor devices set up. Ensure you have set up and certified a backup device.');
|
|
177
|
+
}
|
|
178
|
+
const hasAuthenticatorSecondFactorDevice = nonPrimarySecondFactorDevices.find(device => device.method === UserSecondFactorDeviceMethod.AUTHENTICATOR);
|
|
179
|
+
const smsNonPrimarySecondFactorDevices = nonPrimarySecondFactorDevices.filter(device => device.method === UserSecondFactorDeviceMethod.SMS);
|
|
180
|
+
const authenticatorChoiceSentinel = -1;
|
|
181
|
+
const cancelChoiceSentinel = -2;
|
|
182
|
+
const deviceChoices = smsNonPrimarySecondFactorDevices.map((device, idx) => ({
|
|
183
|
+
title: device.sms_phone_number,
|
|
184
|
+
value: idx,
|
|
185
|
+
}));
|
|
186
|
+
if (hasAuthenticatorSecondFactorDevice) {
|
|
187
|
+
deviceChoices.push({
|
|
188
|
+
title: 'Authenticator',
|
|
189
|
+
value: authenticatorChoiceSentinel,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
deviceChoices.push({
|
|
193
|
+
title: 'Cancel',
|
|
194
|
+
value: cancelChoiceSentinel,
|
|
195
|
+
});
|
|
196
|
+
const selectedValue = await (0, prompts_1.selectAsync)('Select a second-factor device:', deviceChoices);
|
|
197
|
+
if (selectedValue === cancelChoiceSentinel) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
else if (selectedValue === authenticatorChoiceSentinel) {
|
|
201
|
+
return await this.promptForOTPAsync('cancel');
|
|
202
|
+
}
|
|
203
|
+
const device = smsNonPrimarySecondFactorDevices[selectedValue];
|
|
204
|
+
// this is a logged-out endpoint
|
|
205
|
+
const apiV2Client = new api_1.ApiV2Client({ accessToken: null, sessionSecret: null });
|
|
206
|
+
await apiV2Client.postAsync('auth/send-sms-otp', {
|
|
207
|
+
body: {
|
|
208
|
+
username,
|
|
209
|
+
password,
|
|
210
|
+
secondFactorDeviceID: device.id,
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
return await this.promptForOTPAsync('cancel');
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Handle the special case error indicating that a second-factor is required for
|
|
217
|
+
* authentication.
|
|
218
|
+
*
|
|
219
|
+
* There are three cases we need to handle:
|
|
220
|
+
* 1. User's primary second-factor device was SMS, OTP was automatically sent by the server to that
|
|
221
|
+
* device already. In this case we should just prompt for the SMS OTP (or backup code), which the
|
|
222
|
+
* user should be receiving shortly. We should give the user a way to cancel and the prompt and move
|
|
223
|
+
* to case 3 below.
|
|
224
|
+
* 2. User's primary second-factor device is authenticator. In this case we should prompt for authenticator
|
|
225
|
+
* OTP (or backup code) and also give the user a way to cancel and move to case 3 below.
|
|
226
|
+
* 3. User doesn't have a primary device or doesn't have access to their primary device. In this case
|
|
227
|
+
* we should show a picker of the SMS devices that they can have an OTP code sent to, and when
|
|
228
|
+
* the user picks one we show a prompt() for the sent OTP.
|
|
229
|
+
*/
|
|
230
|
+
async retryUsernamePasswordAuthWithOTPAsync(username, password, metadata) {
|
|
231
|
+
const { secondFactorDevices, smsAutomaticallySent } = metadata;
|
|
232
|
+
(0, assert_1.default)(secondFactorDevices !== undefined && smsAutomaticallySent !== undefined, `Malformed OTP error metadata: ${metadata}`);
|
|
233
|
+
const primaryDevice = secondFactorDevices.find(device => device.is_primary);
|
|
234
|
+
let otp = null;
|
|
235
|
+
if (smsAutomaticallySent) {
|
|
236
|
+
(0, assert_1.default)(primaryDevice, 'OTP should only automatically be sent when there is a primary device');
|
|
237
|
+
log_1.default.log(`One-time password was sent to the phone number ending in ${primaryDevice.sms_phone_number}.`);
|
|
238
|
+
otp = await this.promptForOTPAsync('menu');
|
|
239
|
+
}
|
|
240
|
+
if ((primaryDevice === null || primaryDevice === void 0 ? void 0 : primaryDevice.method) === UserSecondFactorDeviceMethod.AUTHENTICATOR) {
|
|
241
|
+
log_1.default.log('One-time password from authenticator required.');
|
|
242
|
+
otp = await this.promptForOTPAsync('menu');
|
|
243
|
+
}
|
|
244
|
+
// user bailed on case 1 or 2, wants to move to case 3
|
|
245
|
+
if (!otp) {
|
|
246
|
+
otp = await this.promptForBackupOTPAsync(username, password, secondFactorDevices);
|
|
247
|
+
}
|
|
248
|
+
if (!otp) {
|
|
249
|
+
throw new Error('Cancelled login');
|
|
250
|
+
}
|
|
251
|
+
await this.loginAsync({
|
|
252
|
+
username,
|
|
253
|
+
password,
|
|
254
|
+
otp,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
exports.default = SessionManager;
|
package/build/user/User.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { CurrentUserQuery } from '../graphql/generated';
|
|
2
|
-
import { getAccessToken, getSessionSecret } from './sessionStorage';
|
|
3
|
-
export { getSessionSecret, getAccessToken };
|
|
4
2
|
export declare type Actor = NonNullable<CurrentUserQuery['meActor']>;
|
|
5
3
|
/**
|
|
6
4
|
* Resolve the name of the actor, either normal user or robot user.
|
|
@@ -8,10 +6,3 @@ export declare type Actor = NonNullable<CurrentUserQuery['meActor']>;
|
|
|
8
6
|
* The display name CANNOT be used as project owner.
|
|
9
7
|
*/
|
|
10
8
|
export declare function getActorDisplayName(user?: Actor): string;
|
|
11
|
-
export declare function getUserAsync(): Promise<Actor | undefined>;
|
|
12
|
-
export declare function loginAsync({ username, password, otp, }: {
|
|
13
|
-
username: string;
|
|
14
|
-
password: string;
|
|
15
|
-
otp?: string;
|
|
16
|
-
}): Promise<void>;
|
|
17
|
-
export declare function logoutAsync(): Promise<void>;
|
package/build/user/User.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
6
|
-
const Analytics = tslib_1.__importStar(require("../analytics/rudderstackClient"));
|
|
7
|
-
const api_1 = require("../api");
|
|
8
|
-
const client_1 = require("../graphql/client");
|
|
9
|
-
const UserQuery_1 = require("../graphql/queries/UserQuery");
|
|
10
|
-
const sessionStorage_1 = require("./sessionStorage");
|
|
11
|
-
Object.defineProperty(exports, "getAccessToken", { enumerable: true, get: function () { return sessionStorage_1.getAccessToken; } });
|
|
12
|
-
Object.defineProperty(exports, "getSessionSecret", { enumerable: true, get: function () { return sessionStorage_1.getSessionSecret; } });
|
|
13
|
-
let currentUser;
|
|
3
|
+
exports.getActorDisplayName = void 0;
|
|
14
4
|
/**
|
|
15
5
|
* Resolve the name of the actor, either normal user or robot user.
|
|
16
6
|
* This should be used whenever the "current user" needs to be displayed.
|
|
@@ -27,52 +17,3 @@ function getActorDisplayName(user) {
|
|
|
27
17
|
}
|
|
28
18
|
}
|
|
29
19
|
exports.getActorDisplayName = getActorDisplayName;
|
|
30
|
-
async function getUserAsync() {
|
|
31
|
-
if (!currentUser && ((0, sessionStorage_1.getAccessToken)() || (0, sessionStorage_1.getSessionSecret)())) {
|
|
32
|
-
const user = await UserQuery_1.UserQuery.currentUserAsync();
|
|
33
|
-
currentUser = user !== null && user !== void 0 ? user : undefined;
|
|
34
|
-
if (user) {
|
|
35
|
-
await Analytics.setUserDataAsync(user.id, {
|
|
36
|
-
username: getActorDisplayName(user),
|
|
37
|
-
user_id: user.id,
|
|
38
|
-
user_type: user.__typename,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return currentUser;
|
|
43
|
-
}
|
|
44
|
-
exports.getUserAsync = getUserAsync;
|
|
45
|
-
async function loginAsync({ username, password, otp, }) {
|
|
46
|
-
const body = await api_1.api.postAsync('auth/loginAsync', { body: { username, password, otp } });
|
|
47
|
-
const { sessionSecret } = body.data;
|
|
48
|
-
const result = await client_1.graphqlClient
|
|
49
|
-
.query((0, graphql_tag_1.default) `
|
|
50
|
-
query UserQuery {
|
|
51
|
-
viewer {
|
|
52
|
-
id
|
|
53
|
-
username
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
`, {}, {
|
|
57
|
-
fetchOptions: {
|
|
58
|
-
headers: {
|
|
59
|
-
'expo-session': sessionSecret,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
additionalTypenames: [] /* UserQuery has immutable fields */,
|
|
63
|
-
})
|
|
64
|
-
.toPromise();
|
|
65
|
-
const { data } = result;
|
|
66
|
-
await (0, sessionStorage_1.setSessionAsync)({
|
|
67
|
-
sessionSecret,
|
|
68
|
-
userId: data.viewer.id,
|
|
69
|
-
username: data.viewer.username,
|
|
70
|
-
currentConnection: 'Username-Password-Authentication',
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
exports.loginAsync = loginAsync;
|
|
74
|
-
async function logoutAsync() {
|
|
75
|
-
currentUser = undefined;
|
|
76
|
-
await (0, sessionStorage_1.setSessionAsync)(undefined);
|
|
77
|
-
}
|
|
78
|
-
exports.logoutAsync = logoutAsync;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchSessionSecretAndUserAsync = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
6
|
+
const api_1 = require("../api");
|
|
7
|
+
const createGraphqlClient_1 = require("../commandUtils/context/contextUtils/createGraphqlClient");
|
|
8
|
+
async function fetchSessionSecretAndUserAsync({ username, password, otp, }) {
|
|
9
|
+
// this is a logged-out endpoint
|
|
10
|
+
const apiV2Client = new api_1.ApiV2Client({
|
|
11
|
+
accessToken: null,
|
|
12
|
+
sessionSecret: null,
|
|
13
|
+
});
|
|
14
|
+
const body = await apiV2Client.postAsync('auth/loginAsync', {
|
|
15
|
+
body: { username, password, otp },
|
|
16
|
+
});
|
|
17
|
+
const { sessionSecret } = body.data;
|
|
18
|
+
const graphqlClient = (0, createGraphqlClient_1.createGraphqlClient)({ accessToken: null, sessionSecret: null });
|
|
19
|
+
const result = await graphqlClient
|
|
20
|
+
.query((0, graphql_tag_1.default) `
|
|
21
|
+
query UserQuery {
|
|
22
|
+
viewer {
|
|
23
|
+
id
|
|
24
|
+
username
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`, {}, {
|
|
28
|
+
fetchOptions: {
|
|
29
|
+
headers: {
|
|
30
|
+
'expo-session': sessionSecret,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
additionalTypenames: [] /* UserQuery has immutable fields */,
|
|
34
|
+
})
|
|
35
|
+
.toPromise();
|
|
36
|
+
const { data } = result;
|
|
37
|
+
return {
|
|
38
|
+
sessionSecret,
|
|
39
|
+
id: data.viewer.id,
|
|
40
|
+
username: data.viewer.username,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.fetchSessionSecretAndUserAsync = fetchSessionSecretAndUserAsync;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
|
|
1
2
|
import { StatuspageServiceName } from '../graphql/generated';
|
|
2
|
-
export declare function maybeWarnAboutEasOutagesAsync(serviceNames: StatuspageServiceName[]): Promise<void>;
|
|
3
|
+
export declare function maybeWarnAboutEasOutagesAsync(graphqlClient: ExpoGraphqlClient, serviceNames: StatuspageServiceName[]): Promise<void>;
|
|
@@ -6,8 +6,8 @@ const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
|
6
6
|
const generated_1 = require("../graphql/generated");
|
|
7
7
|
const StatuspageServiceQuery_1 = require("../graphql/queries/StatuspageServiceQuery");
|
|
8
8
|
const log_1 = tslib_1.__importStar(require("../log"));
|
|
9
|
-
async function maybeWarnAboutEasOutagesAsync(serviceNames) {
|
|
10
|
-
const services = await getStatuspageServiceAsync(serviceNames);
|
|
9
|
+
async function maybeWarnAboutEasOutagesAsync(graphqlClient, serviceNames) {
|
|
10
|
+
const services = await getStatuspageServiceAsync(graphqlClient, serviceNames);
|
|
11
11
|
for (const service of services) {
|
|
12
12
|
warnAboutServiceOutage(service);
|
|
13
13
|
}
|
|
@@ -31,9 +31,9 @@ function warnAboutServiceOutage(service) {
|
|
|
31
31
|
log_1.default.warn(`All information on service status and incidents available at ${(0, log_1.link)('https://status.expo.dev/')}.`);
|
|
32
32
|
log_1.default.newLine();
|
|
33
33
|
}
|
|
34
|
-
async function getStatuspageServiceAsync(serviceNames) {
|
|
34
|
+
async function getStatuspageServiceAsync(graphqlClient, serviceNames) {
|
|
35
35
|
try {
|
|
36
|
-
return await StatuspageServiceQuery_1.StatuspageServiceQuery.statuspageServicesAsync(serviceNames);
|
|
36
|
+
return await StatuspageServiceQuery_1.StatuspageServiceQuery.statuspageServicesAsync(graphqlClient, serviceNames);
|
|
37
37
|
}
|
|
38
38
|
catch {
|
|
39
39
|
return [];
|