Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-components into feature/rc291_timeline_facet

# Conflicts:
#	packages/core-data/package.json
  • Loading branch information
dleadbetter committed Jul 30, 2024
2 parents 488d473 + 6a32fb1 commit 59fcfc3
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 33 deletions.
6 changes: 3 additions & 3 deletions packages/controlled-vocabulary/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/controlled-vocabulary",
"version": "2.2.8",
"version": "2.2.9",
"description": "A package of components to allow user to configure dropdown elements. Use with the \"controlled_vocabulary\" gem.",
"license": "MIT",
"main": "./dist/index.cjs.js",
Expand All @@ -23,8 +23,8 @@
"underscore": "^1.13.2"
},
"peerDependencies": {
"@performant-software/semantic-components": "^2.2.8",
"@performant-software/shared-components": "^2.2.8",
"@performant-software/semantic-components": "^2.2.9",
"@performant-software/shared-components": "^2.2.9",
"react": ">= 16.13.1 < 19.0.0",
"react-dom": ">= 16.13.1 < 19.0.0"
},
Expand Down
10 changes: 4 additions & 6 deletions packages/core-data/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/core-data",
"version": "2.2.7",
"version": "2.2.9",
"description": "A package of components used with the Core Data platform.",
"license": "MIT",
"main": "./dist/index.cjs.js",
Expand All @@ -24,8 +24,6 @@
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-slider": "^1.2.0",
"@radix-ui/react-tooltip": "^1.1.2",
"@samvera/clover-iiif": "^2.3.2",
"@turf/turf": "^6.5.0",
"clsx": "^2.1.0",
Expand All @@ -39,8 +37,8 @@
"underscore": "^1.13.2"
},
"peerDependencies": {
"@performant-software/geospatial": "^2.2.7",
"@performant-software/shared-components": "^2.2.7",
"@performant-software/shared-components": "^2.2.9",
"@performant-software/geospatial": "^2.2.9",
"@peripleo/maplibre": "^0.5.2",
"@peripleo/peripleo": "^0.5.2",
"react": ">= 16.13.1 < 19.0.0",
Expand All @@ -59,4 +57,4 @@
"vite": "^5.1.4",
"vite-plugin-copy": "^0.1.6"
}
}
}
27 changes: 14 additions & 13 deletions packages/core-data/src/services/BaseService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow

import _ from 'underscore';
import Api from '../utils/Api';

class BaseService {
Expand All @@ -24,7 +25,7 @@ class BaseService {
* @returns {Promise<any>}
*/
fetchOne(id, params = {}) {
const url = Api.buildUrl(this.baseUrl, this.getRoute(), id, this.getSearchParams(params));
const url = Api.buildUrl(this.baseUrl, this.getRoute(), id, this.projectIds, params);
return fetch(url).then((response) => response.json());
}

Expand All @@ -37,7 +38,7 @@ class BaseService {
* @returns {Promise<any>}
*/
fetchRelatedEvents(id, params = {}) {
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'events', this.getSearchParams(params));
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'events', this.projectIds, params);
return fetch(url).then((response) => response.json());
}

Expand All @@ -50,7 +51,7 @@ class BaseService {
* @returns {Promise<any>}
*/
fetchRelatedInstances(id, params = {}) {
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'instances', this.getSearchParams(params));
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'instances', this.projectIds, params);
return fetch(url).then((response) => response.json());
}

Expand All @@ -63,7 +64,7 @@ class BaseService {
* @returns {Promise<any>}
*/
fetchRelatedItems(id, params = {}) {
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'items', this.getSearchParams(params));
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'items', this.projectIds, params);
return fetch(url).then((response) => response.json());
}

Expand All @@ -76,7 +77,7 @@ class BaseService {
* @returns {Promise<any>}
*/
fetchRelatedManifests(id, params = {}) {
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'manifests', this.getSearchParams(params));
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'manifests', this.projectIds, params);
return fetch(url).then((response) => response.json());
}

Expand All @@ -89,7 +90,7 @@ class BaseService {
* @returns {Promise<any>}
*/
fetchRelatedMedia(id, params = {}) {
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'media_contents', this.getSearchParams(params));
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'media_contents', this.projectIds, params);
return fetch(url).then((response) => response.json());
}

Expand All @@ -102,7 +103,7 @@ class BaseService {
* @returns {Promise<any>}
*/
fetchRelatedOrganizations(id, params = {}) {
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'organizations', this.getSearchParams(params));
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'organizations', this.projectIds, params);
return fetch(url).then((response) => response.json());
}

Expand All @@ -114,7 +115,7 @@ class BaseService {
* @returns {Promise<any>}
*/
fetchRelatedPeople(id, params = {}) {
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'people', this.getSearchParams(params));
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'people', this.projectIds, params);
return fetch(url).then((response) => response.json());
}

