Skip to content

Commit

Permalink
refactor(types): remove hub-types and move types into other packges
Browse files Browse the repository at this point in the history
affects: @esri/hub-common, @esri/hub-sites, @esri/hub-teams
  • Loading branch information
tomwayson committed Sep 21, 2020
1 parent 0d1f2e3 commit 82f50dd
Show file tree
Hide file tree
Showing 37 changed files with 31 additions and 2,543 deletions.
2 changes: 2 additions & 0 deletions packages/common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export interface IModel {
[key: string]: any;
}

export type IDraft = Partial<IModel>;

/**
* Defined the Initiative Item as having
* `type: "Hub Initiative"`
Expand Down
3 changes: 1 addition & 2 deletions packages/sites/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"@esri/arcgis-rest-request": "^2.13.0",
"@esri/hub-common": "^6.4.0",
"@esri/hub-initiatives": "^6.4.0",
"@esri/hub-teams": "5.x || 6.x",
"@esri/hub-types": "5.x || 6.x"
"@esri/hub-teams": "5.x || 6.x"
},
"devDependencies": {
"@esri/arcgis-rest-auth": "^2.14.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/sites/src/create-site-model-from-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
addSolutionResourceUrlToAssets
} from "@esri/hub-common";
import { createHubTeams } from "@esri/hub-teams";
import { HubTeamType } from "@esri/hub-types";
import { HubTeamType } from "@esri/hub-teams";
import { getTheme } from "./get-theme";
import { getPortalSiteHostname } from "./get-portal-site-hostname";
import { getPortalSiteUrl } from "./get-portal-site-url";
Expand Down
2 changes: 1 addition & 1 deletion packages/sites/src/drafts/apply-draft.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IModel, mergeObjects, cloneObject, getProp } from "@esri/hub-common";
import { _includeListFromItemType } from "./_include-list-from-item-type";
import { IDraft } from "@esri/hub-types";
import { IDraft } from "@esri/hub-common";

/**
* Applies a draft resource to an item model
Expand Down
2 changes: 1 addition & 1 deletion packages/sites/test/drafts/apply-draft.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { applyDraft } from "../../src/drafts/apply-draft";
import { IModel, getProp } from "@esri/hub-common";
import { PAGE_DRAFT_INCLUDE_LIST } from "../../src/drafts";
import { IDraft } from "@esri/hub-types";
import { IDraft } from "@esri/hub-common";

const pageModel = ({
item: {
Expand Down
4 changes: 1 addition & 3 deletions packages/teams/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@
"@esri/arcgis-rest-portal": "^2.15.0",
"@esri/arcgis-rest-request": "^2.13.0",
"@esri/arcgis-rest-types": "^2.13.0",
"@esri/hub-common": "4.x || 5.x || 6.x",
"@esri/hub-types": "5.x || 6.x"
"@esri/hub-common": "4.x || 5.x || 6.x"
},
"devDependencies": {
"@esri/arcgis-rest-auth": "^2.14.1",
"@esri/arcgis-rest-portal": "^2.18.0",
"@esri/arcgis-rest-request": "^2.14.1",
"@esri/arcgis-rest-types": "^2.15.0",
"@esri/hub-common": "^6.10.0",
"@esri/hub-types": "^6.10.0",
"@rollup/plugin-commonjs": "^15.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/src/create-hub-team.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HubTeamType, TEAMTYPES } from "@esri/hub-types";
import { HubTeamType, TEAMTYPES } from "./types";

import {
IHubRequestOptions,
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/src/create-hub-teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "@esri/hub-common";
import { getUserCreatableTeams } from "./utils/get-user-creatable-teams";
import { _createTeamGroups } from "./utils/_create-team-groups";
import { HubTeamType } from "@esri/hub-types";
import { HubTeamType } from "./types";
import { IGroup } from "@esri/arcgis-rest-types";

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
* Apache-2.0 */

export * from "./types";
export * from "./add-users-to-team";
export * from "./create-hub-team";
export * from "./create-hub-teams";
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/teams/src/utils/_create-team-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IHubRequestOptions } from "@esri/hub-common";
import { createGroup, protectGroup, IGroup } from "@esri/arcgis-rest-portal";
import { getUniqueGroupTitle } from "./get-unique-group-title";
import { getAllowedGroupAccess } from "./get-allowed-group-access";
import { IGroupTemplate } from "@esri/hub-types";
import { IGroupTemplate } from "../types";

