@esri/hub-common 14.20.0 → 14.21.1

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 (41) hide show
  1. package/dist/esm/content/_internal/computeProps.js +3 -4
  2. package/dist/esm/content/_internal/computeProps.js.map +1 -1
  3. package/dist/esm/discussions/utils.js +134 -0
  4. package/dist/esm/discussions/utils.js.map +1 -1
  5. package/dist/esm/permissions/_internal/checkOwner.js +6 -2
  6. package/dist/esm/permissions/_internal/checkOwner.js.map +1 -1
  7. package/dist/esm/permissions/_internal/checkPrivileges.js +5 -1
  8. package/dist/esm/permissions/_internal/checkPrivileges.js.map +1 -1
  9. package/dist/esm/search/_internal/portalSearchGroupMembers.js +1 -1
  10. package/dist/esm/search/_internal/portalSearchGroupMembers.js.map +1 -1
  11. package/dist/esm/search/_internal/portalSearchUsers.js +108 -22
  12. package/dist/esm/search/_internal/portalSearchUsers.js.map +1 -1
  13. package/dist/esm/search/hubSearch.js +4 -2
  14. package/dist/esm/search/hubSearch.js.map +1 -1
  15. package/dist/esm/search/serializeQueryForPortal.js +14 -4
  16. package/dist/esm/search/serializeQueryForPortal.js.map +1 -1
  17. package/dist/esm/users/HubUsers.js +1 -7
  18. package/dist/esm/users/HubUsers.js.map +1 -1
  19. package/dist/node/content/_internal/computeProps.js +2 -3
  20. package/dist/node/content/_internal/computeProps.js.map +1 -1
  21. package/dist/node/discussions/utils.js +142 -1
  22. package/dist/node/discussions/utils.js.map +1 -1
  23. package/dist/node/permissions/_internal/checkOwner.js +6 -2
  24. package/dist/node/permissions/_internal/checkOwner.js.map +1 -1
  25. package/dist/node/permissions/_internal/checkPrivileges.js +5 -1
  26. package/dist/node/permissions/_internal/checkPrivileges.js.map +1 -1
  27. package/dist/node/search/_internal/portalSearchGroupMembers.js +1 -1
  28. package/dist/node/search/_internal/portalSearchGroupMembers.js.map +1 -1
  29. package/dist/node/search/_internal/portalSearchUsers.js +111 -23
  30. package/dist/node/search/_internal/portalSearchUsers.js.map +1 -1
  31. package/dist/node/search/hubSearch.js +3 -1
  32. package/dist/node/search/hubSearch.js.map +1 -1
  33. package/dist/node/search/serializeQueryForPortal.js +14 -4
  34. package/dist/node/search/serializeQueryForPortal.js.map +1 -1
  35. package/dist/node/users/HubUsers.js +1 -7
  36. package/dist/node/users/HubUsers.js.map +1 -1
  37. package/dist/types/core/types/IHubLocation.d.ts +1 -1
  38. package/dist/types/discussions/utils.d.ts +53 -0
  39. package/dist/types/search/_internal/portalSearchUsers.d.ts +49 -5
  40. package/dist/types/search/types/IHubCatalog.d.ts +1 -1
  41. package/package.json +1 -1
@@ -1,5 +1,7 @@
1
1
  import { IGroup, IItem } from "@esri/arcgis-rest-types";
2
2
  import { IHubContent, IHubItemEntity } from "../core";
3
+ import { IChannel, SharingAccess } from "./api/types";
4
+ import { IQuery } from "../search";
3
5
  /**
4
6
  * Utility to determine if a given IGroup, IItem, IHubContent, or IHubItemEntity
5
7
  * is discussable.
@@ -14,3 +16,54 @@ export declare function isDiscussable(subject: Partial<IGroup | IItem | IHubCont
14
16
  * @returns {string[]} updated list of type keywords
15
17
  */
16
18
  export declare function setDiscussableKeyword(typeKeywords: string[], discussable: boolean): string[];
