Skip to content

Commit

Permalink
fix: rename url to route
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Dec 5, 2023
1 parent abe947e commit d894dc5
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions packages/octochemdb/src/activeOrNaturalDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import { normalizeActivities } from './utils/normalizeActivities.js';
* Search for a specific natural or active compound using its ID
* @param {object} [options={}]
* @param {string} [options.fields='_id,data'] - List of fields to retrieve
* @param {string} [options.url='activesOrNaturals/v1/id'] - URL of the webservice
* @param {string} [options.route='activesOrNaturals/v1/id'] - URL of the webservice
* @param {string} [options.baseURL='https://octochemdb.cheminfo.org/'] - URL of the webservice
*/

export async function activeOrNaturalDetails(id, options = {}) {
const {
url = 'activesOrNaturals/v1/id',
route = 'activesOrNaturals/v1/id',
baseURL = 'https://octochemdb.cheminfo.org/',
fields = '_id,data',
} = options;

const activeOrNatural = await fetchActiveOrNatural(id, {
url: new URL(url, baseURL).toString(),
url: new URL(route, baseURL).toString(),
fields,
});

Expand Down
8 changes: 4 additions & 4 deletions packages/octochemdb/src/activesOrNaturals.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ import { searchWithIonizations } from './utils/searchWithIonizations.js';
* @param {string} [options.kwTitles=''] - Comma separated list of keyword from the compound title
* @param {string} [options.minNbMassSpectra] - Minimal number of mass spectra
* @param {number} [options.limit=1000] - Maximal number of entries to return
* @param {string} [options.url='activesOrNaturals/v1/search'] - URL of the webservice
* @param {string} [options.route='activesOrNaturals/v1/search'] - Route to this specific webservice
* @param {string[]|undefined} [options.includes] - Array of DBref collections to include
* @param {string} [options.baseURL='https://octochemdb.cheminfo.org/'] - URL of the webservice
* @param {string} [options.baseURL='https://octochemdb.cheminfo.org/'] - Base URL of the webservice
*/

export async function activesOrNaturals(options = {}) {
const {
url = 'activesOrNaturals/v1/search',
route = 'activesOrNaturals/v1/search',
baseURL = 'https://octochemdb.cheminfo.org/',
includes,
} = options;

const realURL = new URL(url, baseURL).toString();
const realURL = new URL(route, baseURL).toString();

const searchParams = prepareSearchParams(options);

Expand Down
2 changes: 1 addition & 1 deletion packages/octochemdb/src/activesOrNaturalsByMF.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { activesOrNaturals } from './activesOrNaturals.js';
* @param {string} [options.kwMeshTerms=''] - Comma separated list of keyword from the medline MeshTerms
* @param {string} [options.kwTitles=''] - Comma separated list of keyword from compound title
* @param {number} [options.limit=1000] - Maximal number of entries to return
* @param {string} [options.url='activesOrNaturals/v1/search'] - URL of the webservice
* @param {string} [options.route='activesOrNaturals/v1/search'] - URL of the webservice
* @param {string} [options.baseURL='https://octochemdb.cheminfo.org/'] - URL of the webservice
*/

Expand Down
6 changes: 3 additions & 3 deletions packages/octochemdb/src/compoundsFromMF.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { postFetchJSON } from './utils/postFetchJSON.js';
* @param {object} [options={}]
* @param {string} [options.fields] - Fields to retrieve from the database
* @param {string} [options.baseURL='https://octochemdb.cheminfo.org/'] - URL of the webservice
* @param {string} [options.url='mfs/v1/fromMF'] - URL of the webservice
* @param {string} [options.route='mfs/v1/fromMF'] - URL of the webservice
* @param {string} [options.titleCompoundsURL='titleCompounds/v1/ids'] - URL of the webservice
* @param {number} [options.limit=50000] - Maximal number of entries to return
*/

export async function compoundsFromMF(mf, options = {}) {
const {
url = 'compounds/v1/fromMF',
route = 'compounds/v1/fromMF',
baseURL = 'https://octochemdb.cheminfo.org/',
limit = 50000,
fields = 'data.ocl.idCode,data.ocl.index,data.iupac',
Expand All @@ -27,7 +27,7 @@ export async function compoundsFromMF(mf, options = {}) {
mf,
};

const realURL = new URL(url, baseURL).toString();
const realURL = new URL(route, baseURL).toString();
const data = (await fetchJSON(realURL, searchParams)).data;

const ids = data.map((datum) => datum._id);
Expand Down
2 changes: 1 addition & 1 deletion packages/octochemdb/src/massSpectra.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export async function massSpectra(options = {}) {
promises.push(
searchMasses({
...options,
url: route.url,
route: route.url,
link: route.link,
}).then((entries) =>
entries.map((entry) => ({ ...entry, database: route.name })),
Expand Down
6 changes: 3 additions & 3 deletions packages/octochemdb/src/mfsFromEMs.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ import { searchWithIonizations } from './utils/searchWithIonizations.js';
* @param {number} [options.minCount=5] - Minimal number of molecules having a specific MF
* @param {number} [options.fields] - Fields to retrieve from the database
* @param {string} [options.baseURL='https://octochemdb.cheminfo.org/'] - URL of the webservice
* @param {string} [options.url='mfs/v1/fromEM'] - URL of the webservice
* @param {string} [options.route='mfs/v1/fromEM'] - URL of the webservice
* @param {string} [options.compoundsURL='mfs/v1/fromMF'] - URL to retrieve corresponding compounds
*/

export async function mfsFromEMs(masses, options = {}) {
const {
url = 'mfs/v1/fromEM',
route = 'mfs/v1/fromEM',
compoundsURL = 'compounds/v1/fromMF',
baseURL = 'https://octochemdb.cheminfo.org/',
minCount = 5,
} = options;

const realURL = new URL(url, baseURL).toString();
const realURL = new URL(route, baseURL).toString();

const searchParams = {};
searchParams.minCount = String(minCount);
Expand Down
6 changes: 3 additions & 3 deletions packages/octochemdb/src/pubmedCompounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import { includeDBRefs } from './utils/includeDBRefs.js';
* Retrieve the compounds from a pubmedID
* @param {string} pubmedID
* @param {object} [options={}]
* @param {string} [options.url='pubmeds/v1/id'] - relative URL of the webservice
* @param {string} [options.route='pubmeds/v1/id'] - relative URL of the webservice
* @param {string} [options.baseURL='https://octochemdb.cheminfo.org/'] - URL of the webservice
* @param {number} [options.limit=1000] - Maximal number of entries to return
* @returns
*/
export async function pubmedCompounds(pubmedID, options = {}) {
const {
url = 'pubmeds/v1/id',
route = 'pubmeds/v1/id',
baseURL = 'https://octochemdb.cheminfo.org/',
limit = 1000,
} = options;

const realURL = new URL(url, baseURL).toString();
const realURL = new URL(route, baseURL).toString();

const searchParams = {
id: pubmedID,
Expand Down

0 comments on commit d894dc5

Please sign in to comment.