UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

59 lines (58 loc) 1.78 kB
import { SYNAPSE_BACKEND_PRODUCTION_URL as n, SYNAPSE_BACKEND_DEV_URL as O, SYNAPSE_BACKEND_STAGING_URL as P } from "../SynapseConstants.js"; var R = /* @__PURE__ */ ((o) => (o[o.REPO_ENDPOINT = 0] = "REPO_ENDPOINT", o[o.PORTAL_ENDPOINT = 1] = "PORTAL_ENDPOINT", o))(R || {}); const p = [ "www.synapse.org", "staging.synapse.org", "tst.synapse.org", "dev.synapse.org", "127.0.0.1" ], r = (o) => p.includes(o.toLowerCase()) ? "/" : "https://www.synapse.org/"; function N() { return r(typeof window > "u" ? "" : window.location.hostname); } const E = { REPO: n, // Computed lazily via a getter so this object can be imported in Node.js (SSR/pre-render) // without crashing on the `window.location.hostname` access. get PORTAL() { return N(); } }, i = (o) => { let t = E; typeof window < "u" && window.SRC_OVERRIDE_ENDPOINT_CONFIG && (t = window.SRC_OVERRIDE_ENDPOINT_CONFIG); const { PORTAL: e, REPO: s } = t; if (!e || !s) throw Error("Error failed to specify endpoints, cannot make call"); return o === 1 ? e : s; }, _ = "https://mock-repo.sagebase.org", a = "https://mock-portal.sagebase.org/", T = { production: { REPO: n, PORTAL: "https://www.synapse.org/" }, staging: { REPO: P, PORTAL: "https://staging.synapse.org/" }, development: { REPO: O, PORTAL: "https://dev.synapse.org/" }, mock: { REPO: _, PORTAL: a }, local: { REPO: "http://localhost:8080/services-repository-develop-SNAPSHOT", PORTAL: "http://localhost:8888/" } }; export { R as BackendDestinationEnum, p as KNOWN_SYNAPSE_ORG_URLS, _ as MOCK_REPO_ORIGIN, E as PRODUCTION_ENDPOINT_CONFIG, T as STACK_MAP, i as getEndpoint, r as getSynapsePortalEndpoint }; //# sourceMappingURL=getEndpoint.js.map