Expand All @@ -127,7 +128,7 @@ class BaseService {
* @returns {Promise<any>}
*/
fetchRelatedPlaces(id, params = {}) {
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'places', this.getSearchParams(params));
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'places', this.projectIds, params);
return fetch(url).then((response) => response.json());
}

Expand All @@ -140,7 +141,7 @@ class BaseService {
* @returns {Promise<any>}
*/
fetchRelatedTaxonomies(id, params = {}) {
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'taxonomies', this.getSearchParams(params));
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'taxonomies', this.projectIds, params);
return fetch(url).then((response) => response.json());
}

Expand All @@ -153,7 +154,7 @@ class BaseService {
* @returns {Promise<any>}
*/
fetchRelatedWorks(id, params = {}) {
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'works', this.getSearchParams(params));
const url = Api.buildNestedUrl(this.baseUrl, this.getRoute(), id, 'works', this.projectIds, params);
return fetch(url).then((response) => response.json());
}

Expand All @@ -172,8 +173,8 @@ class BaseService {
*/
getSearchParams(params) {
return {
project_ids: this.projectIds,
...params
...params,
'project_ids[]': this.projectIds
};
}
}
Expand Down
16 changes: 14 additions & 2 deletions packages/core-data/src/utils/Api.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
// @flow

import _ from 'underscore';

/**
* Builds a fully qualified nested URL for the passed base URL and route.
*
* @param baseUrl
* @param route
* @param id
* @param nested
* @params projectIds
* @param searchParams
*
* @returns {`${string}?${string}`}
*/
const buildNestedUrl = (baseUrl, route, id, nested, searchParams = {}) => {
const buildNestedUrl = (baseUrl, route, id, nested, projectIds = [], searchParams = {}) => {
const url = `${baseUrl}/core_data/public/v1/${route}/${id}/${nested}`;
const params = new URLSearchParams(searchParams);

_.each(projectIds, (projectId) => {
params.append('project_ids[]', projectId);
});

return `${url}?${params}`;
};

Expand All @@ -24,14 +31,19 @@ const buildNestedUrl = (baseUrl, route, id, nested, searchParams = {}) => {
* @param baseUrl
* @param route
* @param id
* @param projectIds
* @param searchParams
*
* @returns {`${string}?${string}`}
*/
const buildUrl = (baseUrl, route, id, searchParams = {}) => {
const buildUrl = (baseUrl, route, id, projectIds = [], searchParams = {}) => {
const url = `${baseUrl}/core_data/public/v1/${route}/${id}`;
const params = new URLSearchParams(searchParams);

_.each(projectIds, (projectId) => {
params.append('project_ids[]', projectId);
});

return `${url}?${params}`;
};

Expand Down
2 changes: 1 addition & 1 deletion packages/geospatial/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/geospatial",
"version": "2.2.8",
"version": "2.2.9",
"description": "A package of components for all things map-related.",
"license": "MIT",
"main": "./dist/index.cjs.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/semantic-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/semantic-components",
"version": "2.2.8",
"version": "2.2.9",
"description": "A package of shared components based on the Semantic UI Framework.",
"license": "MIT",
"main": "./dist/index.cjs.js",
Expand Down Expand Up @@ -35,7 +35,7 @@
"zotero-translation-client": "^5.0.1"
},
"peerDependencies": {
"@performant-software/shared-components": "^2.2.8",
"@performant-software/shared-components": "^2.2.9",
"@samvera/clover-iiif": "^2.3.2",
"react": ">= 16.13.1 < 19.0.0",
"react-dnd": "^11.1.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/shared-components",
"version": "2.2.8",
"version": "2.2.9",
"description": "A package of shared, framework agnostic, components.",
"license": "MIT",
"main": "./dist/index.cjs.js",
Expand Down
6 changes: 3 additions & 3 deletions packages/user-defined-fields/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/user-defined-fields",
"version": "2.2.8",
"version": "2.2.9",
"description": "A package of components used for allowing end users to define fields on models. Use with the \"user_defined_fields\" gem.",
"license": "MIT",
"main": "./dist/index.cjs.js",
Expand All @@ -23,8 +23,8 @@
"underscore": "^1.13.2"
},
"peerDependencies": {
"@performant-software/semantic-components": "^2.2.8",
"@performant-software/shared-components": "^2.2.8",
"@performant-software/semantic-components": "^2.2.9",
"@performant-software/shared-components": "^2.2.9",
"react": ">= 16.13.1 < 19.0.0",
"react-dom": ">= 16.13.1 < 19.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/visualize/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@performant-software/visualize",
"version": "2.2.8",
"version": "2.2.9",
"description": "A package of components used for data visualization",
"license": "MIT",
"main": "./dist/index.cjs.js",
Expand Down
2 changes: 1 addition & 1 deletion react-components.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"packages/user-defined-fields",
"packages/visualize"
],
"version": "2.2.8"
"version": "2.2.9"
}

0 comments on commit 59fcfc3

Please sign in to comment.