19
+ /**
20
+ * Determines if the given channel is considered to be a `public` channel, supporting both
21
+ * legacy permissions and V2 ACL model.
22
+ * @param channel An IChannel record
23
+ * @returns true if the channel is considered `public`
24
+ */
25
+ export declare function isPublicChannel(channel: IChannel): boolean;
26
+ /**
27
+ * Determines if the given channel is considered to be an `org` channel, supporting both
28
+ * legacy permissions and V2 ACL model.
29
+ * @param channel An IChannel record
30
+ * @returns true if the channel is considered `org`
31
+ */
32
+ export declare function isOrgChannel(channel: IChannel): boolean;
33
+ /**
34
+ * Determines if the given channel is considered to be a `private` channel, supporting both
35
+ * legacy permissions and V2 ACL model.
36
+ * @param channel An IChannel record
37
+ * @returns true if the channel is considered `private`
38
+ */
39
+ export declare function isPrivateChannel(channel: IChannel): boolean;
40
+ /**
41
+ * Determines the given channel's access, supporting both legacy permissions and V2 ACL
42
+ * model.
43
+ * @param channel An IChannel record
44
+ * @returns `public`, `org` or `private`
45
+ */
46
+ export declare function getChannelAccess(channel: IChannel): SharingAccess;
47
+ /**
48
+ * Returns an array of org ids configured for the channel, supporting both legacy permissions
49
+ * and V2 ACL model.
50
+ * @param channel An IChannel record
51
+ * @returns an array of org ids for the given channel
52
+ */
53
+ export declare function getChannelOrgIds(channel: IChannel): string[];
54
+ /**
55
+ * Returns an array of group ids configured for the channel, supporting both legacy permissions
56
+ * and V2 ACL model.
57
+ * @param channel An IChannel record
58
+ * @returns an array of group ids for the given channel
59
+ */
60
+ export declare function getChannelGroupIds(channel: IChannel): string[];
61
+ /**
62
+ * A utility method used to build an IQuery to search for users that are permitted to be at-mentioned for the given channel.
63
+ * @param input An array of strings to search for. Each string is mapped to `username` and `fullname`, filters as an OR condition
64
+ * @param channel An IChannel record
65
+ * @param currentUsername The currently authenticated user's username
66
+ * @param options An IHubSearchOptions object
67
+ * @returns a promise that resolves an IHubSearchResponse<IHubSearchResult>
68
+ */
69
+ export declare function getChannelUsersQuery(inputs: string[], channel: IChannel, currentUsername?: string): IQuery;
@@ -1,9 +1,53 @@
1
1
  import { IHubSearchOptions, IHubSearchResponse, IHubSearchResult, IQuery } from "../types";
2
2
  /**
3
3
  * @private
4
- * Portal Search Implementation for Users
5
- * @param filterGroups
6
- * @param options
7
- * @returns
4
+ *
5
+ * Portal Search Implementation for Users within the currently authenticated user's organization.
6
+ * Automatically adds "org.name as OrgName" enrichment
7
+ *
8
+ * DEPRECATED: This method will be deprecated in a future release, as it's not ideal to impose default enrichments in all
9
+ * cases. When this method is depreated, all places that currently call `hubSearch` with a `targetEntity` of `user` will
10
+ * need to be updated to use the `portalUser` `targetEntity` and explicitly pass `"org.name as OrgName"` in `inclues` to
11
+ * preserve that enrichment, if needed. E.g.
12
+ *
13
+ * ```js
14
+ * // before
15
+ * await hubSearch(
16
+ * { targetEntity: "user", ... },
17
+ * { start: 1, ... },
18
+ * );
19
+ *
20
+ * // after
21
+ * await hubSearch(
22
+ * { targetEntity: "portalUser", ... },
23
+ * { start: 1, include: ["org.name as OrgName", ...], ... },
24
+ * );
25
+ * ```
26
+ *
27
+ * @param query An IQuery object representing the query to serialize
28
+ * @param options An IHubSearchOptions of search options
29
+ * @returns a promise that resolves an IHubSearchResponse<IHubSearchResult> of users results
8
30
  */
9
- export declare function portalSearchUsers(query: IQuery, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
31
+ export declare function searchPortalUsersLegacy(query: IQuery, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
32
+ /**
33
+ * @private
34
+ *
35
+ * Portal Search Implementation for Users within the currently authenticated user's organization.
36
+ * No enrichments added by default.
37
+ *
38
+ * @param query An IQuery object representing the query to serialize
39
+ * @param options An IHubSearchOptions of search options
40
+ * @returns a promise that resolves an IHubSearchResponse<IHubSearchResult> of users results
41
+ */
42
+ export declare function searchPortalUsers(query: IQuery, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
43
+ /**
44
+ * @private
45
+ *
46
+ * Community Search Implementation for Users within in any organization.
47
+ * No enrichments added by default.
48
+ *
49
+ * @param query An IQuery object representing the query to serialize
50
+ * @param options An IHubSearchOptions of search options
51
+ * @returns a promise that resolves an IHubSearchResponse<IHubSearchResult> of users results
52
+ */
53
+ export declare function searchCommunityUsers(query: IQuery, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
@@ -50,7 +50,7 @@ export interface IHubCollection {
50
50
  */
51
51
  targetEntity: EntityType;
52
52
  }
53
- export declare type EntityType = "item" | "group" | "user" | "groupMember" | "event" | "channel";
53
+ export declare type EntityType = "item" | "group" | "user" | "portalUser" | "communityUser" | "groupMember" | "event" | "channel";
54
54
  /**
55
55
  * @private
56
56
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "14.20.0",
3
+ "version": "14.21.1",
4
4
  "description": "Common TypeScript types and utility functions for @esri/hub.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "module": "dist/esm/index.js",