@esri/hub-common 14.21.1 → 14.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/esm/groups/addGroupMembers.js +79 -0
  2. package/dist/esm/groups/addGroupMembers.js.map +1 -0
  3. package/dist/esm/groups/index.js +1 -2
  4. package/dist/esm/groups/index.js.map +1 -1
  5. package/dist/node/groups/addGroupMembers.js +83 -0
  6. package/dist/node/groups/addGroupMembers.js.map +1 -0
  7. package/dist/node/groups/index.js +1 -2
  8. package/dist/node/groups/index.js.map +1 -1
  9. package/dist/types/groups/addGroupMembers.d.ts +16 -0
  10. package/dist/types/groups/index.d.ts +1 -2
  11. package/dist/types/groups/types/types.d.ts +10 -61
  12. package/package.json +1 -1
  13. package/dist/esm/groups/_internal/AddOrInviteUsersToGroupUtils.js +0 -195
  14. package/dist/esm/groups/_internal/AddOrInviteUsersToGroupUtils.js.map +0 -1
  15. package/dist/esm/groups/_internal/processAutoAddUsers.js +0 -62
  16. package/dist/esm/groups/_internal/processAutoAddUsers.js.map +0 -1
  17. package/dist/esm/groups/_internal/processEmailUsers.js +0 -50
  18. package/dist/esm/groups/_internal/processEmailUsers.js.map +0 -1
  19. package/dist/esm/groups/_internal/processInviteUsers.js +0 -51
  20. package/dist/esm/groups/_internal/processInviteUsers.js.map +0 -1
  21. package/dist/esm/groups/addOrInviteUsersToGroup.js +0 -67
  22. package/dist/esm/groups/addOrInviteUsersToGroup.js.map +0 -1
  23. package/dist/esm/groups/addOrInviteUsersToGroups.js +0 -51
  24. package/dist/esm/groups/addOrInviteUsersToGroups.js.map +0 -1
  25. package/dist/node/groups/_internal/AddOrInviteUsersToGroupUtils.js +0 -205
  26. package/dist/node/groups/_internal/AddOrInviteUsersToGroupUtils.js.map +0 -1
  27. package/dist/node/groups/_internal/processAutoAddUsers.js +0 -66
  28. package/dist/node/groups/_internal/processAutoAddUsers.js.map +0 -1
  29. package/dist/node/groups/_internal/processEmailUsers.js +0 -54
  30. package/dist/node/groups/_internal/processEmailUsers.js.map +0 -1
  31. package/dist/node/groups/_internal/processInviteUsers.js +0 -55
  32. package/dist/node/groups/_internal/processInviteUsers.js.map +0 -1
  33. package/dist/node/groups/addOrInviteUsersToGroup.js +0 -71
  34. package/dist/node/groups/addOrInviteUsersToGroup.js.map +0 -1
  35. package/dist/node/groups/addOrInviteUsersToGroups.js +0 -55
  36. package/dist/node/groups/addOrInviteUsersToGroups.js.map +0 -1
  37. package/dist/types/groups/_internal/AddOrInviteUsersToGroupUtils.d.ts +0 -82
  38. package/dist/types/groups/_internal/processAutoAddUsers.d.ts +0 -15
  39. package/dist/types/groups/_internal/processEmailUsers.d.ts +0 -14
  40. package/dist/types/groups/_internal/processInviteUsers.d.ts +0 -13
  41. package/dist/types/groups/addOrInviteUsersToGroup.d.ts +0 -18
  42. package/dist/types/groups/addOrInviteUsersToGroups.d.ts +0 -30
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addOrInviteUsersToGroup = void 0;
4
- const AddOrInviteUsersToGroupUtils_1 = require("./_internal/AddOrInviteUsersToGroupUtils");
5
- /**
6
- * Add or invite N users to a single group
7
- * Org|community|world logic flows are run even if there are no users applicable for that particular path.
8
- * Results from each path are consolidated and surfaced in the return object as failures and errors are of
9
- * more importance than successes.
10
- *
11
- * @export
12
- * @param {string} groupId Group we are adding users to
13
- * @param {IUserWithOrgType[]} users array of users to add
14
- * @param {IAuthenticationManager} primaryRO primary requestOptions
15
- * @param {boolean} canAutoAddUser Can we automatically add a user to the group?
16
- * @param {boolean} addUserAsGroupAdmin Should the user be added as a group administrator
17
- * @param {IAddOrInviteEmail} email Email object
18
- * @return {IAddOrInviteToGroupResult} Result object
19
- */
20
- async function addOrInviteUsersToGroup(groupId, users, primaryRO, canAutoAddUser, addUserAsGroupAdmin, email) {
21
- // Group users by their org relationship
22
- const parsedUsers = AddOrInviteUsersToGroupUtils_1.groupUsersByOrgRelationship(users);
23
- // build up params for the context
24
- const inputParams = {
25
- groupId,
26
- primaryRO,
27
- allUsers: users,
28
- canAutoAddUser,
29
- addUserAsGroupAdmin,
30
- email,
31
- };
32
- // create context from params and parsed users
33
- const context = Object.assign(inputParams, parsedUsers);
34
- // result obj by org relationship
35
- const result = {
36
- community: await AddOrInviteUsersToGroupUtils_1.addOrInviteCommunityUsers(context),
37
- org: await AddOrInviteUsersToGroupUtils_1.addOrInviteOrgUsers(context),
38
- world: await AddOrInviteUsersToGroupUtils_1.addOrInviteWorldUsers(context),
39
- partnered: await AddOrInviteUsersToGroupUtils_1.addOrInvitePartneredUsers(context),
40
- collaborationCoordinator: await AddOrInviteUsersToGroupUtils_1.addOrInviteCollaborationCoordinators(context),
41
- notAdded: [],
42
- notInvited: [],
43
- notEmailed: [],
44
- errors: [],
45
- groupId,
46
- };
47
- // Bring not added / invited / emailed / errors up to the top level
48
- result.notAdded = [
49
- ...result.community.notAdded,
50
- ...result.org.notAdded,
51
- ...result.world.notAdded,
52
- ];
53
- result.notInvited = [
54
- ...result.community.notInvited,
55
- ...result.org.notInvited,
56
- ...result.world.notInvited,
57
- ];
58
- result.notEmailed = [
59
- ...result.community.notEmailed,
60
- ...result.org.notEmailed,
61
- ...result.world.notEmailed,
62
- ];
63
- result.errors = [
64
- ...result.community.errors,
65
- ...result.org.errors,
66
- ...result.world.errors,
67
- ];
68
- return result;
69
- }
70
- exports.addOrInviteUsersToGroup = addOrInviteUsersToGroup;
71
- //# sourceMappingURL=addOrInviteUsersToGroup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addOrInviteUsersToGroup.js","sourceRoot":"","sources":["../../../src/groups/addOrInviteUsersToGroup.ts"],"names":[],"mappings":";;;AAQA,2FAOkD;AAElD;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,uBAAuB,CAC3C,OAAe,EACf,KAAyB,EACzB,SAAiC,EACjC,cAAuB,EACvB,mBAA4B,EAC5B,KAAwB;IAExB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;IACF,MAAM,CAAC,MAAM,GAAG;QACd,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM;QAC1B,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM;QACpB,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM;KACvB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AA1DD,0DA0DC"}
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addOrInviteUsersToGroups = void 0;
4
- const addOrInviteUsersToGroup_1 = require("./addOrInviteUsersToGroup");
5
- /**
6
- * addOrInviteUsersToGroups adds/invites N users to N groups
7
- * Initial entry point function for add/invite members flow
8
- * when dealing with multiple groups.
9
- * Responses from each group are then consolidated into the final returned object.
10
- *
11
- * @export
12
- * @param {string[]} groupIds array of groups we are adding users to
13
- * @param {IUserWithOrgType[]} users array of users to add to those groups
14
- * @param {IAuthenticationManager} primaryRO primary requestOptions
15
- * @param {boolean} [canAutoAddUser=false] Can we automatically add a user to the group?
16
- * @param {boolean} [addUserAsGroupAdmin=false] Can the user be added to a group as an administrator of that group?
17
- * @param {IAddOrInviteEmail} [email] Email object contains auth for the email && the email object itself
18
- * @return {*} {Promise<{
19
- * notAdded: string[];
20
- * notInvited: string[];
21
- * notEmailed: string[];
22
- * errors: ArcGISRequestError[];
23
- * responses: IAddOrInviteToGroupResult[];
24
- * }>} Results object
25
- */
26
- async function addOrInviteUsersToGroups(groupIds, users, primaryRO, canAutoAddUser = false, addUserAsGroupAdmin = false, email) {
27
- let notAdded = [];
28
- let notInvited = [];
29
- let notEmailed = [];
30
- let errors = [];
31
- const responses = [];
32
- // need to for..of loop this as a reduce will overwrite promises during execution
33
- // this way we get an object of each group id nicely.
34
- for (const groupId of groupIds) {
35
- // For each group we'll add the users to them.
36
- const result = await addOrInviteUsersToGroup_1.addOrInviteUsersToGroup(groupId, users, primaryRO, canAutoAddUser, addUserAsGroupAdmin, email);
37
- // attach each groups results
38
- responses.push(result);
39
- // surface results to the top of the stack...
40
- notAdded = notAdded.concat(result.notAdded);
41
- errors = errors.concat(result.errors);
42
- notInvited = notInvited.concat(result.notInvited);
43
- notEmailed = notEmailed.concat(result.notEmailed);
44
- }
45
- // Return built up result object.
46
- return {
47
- notAdded,
48
- notInvited,
49
- notEmailed,
50
- errors,
51
- responses,
52
- };
53
- }
54
- exports.addOrInviteUsersToGroups = addOrInviteUsersToGroups;
55
- //# sourceMappingURL=addOrInviteUsersToGroups.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addOrInviteUsersToGroups.js","sourceRoot":"","sources":["../../../src/groups/addOrInviteUsersToGroups.ts"],"names":[],"mappings":";;;AASA,uEAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,KAAK,UAAU,wBAAwB,CAC5C,QAAkB,EAClB,KAAyB,EACzB,SAAiC,EACjC,iBAA0B,KAAK,EAC/B,sBAA+B,KAAK,EACpC,KAAyB;IAQzB,IAAI,QAAQ,GAAa,EAAE,CAAC;IAC5B,IAAI,UAAU,GAAa,EAAE,CAAC;IAC9B,IAAI,UAAU,GAAa,EAAE,CAAC;IAC9B,IAAI,MAAM,GAAyB,EAAE,CAAC;IACtC,MAAM,SAAS,GAAgC,EAAE,CAAC;IAClD,iFAAiF;IACjF,qDAAqD;IACrD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,8CAA8C;QAC9C,MAAM,MAAM,GAAG,MAAM,iDAAuB,CAC1C,OAAO,EACP,KAAK,EACL,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,KAAK,CACN,CAAC;QACF,6BAA6B;QAC7B,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,6CAA6C;QAC7C,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5C,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACtC,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAClD,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;KACnD;IACD,iCAAiC;IACjC,OAAO;QACL,QAAQ;QACR,UAAU;QACV,UAAU;QACV,MAAM;QACN,SAAS;KACV,CAAC;AACJ,CAAC;AA/CD,4DA+CC"}
@@ -1,82 +0,0 @@
1
- import { IAddOrInviteContext, IAddOrInviteResponse, IUserOrgRelationship, IUserWithOrgType } from "../types";
2
- /**
3
- * @private
4
- * Handles add/invite logic for collaboration coordinators inside partnered orgs.
5
- * This is intentionally split out from the invitation of partnered org normal members,
6
- * because the two types of partnered org usres (regular and collaboration coordinator)
7
- * always come from the same 'bucket', however have distinctly different add paths Invite vs auto add.
8
- * It returns either an empty instance of the addOrInviteResponse
9
- * object, or their response from auto adding users.
10
- *
11
- * @export
12
- * @param {IAddOrInviteContext} context context object
13
- * @return {IAddOrInviteResponse} response object
14
- */
15
- export declare function addOrInviteCollaborationCoordinators(context: IAddOrInviteContext): Promise<IAddOrInviteResponse>;
16
- /**
17
- * @private
18
- * Handles add/invite logic for community users
19
- * It returns either an empty instance of the addOrInviteResponse
20
- * object, or either ther esponse from processing auto adding
21
- * users or inviting users. If an email has been passed in it also notifies
22
- * processAutoAddUsers that emails should be sent.
23
- *
24
- * @export
25
- * @param {IAddOrInviteContext} context context object
26
- * @return {IAddOrInviteResponse} response object
27
- */
28
- export declare function addOrInviteCommunityUsers(context: IAddOrInviteContext): Promise<IAddOrInviteResponse>;
29
- /**
30
- * @private
31
- * Handles add/invite logic for Org users
32
- * It returns either an empty instance of the addOrInviteResponse
33
- * object, or either ther esponse from processing auto adding a users or inviting a user
34
- *
35
- * @export
36
- * @param {IAddOrInviteContext} context context object
37
- * @return {IAddOrInviteResponse} response object
38
- */
39
- export declare function addOrInviteOrgUsers(context: IAddOrInviteContext): Promise<IAddOrInviteResponse>;
40
- /**
41
- * @private
42
- * Handles add/invite logic for partnered org users.
43
- * It returns either an empty instance of the addOrInviteResponse
44
- * object, or their response from inviting users.
45
- *
46
- * @export
47
- * @param {IAddOrInviteContext} context context object
48
- * @return {IAddOrInviteResponse} response object
49
- */
50
- export declare function addOrInvitePartneredUsers(context: IAddOrInviteContext): Promise<IAddOrInviteResponse>;
51
- /**
52
- * @private
53
- * Handles add/invite logic for world users
54
- * It either returns an empty instance of the add/invite response
55
- * object, or a populated version from processInviteUsers
56
- *
57
- * @export
58
- * @param {IAddOrInviteContext} context Context object
59
- * @return {IAddOrInviteResponse} Response object
60
- */
61
- export declare function addOrInviteWorldUsers(context: IAddOrInviteContext): Promise<IAddOrInviteResponse>;
62
- /**
63
- * @private
64
- * Returns an empty instance of the addorinviteresponse object.
65
- * We are using this because if you leave out any of the props
66
- * from the final object and you are concatting together arrays you can concat
67
- * an undeifined inside an array which will throw off array lengths.
68
- *
69
- * @export
70
- * @return {IAddOrInviteResponse}
71
- */
72
- export declare function handleNoUsers(context?: IAddOrInviteContext, userType?: "world" | "org" | "community" | "partnered", shouldEmail?: boolean): Promise<IAddOrInviteResponse>;
73
- /**
74
- * @private
75
- * Takes users array and sorts them into an object by the type of user they are
76
- * based on the orgType prop (world|org|community)
77
- *
78
- * @export
79
- * @param {IUserWithOrgType[]} users array of users
80
- * @return {IUserOrgRelationship} Object of users sorted by type (world, org, community)
81
- */
82
- export declare function groupUsersByOrgRelationship(users: IUserWithOrgType[]): IUserOrgRelationship;
@@ -1,15 +0,0 @@
1
- import { IAddOrInviteContext, IAddOrInviteResponse } from "../types";
2
- /**
3
- * @private
4
- * Governs logic for automatically adding N users to a group.
5
- * Users are added as either a regular user OR as an administrator of the group
6
- * depending on the addUserAsGroupAdmin prop on the IAddOrInviteContext.
7
- * If there is an email object on the IAddOrInviteContext, then email notifications are sent.
8
- *
9
- * @export
10
- * @param {IAddOrInviteContext} context context object
11
- * @param {string} userType what type of user is it: org | world | community
12
- * @param {boolean} [shouldEmail=false] should the user be emailed?
13
- * @return {IAddOrInviteResponse} response object
14
- */
15
- export declare function processAutoAddUsers(context: IAddOrInviteContext, userType: "world" | "org" | "community" | "partnered" | "collaborationCoordinator", shouldEmail?: boolean): Promise<IAddOrInviteResponse>;
@@ -1,14 +0,0 @@
1
- import { IAddOrInviteContext, IAddOrInviteResponse } from "../types";
2
- /**
3
- * @private
4
- * Governs the logic for emailing N users. It acts under the assumption
5
- * that all the 'community' users are the ones being emailed (this is due to platform rules we conform to)
6
- * Function is called upstream depending on if an email object is attached to the context.
7
- * Email object contains its own auth as it'll require the community admin to send the email itself.
8
- * An individual email call goes out for each user due to how the response of multiple users in a single call works.
9
- *
10
- * @export
11
- * @param {IAddOrInviteContext} context context object
12
- * @return {IAddOrInviteResponse} response object
13
- */
14
- export declare function processEmailUsers(context: IAddOrInviteContext): Promise<IAddOrInviteResponse>;
@@ -1,13 +0,0 @@
1
- import { IAddOrInviteContext, IAddOrInviteResponse } from "../types";
2
- /**
3
- * @private
4
- * Governs the logic for inviting N users to a single group.
5
- * An individual invite call goes out for each user and the results are consolidated.
6
- * See comment in function about the for...of loop which explains reasoning.
7
- *
8
- * @export
9
- * @param {IAddOrInviteContext} context context object
10
- * @param {string} userType what type of user is it: org | world | community
11
- * @return {IAddOrInviteResponse} response object
12
- */
13
- export declare function processInviteUsers(context: IAddOrInviteContext, userType: "world" | "org" | "community" | "partnered"): Promise<IAddOrInviteResponse>;
@@ -1,18 +0,0 @@
1
- import { IAuthenticationManager } from "@esri/arcgis-rest-request";
2
- import { IAddOrInviteEmail, IAddOrInviteToGroupResult, IUserWithOrgType } from "./types";
3
- /**
4
- * Add or invite N users to a single group
5
- * Org|community|world logic flows are run even if there are no users applicable for that particular path.
6
- * Results from each path are consolidated and surfaced in the return object as failures and errors are of
7
- * more importance than successes.
8
- *
9
- * @export
10
- * @param {string} groupId Group we are adding users to
11
- * @param {IUserWithOrgType[]} users array of users to add
12
- * @param {IAuthenticationManager} primaryRO primary requestOptions
13
- * @param {boolean} canAutoAddUser Can we automatically add a user to the group?
14
- * @param {boolean} addUserAsGroupAdmin Should the user be added as a group administrator
15
- * @param {IAddOrInviteEmail} email Email object
16
- * @return {IAddOrInviteToGroupResult} Result object
17
- */
18
- export declare function addOrInviteUsersToGroup(groupId: string, users: IUserWithOrgType[], primaryRO: IAuthenticationManager, canAutoAddUser: boolean, addUserAsGroupAdmin: boolean, email: IAddOrInviteEmail): Promise<IAddOrInviteToGroupResult>;
@@ -1,30 +0,0 @@
1
- import { ArcGISRequestError, IAuthenticationManager } from "@esri/arcgis-rest-request";
2
- import { IAddOrInviteEmail, IAddOrInviteToGroupResult, IUserWithOrgType } from "./types";
3
- /**
4
- * addOrInviteUsersToGroups adds/invites N users to N groups
5
- * Initial entry point function for add/invite members flow
6
- * when dealing with multiple groups.
7
- * Responses from each group are then consolidated into the final returned object.
8
- *
9
- * @export
10
- * @param {string[]} groupIds array of groups we are adding users to
11
- * @param {IUserWithOrgType[]} users array of users to add to those groups
12
- * @param {IAuthenticationManager} primaryRO primary requestOptions
13
- * @param {boolean} [canAutoAddUser=false] Can we automatically add a user to the group?
14
- * @param {boolean} [addUserAsGroupAdmin=false] Can the user be added to a group as an administrator of that group?
15
- * @param {IAddOrInviteEmail} [email] Email object contains auth for the email && the email object itself
16
- * @return {*} {Promise<{
17
- * notAdded: string[];
18
- * notInvited: string[];
19
- * notEmailed: string[];
20
- * errors: ArcGISRequestError[];
21
- * responses: IAddOrInviteToGroupResult[];
22
- * }>} Results object
23
- */
24
- export declare function addOrInviteUsersToGroups(groupIds: string[], users: IUserWithOrgType[], primaryRO: IAuthenticationManager, canAutoAddUser?: boolean, addUserAsGroupAdmin?: boolean, email?: IAddOrInviteEmail): Promise<{
25
- notAdded: string[];
26
- notInvited: string[];
27
- notEmailed: string[];
28
- errors: ArcGISRequestError[];
29
- responses: IAddOrInviteToGroupResult[];
30
- }>;