/**
* Create a team group. Will ensure the team name is unique in the users org
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/src/utils/_create-team-groups.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IGroupTemplate } from "@esri/hub-types";
import { IGroupTemplate } from "../types";
import { IHubRequestOptions } from "@esri/hub-common";
import { _translateTeamTemplate } from "./_translate-team-template";
import { _createTeamGroup } from "./_create-team-group";
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/src/utils/_translate-team-template.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IGroupTemplate } from "@esri/hub-types";
import { IGroupTemplate } from "../types";
import { getProp } from "@esri/hub-common";

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IUser } from "@esri/arcgis-rest-auth";
import { hasAllPrivileges } from "./has-all-privileges";
import { HubProduct, includes } from "@esri/hub-common";
import { IGroupTemplate } from "@esri/hub-types";
import { IGroupTemplate } from "../types";

/**
* Predicate for filtering group templates based on product
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/src/utils/can-user-create-team.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IUser } from "@esri/arcgis-rest-auth";
import { IHubRequestOptions, getProp, getHubProduct } from "@esri/hub-common";
import { HubTeamType } from "@esri/hub-types";
import { HubTeamType } from "../types";
import { getUserCreatableTeams } from "./get-user-creatable-teams";

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/src/utils/get-allowed-group-access.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IUser } from "@esri/arcgis-rest-auth";
import { hasAllPrivileges } from "./has-all-privileges";
import { GROUP_ACCESS_PRIVS } from "./group-access-privs";
import { AGOAccess } from "@esri/hub-types";
import { AGOAccess } from "../types";

/**
* Returns the allowed group access based on a user's privileges
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HubProduct } from "@esri/hub-types";
import { HubProduct } from "../types";

interface ITeamPropMap {
content: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/src/utils/get-team-template.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HubTeamType, HubProduct } from "@esri/hub-types";
import { HubTeamType, HubProduct } from "../types";
import { getTeamsAvailableInProduct } from "./get-teams-available-in-product";

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HubProduct } from "@esri/hub-types";
import { HubProduct } from "../types";
import { getTeamsAvailableInProduct } from "./get-teams-available-in-product";

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/src/utils/get-teams-available-in-product.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HubProduct, IGroupTemplate } from "@esri/hub-types";
import { HubProduct, IGroupTemplate } from "../types";
import { cloneObject } from "@esri/hub-common";
import { WELLKNOWNTEAMS } from "../well-known-teams";

Expand Down
2 changes: 1 addition & 1 deletion packages/teams/src/utils/get-teams-for-product.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HubProduct } from "@esri/hub-types";
import { HubProduct } from "../types";

export function getTeamsForProduct(product: HubProduct) {
const teams = ["content", "core"];
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/src/utils/get-user-creatable-teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IUser } from "@esri/arcgis-rest-auth";
import { cloneObject, HubProduct } from "@esri/hub-common";
import { WELLKNOWNTEAMS } from "../well-known-teams";
import { canUserCreateTeamInProduct } from "./can-user-create-team-in-product";
import { IGroupTemplate } from "@esri/hub-types";
import { IGroupTemplate } from "../types";

/**
* Return array of group templates that the current user has licensing
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/src/well-known-teams.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IGroupTemplate } from "@esri/hub-types";
import { IGroupTemplate } from "./types";

/**
* Hash of the team group templates.
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/test/create-hub-team.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IHubRequestOptions } from "@esri/hub-common";
import { UserSession } from "@esri/arcgis-rest-auth";

import { createHubTeam } from "../src/create-hub-team";
import { HubTeamType, IGroupTemplate } from "@esri/hub-types";
import { HubTeamType, IGroupTemplate } from "../src/types";

describe("createHubTeam", () => {
const translations = {};
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/test/create-hub-teams.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { UserSession } from "@esri/arcgis-rest-auth";
import { IGroup } from "@esri/arcgis-rest-types";
import * as _createTeamGroupsModule from "../src/utils/_create-team-groups";
import { createHubTeams } from "../src/create-hub-teams";
import { HubTeamType } from "@esri/hub-types";
import { HubTeamType } from "../src/types";

describe("createHubTeams", () => {
const ro = {
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/test/utils/_create-team-group.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as getUniqueTitleModule from "../../src/utils/get-unique-group-title";
import * as portalModule from "@esri/arcgis-rest-portal";
import { IHubRequestOptions, cloneObject } from "@esri/hub-common";
import { IGroupTemplate } from "@esri/hub-types";
import { IGroupTemplate } from "../../src/types";
import { _createTeamGroup } from "../../src/utils/_create-team-group";
import { IUser } from "@esri/arcgis-rest-auth";

Expand Down
2 changes: 1 addition & 1 deletion packages/teams/test/utils/_create-team-groups.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as _createTeamModule from "../../src/utils/_create-team-group";
import { IGroupTemplate } from "@esri/hub-types";
import { IGroupTemplate } from "../../src/types";
import { _createTeamGroups } from "../../src/utils/_create-team-groups";
import { IHubRequestOptions, cloneObject } from "@esri/hub-common";
import { IUser } from "@esri/arcgis-rest-auth";
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/test/utils/_translate-team-template.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IGroupTemplate } from "@esri/hub-types";
import { IGroupTemplate } from "../../src/types";
import { _translateTeamTemplate } from "../../src/utils/_translate-team-template";

describe("_translateTeamTemplate", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getTeamPropertiesMapForProduct } from "../../src/utils/get-team-properties-map-for-product";
import { HubProduct } from "@esri/hub-types";
import { HubProduct } from "../../src/types";
describe("getTeamPropertiesMapForProduct", () => {
it("should always return content and core", () => {
const products: HubProduct[] = ["basic", "premium", "portal"];
Expand Down
2 changes: 1 addition & 1 deletion packages/teams/test/utils/get-team-template.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getTeamTemplate } from "../../src/utils/get-team-template";
import { HubProduct, HubTeamType } from "@esri/hub-types";
import { HubProduct, HubTeamType } from "../../src/types";

describe("getTeamTemplate", () => {
it("it returns nothing for invalid product or team", function() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as getTeamsAvailableInProductModule from "../../src/utils/get-teams-available-in-product";
import { getTeamTypesAvailableInProduct } from "../../src/utils/get-team-types-available-in-product";
import { HubTeamType } from "@esri/hub-types";
import { HubTeamType } from "../../src/types";

describe("getTeamTypesAvailableInProduct", () => {
it("maps group templates to team types", function() {
Expand Down
58 changes: 0 additions & 58 deletions packages/types/README.md

This file was deleted.

Loading

0 comments on commit 82f50dd

Please sign in to comment.