synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
2,246 lines • 52.7 kB
JavaScript
import "../utils/PermissionLevelToAccessType.js";
import { ACCESS_TOKEN_COOKIE_KEY as w, BUNDLE_MASK_QUERY_MAX_ROWS_PER_PAGE as Tt, DATETIME_UTC_COOKIE_KEY as It, EXPERIMENTAL_MODE_COOKIE as Rt } from "../utils/SynapseConstants.js";
import "react";
import { CSRF_TOKEN_STORAGE_KEY as _t } from "../utils/hooks/useDetectSSOCode.js";
import { returnIfTwoFactorAuthError as C, allowNotFoundError as p, isOutsideSynapseOrg as j } from "./SynapseClientUtils.js";
import { doPost as i, doPut as l, doDelete as N, doGet as a, delay as U } from "./HttpClient.js";
import { memoize as pt } from "lodash-es";
import "use-deep-compare-effect";
import "../utils/context/SynapseContext.js";
import "@tanstack/react-query";
import "@tanstack/query-core";
import "lodash-es/isEmpty";
import "lodash-es/isEqual";
import "lodash-es/xorWith";
import { removeUndefined as F } from "../utils/functions/ObjectUtils.js";
import { SortBy as Dt, Direction as gt, ObjectType as b, DiscussionThreadOrder as mt, DiscussionFilter as z, DiscussionReplyOrder as vt, TYPE_FILTER as ft, FileHandleAssociateType as St } from "@sage-bionetworks/synapse-types";
import "../utils/functions/EntityTypeUtils.js";
import { BackendDestinationEnum as r, getEndpoint as L } from "../utils/functions/getEndpoint.js";
import "@mui/material";
import { SynapseClient as At } from "@sage-bionetworks/synapse-client";
import "../utils/types/IsType.js";
import "@sage-bionetworks/synapse-client/generated/models/TwoFactorAuthErrorResponse";
import "react/jsx-runtime";
import "../utils/hooks/useCookiePreferences.js";
import "../utils/hooks/useSourceAppConfigs.js";
import { getCookieDomain as yt } from "../utils/AppUtils/AppUtils.js";
import "../utils/AppUtils/session/ApplicationSessionContext.js";
import "../utils/context/FullContextProvider.js";
import "../utils/context/DocumentMetadataContext.js";
import '../style/components/_spinner.css';/* empty css */
import "react-router";
import "@sage-bionetworks/synapse-client/util/SynapseClientError";
import { TEAM_ID_MEMBER_ID_WITH_NOTIFICATION as ht, TEAM_MEMBER as $t, FAVORITES as k, BIND_INVITATION_TO_AUTHENTICATED_USER as wt, ACCESS_APPROVAL as Ct, ACCESS_REQUIREMENT as Q, ACCESS_REQUIREMENT_ACL as f, AGENT_SESSION as Ut, ENTITY as Ft, ENTITY_ACL as S, EVALUATION as x, REPO as A, VERIFICATION_SUBMISSION as bt, WIKI_PAGE as Lt, ALL_USER_SESSION_TOKENS as kt, ENTITY_ID as Mt, SESSION_ACCESS_TOKEN as Ht, THREAD_ID as m, FORUM as M, ACCESS_REQUIREMENT_BY_ID as Bt, ACCESS_REQUIREMENT_STATUS as qt, START_CHAT_ASYNC as Yt, GET_CHAT_ASYNC as Vt, APPROVED_SUBMISSION_INFO as Gt, ASYNCHRONOUS_JOB_TOKEN as V, AGENT_CHAT_TRACE as Jt, ACCESS_REQUIREMENT_DATA_ACCESS_REQUEST_FOR_UPDATE as jt, ENTITY_BUNDLE_V2 as zt, ENTITY_ACTIONS_REQUIRED as Qt, ENTITY_HEADERS as xt, ENTITY_PATH as Kt, ENTITY_PERMISSIONS as Wt, WIKI_OBJECT_TYPE as y, EVALUATION_BY_ID as K, FILE_HANDLE_BATCH as Xt, FORUM_THREAD as Zt, USER_GROUP_HEADERS_BATCH as te, INVITEE_VERIFICATION_SIGNED_TOKEN as ee, TRASHCAN_VIEW as ne, MEMBERSHIP_INVITATION as re, PROJECTS as oe, USER_BUNDLE as se, NOTIFICATION_EMAIL as ie, PROJECT_STORAGE_USAGE as ae, TABLE_QUERY_ASYNC_START as ce, TABLE_QUERY_ASYNC_GET as Ee, THREAD as v, ACCESS_REQUIREMENT_RESEARCH_PROJECT_FOR_UPDATE as ue, REGISTERED_SCHEMA_ID as le, ENTITY_SCHEMA_VALIDATION as Pe, AGENT_SESSION_HISTORY as Oe, DATA_ACCESS_SUBMISSION_BY_ID as W, TEAM as Ne, TERMS_OF_USE_INFO as de, TERMS_OF_USE_STATUS as Te, USER_ID_BUNDLE as Ie, USER_GROUP_HEADERS as X, USER_PROFILE as Z, USER_PROFILE_ID as Re, SCHEMA_VALIDATION_START as _e, SCHEMA_VALIDATION_GET as pe, WIKI_PAGE_ID as tt, ENTITY_ACCESS as De, ALIAS_AVAILABLE as ge, LIST_AGENT_SESSIONS as me, TRASHCAN_PURGE as ve, REGISTER_ACCOUNT_STEP_1 as fe, REGISTER_ACCOUNT_STEP_2 as Se, TRASHCAN_RESTORE as Ae, ACCESS_REQUIREMENT_SEARCH as ye, ACCESS_REQUEST_SUBMISSION_SEARCH as he, TERMS_OF_USE as $e, DATA_ACCESS_REQUEST_SUBMISSION as we, UPDATE_AGENT_SESSION as Ce, DATA_ACCESS_REQUEST as Ue, ENTITY_JSON as et, RESEARCH_PROJECT as Fe, VERIFICATION_SUBMISSION_STATE as be, ACCESS_APPROVAL_BY_ID as Le, ENTITY_ACCESS_REQUIREMENTS as ke, ACTIVITY_FOR_ENTITY as Me, ENTITY_VERSION_JSON as He, TEAM_ID_MEMBER_ID as nt, TEAM_MEMBERS as Be, ACCESS_REQUIREMENT_WIKI_PAGE_KEY as qe, ENTITY_ALIAS as Ye, ENTITY_SCHEMA_BINDING as Ve, CHANGE_PASSWORD as Ge, PROFILE_IMAGE_PREVIEW as Je, DOI_ASSOCIATION as je, DOI as ze, ENTITY_EVALUATION as Qe } from "../utils/APIConstants.js";
import xe from "../utils/appendFinalQueryParamKey.js";
import { calculateFriendlyFileSize as G } from "../utils/functions/calculateFriendlyFileSize.js";
import { dispatchDownloadListChangeEvent as rt } from "../utils/functions/dispatchDownloadListChangeEvent.js";
import { sanitize as Ke } from "../utils/functions/SanitizeHtmlUtils.js";
import We from "spark-md5";
import h from "universal-cookie";
const ot = 5242880, Xe = 1e4, Ze = 1;
function ir() {
if (typeof window > "u")
return "http://localhost/";
const t = window.location.port ? `:${window.location.port}` : "";
return `${window.location.protocol}//${window.location.hostname}${t}/`;
}
const ar = () => a(
"/repo/v1/version",
void 0,
r.REPO_ENDPOINT
);
function cr(t, e, n) {
return i(
"/repo/v1/validateDefiningSql",
{ definingSql: t, entityType: e },
n,
r.REPO_ENDPOINT
);
}
const Er = async (t, e = void 0) => {
const n = await i(
`/repo/v1/entity/${t.entityId}/table/download/csv/async/start`,
t,
e,
r.REPO_ENDPOINT
);
return T(
n.token,
`/repo/v1/entity/${t.entityId}/table/download/csv/async/get/${n.token}`,
e
);
}, ur = async (t, e = void 0) => {
const n = await i(
`/repo/v1/entity/${t.entityId}/table/download/pfb/async/start`,
t,
e,
r.REPO_ENDPOINT
);
return T(
n.token,
`/repo/v1/entity/${t.entityId}/table/download/pfb/async/get/${n.token}`,
e
);
}, tn = (t, e = void 0) => a(
`/file/v1/fileHandle/${t}`,
e,
r.REPO_ENDPOINT
), lr = (t, e = void 0, n, o, s = !0) => a(
`/file/v1/file/${t}?fileAssociateType=${n}&fileAssociateId=${o}&redirect=${s}`,
e,
r.REPO_ENDPOINT
), en = (t, e = void 0) => a(
`/file/v1/fileHandle/${t}/url?redirect=false`,
e,
r.REPO_ENDPOINT
), H = async (t, e, n, o) => {
let s = await a(
V(t),
n,
r.REPO_ENDPOINT
);
for (o?.(s); s.jobState && s.jobState === "PROCESSING"; )
await U(500), s = await a(
V(t),
n,
r.REPO_ENDPOINT
), o?.(s);
if (s.jobState === "FAILED") {
const c = await a(
e,
n,
r.REPO_ENDPOINT
);
console.warn(
"SynapseClient.getAsyncResultFromJobId should have thrown an error, but instead retrieved the following response:",
c
);
}
return s;
}, T = async (t, e, n) => (await H(
t,
e,
n
)).responseBody, Pr = async (t, e, n) => {
const o = await i(
ce(t.entityId),
t,
e,
r.REPO_ENDPOINT
);
return H(
o.token,
Ee(t.entityId, o.token),
e,
n
);
}, J = async (t, e, n) => {
const o = await i(
`/repo/v1/entity/${t.entityId}/table/query/async/start`,
t,
e,
r.REPO_ENDPOINT,
{ signal: n }
);
return T(
o.token,
`/repo/v1/entity/${t.entityId}/table/query/async/get/${o.token}`,
e
);
}, Or = async (t, e = void 0, n) => {
let o = 0;
const { query: s, ...c } = t, E = {
...c,
query: { ...s, offset: o, limit: void 0 },
partMask: t.partMask | Tt
}, u = await J(E, e, n);
let O = u.queryResult.queryResults.rows.length < u.maxRowsPerPage;
for (o += u.queryResult.queryResults.rows.length, E.query.limit = u.maxRowsPerPage; !O; ) {
E.query.offset = o;
const P = await J(
E,
e,
n
);
u.queryResult.queryResults.rows.push(
...P.queryResult.queryResults.rows
// ... spread operator to push all elements on
), O = P.queryResult.queryResults.rows.length < E.query.limit, o += P.queryResult.queryResults.rows.length;
}
return u;
};
async function Nr(t, e, n, o = r.REPO_ENDPOINT) {
return C(
() => i(
"/auth/v1/login2",
{ username: t, password: e, authenticationReceipt: n },
void 0,
o
)
);
}
function dr(t, e = r.REPO_ENDPOINT) {
return i("/auth/v1/2fa/token", t, void 0, e);
}
const Tr = (t, e, n, o = r.REPO_ENDPOINT) => {
const s = n?.csrfToken;
if (s)
try {
localStorage.setItem(_t, s);
} catch (c) {
console.warn("Unable to persist OAuth CSRF token.", c);
}
return i(
"/auth/v1/oauth2/authurl",
{
provider: t,
redirectUrl: e,
state: n ? encodeURIComponent(JSON.stringify(n)) : void 0
},
void 0,
o
);
}, Ir = (t, e, n, o = r.REPO_ENDPOINT) => C(
() => i(
"/auth/v1/oauth2/session2",
{ provider: t, authenticationCode: e, redirectUrl: n },
void 0,
o
)
);
function Rr(t) {
return a(
"/auth/v1/2fa",
t,
r.REPO_ENDPOINT
);
}
function _r(t) {
return N(
"/auth/v1/2fa",
t,
r.REPO_ENDPOINT
);
}
function pr(t) {
return i(
"/auth/v1/2fa/enroll",
null,
t,
r.REPO_ENDPOINT
);
}
function Dr(t, e) {
return i(
"/auth/v1/2fa",
t,
e,
r.REPO_ENDPOINT
);
}
function gr(t) {
return i(
"/auth/v1/2fa/recoveryCodes",
null,
t,
r.REPO_ENDPOINT
);
}
function mr(t) {
return i(
"/auth/v1/2fa/reset",
t,
void 0,
r.REPO_ENDPOINT
);
}
function vr(t) {
return i(
"/auth/v1/2fa/disable",
t,
void 0,
r.REPO_ENDPOINT
);
}
const nn = (t, e) => i(
Ft,
t,
e,
r.REPO_ENDPOINT
), fr = (t, e) => nn(
{
name: t,
concreteType: "org.sagebionetworks.repo.model.Project"
},
e
), rn = (t) => a(
Z,
t,
r.REPO_ENDPOINT
), Sr = (t, e) => a(
Re(t),
e,
r.REPO_ENDPOINT
), Ar = (t, e, n) => a(
`${Ie(t)}?mask=${e}`,
n,
r.REPO_ENDPOINT
), yr = (t, e) => a(
`${se}?mask=${t}`,
e,
r.REPO_ENDPOINT
), hr = (t, e = void 0) => l(
"/repo/v1/userProfile",
t,
e,
r.REPO_ENDPOINT
), $r = (t = "", e = ft.ALL, n = 0, o = 20, s) => a(
X + `?prefix=${t}&typeFilter=${e}&offset=${n}&limit=${o}`,
s,
r.REPO_ENDPOINT
), wr = (t, e) => i(
`${X}/aliases`,
{ list: t },
e,
r.REPO_ENDPOINT
), Cr = (t, e) => a(
te + `?ids=${t.join(",")}`,
e,
r.REPO_ENDPOINT
), Ur = async (t = {}, e) => {
const n = new URLSearchParams();
t.accessType != null && n.set("accessType", t.accessType), t.activeOnly != null && n.set("activeOnly", t.activeOnly.toString()), t.evaluationIds != null && n.set("evaluationIds", t.evaluationIds.join(","));
const o = (s, c) => {
n.set("limit", s.toString()), n.set("offset", c.toString());
const E = `${x}?${n.toString()}`;
return a(
E,
e,
r.REPO_ENDPOINT
);
};
if (t.evaluationIds) {
const s = await g(o);
return {
totalNumberOfResults: s.length,
results: s
};
}
return o(t.limit ?? 20, t.offset ?? 0);
}, Fr = (t, e = void 0) => i(
Z,
{ list: t },
e,
r.REPO_ENDPOINT
), br = (t, e = void 0, n) => i(
"/repo/v1/entity/children",
t,
e,
r.REPO_ENDPOINT,
{ signal: n }
), Lr = (t, e = void 0) => i(
"/repo/v1/entity/child",
t,
e,
r.REPO_ENDPOINT
), on = (t, e = void 0) => i(
Xt,
t,
e,
r.REPO_ENDPOINT
), kr = async (t, e = void 0) => {
const n = await i(
"/file/v1/file/bulk/async/start",
t,
e,
r.REPO_ENDPOINT
);
return T(
n.token,
`/file/v1/file/bulk/async/get/${n.token}`,
e
);
}, Mr = (t = void 0, e, n) => {
if (e.indexOf(".") > -1) {
const s = e.split(".");
e = s[0], n = s[1];
}
const o = n ? `/repo/v1/entity/${e}/version/${n}` : `/repo/v1/entity/${e}`;
return a(o, t, r.REPO_ENDPOINT);
}, Hr = (t, e) => st(
t.map((n) => ({ targetId: n })),
e
), st = (t, e) => {
const n = t.map((o) => {
if (o.targetId.indexOf(".") > -1) {
const s = o.targetId.split(".");
return {
targetId: s[0],
version: s[1]
};
} else return o;
});
return i(
xt,
{ references: n },
e,
r.REPO_ENDPOINT
);
}, Br = (t, e) => p(
() => a(
Ye(t),
e,
r.REPO_ENDPOINT
)
), qr = async (t, e, n) => (await st(
[{ targetId: t, targetVersionNumber: e }],
n
)).results[0], Yr = (t, e = void 0) => i(
S(t.id),
t,
e,
r.REPO_ENDPOINT
), Vr = (t, e = void 0) => l(
S(t.id),
t,
e,
r.REPO_ENDPOINT
), Gr = (t, e = void 0) => N(
S(t),
e,
r.REPO_ENDPOINT
), Jr = (t, e = void 0, n) => {
let o = `/repo/v1/entity/${t.id}`;
return n && (o += "?newVersion=true"), l(
o,
t,
e,
r.REPO_ENDPOINT
);
}, jr = (t = void 0, e) => N(
Mt(e),
t,
r.REPO_ENDPOINT
), zr = (t, e, n, o) => i(
zt(t, n),
e,
o,
r.REPO_ENDPOINT
), Qr = (t, e, n = "", o = b.ENTITY) => {
const s = `${y(o)}/${e}/wiki/${n}`;
return a(s, t, r.REPO_ENDPOINT);
};
function sn(t, e = 0, n = 200, o = "NAME", s = "ASC") {
const c = new URLSearchParams();
c.set("offset", e.toString()), c.set("limit", n.toString()), c.set("sort", o), c.set("sortDirection", s);
const E = `${k}?${c.toString()}`;
return a(
E,
t,
r.REPO_ENDPOINT
);
}
function xr(t, e = "NAME", n = "ASC") {
return g(
(s, c) => sn(t, c, s, e, n),
200
);
}
function Kr(t, e) {
return i(
`${k}/${t}`,
null,
e,
r.REPO_ENDPOINT
);
}
const Wr = (t, e) => N(
`${k}/${t}`,
e,
r.REPO_ENDPOINT
), Xr = (t, e, n = 0, o = 200) => {
const s = `/repo/v1/challenge?participantId=${e}&offset=${n}&limit=${o}`;
return a(s, t, r.REPO_ENDPOINT);
}, Zr = (t, e) => {
const n = `/repo/v1//user/${t}/certifiedUserPassingRecord`;
return p(
() => a(n, e, r.REPO_ENDPOINT)
);
}, to = (t, e) => {
const n = `/repo/v1/user/${t}/revokeCertification`;
return l(n, null, e, r.REPO_ENDPOINT);
}, eo = (t, e, n = 0, o = 200) => {
const s = `/repo/v1/challenge/${e}/challengeTeam?&offset=${n}&limit=${o}`;
return a(s, t, r.REPO_ENDPOINT);
}, no = (t, e) => g((o, s) => {
const c = `/repo/v1/challenge/${e}/challengeTeam?&offset=${s}&limit=${o}`;
return a(
c,
t,
r.REPO_ENDPOINT
);
}), ro = (t, e, n = 0, o = 50) => {
const s = `/repo/v1/challenge/${e}/submissionTeams?&offset=${n}&limit=${o}`;
return a(s, t, r.REPO_ENDPOINT);
}, oo = (t, e, n) => {
const o = `/repo/v1/evaluation/${t}/team/${e}/submissionEligibility`;
return a(o, n, r.REPO_ENDPOINT);
}, so = (t, e) => {
const n = `/repo/v1/challenge/${String(
t.challengeId
)}/challengeTeam`;
return i(
n,
t,
e,
r.REPO_ENDPOINT
);
}, io = (t, e) => {
const n = `/repo/v1/entity/${t}/challenge`;
return a(n, e, r.REPO_ENDPOINT);
};
function ao(t, e) {
return i(
"/repo/v1/team",
t,
e,
r.REPO_ENDPOINT
);
}
const co = (t, e, n = 0, o = 200) => {
const s = `/repo/v1/user/${e}/team?offset=${n}&limit=${o}`;
return a(s, t, r.REPO_ENDPOINT);
}, Eo = (t, e) => g((o, s) => {
const c = `/repo/v1/team/${e}/accessRequirement?offset=${s}&limit=${o}`;
return a(
c,
t,
r.REPO_ENDPOINT
);
}), uo = (t, e, n = "", o = 10, s = 0) => {
const c = `${Be(e)}?limit=${o}&offset=${s}${n ? `&fragment=${n}` : ""}`;
return a(c, t, r.REPO_ENDPOINT);
}, lo = (t) => l(
$t,
t,
void 0,
r.REPO_ENDPOINT
), Po = (t, e, n) => l(
ht(t, e),
void 0,
n,
r.REPO_ENDPOINT
);
function an(t, e) {
return a(
`${A}/user/${t}/openInvitation`,
e,
r.REPO_ENDPOINT
);
}
function Oo(t, e) {
return g(
() => an(t, e)
);
}
function No(t, e) {
return i(
`${A}/membershipInvitation`,
t,
e,
r.REPO_ENDPOINT
);
}
const To = (t) => i(
re(
t.membershipInvitationId
),
t,
void 0,
r.REPO_ENDPOINT
), Io = (t, e) => a(
ee(t),
e,
r.REPO_ENDPOINT
), Ro = (t, e, n) => l(
wt(e),
t,
n,
r.REPO_ENDPOINT
), _o = (t, e, n) => {
const o = nt(t, e);
return p(
() => a(o, n, r.REPO_ENDPOINT)
);
}, po = (t, e, n) => {
const o = `${nt(t, e)}/membershipStatus`;
return a(o, n, r.REPO_ENDPOINT);
}, Do = (t, e) => i(
"/repo/v1/membershipRequest",
t,
e,
r.REPO_ENDPOINT
), go = (t, e, n) => N(
`/repo/v1/team/${t}/member/${e}`,
n,
r.REPO_ENDPOINT
), mo = (t, e) => a(
Ne(t),
e,
r.REPO_ENDPOINT
), vo = (t, e) => i(
"/repo/v1/teamList",
{ list: t },
e,
r.REPO_ENDPOINT
), fo = (t, e) => {
const n = `/repo/v1/entity/${e}/wikikey`;
return a(
n,
t,
r.REPO_ENDPOINT
);
}, So = (t, e) => {
const n = qe(e);
return a(
n,
t,
r.REPO_ENDPOINT
);
}, Ao = (t, e, n) => {
const o = `${y(e)}/${n}/wikikey`;
return p(
() => a(o, t, r.REPO_ENDPOINT)
);
}, yo = (t, e, n, o = b.ENTITY) => {
const s = `${y(
o
)}/${e}/wiki2/${n}/attachmenthandles`;
return a(s, t, r.REPO_ENDPOINT);
}, ho = (t, e, n) => {
const o = `/repo/v1/evaluation/${e}/wiki/${n}/attachmenthandles`;
return a(o, t, r.REPO_ENDPOINT);
}, $o = (t, e, n, o, s = b.ENTITY) => {
const c = `${y(
s
)}/${e}/wiki2/${n}/attachment?fileName=${o}&redirect=false`;
return a(c, t, r.REPO_ENDPOINT);
}, wo = (t, e) => {
const n = `${tt(
e.ownerObjectType,
e.ownerObjectId,
e.wikiPageId
)}`;
return a(n, t, r.REPO_ENDPOINT);
}, Co = (t, e, n, o) => i(
Lt(e, n),
o,
t,
r.REPO_ENDPOINT
), Uo = (t, e, n, o) => {
const s = `${tt(e, n, o.id)}`;
return l(
s,
o,
t,
r.REPO_ENDPOINT
);
}, Fo = () => !!new h().get(Rt), cn = async (t) => {
if (j()) {
const e = new h();
t ? e.set(w, t, {
// expires in 10 days (see SWC-6190)
maxAge: 3600 * 24 * 10,
path: "/",
domain: yt()
}) : (e.remove(w, { path: "/" }), await U(100));
} else
return i(
"/Portal/sessioncookie",
{ sessionToken: t },
void 0,
r.PORTAL_ENDPOINT,
{ credentials: "include" }
);
}, it = async () => {
if (j()) {
const t = new h();
return Promise.resolve(t.get(w));
}
return a(
"/Portal/sessioncookie?validate=true",
void 0,
r.PORTAL_ENDPOINT,
{ credentials: "include" }
);
}, bo = () => new h().get(It) === "true", Lo = (t, e) => i("/repo/v1/principal/alias", e, t, r.REPO_ENDPOINT);
function En(t) {
return N(
Ht,
t,
r.REPO_ENDPOINT
);
}
async function ko(t) {
const e = await rn(t);
return N(
kt(e.ownerId),
t,
r.REPO_ENDPOINT
);
}
const Mo = async (t = "0") => {
let e;
try {
e = await it(), e && await En(e);
} catch (o) {
console.warn("Could not get/revoke the current access token", o);
}
let n = "";
try {
n = (await new At({
basePath: L(r.REPO_ENDPOINT)
}).authenticationServicesClient.getAuthV1AnonymousToken({
realm: t
})).accessToken;
} catch (o) {
console.error("Failed to get an anonymous access token.", o);
}
return await cn(n), n;
}, un = (t, e, n, o = Ze, s = n.type, c, E, u, O) => new Promise(
(P, d) => {
const I = Math.max(
ot,
n.size / Xe
), R = {
contentType: s,
fileName: e,
fileSizeBytes: n.size,
partSizeBytes: I,
storageLocationId: o
};
at(n).then((D) => {
u && u(), R.contentMD5Hex = D, Pn(
t,
e,
n,
R,
P,
d,
c,
E,
O
);
});
}
), at = pt((t) => new Promise((e, n) => {
const s = Math.ceil(t.size / 2097152), c = new We.ArrayBuffer(), E = new FileReader();
let u = 0;
E.onload = function(P) {
if (console.debug("read chunk nr", u + 1, "of", s), c.append(E.result), u++, u < s)
O();
else {
console.debug("finished loading");
const d = c.end();
console.debug("computed hash", d), e(d);
}
}, E.onerror = function() {
console.warn("oops, something went wrong.", E.error), n(E.error);
};
const O = () => {
const P = u * 2097152, d = P + 2097152 >= t.size ? t.size : P + 2097152;
E.readAsArrayBuffer(t.slice(P, d));
};
O();
})), ct = async (t, e, n, o, s, c, E, u, O, P, d, I) => {
if (n[t - 1]) {
P();
return;
}
const R = e.uploadId, D = {
uploadId: R,
contentType: "application/octet-stream",
// each part is binary
partNumbers: [t]
}, _ = `/file/v1/file/multipart/${R}/presigned/url/batch`, Pt = (await i(
_,
D,
o,
r.REPO_ENDPOINT
)).partPresignedUrls[0].uploadPresignedUrl, Ot = (t - 1) * E.partSizeBytes;
let $ = t * E.partSizeBytes - 1;
$ >= E.fileSizeBytes && ($ = E.fileSizeBytes - 1);
const Y = c.slice(
Ot,
$ + 1,
D.contentType
);
await ln(
Pt,
Y,
D.contentType,
d,
I
);
const Nt = await at(Y), dt = `/file/v1/file/multipart/${R}/add/${t}?partMD5Hex=${Nt}`;
(await l(
dt,
void 0,
o,
r.REPO_ENDPOINT
)).addPartState === "ADD_SUCCESS" ? (n[t - 1] = !0, P(), Et(
e,
n,
s,
o,
u,
O
)) : (await U(1e3), await ct(
t,
e,
n,
o,
s,
c,
E,
u,
O,
P,
d,
I
));
}, Et = (t, e, n, o, s, c) => {
if (e.every((E) => E)) {
const E = `/file/v1/file/multipart/${t.uploadId}/complete`;
l(
E,
void 0,
o,
r.REPO_ENDPOINT
).then((u) => {
s({
fileHandleId: u.resultFileHandleId,
fileName: n
});
}).catch((u) => {
c(u);
});
}
}, ln = async (t, e, n, o, s) => {
const c = s || new AbortController(), E = c.signal, O = setInterval(() => {
o && o() && !c.signal.aborted && c.abort();
}, 1e3);
try {
await fetch(t, {
method: "PUT",
headers: {
"Content-Type": n
},
body: e,
signal: E
});
} finally {
clearInterval(O);
}
}, Pn = (t, e, n, o, s, c, E, u, O) => {
i(
"/file/v1/file/multipart",
o,
t,
r.REPO_ENDPOINT
).then((d) => {
const I = d.partsState.split("").map((_) => _ === "1");
let R = 0;
const D = () => {
R++, E && E({
value: R,
total: I.length
});
};
for (let _ = 0; _ < I.length; _ = _ + 1)
I[_] ? D() : ct(
_ + 1,
d,
I,
t,
e,
n,
o,
s,
c,
D,
u,
O
);
Et(
d,
I,
e,
t,
s,
c
);
}).catch((d) => {
c(d);
});
}, Ho = (t, e) => new Promise((n, o) => {
const s = tn(
t,
e
), c = en(
t,
e
);
Promise.all([s, c]).then((E) => {
const u = E[0], O = E[1];
return On(u, O).then(
(P) => {
n(P);
}
);
}).catch((E) => {
o(E);
});
}), On = (t, e, n = ot) => new Promise((o, s) => {
t.contentSize < n ? fetch(e, {
method: "GET",
mode: "cors",
cache: "no-cache",
headers: {
"Content-Type": t.contentType
}
}).then((c) => {
c.text().then((E) => {
o(E);
});
}) : s(
new Error(
`File size (${G(
t.contentSize
)}) exceeds the maximum size that can be downloaded (${G(
n
)})`
)
);
}), Bo = (t, e, n, o, s) => new Promise((c, E) => {
const u = [
{
associateObjectId: t.id,
associateObjectType: St.FileEntity,
fileHandleId: t.dataFileHandleId
}
];
on({
includeFileHandles: n || !1,
includePreSignedURLs: o || !1,
includePreviewPreSignedURLs: s || !1,
requestedFiles: u
}, e).then((P) => {
P.requestedFiles.length && P.requestedFiles[0].fileHandleId !== void 0 ? c(P.requestedFiles[0]) : E(new Error(P.requestedFiles[0].failureCode));
}).catch((P) => {
E(P);
});
}), Nn = (t, e) => i(
"/repo/v1/download/list/add",
{
batchToAdd: t
},
e,
r.REPO_ENDPOINT
), qo = (t, e, n) => Nn(
[{ fileEntityId: t, versionNumber: e }],
n
), Yo = async (t, e) => {
const o = await i(
"/repo/v1/download/list/package/async/start",
{
zipFileName: t,
includeManifest: !0,
concreteType: "org.sagebionetworks.repo.model.download.DownloadListPackageRequest"
},
e,
r.REPO_ENDPOINT
);
return T(
o.token,
`/repo/v1/download/list/package/async/get/${o.token}`,
e
);
}, Vo = async (t = void 0) => {
const n = await i(
"/repo/v1/download/list/manifest/async/start",
{
csvTableDescriptor: {},
concreteType: "org.sagebionetworks.repo.model.download.DownloadListManifestRequest"
},
t,
r.REPO_ENDPOINT
);
return T(
n.token,
`/repo/v1/download/list/manifest/async/get/${n.token}`,
t
);
}, Go = async (t, e = void 0) => {
const n = await i(
"/repo/v1/download/list/add/async/start",
t,
e,
r.REPO_ENDPOINT
);
return T(
n.token,
`/repo/v1/download/list/add/async/get/${n.token}`,
e
);
}, Jo = (t, e, n) => i(
`/repo/v1/entity/${t}/acl`,
e,
n,
r.REPO_ENDPOINT
), jo = (t, e, n, o) => {
let s = `/repo/v1/evaluation/submission?etag=${n}`;
return o && (s += `&submissionEligibilityHash=${o}`), i(
s,
e,
t,
r.REPO_ENDPOINT
);
}, zo = (t, e) => a(
`/repo/v1/evaluation/${t}/permissions`,
e,
r.REPO_ENDPOINT
), Qo = (t, e) => t ? a(
K(t),
e,
r.REPO_ENDPOINT
) : Promise.reject(new Error("evalId is empty")), xo = (t, e) => t.id ? l(
K(t.id),
t,
e,
r.REPO_ENDPOINT
) : Promise.reject(new Error("evaluation does not have an ID")), Ko = (t, e) => i(
x,
t,
e,
r.REPO_ENDPOINT
), Wo = (t, e) => N(
`/repo/v1/evaluation/${t}`,
e,
r.REPO_ENDPOINT
), Xo = (t, e, n) => a(
`/repo/v1/evaluation/${t}/round/${e}`,
n,
r.REPO_ENDPOINT
), Zo = (t, e, n) => i(
`/repo/v1/evaluation/${t}/round/list`,
e ?? {},
n,
r.REPO_ENDPOINT
), ts = (t, e) => i(
`/repo/v1/evaluation/${t.evaluationId}/round`,
t,
e,
r.REPO_ENDPOINT
), es = (t, e) => l(
`/repo/v1/evaluation/${t.evaluationId}/round/${t.id}`,
t,
e,
r.REPO_ENDPOINT
), ns = (t, e, n) => N(
`/repo/v1/evaluation/${t}/round/${e}`,
n,
r.REPO_ENDPOINT
), rs = (t, e) => a(
`/repo/v1/evaluation/submission/query?query=${encodeURI(t)}`,
e,
r.REPO_ENDPOINT
), os = (t) => i(
"/auth/v1/oauth2/description",
t,
void 0,
r.REPO_ENDPOINT
), ss = (t, e) => i(
"/auth/v1/oauth2/consentcheck",
t,
e,
r.REPO_ENDPOINT
), is = (t) => a(
`/auth/v1/oauth2/client/${t}`,
void 0,
r.REPO_ENDPOINT
), as = (t, e) => a(
`/auth/v1/oauth2/client${e ? "?nextPageToken=" + e : ""}`,
t,
r.REPO_ENDPOINT
), cs = (t, e) => i(
"/auth/v1/oauth2/client",
t,
e,
r.REPO_ENDPOINT
), Es = (t, e) => N(
`/auth/v1/oauth2/client/${t}`,
e,
r.REPO_ENDPOINT
), us = (t, e) => l(
`/auth/v1/oauth2/client/${t.client_id}`,
t,
e,
r.REPO_ENDPOINT
), ls = (t, e) => l(
`/auth/v1/oauth2/client/${t.client_id}/verificationPrecheck`,
t,
e,
r.REPO_ENDPOINT
), Ps = (t, e) => i(
`/auth/v1/oauth2/client/secret/${e}`,
void 0,
t,
r.REPO_ENDPOINT
), Os = async (t) => a(
"/auth/v1/authenticatedOn",
t,
r.REPO_ENDPOINT
), Ns = (t, e) => i(
"/auth/v1/oauth2/consent",
t,
e,
r.REPO_ENDPOINT
), ds = (t, e) => i(
`/repo/v1/form/group?name=${encodeURI(t)}`,
void 0,
e,
r.REPO_ENDPOINT
), Ts = (t, e) => a(
`/repo/v1/form/group/${t}/acl`,
e,
r.REPO_ENDPOINT
), Is = (t, e, n) => l(
`/repo/v1/form/group/${t}/acl`,
e,
n,
r.REPO_ENDPOINT
), Rs = (t, e, n, o) => {
const s = {
name: e,
fileHandleId: n
};
return i(
`/repo/v1/form/data?groupId=${t}`,
s,
o,
r.REPO_ENDPOINT
);
}, _s = (t, e, n, o) => {
const s = {
name: e,
fileHandleId: n
};
return l(
`/repo/v1/form/data/${t}`,
s,
o,
r.REPO_ENDPOINT
);
}, ps = (t, e) => N(
`/repo/v1/form/data/${t}`,
e,
r.REPO_ENDPOINT
), Ds = (t, e) => i(
`/repo/v1/form/data/${t}/submit`,
void 0,
e,
r.REPO_ENDPOINT
), gs = (t, e) => i(
"/repo/v1/form/data/list",
t,
e,
r.REPO_ENDPOINT
), ms = (t, e) => i(
"/repo/v1/form/data/list/reviewer",
t,
e,
r.REPO_ENDPOINT
), vs = (t, e) => l(
`/repo/v1/form/data/${t}/accept`,
void 0,
e,
r.REPO_ENDPOINT
), fs = (t, e, n) => {
const o = {
reason: e
};
return l(
`/repo/v1/form/data/${t}/reject`,
o,
n,
r.REPO_ENDPOINT
);
}, Ss = (t, e) => i(
"/repo/v1/statistics",
t,
e,
r.REPO_ENDPOINT
), As = (t, e) => i(
"/repo/v1/restrictionInformation",
t,
e,
r.REPO_ENDPOINT
), ys = (t, e) => i(
"/repo/v1/restrictionInformation/batch",
t,
e,
r.REPO_ENDPOINT
), hs = (t, e, n = 50, o = 0) => {
const s = `${ke(
e
)}?limit=${n}&offset=${o}`;
return a(
s,
t,
r.REPO_ENDPOINT
);
}, $s = (t, e) => a(
Bt(e),
t,
r.REPO_ENDPOINT
), ws = (t, e) => ("description" in e && delete e.description, i(
Q,
e,
t,
r.REPO_ENDPOINT
)), Cs = (t, e) => ("description" in e && delete e.description, l(
`${Q}/${e.id}`,
e,
t,
r.REPO_ENDPOINT
)), Us = (t, e) => p(
() => a(
f(e),
t,
r.REPO_ENDPOINT
)
), Fs = (t, e) => N(
f(e),
t,
r.REPO_ENDPOINT
), bs = (t, e) => i(
f(e.id),
e,
t,
r.REPO_ENDPOINT
), Ls = (t, e) => l(
f(e.id),
e,
t,
r.REPO_ENDPOINT
), ks = (t, e) => i(
ye,
e,
t,
r.REPO_ENDPOINT
);
function Ms(t, e) {
return a(
qt(e),
t,
r.REPO_ENDPOINT
);
}
const Hs = (t, e) => g((o, s) => {
const c = `/repo/v1/entity/${e}/accessRequirement?limit=${o}&offset=${s}`;
return a(
c,
t,
r.REPO_ENDPOINT
);
});
function Bs(t, e) {
return i(
`/repo/v1/entity/${t}/lockAccessRequirement`,
null,
e,
r.REPO_ENDPOINT
);
}
const qs = async (t, e) => {
const n = `${Le(e)}`;
return a(
n,
t,
r.REPO_ENDPOINT
);
}, Ys = async (t, e) => i(
Ct,
e,
t,
r.REPO_ENDPOINT
), Vs = (t) => a(
"/file/v1/download/list",
t,
r.REPO_ENDPOINT
), Gs = (t, e) => {
const n = "/file/v1/download/order", o = t ? `${n}?zipFileName=${t}` : n;
return i(
o,
void 0,
e,
r.REPO_ENDPOINT
);
}, g = async (t, e = 50) => {
let n = 0, o = !0;
const s = [];
for (; o; )
try {
const c = await t(e, n);
s.push(...c.results), n += c.results.length, c.results.length < e && (o = !1);
} catch (c) {
throw Error(`Error on getting paginated results ${c}`);
}
return s;
};
async function ut(t) {
let e = !0, n;
const o = [];
for (; e; )
try {
const s = await t(n);
"results" in s ? o.push(...s.results) : "page" in s && o.push(...s.page), n = s.nextPageToken, n || (e = !1);
} catch (s) {
throw Error(`Error on getting paginated results ${s}`);
}
return o;
}
const Js = (t, e) => i(
"/file/v1/download/list/remove",
{ list: t },
e,
r.REPO_ENDPOINT
).then((n) => (rt(n), n)), js = (t) => N(
"/file/v1/download/list",
t,
r.REPO_ENDPOINT
).then(() => {
rt(void 0);
}), zs = async (t, e = void 0) => {
const n = await i(
`/repo/v1/entity/${t.entityId}/table/transaction/async/start`,
t,
e,
r.REPO_ENDPOINT
);
return T(
n.token,
`/repo/v1/entity/${t.entityId}/table/transaction/async/get/${n.token}`,
e
);
}, Qs = (t, e) => i(
"/auth/v1/personalAccessToken",
t,
e,
r.REPO_ENDPOINT
), xs = (t, e) => a(
`/auth/v1/personalAccessToken${e ? "?nextPageToken=" + e : ""}`,
t,
r.REPO_ENDPOINT
), Ks = (t, e) => N(
`/auth/v1/personalAccessToken/${t}`,
e,
r.REPO_ENDPOINT
), Ws = (t, e = {}) => {
const n = new URLSearchParams(
F(e)
);
return a(
`${oe}?${n.toString()}`,
t,
r.REPO_ENDPOINT
);
}, Xs = (t, e = {}, n) => {
const o = new URLSearchParams(
F(e)
);
return a(
`/repo/v1/projects/user/${t}?${o.toString()}`,
n,
r.REPO_ENDPOINT
);
}, Zs = (t, e) => a(
S(t),
e,
r.REPO_ENDPOINT
), ti = (t, e = {}, n) => {
const o = new URLSearchParams(
F(e)
);
return g((c, E) => {
const u = `${Qe(
t
)}?offset=${E}&limit=${c}&${o.toString()}`;
return a(
u,
n,
r.REPO_ENDPOINT
);
});
}, ei = (t, e) => a(
Wt(t),
e,
r.REPO_ENDPOINT
), ni = (t, e) => a(
Kt(t),
e,
r.REPO_ENDPOINT
), ri = (t, e, n = 0, o = 200) => a(
`/repo/v1/entity/${t}/version?offset=${n}&limit=${o}`,
e,
r.REPO_ENDPOINT
), oi = (t, e) => i(
"/repo/v1/search",
t,
e,
r.REPO_ENDPOINT
);
async function B(t, e) {
const o = await i(
"/repo/v1/download/list/query/async/start",
{
concreteType: "org.sagebionetworks.repo.model.download.DownloadListQueryRequest",
requestDetails: e
},
t,
r.REPO_ENDPOINT
);
return (await T(
o.token,
`/repo/v1/download/list/query/async/get/${o.token}`,
t
)).responseDetails;
}
const si = (t) => N(
"/repo/v1/download/list",
t,
r.REPO_ENDPOINT
), ii = (t, e = void 0) => B(e, t), ai = (t = void 0) => B(t, {
concreteType: "org.sagebionetworks.repo.model.download.FilesStatisticsRequest"
}), dn = (t, e = void 0) => B(
e,
t
), ci = (t, e = void 0) => ut(
() => dn(t, e)
), Ei = (t, e = void 0) => i(
"/repo/v1/download/list/remove",
t,
e,
r.REPO_ENDPOINT
), ui = (t, e) => i(
Fe,
t,
e,
r.REPO_ENDPOINT
), li = (t, e) => a(
ue(t),
e,
r.REPO_ENDPOINT
), Pi = (t, e) => a(
jt(t),
e,
r.REPO_ENDPOINT
);
function Oi(t, e) {
return i(
Ue,
t,
e,
r.REPO_ENDPOINT
);
}
const Ni = (t, e) => i(
we(t.requestId),
t,
e,
r.REPO_ENDPOINT
), di = (t, e) => l(
`/repo/v1/dataAccessSubmission/${t}/cancellation`,
void 0,
e,
r.REPO_ENDPOINT
), Ti = (t, e) => a(
W(t),
e,
r.REPO_ENDPOINT
), Ii = (t, e) => l(
W(t.submissionId),
t,
e,
r.REPO_ENDPOINT
), Ri = (t, e) => p(
() => a(
Ve(t),
e,
r.REPO_ENDPOINT
)
), _i = (t, e) => a(
Pe(t),
e,
r.REPO_ENDPOINT
), pi = (t) => a(
`${le(t)}`,
void 0,
r.REPO_ENDPOINT
), Di = async (t, e) => {
const n = await i(
_e,
{
concreteType: "org.sagebionetworks.repo.model.schema.GetValidationSchemaRequest",
$id: t
},
e,
r.REPO_ENDPOINT
);
return T(
n.token,
pe(n.token),
e
);
}, gi = (t, e, n) => a(
`${De(t)}?accessType=${e}`,
n,
r.REPO_ENDPOINT
), mi = (t, e, n, o) => {
const s = new URLSearchParams();
s.set("includeDerivedAnnotations", String(n));
const c = e ? He(t, e) : et(t);
return a(
`${c}?${s.toString()}`,
o,
r.REPO_ENDPOINT
);
}, vi = (t, e, n) => l(
et(t),
e,
n,
r.REPO_ENDPOINT
), fi = (t) => a(
ie,
t,
r.REPO_ENDPOINT
), Si = (t, e) => i(
ge,
t,
e,
r.REPO_ENDPOINT
), Ai = (t, e) => i(
fe(e),
t,
void 0,
r.REPO_ENDPOINT
), yi = (t) => i(
Se,
t,
void 0,
r.REPO_ENDPOINT
), hi = (t, e, n, o, s = r.REPO_ENDPOINT) => i(
"/auth/v1/oauth2/account2",
{
provider: e,
authenticationCode: n,
redirectUrl: o,
userName: t
},
void 0,
s
), $i = async (t, e, n, o = r.REPO_ENDPOINT) => {
const s = await it();
return i(
"/auth/v1/oauth2/alias",
{ provider: t, authenticationCode: e, redirectUrl: n },
s,
o
);
}, wi = async (t, e, n) => {
const o = `/auth/v1/oauth2/alias?provider=${t}&alias=${encodeURIComponent(
n
)}`;
return N(o, e, r.REPO_ENDPOINT);
}, Ci = (t) => i(
$e,
t,
void 0,
r.REPO_ENDPOINT
), Ui = (t, e) => i(
bt,
t,
e,
r.REPO_ENDPOINT
);
function Fi(t, e, n) {
return i(
be(t),
e,
n,
r.REPO_ENDPOINT
);
}
const bi = (t) => C(
() => i(
Ge,
t,
void 0,
r.REPO_ENDPOINT
)
), Li = (t) => {
const e = xe(
new URL(window.location.href),
"passwordResetToken"
), n = `/auth/v1/user/password/reset?passwordResetEndpoint=${encodeURIComponent(
e
)}`;
return i(
n,
{ email: t },
void 0,
r.REPO_ENDPOINT
);
}, ki = (t, e, n, o) => i(
`/repo/v1/account/${e}/emailValidation?portalEndpoint=${n}`,
{ email: t },
o,
r.REPO_ENDPOINT
), Mi = (t, e) => i(
"/repo/v1/email",
t,
e,
r.REPO_ENDPOINT
), Hi = (t, e) => N(
`/repo/v1/email?email=${encodeURIComponent(e)}`,
t,
r.REPO_ENDPOINT
), Bi = (t, e) => l(
"/repo/v1/notificationEmail",
{ email: t },
e,
r.REPO_ENDPOINT
), qi = (t, e) => a(
`/repo/v1/project/${t}/forum`,
e,
r.REPO_ENDPOINT
), Yi = (t, e) => a(
`/repo/v1/reply/${t}`,
e,
r.REPO_ENDPOINT
), Vi = (t, e) => i(
"/repo/v1/reply",
t,
e,
r.REPO_ENDPOINT
), Gi = (t, e) => l(
`/repo/v1/reply/${t.replyId}/message`,
{ messageMarkdown: t.messageMarkdown },
e,
r.REPO_ENDPOINT
), Ji = (t, e) => N(
`/repo/v1/reply/${e}`,
t,
r.REPO_ENDPOINT
), ji = (t, e, n = 30, o = 0, s = vt.CREATED_ON, c = !0, E = z.EXCLUDE_DELETED) => {
const u = new URLSearchParams();
u.set("offset", o.toString()), u.set("limit", n.toString()), u.set("sort", s), u.set("ascending", c.toString()), u.set("filter", E);
const O = `${v}/${e}/replies?${u.toString()}`;
return a(
O,
t,
r.REPO_ENDPOINT
);
}, zi = (t, e) => a(
`/repo/v1/reply/messageUrl?messageKey=${t}`,
e,
r.REPO_ENDPOINT
), Qi = (t, e) => l(
`${m(e)}/pin`,
void 0,
t,
r.REPO_ENDPOINT
), xi = (t, e) => l(
`${m(e)}/unpin`,
void 0,
t,
r.REPO_ENDPOINT
), Ki = (t, e) => a(
m(t),
e,
r.REPO_ENDPOINT
), Wi = (t, e) => a(
`${v}/messageUrl?messageKey=${t}`,
e,
r.REPO_ENDPOINT
), Xi = (t, e) => i(
v,
e,
t,
r.REPO_ENDPOINT
), Zi = (t, e) => l(
`${v}/${e.threadId}/title`,
{ title: e.title },
t,
r.REPO_ENDPOINT
), ta = (t, e) => l(
`${v}/${e.threadId}/message`,
{ messageMarkdown: e.messageMarkdown },
t,
r.REPO_ENDPOINT
), ea = (t, e) => N(
m(e),
t,
r.REPO_ENDPOINT
), na = (t, e) => l(
`${m(e)}/restore`,
void 0,
t,
r.REPO_ENDPOINT
), Tn = (t, e, n = 20, o = 0) => {
const s = new URLSearchParams();
return s.set("offset", o.toString()), s.set("limit", n.toString()), a(
`${M}/${e}/moderators?${s.toString()}`,
t,
r.REPO_ENDPOINT
);
};
function ra(t, e) {
return g(
(o, s) => Tn(t, e, o, s),
20
);
}
const oa = (t, e) => a(
`${M}/${e}`,
t,
r.REPO_ENDPOINT
), sa = (t, e, n) => i(
`${M}/${e}/search`,
t,
n,
r.REPO_ENDPOINT
), ia = (t, e, n = 0, o = 20, s = mt.PINNED_AND_LAST_ACTIVITY, c = !0, E = z.EXCLUDE_DELETED) => {
const u = new URLSearchParams();
u.set("offset", n.toString()), u.set("limit", o.toString()), u.set("sort", s), u.set("ascending", c.toString()), u.set("filter", E);
const O = `${Zt(e)}?${u.toString()}`;
return a(
O,
t,
r.REPO_ENDPOINT
);
}, aa = (t, e) => i(
"/repo/v1/accessApproval/search",
t,
e,
r.REPO_ENDPOINT
), ca = (t, e) => i(
he,
t,
e,
r.REPO_ENDPOINT
), Ea = (t, e) => i(
Gt(t.accessRequirementId),
t,
e,
r.REPO_ENDPOINT
), ua = (t, e, n) => {
const o = Me(
t,
e ? `${e}` : void 0
);
return a(o, n, r.REPO_ENDPOINT);
};
function la(t) {
return p(
() => a(
Je(t) + "?redirect=false",
void 0,
r.REPO_ENDPOINT
)
);
}
function Pa(t, e = 0, n = 25) {
return a(
ne + `?offset=${e}&limit=${n}`,
t,
r.REPO_ENDPOINT
);
}
function Oa(t, e) {
return l(
Ae(t),
void 0,
e,
r.REPO_ENDPOINT
);
}
function Na(t, e) {
return l(
ve(t),
void 0,
e,
r.REPO_ENDPOINT
);
}
function da(t) {
return a(
"/repo/v1/certifiedUserTest",
t,
r.REPO_ENDPOINT
);
}
function Ta(t, e) {
return i(
"/repo/v1/certifiedUserTestResponse",
e,
t,
r.REPO_ENDPOINT
);
}
const q = "https://s3.amazonaws.com/geoloc.sagebase.org/", In = q + "allPoints.json", Rn = q + "googlemap.txt";
async function Ia() {
return await (await fetch(Rn)).text();
}
async function Ra() {
return await (await fetch(In)).json();
}
async function _a(t) {
const e = await fetch(`${q}${t}.json`);
return e.status == 200 ? await e.json() : [];
}
function pa(t, e = 100, n = 0, o) {
const s = new URLSearchParams();
return s.set("limit", e.toString()), s.set("offset", n.toString()), s.set("objectType", o.objectType), o.sortBy && s.set("sortBy", o.sortBy), o.sortDirection && s.set("sortDirection", o.sortDirection), a(
`/repo/v1/subscription/all?${s.toString()}`,
t,
r.REPO_ENDPOINT
);
}
function Da(t, e) {
return a(
`/repo/v1/subscription/${e}`,
t,
r.REPO_ENDPOINT
);
}
function ga(t, e) {
return i(
"/repo/v1/subscription/subscribers",
e,
t,
r.REPO_ENDPOINT
);
}
function ma(t, e) {
return i(
"/repo/v1/subscription",
e,
t,
r.REPO_ENDPOINT
);
}
function va(t, e) {
return N(
`/repo/v1/subscription/${e}`,
t,
r.REPO_ENDPOINT
);
}
function fa(t, e) {
return i(
"/repo/v1/subscription/list",
e,
t,
r.REPO_ENDPOINT
);
}
function Sa(t, e) {
return a(
`/file/v1/entity/${t}/uploadDestination`,
e,
r.REPO_ENDPOINT
);
}
function Aa(t, e, n) {
return a(
`/file/v1/entity/${t}/uploadDestination/${e}`,
n,
r.REPO_ENDPOINT
);
}
function ya(t, e, n, o = "ENTITY") {
const s = new URLSearchParams();
return s.set("type", o), s.set("id", e), n && s.set("version", n.toString()), p(
() => a(
`${je}?${s.toString()}`,
t,
r.REPO_ENDPOINT
)
);
}
function ha(t, e, n, o = "ENTITY") {
const s = new URLSearchParams();
return s.set("type", o), s.set("id", e), n && s.set("version", n.toString()), p(
() => a(
`${ze}?${s.toString()}`,
t,
r.REPO_ENDPOINT
)
);
}
function $a(t, e, n) {
const o = new URLSearchParams();
return o.set("fileHandleId", t), e && n && (o.set("associatedObjectId", e), o.set("associatedObjectType", n.toString())), `${L(
r.PORTAL_ENDPOINT
)}/Portal/filehandleassociation?${o.toString()}`;
}
const wa = () => a(
"/Portal/featureflags",
void 0,
r.PORTAL_ENDPOINT
), Ca = (t, e) => a(
Qt(t),
e,
r.REPO_ENDPOINT
), Ua = (t, e, n = 0, o = 20, s = Dt.CREATED_ON, c = gt.DESC) => {
const E = new URLSearchParams();
return E.set("offset", n.toString()), E.set("limit", o.toString()), E.set("sort", s), E.set("sortDirection", c), a(
`/repo/v1/entity/${t}/dockerTag?${E.toString()}`,
e,
r.REPO_ENDPOINT
);
};
function Fa(t, e, n) {
const o = new URLSearchParams();
return n && o.set("nextPageToken", n), a(
`/repo/v1/accessRequirement/${e}/subjects?${o.toString()}`,
t,
r.REPO_ENDPOINT
);
}
function ba(t, e) {
return i(
"/repo/v1/column/batch",
{
list: e.map((n) => ({
...n,
concreteType: "org.sagebionetworks.repo.model.table.ColumnModel"
})),
concreteType: "org.sagebionetworks.repo.model.ListWrapper"
},
t,
r.REPO_ENDPOINT
);
}
function La(t, e) {
const n = new URLSearchParams();
return t != null && n.set("viewEntityType", t), e != null && n.set("viewTypeMask", e.toString()), a(
`/repo/v1/column/tableview/defaults?${n.toString()}`,
void 0,
r.REPO_ENDPOINT
);
}
async function ka(t, e = void 0) {
return ut(async (o) => {
t.nextPageToken = o;
const s = await i(
"/repo/v1/column/view/scope/async/start",
t,
e,
r.REPO_ENDPOINT
);
return T(
s.token,
`/repo/v1/column/view/scope/async/get/${s.token}`,
e
);
});
}
const lt = async (t, e, n, o) => {
const s = Ke(n), c = await un(
o,
"content",
new Blob([s], { type: "text/plain" })
);
return {
recipients: t,
subject: e,
notificationUnsubscribeEndpoint: `${L(
r.PORTAL_ENDPOINT
)}SignedToken:`,
fileHandleId: c.fileHandleId
};
};
async function Ma(t, e, n, o) {
const s = await lt(
t,
e,
n,
o
);
return i(
`${A}/message`,
s,
o,
r.REPO_ENDPOINT
);
}
async function Ha(t, e, n, o) {
const s = await lt([], e, n, o);
return i(
`${A}/entity/${t}/message`,
s,
o,
r.REPO_ENDPOINT
);
}
const Ba = (t, e = void 0) => i(
Ut,
t,
e,
r.REPO_ENDPOINT
), qa = (t, e = void 0) => l(
Ce(t.sessionId),
t,
e,
r.REPO_ENDPOINT
), Ya = (t, e = void 0) => i(
me,
t,
e,
r.REPO_ENDPOINT
), Va = async (t, e, n) => {
const o = await i(
Yt,
t,
e,
r.REPO_ENDPOINT
);
return H(
o.token,
Vt(o.token),
e,
n
);
}, Ga = (t, e = void 0, n) => i(
Oe(t.sessionId),
t,
e,
r.REPO_ENDPOINT,
{ signal: n }
), Ja = (t, e = void 0, n) => i(
Jt(t.jobId),
t,
e,
r.REPO_ENDPOINT,
{ signal: n }
), ja = (t = void 0, e) => a(
de,
t,
r.REPO_ENDPOINT,
{ signal: e }
), za = (t = void 0, e) => a(
Te,
t,
r.REPO_ENDPOINT,
{ signal: e }
), Qa = (t, e = void 0, n) => a(
ae(t),
e,
r.REPO_ENDPOINT,
{ signal: n }
);
export {
Ze as SYNAPSE_STORAGE_LOCATION_ID,
vs as acceptFormData,
ki as addEmailAddressStep1,
Mi as addEmailAddressStep2,
Nn as addFileBatchToDownloadListV2,
qo as addFileToDownloadListV2,
Go as addFilesToDownloadListV2,
Po as addTeamMemberAsAuthenticatedUserOrAdmin,
lo as addTeamMemberWithToken,
Kr as addUserFavorite,
Ro as bindInvitationToAuthenticatedUser,
$i as bindOAuthProviderToAccount,
at as calculateMd5,
di as cancelDataAccessRequest,
bi as changePassword,
Et as checkUploadComplete,
si as clearDownloadListV2,
Dr as complete2FAEnrollment,
Ns as consentToOAuth2Request,
Jo as createACL,
Ys as createAccessApproval,
ws as createAccessRequirement,
bs as createAccessRequirementAcl,
Ba as createAgentSession,
ba as createColumnModels,
nn as createEntity,
Yr as createEntityACL,
Ko as createEvaluation,
ts as createEvaluationRound,
Rs as createFormData,
ds as createFormGroup,
Bs as createLockAccessRequirement,
Vo as createManifestFromDownloadListV2,
No as createMembershipInvitation,
Do as createMembershipRequest,
cs as createOAuthClient,
Ps as createOAuthClientSecret,
Yo as createPackageFromDownloadListV2,
Qs as createPersonalAccessToken,
Ui as createProfileVerificationSubmission,
fr as createProject,
gr as createRecoveryCodes,
Er as createTableCsvForDownload,
ur as createTablePfbForDownload,
ao as createTeam,
Co as createWikiPage,
Fs as deleteAccessRequirementAcl,
ko as deleteAllSessionAccessTokens,
js as deleteDownloadList,
Js as deleteDownloadListFiles,
Hi as deleteEmail,
jr as deleteEntity,
Gr as deleteEntityACL,
Wo as deleteEvaluation,
ns as deleteEvaluationRound,
ps as deleteFormData,
go as deleteMemberFromTeam,
Es as deleteOAuthClient,
Ks as deletePersonalAccessToken,
Ji as deleteReply,
En as deleteSessionAccessToken,
va as deleteSubscription,
ea as deleteThread,
vr as disableTwoFactorAuth,
_r as disableTwoFactorAuthForCurrentUser,
sa as forumSearch,
qs as getAccessApproval,
hs as getAccessRequirement,
Us as getAccessRequirementAcl,
$s as getAccessRequirementById,
Ms as getAccessRequirementStatus,
it as getAccessTokenFromCookie,
ua as getActivityForEntity,
lr as getActualFileHandleByIdURL,
Va as getAgentChatAsyncJobResults,
Hs as getAllAccessRequirements,
no as getAllChallengeTeams,
ci as getAllDownloadListActionsRequired,
ti as getAllEntityEvaluations,
ra as getAllModerators,
ut as getAllOfNextPageTokenPaginatedService,
g as getAllOfPaginatedService,
Oo as getAllOpenMembershipInvitationsForUser,
pa as getAllSubscriptions,
Ra as getAllSynapseUserGeoData,
xr as getAllUserFavorites,
ka as getAnnotationColumnModels,
Ea as getApprovedSubmissionInfo,
T as getAsyncResultBodyFromJobId,
H as getAsyncResultFromJobId,
Os as getAuthenticatedOn,
ii as getAvailableFilesToDownload,
kr as getBulkFiles,
da as getCertifyQuiz,
eo as getChallengeTeams,
Ja as getChatAgentTraceEvents,
Rr as getCurrentUserTwoFactorEnrollmentStatus,
ha as getDOI,
ya as getDOIAssociation,
Pi as getDataAccessRequestForUpdate,
La as getDefaultColumnModels,
Sa as getDefaultUploadDestination,
Ua as getDockerTag,
Vs as getDownloadList,
dn as getDownloadListActionsRequired,
ai as getDownloadListStatistics,
Gs as getDownloadOrder,
Mr as getEntity,
Zs as getEntityACL,
Br as getEntityAlias,
zr as getEntityBundleV2,
io as getEntityChallenge,
br as getEntityChildren,
Ca as getEntityDownloadActionsRequired,
qr as getEntityHeader,
st as getEntityHeaders,
Hr as getEntityHeadersByIds,
mi as getEntityJson,
ni as getEntityPath,
ei as getEntityPermissions,
ri as getEntityVersions,
Qr as getEntityWiki,
Qo as getEvaluation,
zo as getEvaluationPermissions,
Xo as getEvaluationRound,
Zo as getEvaluationRoundsList,
rs as getEvaluationSubmissions,
Ur as getEvaluations,
wa as getFeatureFlags,
tn as getFileHandleById,
en as getFileHandleByIdURL,
On as getFileHandleContent,
Ho as getFileHandleContentFromID,
Bo as getFileResult,
on as getFiles,
Ts as getFormACL,
qi as getForum,
oa as getForumMetadata,
ia as getForumThreads,
Or as getFullQueryTableResults,
Ia as getGoogleMapsApiKey,
Cr as getGroupHeadersBatch,
Io as getInviteeVerificationSignedToken,
_o as getIsUserMemberOfTeam,
Pa as getItemsInTrashCan,
To as getMembershipInvitation,
po as getMembershipStatus,
Tn as getModerators,
Ws as getMyProjects,
yr as getMyUserBundle,
fi as getNotificationEmail,
as as getOAuth2,
is as getOAuth2Client,
os as getOAuth2RequestDescription,
an as getOpenMembershipInvitationsForUser,
Zr as getPassingRecord,
xs as getPersonalAccessTokenRecords,
$a as getPortalFileHandleServletUrl,
$o as getPresignedUrlForWikiAttachment,
Lo as getPrincipalAliasRequest,
la as getProfilePicPreviewPresignedUrl,
Ss as getProjectStatistics,
Qa as getProjectStorageUsage,
Pr as getQueryTableAsyncJobResults,
J as getQueryTableResults,
ji as getReplies,
Yi as getReply,
zi as getReplyMessageUrl,
li as getResearchProject,
As as getRestrictionInformation,
ys as getRestrictionInformationBatch,
ir as getRootURL,
Ao as getRootWikiPageKey,
pi as getSchema,
Ri as getSchemaBinding,
_i as getSchemaValidationResults,
Ga as getSessionHistory,
Fa as getSubjects,
Ti as getSubmissionById,
oo as getSubmissionEligibility,
ro as getSubmissionTeams,
ga as getSubscribers,
Da as getSubscription,
_a as getSynapseTeamGeoData,
mo as getTeam,
Eo as getTeamAccessRequirements,
vo as getTeamList,
uo as getTeamMembers,
ja as getTermsOfServiceInfo,
za as getTermsOfServiceStatus,
Ki as getThr