synapse-react-client 3.1.24 → 3.1.26
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/dist/components/styled/LeftRightPanel.d.ts +10 -0
- package/dist/components/styled/LeftRightPanel.js +45 -0
- package/dist/components/styled/LeftRightPanel.js.map +1 -0
- package/dist/containers/CardContainerLogic.js +4 -3
- package/dist/containers/CardContainerLogic.js.map +1 -1
- package/dist/containers/SynapseNavDrawer.js +1 -3
- package/dist/containers/SynapseNavDrawer.js.map +1 -1
- package/dist/containers/TextField.d.ts +8 -0
- package/dist/containers/TextField.js +22 -0
- package/dist/containers/TextField.js.map +1 -0
- package/dist/containers/access_requirement_list/AccessRequirementList.js +15 -12
- package/dist/containers/access_requirement_list/AccessRequirementList.js.map +1 -1
- package/dist/containers/access_requirement_list/managedACTAccess/CancelRequestDataAccess.d.ts +1 -1
- package/dist/containers/access_requirement_list/managedACTAccess/CancelRequestDataAccess.js +21 -16
- package/dist/containers/access_requirement_list/managedACTAccess/CancelRequestDataAccess.js.map +1 -1
- package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccess.js +1 -1
- package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccess.js.map +1 -1
- package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccessStep1.js +14 -9
- package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccessStep1.js.map +1 -1
- package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccessStep2.js +22 -18
- package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccessStep2.js.map +1 -1
- package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccessSuccess.js +11 -7
- package/dist/containers/access_requirement_list/managedACTAccess/RequestDataAccessSuccess.js.map +1 -1
- package/dist/containers/auth/AuthenticationMethodSelection.d.ts +17 -0
- package/dist/containers/auth/AuthenticationMethodSelection.js +49 -0
- package/dist/containers/auth/AuthenticationMethodSelection.js.map +1 -0
- package/dist/containers/auth/LoginFlowBackButton.d.ts +10 -0
- package/dist/containers/auth/LoginFlowBackButton.js +38 -0
- package/dist/containers/auth/LoginFlowBackButton.js.map +1 -0
- package/dist/containers/auth/LoginForm.d.ts +18 -0
- package/dist/containers/auth/LoginForm.js +32 -0
- package/dist/containers/auth/LoginForm.js.map +1 -0
- package/dist/containers/auth/LoginPage.d.ts +2 -3
- package/dist/containers/auth/LoginPage.js +84 -25
- package/dist/containers/auth/LoginPage.js.map +1 -1
- package/dist/containers/auth/RecoveryCodeForm.d.ts +8 -0
- package/dist/containers/auth/RecoveryCodeForm.js +30 -0
- package/dist/containers/auth/RecoveryCodeForm.js.map +1 -0
- package/dist/containers/auth/StandaloneLoginForm.d.ts +12 -0
- package/dist/containers/auth/StandaloneLoginForm.js +24 -0
- package/dist/containers/auth/StandaloneLoginForm.js.map +1 -0
- package/dist/containers/auth/TOTPForm.d.ts +8 -0
- package/dist/containers/auth/TOTPForm.js +38 -0
- package/dist/containers/auth/TOTPForm.js.map +1 -0
- package/dist/containers/auth/UsernamePasswordForm.d.ts +9 -0
- package/dist/containers/auth/UsernamePasswordForm.js +29 -0
- package/dist/containers/auth/UsernamePasswordForm.js.map +1 -0
- package/dist/containers/home_page/featured-data/QueryPerFacetPlotsCard.js +2 -1
- package/dist/containers/home_page/featured-data/QueryPerFacetPlotsCard.js.map +1 -1
- package/dist/containers/table/StandaloneQueryWrapper.js +2 -1
- package/dist/containers/table/StandaloneQueryWrapper.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/style/base/_core.scss +0 -13
- package/dist/style/components/_access-requirement-list.scss +0 -7
- package/dist/umd/synapse-react-client.development.css +0 -17
- package/dist/umd/synapse-react-client.development.css.map +2 -2
- package/dist/umd/synapse-react-client.development.js +28424 -27327
- package/dist/umd/synapse-react-client.development.js.map +4 -4
- package/dist/umd/synapse-react-client.production.min.css +1 -1
- package/dist/umd/synapse-react-client.production.min.js +89 -83
- package/dist/umd.index.d.ts +8 -6
- package/dist/umd.index.js +5 -3
- package/dist/umd.index.js.map +1 -1
- package/dist/utils/SynapseClient.d.ts +30 -16
- package/dist/utils/SynapseClient.js +99 -120
- package/dist/utils/SynapseClient.js.map +1 -1
- package/dist/utils/SynapseClientError.d.ts +4 -1
- package/dist/utils/SynapseClientError.js +2 -5
- package/dist/utils/SynapseClientError.js.map +1 -1
- package/dist/utils/SynapseConstants.d.ts +1 -0
- package/dist/utils/SynapseConstants.js +2 -1
- package/dist/utils/SynapseConstants.js.map +1 -1
- package/dist/utils/SynapseContext.d.ts +6 -4
- package/dist/utils/SynapseContext.js +26 -6
- package/dist/utils/SynapseContext.js.map +1 -1
- package/dist/utils/functions/ArrayUtils.d.ts +5 -0
- package/dist/utils/functions/ArrayUtils.js +25 -0
- package/dist/utils/functions/ArrayUtils.js.map +1 -0
- package/dist/utils/hooks/SynapseAPI/KeyFactory.d.ts +102 -0
- package/dist/utils/hooks/SynapseAPI/KeyFactory.js +308 -0
- package/dist/utils/hooks/SynapseAPI/KeyFactory.js.map +1 -0
- package/dist/utils/hooks/SynapseAPI/QueryClientUtils.d.ts +9 -0
- package/dist/utils/hooks/SynapseAPI/QueryClientUtils.js +18 -0
- package/dist/utils/hooks/SynapseAPI/QueryClientUtils.js.map +1 -0
- package/dist/utils/hooks/SynapseAPI/dataaccess/useAccessApprovals.js +2 -2
- package/dist/utils/hooks/SynapseAPI/dataaccess/useAccessApprovals.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/dataaccess/useAccessRequirements.js +13 -14
- package/dist/utils/hooks/SynapseAPI/dataaccess/useAccessRequirements.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/dataaccess/useDataAccessSubmission.js +17 -18
- package/dist/utils/hooks/SynapseAPI/dataaccess/useDataAccessSubmission.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/dataaccess/useGetApprovedSubmissionInfo.js +2 -2
- package/dist/utils/hooks/SynapseAPI/dataaccess/useGetApprovedSubmissionInfo.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/doi/useDOI.js +2 -2
- package/dist/utils/hooks/SynapseAPI/doi/useDOI.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/download/useDownloadList.d.ts +0 -8
- package/dist/utils/hooks/SynapseAPI/download/useDownloadList.js +13 -29
- package/dist/utils/hooks/SynapseAPI/download/useDownloadList.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/entity/useEntity.js +19 -19
- package/dist/utils/hooks/SynapseAPI/entity/useEntity.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/entity/useEntityBoundSchema.js +4 -5
- package/dist/utils/hooks/SynapseAPI/entity/useEntityBoundSchema.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/entity/useEntityBundle.js +2 -3
- package/dist/utils/hooks/SynapseAPI/entity/useEntityBundle.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/entity/useGetEntityChildren.js +4 -5
- package/dist/utils/hooks/SynapseAPI/entity/useGetEntityChildren.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/entity/useGetEntityHeaders.js +4 -4
- package/dist/utils/hooks/SynapseAPI/entity/useGetEntityHeaders.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/entity/useGetQueryResultBundle.js +8 -9
- package/dist/utils/hooks/SynapseAPI/entity/useGetQueryResultBundle.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/entity/useSchema.js +3 -1
- package/dist/utils/hooks/SynapseAPI/entity/useSchema.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/file/useFiles.js +4 -3
- package/dist/utils/hooks/SynapseAPI/file/useFiles.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/file/useUploadDestination.js +2 -2
- package/dist/utils/hooks/SynapseAPI/file/useUploadDestination.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/index.d.ts +2 -0
- package/dist/utils/hooks/SynapseAPI/index.js +2 -0
- package/dist/utils/hooks/SynapseAPI/index.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/oauth/useOAuthClient.js +6 -6
- package/dist/utils/hooks/SynapseAPI/oauth/useOAuthClient.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/search/useSearch.js +4 -4
- package/dist/utils/hooks/SynapseAPI/search/useSearch.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/team/useTeamMembers.js +4 -4
- package/dist/utils/hooks/SynapseAPI/team/useTeamMembers.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/trash/useTrashCan.js +6 -6
- package/dist/utils/hooks/SynapseAPI/trash/useTrashCan.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/user/useFavorites.js +8 -8
- package/dist/utils/hooks/SynapseAPI/user/useFavorites.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/user/useGetUserChallenges.js +2 -2
- package/dist/utils/hooks/SynapseAPI/user/useGetUserChallenges.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/user/useGetUserProjects.js +2 -2
- package/dist/utils/hooks/SynapseAPI/user/useGetUserProjects.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/user/useGetUserTeams.js +2 -2
- package/dist/utils/hooks/SynapseAPI/user/useGetUserTeams.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/user/usePersonalAccessToken.js +2 -2
- package/dist/utils/hooks/SynapseAPI/user/usePersonalAccessToken.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/user/useProjects.js +4 -4
- package/dist/utils/hooks/SynapseAPI/user/useProjects.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/user/useUserBundle.js +17 -24
- package/dist/utils/hooks/SynapseAPI/user/useUserBundle.js.map +1 -1
- package/dist/utils/hooks/SynapseAPI/user/useUserGroupHeader.js +6 -4
- package/dist/utils/hooks/SynapseAPI/user/useUserGroupHeader.js.map +1 -1
- package/dist/utils/hooks/index.d.ts +15 -0
- package/dist/utils/hooks/index.js +20 -0
- package/dist/utils/hooks/index.js.map +1 -0
- package/dist/utils/hooks/useDetectSSOCode.d.ts +8 -0
- package/dist/utils/hooks/useDetectSSOCode.js +90 -0
- package/dist/utils/hooks/useDetectSSOCode.js.map +1 -0
- package/dist/utils/hooks/useFocus.d.ts +15 -0
- package/dist/utils/hooks/useFocus.js +25 -0
- package/dist/utils/hooks/useFocus.js.map +1 -0
- package/dist/utils/hooks/useLogin.d.ts +15 -0
- package/dist/utils/hooks/useLogin.js +155 -0
- package/dist/utils/hooks/useLogin.js.map +1 -0
- package/dist/utils/hooks/useTraceUpdate.d.ts +1 -0
- package/dist/utils/hooks/useTraceUpdate.js +22 -0
- package/dist/utils/hooks/useTraceUpdate.js.map +1 -0
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.js +5 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/synapseTypes/ErrorResponse.d.ts +22 -0
- package/dist/utils/synapseTypes/ErrorResponse.js +17 -0
- package/dist/utils/synapseTypes/ErrorResponse.js.map +1 -0
- package/dist/utils/synapseTypes/LoginResponse.d.ts +0 -1
- package/dist/utils/synapseTypes/TwoFactorAuthLoginRequest.d.ts +12 -0
- package/dist/utils/synapseTypes/TwoFactorAuthLoginRequest.js +3 -0
- package/dist/utils/synapseTypes/TwoFactorAuthLoginRequest.js.map +1 -0
- package/package.json +9 -7
- package/dist/assets/ButtonWithIcon.d.ts +0 -12
- package/dist/assets/ButtonWithIcon.js +0 -17
- package/dist/assets/ButtonWithIcon.js.map +0 -1
- package/dist/containers/auth/Login.d.ts +0 -24
- package/dist/containers/auth/Login.js +0 -125
- package/dist/containers/auth/Login.js.map +0 -1
- package/dist/utils/hooks/SynapseAPI/entity/queryKeys.d.ts +0 -93
- package/dist/utils/hooks/SynapseAPI/entity/queryKeys.js +0 -69
- package/dist/utils/hooks/SynapseAPI/entity/queryKeys.js.map +0 -1
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.getDOIAssociation = exports.getDefaultUploadDestination = exports.postSubscriptionList = exports.deleteSubscription = exports.postSubscription = exports.getSubscribers = exports.getSubscription = exports.getSynapseTeamGeoData = exports.getAllSynapseUserGeoData = exports.getGoogleMapsApiKey = exports.postCertifiedUserTestResponse = exports.getCertifyQuiz = exports.purgeFromTrashCan = exports.restoreFromTrashCan = exports.getItemsInTrashCan = void 0;
|
|
3
|
+
exports.getUserFavorites = exports.getEntityWiki = exports.getEntityBundleV2 = exports.deleteEntity = exports.updateEntity = exports.getEntityHeader = exports.getEntityHeaders = exports.getEntityHeadersByIds = exports.getEntity = exports.getBulkFiles = exports.getFiles = exports.lookupChildEntity = exports.getEntityChildren = exports.getUserProfiles = exports.getEvaluations = exports.getGroupHeadersBatch = exports.postUserGroupHeadersWithAlias = exports.getUserGroupHeaders = exports.updateMyUserProfile = exports.getMyUserBundle = exports.getUserBundle = exports.getUserProfileById = exports.getUserProfile = exports.createProject = exports.createEntity = exports.oAuthSessionRequest = exports.oAuthUrlRequest = exports.loginWith2fa = exports.login = exports.getFullQueryTableResults = exports.getQueryTableResults = exports.getQueryTableAsyncJobResults = exports.getAsyncResultBodyFromJobId = exports.getAsyncResultFromJobId = exports.getFileHandleByIdURL = exports.getActualFileHandleByIdURL = exports.getFileHandleById = exports.getDownloadFromTableRequest = exports.getVersion = exports.doPut = exports.doDelete = exports.doGet = exports.doPost = exports.returnIfTwoFactorAuthError = exports.allowNotFoundError = exports.delay = exports.getRootURL = exports.SYNAPSE_STORAGE_LOCATION_ID = exports.ACCESS_TOKEN_COOKIE_KEY = exports.IS_OUTSIDE_SYNAPSE_ORG = void 0;
|
|
4
|
+
exports.createOAuthClient = exports.getOAuth2 = exports.getOAuth2Client = exports.hasUserAuthorizedOAuthClient = exports.getOAuth2RequestDescription = exports.getEvaluationSubmissions = exports.deleteEvaluationRound = exports.updateEvaluationRound = exports.createEvaluationRound = exports.getEvaluationRoundsList = exports.getEvaluationRound = exports.deleteEvaluation = exports.createEvaluation = exports.updateEvaluation = exports.getEvaluation = exports.getEvaluationPermissions = exports.submitToEvaluation = exports.createACL = exports.addFilesToDownloadListV2 = exports.createManifestFromDownloadListV2 = exports.createPackageFromDownloadListV2 = exports.addFileToDownloadListV2 = exports.getFileResult = exports.getFileHandleContent = exports.getFileHandleContentFromID = exports.startMultipartUpload = exports.checkUploadComplete = exports.uploadFile = exports.signOut = exports.getPrincipalAliasRequest = exports.getUseUtcTimeFromCookie = exports.getAccessTokenFromCookie = exports.setAccessTokenCookie = exports.isInSynapseExperimentalMode = exports.getPresignedUrlForWikiAttachment = exports.getWikiAttachmentsFromEvaluation = exports.getWikiAttachmentsFromEntity = exports.getWikiPageKeyForAccessRequirement = exports.getWikiPageKeyForEntity = exports.getIsUserMemberOfTeam = exports.bindInvitationToAuthenticatedUser = exports.getInviteeVerificationSignedToken = exports.getMembershipInvitation = exports.addTeamMemberAsAuthenticatedUserOrAdmin = exports.addTeamMemberWithToken = exports.getTeamMembers = exports.getUserTeamList = exports.getUserChallenges = exports.removeUserFavorite = exports.addUserFavorite = void 0;
|
|
5
|
+
exports.getDataAccessRequestForUpdate = exports.getResearchProject = exports.updateResearchProject = exports.removeItemFromDownloadListV2 = exports.getDownloadListActionsRequired = exports.getDownloadListStatistics = exports.getAvailableFilesToDownload = exports.clearDownloadListV2 = exports.searchEntities = exports.getEntityVersions = exports.getEntityPath = exports.getUserProjects = exports.getMyProjects = exports.deletePersonalAccessToken = exports.getPersonalAccessTokenRecords = exports.createPersonalAccessToken = exports.getTransformSqlWithFacetsRequest = exports.updateTable = exports.deleteDownloadList = exports.deleteDownloadListFiles = exports.getAllOfPaginatedService = exports.getDownloadOrder = exports.getDownloadList = exports.postAccessApproval = exports.getAccessApproval = exports.createLockAccessRequirement = exports.getAllAccessRequirements = exports.getAccessRequirementStatus = exports.searchAccessRequirements = exports.getAccessRequirementAcl = exports.getAccessRequirementById = exports.getAccessRequirement = exports.getRestrictionInformation = exports.getProjectStatistics = exports.rejectFormData = exports.acceptFormData = exports.listFormDataAsFormAdmin = exports.listFormData = exports.submitFormData = exports.deleteFormData = exports.updateFormData = exports.createFormData = exports.updateFormACL = exports.getFormACL = exports.createFormGroup = exports.consentToOAuth2Request = exports.getAuthenticatedOn = exports.createOAuthClientSecret = exports.updateOAuthClient = exports.deleteOAuthClient = void 0;
|
|
6
|
+
exports.getActivityForEntity = exports.getApprovedSubmissionInfo = exports.searchAccessSubmission = exports.searchAccessApprovals = exports.getForumThread = exports.forumSearch = exports.getModerators = exports.restoreThread = exports.deleteThread = exports.putThreadMessage = exports.putThreadTitle = exports.postThread = exports.getThreadMessageUrl = exports.getThread = exports.unPinThread = exports.pinThread = exports.getReplyMessageUrl = exports.getReplies = exports.deleteReply = exports.putReply = exports.postReply = exports.getReply = exports.updateNotificationEmail = exports.deleteEmail = exports.addEmailAddressStep2 = exports.addEmailAddressStep1 = exports.resetPassword = exports.changePasswordWithToken = exports.changePasswordWithCurrentPassword = exports.createProfileVerificationSubmission = exports.signSynapseTermsOfUse = exports.unbindOAuthProviderToAccount = exports.bindOAuthProviderToAccount = exports.oAuthRegisterAccountStep2 = exports.registerAccountStep2 = exports.registerAccountStep1 = exports.isAliasAvailable = exports.getNotificationEmail = exports.updateEntityJson = exports.getEntityJson = exports.hasAccessToEntity = exports.getValidationSchema = exports.getSchema = exports.getSchemaValidationResults = exports.getSchemaBinding = exports.updateSubmissionStatus = exports.getSubmissionById = exports.cancelDataAccessRequest = exports.submitDataAccessRequest = exports.updateDataAccessRequest = void 0;
|
|
7
|
+
exports.getDOIAssociation = exports.getDefaultUploadDestination = exports.postSubscriptionList = exports.deleteSubscription = exports.postSubscription = exports.getSubscribers = exports.getSubscription = exports.getSynapseTeamGeoData = exports.getAllSynapseUserGeoData = exports.getGoogleMapsApiKey = exports.postCertifiedUserTestResponse = exports.getCertifyQuiz = exports.purgeFromTrashCan = exports.restoreFromTrashCan = exports.getItemsInTrashCan = exports.getProfilePicPreviewPresignedUrl = void 0;
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
9
|
var spark_md5_1 = tslib_1.__importDefault(require("spark-md5"));
|
|
10
10
|
var universal_cookie_1 = tslib_1.__importDefault(require("universal-cookie"));
|
|
11
11
|
var _1 = require(".");
|
|
12
|
-
var Login_1 = require("../containers/auth/Login");
|
|
13
12
|
var APIConstants_1 = require("./APIConstants");
|
|
14
13
|
var dispatchDownloadListChangeEvent_1 = require("./functions/dispatchDownloadListChangeEvent");
|
|
15
14
|
var getEndpoint_1 = require("./functions/getEndpoint");
|
|
16
15
|
var ObjectUtils_1 = require("./functions/ObjectUtils");
|
|
17
16
|
var SynapseConstants_1 = require("./SynapseConstants");
|
|
18
17
|
var synapseTypes_1 = require("./synapseTypes/");
|
|
18
|
+
var synapseTypes_2 = require("./synapseTypes");
|
|
19
19
|
var DiscussionBundle_1 = require("./synapseTypes/DiscussionBundle");
|
|
20
|
-
var UserGroupHeader_1 = require("./synapseTypes/UserGroupHeader");
|
|
21
20
|
var SynapseClientError_1 = require("./SynapseClientError");
|
|
22
21
|
var calculateFriendlyFileSize_1 = require("./functions/calculateFriendlyFileSize");
|
|
22
|
+
var ErrorResponse_1 = require("./synapseTypes/ErrorResponse");
|
|
23
23
|
var cookies = new universal_cookie_1.default();
|
|
24
24
|
// TODO: Create JSON response types for all return types
|
|
25
|
-
exports.IS_OUTSIDE_SYNAPSE_ORG = window.location.hostname
|
|
25
|
+
exports.IS_OUTSIDE_SYNAPSE_ORG = !window.location.hostname
|
|
26
26
|
.toLowerCase()
|
|
27
|
-
.includes('.synapse.org')
|
|
28
|
-
? false
|
|
29
|
-
: true;
|
|
27
|
+
.includes('.synapse.org');
|
|
30
28
|
exports.ACCESS_TOKEN_COOKIE_KEY = 'org.sagebionetworks.security.user.login.token';
|
|
31
29
|
// Max size file that we will allow the caller to read into memory (5MB)
|
|
32
30
|
var MAX_JS_FILE_DOWNLOAD_SIZE = 5242880;
|
|
@@ -84,6 +82,46 @@ function allowNotFoundError(fn) {
|
|
|
84
82
|
});
|
|
85
83
|
}
|
|
86
84
|
exports.allowNotFoundError = allowNotFoundError;
|
|
85
|
+
/**
|
|
86
|
+
* If the asynchronous request returns a TwoFactorAuthErrorResponse, return that error instead of throwing it. Other
|
|
87
|
+
* types of errors will still be thrown.
|
|
88
|
+
* @param fn
|
|
89
|
+
*/
|
|
90
|
+
function returnIfTwoFactorAuthError(fn) {
|
|
91
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var response, e_2;
|
|
93
|
+
return tslib_1.__generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
response = null;
|
|
97
|
+
_a.label = 1;
|
|
98
|
+
case 1:
|
|
99
|
+
_a.trys.push([1, 3, , 4]);
|
|
100
|
+
return [4 /*yield*/, fn()];
|
|
101
|
+
case 2:
|
|
102
|
+
response = _a.sent();
|
|
103
|
+
return [3 /*break*/, 4];
|
|
104
|
+
case 3:
|
|
105
|
+
e_2 = _a.sent();
|
|
106
|
+
if (e_2 instanceof SynapseClientError_1.SynapseClientError &&
|
|
107
|
+
e_2.status === 401 &&
|
|
108
|
+
e_2.errorResponse &&
|
|
109
|
+
'errorCode' in e_2.errorResponse &&
|
|
110
|
+
e_2.errorResponse.errorCode === ErrorResponse_1.ErrorResponseCode.TWO_FA_REQUIRED &&
|
|
111
|
+
e_2.errorResponse.concreteType ===
|
|
112
|
+
'org.sagebionetworks.repo.model.auth.TwoFactorAuthErrorResponse') {
|
|
113
|
+
return [2 /*return*/, e_2.errorResponse];
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
throw e_2;
|
|
117
|
+
}
|
|
118
|
+
return [3 /*break*/, 4];
|
|
119
|
+
case 4: return [2 /*return*/, response];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
exports.returnIfTwoFactorAuthError = returnIfTwoFactorAuthError;
|
|
87
125
|
/*
|
|
88
126
|
0 - no internet connection
|
|
89
127
|
429 - Too Many Requests
|
|
@@ -157,7 +195,7 @@ var fetchWithExponentialTimeout = function (url, options, delayMs) {
|
|
|
157
195
|
else if (responseObject !== null &&
|
|
158
196
|
typeof responseObject === 'object' &&
|
|
159
197
|
'reason' in responseObject) {
|
|
160
|
-
throw new SynapseClientError_1.SynapseClientError(response.status, responseObject.reason, url.toString());
|
|
198
|
+
throw new SynapseClientError_1.SynapseClientError(response.status, responseObject.reason, url.toString(), responseObject);
|
|
161
199
|
}
|
|
162
200
|
else {
|
|
163
201
|
throw new SynapseClientError_1.SynapseClientError(response.status, JSON.stringify(responseObject), url.toString());
|
|
@@ -280,6 +318,7 @@ exports.getFileHandleByIdURL = getFileHandleByIdURL;
|
|
|
280
318
|
/**
|
|
281
319
|
* Get a completed asynchronous job. Will refetch every 500ms until COMPLETE or FAILED.
|
|
282
320
|
* @param asyncJobId
|
|
321
|
+
* @param responseBodyEndpoint
|
|
283
322
|
* @param accessToken
|
|
284
323
|
* @param setCurrentAsyncStatus - optional function that will receive the AsynchronousJobStatus object every time
|
|
285
324
|
* it's fetched, including while it is in the "PROCESSING" state.
|
|
@@ -319,6 +358,7 @@ exports.getAsyncResultFromJobId = getAsyncResultFromJobId;
|
|
|
319
358
|
/**
|
|
320
359
|
* Get the response body for an asynchronous job, or throw an error if the job failed.
|
|
321
360
|
* @param asyncJobId
|
|
361
|
+
* @param responseBodyEndpoint
|
|
322
362
|
* @param accessToken
|
|
323
363
|
* @returns
|
|
324
364
|
*/
|
|
@@ -338,7 +378,6 @@ exports.getAsyncResultBodyFromJobId = getAsyncResultBodyFromJobId;
|
|
|
338
378
|
* https://rest-docs.synapse.org/rest/POST/entity/id/table/query/nextPage/async/start.html
|
|
339
379
|
* @param {*} queryBundleRequest
|
|
340
380
|
* @param {*} accessToken
|
|
341
|
-
* @param {*} endpoint
|
|
342
381
|
*/
|
|
343
382
|
var getQueryTableAsyncJobResults = function (queryBundleRequest, accessToken, setCurrentAsyncStatus) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
344
383
|
var asyncJobId;
|
|
@@ -356,7 +395,7 @@ exports.getQueryTableAsyncJobResults = getQueryTableAsyncJobResults;
|
|
|
356
395
|
* https://rest-docs.synapse.org/rest/POST/entity/id/table/query/nextPage/async/start.html
|
|
357
396
|
* @param {*} queryBundleRequest
|
|
358
397
|
* @param {*} accessToken
|
|
359
|
-
* @param {*}
|
|
398
|
+
* @param {*} signal
|
|
360
399
|
*/
|
|
361
400
|
var getQueryTableResults = function (queryBundleRequest, accessToken, signal) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
362
401
|
var asyncJobId;
|
|
@@ -387,7 +426,7 @@ exports.getQueryTableResults = getQueryTableResults;
|
|
|
387
426
|
var getFullQueryTableResults = function (queryBundleRequest, accessToken, signal) {
|
|
388
427
|
if (accessToken === void 0) { accessToken = undefined; }
|
|
389
428
|
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
390
|
-
var
|
|
429
|
+
var offset, query, rest, queryRequest, data, isDone, response;
|
|
391
430
|
var _a;
|
|
392
431
|
return tslib_1.__generator(this, function (_b) {
|
|
393
432
|
switch (_b.label) {
|
|
@@ -396,12 +435,13 @@ var getFullQueryTableResults = function (queryBundleRequest, accessToken, signal
|
|
|
396
435
|
query = queryBundleRequest.query, rest = tslib_1.__rest(queryBundleRequest, ["query"]);
|
|
397
436
|
queryRequest = tslib_1.__assign(tslib_1.__assign({}, rest), { query: tslib_1.__assign(tslib_1.__assign({}, query), { offset: offset }), partMask: queryBundleRequest.partMask |
|
|
398
437
|
_1.SynapseConstants.BUNDLE_MASK_QUERY_MAX_ROWS_PER_PAGE });
|
|
399
|
-
return [4 /*yield*/, (0, exports.getQueryTableResults)(queryRequest, accessToken, signal)
|
|
438
|
+
return [4 /*yield*/, (0, exports.getQueryTableResults)(queryRequest, accessToken, signal)
|
|
439
|
+
// we are done if we return less than a max pagesize that the backend is willing to return.
|
|
440
|
+
];
|
|
400
441
|
case 1:
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
offset += response.queryResult.queryResults.rows.length;
|
|
442
|
+
data = _b.sent();
|
|
443
|
+
isDone = data.queryResult.queryResults.rows.length < data.maxRowsPerPage;
|
|
444
|
+
offset += data.queryResult.queryResults.rows.length;
|
|
405
445
|
queryRequest.query.limit = data.maxRowsPerPage; // set the limit to the actual max rows per page
|
|
406
446
|
_b.label = 2;
|
|
407
447
|
case 2:
|
|
@@ -409,11 +449,11 @@ var getFullQueryTableResults = function (queryBundleRequest, accessToken, signal
|
|
|
409
449
|
queryRequest.query.offset = offset;
|
|
410
450
|
return [4 /*yield*/, (0, exports.getQueryTableResults)(queryRequest, accessToken, signal)];
|
|
411
451
|
case 3:
|
|
412
|
-
|
|
413
|
-
(_a = data.queryResult.queryResults.rows).push.apply(_a,
|
|
452
|
+
response = _b.sent();
|
|
453
|
+
(_a = data.queryResult.queryResults.rows).push.apply(_a, response.queryResult.queryResults.rows);
|
|
414
454
|
isDone =
|
|
415
|
-
|
|
416
|
-
offset +=
|
|
455
|
+
response.queryResult.queryResults.rows.length < queryRequest.query.limit;
|
|
456
|
+
offset += response.queryResult.queryResults.rows.length;
|
|
417
457
|
return [3 /*break*/, 2];
|
|
418
458
|
case 4: return [2 /*return*/, data];
|
|
419
459
|
}
|
|
@@ -426,11 +466,28 @@ exports.getFullQueryTableResults = getFullQueryTableResults;
|
|
|
426
466
|
* authenticated requests.
|
|
427
467
|
* https://rest-docs.synapse.org/rest/POST/login2.html
|
|
428
468
|
*/
|
|
429
|
-
|
|
469
|
+
function login(username, password, authenticationReceipt, endpoint) {
|
|
430
470
|
if (endpoint === void 0) { endpoint = getEndpoint_1.BackendDestinationEnum.REPO_ENDPOINT; }
|
|
431
|
-
return
|
|
432
|
-
|
|
471
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
472
|
+
return tslib_1.__generator(this, function (_a) {
|
|
473
|
+
return [2 /*return*/, returnIfTwoFactorAuthError(function () {
|
|
474
|
+
return (0, exports.doPost)('/auth/v1/login2', { username: username, password: password, authenticationReceipt: authenticationReceipt }, undefined, endpoint);
|
|
475
|
+
})];
|
|
476
|
+
});
|
|
477
|
+
});
|
|
478
|
+
}
|
|
433
479
|
exports.login = login;
|
|
480
|
+
/**
|
|
481
|
+
* Performs authentication using 2FA, the body of the request needs to include the twoFaToken received as part of the
|
|
482
|
+
* error when authenticating and the totp code shown by the authenticator application.
|
|
483
|
+
*
|
|
484
|
+
* https://rest-docs.synapse.org/rest/POST/2fa/token.html
|
|
485
|
+
*/
|
|
486
|
+
function loginWith2fa(request, endpoint) {
|
|
487
|
+
if (endpoint === void 0) { endpoint = getEndpoint_1.BackendDestinationEnum.REPO_ENDPOINT; }
|
|
488
|
+
return (0, exports.doPost)('/auth/v1/2fa/token', request, undefined, endpoint);
|
|
489
|
+
}
|
|
490
|
+
exports.loginWith2fa = loginWith2fa;
|
|
434
491
|
/**
|
|
435
492
|
* Get redirect url
|
|
436
493
|
* https://rest-docs.synapse.org/rest/POST/oauth2/authurl.html
|
|
@@ -453,7 +510,9 @@ exports.oAuthUrlRequest = oAuthUrlRequest;
|
|
|
453
510
|
*/
|
|
454
511
|
var oAuthSessionRequest = function (provider, authenticationCode, redirectUrl, endpoint) {
|
|
455
512
|
if (endpoint === void 0) { endpoint = getEndpoint_1.BackendDestinationEnum.REPO_ENDPOINT; }
|
|
456
|
-
return (
|
|
513
|
+
return returnIfTwoFactorAuthError(function () {
|
|
514
|
+
return (0, exports.doPost)('/auth/v1/oauth2/session2', { provider: provider, authenticationCode: authenticationCode, redirectUrl: redirectUrl }, undefined, endpoint);
|
|
515
|
+
});
|
|
457
516
|
};
|
|
458
517
|
exports.oAuthSessionRequest = oAuthSessionRequest;
|
|
459
518
|
/**
|
|
@@ -525,7 +584,7 @@ exports.updateMyUserProfile = updateMyUserProfile;
|
|
|
525
584
|
*/
|
|
526
585
|
var getUserGroupHeaders = function (prefix, typeFilter, offset, limit) {
|
|
527
586
|
if (prefix === void 0) { prefix = ''; }
|
|
528
|
-
if (typeFilter === void 0) { typeFilter =
|
|
587
|
+
if (typeFilter === void 0) { typeFilter = synapseTypes_2.TYPE_FILTER.ALL; }
|
|
529
588
|
if (offset === void 0) { offset = 0; }
|
|
530
589
|
if (limit === void 0) { limit = 20; }
|
|
531
590
|
return (0, exports.doGet)(APIConstants_1.USER_GROUP_HEADERS +
|
|
@@ -867,7 +926,7 @@ exports.isInSynapseExperimentalMode = isInSynapseExperimentalMode;
|
|
|
867
926
|
*
|
|
868
927
|
* @param {*} token Access token. If undefined, then call should instruct the browser to delete the cookie.
|
|
869
928
|
*/
|
|
870
|
-
var setAccessTokenCookie = function (token
|
|
929
|
+
var setAccessTokenCookie = function (token) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
871
930
|
return tslib_1.__generator(this, function (_a) {
|
|
872
931
|
switch (_a.label) {
|
|
873
932
|
case 0:
|
|
@@ -888,18 +947,10 @@ var setAccessTokenCookie = function (token, sessionCallback) { return tslib_1.__
|
|
|
888
947
|
path: '/',
|
|
889
948
|
});
|
|
890
949
|
_a.label = 3;
|
|
891
|
-
case 3:
|
|
892
|
-
sessionCallback();
|
|
893
|
-
return [3 /*break*/, 5];
|
|
950
|
+
case 3: return [3 /*break*/, 5];
|
|
894
951
|
case 4:
|
|
895
952
|
// will set cookie in the http header
|
|
896
|
-
return [2 /*return*/, (0, exports.doPost)('Portal/sessioncookie', { sessionToken: token }, undefined, getEndpoint_1.BackendDestinationEnum.PORTAL_ENDPOINT, { credentials: 'include' })
|
|
897
|
-
.then(function (_) {
|
|
898
|
-
sessionCallback();
|
|
899
|
-
})
|
|
900
|
-
.catch(function (err) {
|
|
901
|
-
console.error('Error on setting access token ', err);
|
|
902
|
-
})];
|
|
953
|
+
return [2 /*return*/, (0, exports.doPost)('Portal/sessioncookie', { sessionToken: token }, undefined, getEndpoint_1.BackendDestinationEnum.PORTAL_ENDPOINT, { credentials: 'include' })];
|
|
903
954
|
case 5: return [2 /*return*/];
|
|
904
955
|
}
|
|
905
956
|
});
|
|
@@ -927,82 +978,10 @@ var getPrincipalAliasRequest = function (accessToken, request) {
|
|
|
927
978
|
return (0, exports.doPost)(url, request, accessToken, getEndpoint_1.BackendDestinationEnum.REPO_ENDPOINT);
|
|
928
979
|
};
|
|
929
980
|
exports.getPrincipalAliasRequest = getPrincipalAliasRequest;
|
|
930
|
-
|
|
931
|
-
During SSO login, the authorization provider (Google) will
|
|
932
|
-
send the user back to the portal with an authorization code,
|
|
933
|
-
which can be exchanged for a Synapse user session.
|
|
934
|
-
This function should be called whenever the root App is initialized
|
|
935
|
-
(to look for this code parameter and complete the round-trip).
|
|
936
|
-
If state is included, then we assume that this is being used for account creation,
|
|
937
|
-
where we pass the username through the process.
|
|
938
|
-
*/
|
|
939
|
-
var detectSSOCode = function (registerAccountUrl, onError) {
|
|
940
|
-
var redirectURL = (0, exports.getRootURL)();
|
|
941
|
-
// 'code' handling (from SSO) should be preformed on the root page, and then redirect to original route.
|
|
942
|
-
var fullUrl = new URL(window.location.href);
|
|
943
|
-
// in test environment the searchParams isn't defined
|
|
944
|
-
var searchParams = fullUrl.searchParams;
|
|
945
|
-
if (!searchParams) {
|
|
946
|
-
return;
|
|
947
|
-
}
|
|
948
|
-
var code = searchParams.get('code');
|
|
949
|
-
var provider = searchParams.get('provider');
|
|
950
|
-
var state = searchParams.get('state');
|
|
951
|
-
// state is used during OAuth based Synapse account creation (it's the username)
|
|
952
|
-
if (code && provider) {
|
|
953
|
-
var redirectUrl = "".concat(redirectURL, "?provider=").concat(provider);
|
|
954
|
-
var redirectAfterSuccess_1 = function () {
|
|
955
|
-
// go back to original route after successful SSO login
|
|
956
|
-
var originalUrl = localStorage.getItem('after-sso-login-url');
|
|
957
|
-
localStorage.removeItem('after-sso-login-url');
|
|
958
|
-
if (originalUrl) {
|
|
959
|
-
window.location.replace(originalUrl);
|
|
960
|
-
}
|
|
961
|
-
};
|
|
962
|
-
if (Login_1.PROVIDERS.GOOGLE == provider) {
|
|
963
|
-
var onSuccess = function (synToken) {
|
|
964
|
-
(0, exports.setAccessTokenCookie)(synToken.accessToken, redirectAfterSuccess_1);
|
|
965
|
-
};
|
|
966
|
-
var onFailure = function (err) {
|
|
967
|
-
if (err.status === 404) {
|
|
968
|
-
// Synapse account not found, send to registration page
|
|
969
|
-
window.location.replace(registerAccountUrl !== null && registerAccountUrl !== void 0 ? registerAccountUrl : "".concat(getEndpoint_1.PRODUCTION_ENDPOINT_CONFIG.PORTAL, "#!RegisterAccount:0"));
|
|
970
|
-
}
|
|
971
|
-
console.error('Error with Google account association: ', err);
|
|
972
|
-
if (onError) {
|
|
973
|
-
onError(err.reason);
|
|
974
|
-
}
|
|
975
|
-
};
|
|
976
|
-
if (state) {
|
|
977
|
-
(0, exports.oAuthRegisterAccountStep2)(state, provider, code, redirectUrl, getEndpoint_1.BackendDestinationEnum.REPO_ENDPOINT)
|
|
978
|
-
.then(onSuccess)
|
|
979
|
-
.catch(onFailure);
|
|
980
|
-
}
|
|
981
|
-
else {
|
|
982
|
-
(0, exports.oAuthSessionRequest)(provider, code, redirectUrl, getEndpoint_1.BackendDestinationEnum.REPO_ENDPOINT)
|
|
983
|
-
.then(onSuccess)
|
|
984
|
-
.catch(onFailure);
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
else if (Login_1.PROVIDERS.ORCID == provider) {
|
|
988
|
-
// now bind this to the user account
|
|
989
|
-
var onFailure = function (err) {
|
|
990
|
-
console.error('Error binding ORCiD to account: ', err);
|
|
991
|
-
if (onError) {
|
|
992
|
-
onError(err.reason);
|
|
993
|
-
}
|
|
994
|
-
};
|
|
995
|
-
(0, exports.bindOAuthProviderToAccount)(provider, code, redirectUrl, getEndpoint_1.BackendDestinationEnum.REPO_ENDPOINT)
|
|
996
|
-
.then(redirectAfterSuccess_1)
|
|
997
|
-
.catch(onFailure);
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
};
|
|
1001
|
-
exports.detectSSOCode = detectSSOCode;
|
|
1002
|
-
var signOut = function (sessionCallback) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
981
|
+
var signOut = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
1003
982
|
return tslib_1.__generator(this, function (_a) {
|
|
1004
983
|
switch (_a.label) {
|
|
1005
|
-
case 0: return [4 /*yield*/, (0, exports.setAccessTokenCookie)(undefined
|
|
984
|
+
case 0: return [4 /*yield*/, (0, exports.setAccessTokenCookie)(undefined)];
|
|
1006
985
|
case 1:
|
|
1007
986
|
_a.sent();
|
|
1008
987
|
return [2 /*return*/];
|
|
@@ -1803,7 +1782,7 @@ exports.getDownloadOrder = getDownloadOrder;
|
|
|
1803
1782
|
* @returns
|
|
1804
1783
|
*/
|
|
1805
1784
|
var getAllOfPaginatedService = function (fn) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
1806
|
-
var limit, offset, existsMoreData, results, data,
|
|
1785
|
+
var limit, offset, existsMoreData, results, data, e_3;
|
|
1807
1786
|
return tslib_1.__generator(this, function (_a) {
|
|
1808
1787
|
switch (_a.label) {
|
|
1809
1788
|
case 0:
|
|
@@ -1827,8 +1806,8 @@ var getAllOfPaginatedService = function (fn) { return tslib_1.__awaiter(void 0,
|
|
|
1827
1806
|
}
|
|
1828
1807
|
return [3 /*break*/, 5];
|
|
1829
1808
|
case 4:
|
|
1830
|
-
|
|
1831
|
-
throw Error("Error on getting paginated results ".concat(
|
|
1809
|
+
e_3 = _a.sent();
|
|
1810
|
+
throw Error("Error on getting paginated results ".concat(e_3));
|
|
1832
1811
|
case 5: return [3 /*break*/, 1];
|
|
1833
1812
|
case 6: return [2 /*return*/, results];
|
|
1834
1813
|
}
|
|
@@ -1845,7 +1824,7 @@ var deleteDownloadListFiles = function (list, accessToken) {
|
|
|
1845
1824
|
exports.deleteDownloadListFiles = deleteDownloadListFiles;
|
|
1846
1825
|
// https://rest-docs.synapse.org/rest/DELETE/download/list.html ?
|
|
1847
1826
|
var deleteDownloadList = function (accessToken) {
|
|
1848
|
-
return (0, exports.doDelete)('/file/v1/download/list', accessToken, getEndpoint_1.BackendDestinationEnum.REPO_ENDPOINT).then(function (
|
|
1827
|
+
return (0, exports.doDelete)('/file/v1/download/list', accessToken, getEndpoint_1.BackendDestinationEnum.REPO_ENDPOINT).then(function () {
|
|
1849
1828
|
(0, dispatchDownloadListChangeEvent_1.dispatchDownloadListChangeEvent)(undefined);
|
|
1850
1829
|
});
|
|
1851
1830
|
};
|
|
@@ -2613,7 +2592,7 @@ function getAllSynapseUserGeoData() {
|
|
|
2613
2592
|
case 1:
|
|
2614
2593
|
response = _a.sent();
|
|
2615
2594
|
return [4 /*yield*/, response.json()];
|
|
2616
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
2595
|
+
case 2: return [2 /*return*/, (_a.sent())];
|
|
2617
2596
|
}
|
|
2618
2597
|
});
|
|
2619
2598
|
});
|
|
@@ -2631,7 +2610,7 @@ function getSynapseTeamGeoData(teamId) {
|
|
|
2631
2610
|
case 1:
|
|
2632
2611
|
response = _a.sent();
|
|
2633
2612
|
return [4 /*yield*/, response.json()];
|
|
2634
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
2613
|
+
case 2: return [2 /*return*/, (_a.sent())];
|
|
2635
2614
|
}
|
|
2636
2615
|
});
|
|
2637
2616
|
});
|