Skip to content

Commit

Permalink
refactor(hub-sites): remove _shareItemsToSiteGroups()
Browse files Browse the repository at this point in the history
affects: @esri/hub-sites

BREAKING CHANGE:
remove _shareItemsToSiteGroups()
  • Loading branch information
tomwayson committed Jul 27, 2022
1 parent 1132c43 commit b806773
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 29 deletions.
2 changes: 1 addition & 1 deletion packages/sites/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export * from "./create-site-model-from-template";
export * from "./convert-site-to-template";
export * from "./_get-site-data-by-id";
export * from "./_get-second-pass-sharing-options";
export * from "./_share-items-to-site-groups";
export * from "./share-items-to-site-groups";
export * from "./_second-pass-adlib-pages";
export * from "./_update-pages";
export * from "./site-second-pass";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,6 @@ import { shareItemWithGroup, ISharingResponse } from "@esri/arcgis-rest-portal";
import { _getSecondPassSharingOptions } from "./_get-second-pass-sharing-options";
import { _getSharingEligibleModels } from "./_get-sharing-eligible-models";

/**
* Share all the other models to the Site's content and collaboration groups, if
* those groups were created for the site (depends on user's privs)
* **DEPRECATED: Use shareItemsToSiteGroups() instead**
* @param {object} siteModel Site Model
* @param {Array} solutionModels Array of all models created by the Solution
* @param {IHubRequestOptions} hubRequestOptions
* @private
*/
export function _shareItemsToSiteGroups(
siteModel: IModel,
solutionModels: IModel[],
hubRequestOptions: IHubRequestOptions
) {
/* tslint:disable no-console */
console.info(
`DEPRECATED: _shareItemsToSiteGroups will be removed at v10.0.0. Use shareItemsToSiteGroups instead.`
);
return shareItemsToSiteGroups(siteModel, solutionModels, hubRequestOptions);
}
/**
* Share all the other models to the Site's content and collaboration groups, if
* those groups were created for the site (depends on user's privs)
Expand Down
6 changes: 3 additions & 3 deletions packages/sites/src/site-second-pass.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IModelTemplate, IHubRequestOptions, IModel } from "@esri/hub-common";
import { _shareItemsToSiteGroups } from "./_share-items-to-site-groups";
import { shareItemsToSiteGroups } from "./share-items-to-site-groups";
import { _updatePages } from "./_update-pages";

/**
Expand All @@ -16,9 +16,9 @@ export function siteSecondPass(
let secondPassPromises: Array<Promise<any>> = [];
// get all the items that are not the site
secondPassPromises = secondPassPromises.concat(
_shareItemsToSiteGroups(
shareItemsToSiteGroups(
siteModel,
(solutionModels as unknown) as IModel[],
solutionModels as unknown as IModel[],
hubRequestOptions
)
);
Expand Down
6 changes: 3 additions & 3 deletions packages/sites/test/_share-items-to-site-groups.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { _shareItemsToSiteGroups } from "../src";
import { shareItemsToSiteGroups } from "../src";
import * as portalModule from "@esri/arcgis-rest-portal";
import { IModel, IHubRequestOptions } from "@esri/hub-common";
import * as sharingEligibleModelsModule from "../src/_get-sharing-eligible-models";

describe("_shareItemsToSiteGroups", () => {
describe("shareItemsToSiteGroups", () => {
it("shares items to groups using shareItemsToSiteGroups", async () => {
const shareSpy = spyOn(portalModule, "shareItemWithGroup").and.returnValue(
Promise.resolve({})
Expand Down Expand Up @@ -34,7 +34,7 @@ describe("_shareItemsToSiteGroups", () => {
"_getSharingEligibleModels"
).and.returnValue(Promise.resolve(toShare.slice(1, 3)));

await _shareItemsToSiteGroups(siteModel, toShare, hubRequestOptions);
await shareItemsToSiteGroups(siteModel, toShare, hubRequestOptions);

expect(_getSharingEligibleModelsSpy.calls.count()).toBe(
1,
Expand Down
4 changes: 2 additions & 2 deletions packages/sites/test/site-second-pass.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { siteSecondPass } from "../src";
import * as shareItemsModule from "../src/_share-items-to-site-groups";
import * as shareItemsModule from "../src/share-items-to-site-groups";
import * as updatePagesModule from "../src/_update-pages";
import { IModel, IHubRequestOptions, IModelTemplate } from "@esri/hub-common";
import { expectAllCalled } from "./test-helpers.test";
Expand All @@ -8,7 +8,7 @@ describe("siteSecondPass", () => {
it("calls the correct functions", async () => {
const shareSpy = spyOn(
shareItemsModule,
"_shareItemsToSiteGroups"
"shareItemsToSiteGroups"
).and.returnValue(Promise.resolve({}));
const updateSpy = spyOn(updatePagesModule, "_updatePages").and.returnValue(
Promise.resolve({})
Expand Down

0 comments on commit b806773

Please sign in to comment.