Skip to content

Commit

Permalink
Revert "feat: add IHubOrganization with fetch and hubSearch support (#…
Browse files Browse the repository at this point in the history
…1808)"

This reverts commit ef89d09.
  • Loading branch information
benstoltz authored Feb 25, 2025
1 parent 711a94e commit fa6020a
Show file tree
Hide file tree
Showing 20 changed files with 13 additions and 1,833 deletions.
43 changes: 0 additions & 43 deletions packages/common/e2e/org-search.e2e.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/common/src/content/get-family.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ export function getFamily(type: string) {
case "hub initiative":
family = "initiative";
break;
case "organization":
family = "organization";
break;
default:
// by default derive from collection
family = collectionToFamily(getCollection(type));
Expand Down
4 changes: 0 additions & 4 deletions packages/common/src/core/fetchHubEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { fetchInitiativeTemplate } from "../initiative-templates/fetch";
import { fetchSurvey } from "../surveys/fetch";
import { fetchEvent } from "../events/fetch";
import { convertUserToHubUser, fetchHubUser } from "../users";
import { fetchOrganization } from "../org/fetch";

/**
* Fetch a Hub entity by identifier (id or slug)
Expand Down Expand Up @@ -59,9 +58,6 @@ export async function fetchHubEntity(
case "event":
result = await fetchEvent(identifier, context.hubRequestOptions);
break;
case "organization":
result = await fetchOrganization(identifier, context.requestOptions);
break;
case "initiativeTemplate":
result = await fetchInitiativeTemplate(
identifier,
Expand Down
12 changes: 5 additions & 7 deletions packages/common/src/core/types/HubEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ import { IHubTemplate } from "./IHubTemplate";
import { IHubSurvey } from "./IHubSurvey";
import { IHubEvent } from "./IHubEvent";
import { IHubUser } from "./IHubUser";
import { IHubOrganization } from "../..";

export type HubEntity =
| IHubSite
| IHubProject
| IHubDiscussion
| IHubEvent
| IHubGroup
| IHubInitiative
| IHubOrganization
| IHubPage
| IHubProject
| IHubSite
| IHubSurvey
| IHubGroup
| IHubTemplate
| IHubSurvey
| IHubEvent
| IHubUser;
3 changes: 1 addition & 2 deletions packages/common/src/core/types/HubEntityType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ export const HUB_ENTITY_TYPES = [
"group",
"initiative",
"initiativeTemplate",
"org", // TODO: Remove at next breaking change
"organization",
"org",
"page",
"project",
"site",
Expand Down
63 changes: 0 additions & 63 deletions packages/common/src/core/types/IHubOrganization.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/common/src/core/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export * from "./IHubItemEntity";
export * from "./IHubLayout";
export * from "./IHubLocation";
export * from "./IHubMapSettings";
export * from "./IHubOrganization";
export * from "./IHubPage";
export * from "./IHubProject";
export * from "./IHubTemplate";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const DEFAULT_ENTITY_SETTINGS_BY_ENTITY_TYPE: Record<
initiativeTemplate: null,
page: null,
content: null,
organization: null,
org: null,
group: null,
template: null,
Expand Down
93 changes: 0 additions & 93 deletions packages/common/src/org/fetch.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/common/src/org/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from "./fetch-org";
export * from "./fetchOrgLimits";
export * from "./fetch";
48 changes: 0 additions & 48 deletions packages/common/src/search/_internal/portalFetchOrgs.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/common/src/search/hubSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { hubSearchItems } from "./_internal/hubSearchItems";
import { hubSearchChannels } from "./_internal/hubSearchChannels";
import { hubSearchEvents } from "./_internal/hubSearchEvents";
import { hubSearchEventAttendees } from "./_internal/hubSearchEventAttendees";
import { portalFetchOrgs } from "./_internal/portalFetchOrgs";

/**
* Main entrypoint for searching via Hub
Expand Down Expand Up @@ -84,7 +83,6 @@ export async function hubSearch(
portalUser: searchPortalUsers,
communityUser: searchCommunityUsers,
groupMember: portalSearchGroupMembers,
organization: portalFetchOrgs,
},
"arcgis-hub": {
item: hubSearchItems,
Expand Down
1 change: 0 additions & 1 deletion packages/common/src/search/types/IHubCatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ export const targetEntities = [
"channel",
"discussionPost",
"eventAttendee",
"organization",
] as const;
export type EntityType = (typeof targetEntities)[number];

Expand Down
9 changes: 4 additions & 5 deletions packages/common/src/search/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,12 @@ export function getScopeGroupPredicate(scope: IQuery): IPredicate {
* @returns
*/
export function getGroupPredicate(query: IQuery): IPredicate {
const predicate = "group";
const expandedQuery = expandQuery(query);
const isTargetPredicate = (p: IPredicate) => !!p[predicate];
const filter = expandedQuery.filters.find((f) =>
f.predicates.find(isTargetPredicate)
const isGroupPredicate = (predicate: IPredicate) => !!predicate.group;
const groupFilter = expandedQuery.filters.find((f) =>
f.predicates.find(isGroupPredicate)
);
return filter && filter.predicates.find(isTargetPredicate);
return groupFilter && groupFilter.predicates.find(isGroupPredicate);
}

/**
Expand Down
1 change: 0 additions & 1 deletion packages/common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ export const HubFamilies = [
"channel",
"discussion",
"eventAttendee",
"organization",
] as const;

/**
Expand Down
9 changes: 1 addition & 8 deletions packages/common/test/content/get-family.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getFamily, getFamilyTypes } from "../../src";
import { getFamilyTypes } from "../../src";

describe("getFamily", () => {
beforeAll(() => {
Expand Down Expand Up @@ -91,11 +91,4 @@ describe("getFamily", () => {
expect(types).toBeUndefined();
});
});

describe("getFamily", () => {
it("can get types any other valid family", () => {
const type = getFamily("organization");
expect(type).toBe("organization");
});
});
});
Loading

0 comments on commit fa6020a

Please sign in to comment.