@esri/hub-common 9.38.0 → 9.41.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 (116) hide show
  1. package/dist/es2017/content/_internal.js +83 -0
  2. package/dist/es2017/content/_internal.js.map +1 -1
  3. package/dist/es2017/content/compose.js +7 -11
  4. package/dist/es2017/content/compose.js.map +1 -1
  5. package/dist/es2017/core/types/IHubContent.js +7 -0
  6. package/dist/es2017/core/types/IHubContent.js.map +1 -1
  7. package/dist/es2017/index.js +2 -0
  8. package/dist/es2017/index.js.map +1 -1
  9. package/dist/es2017/items/_enrichments.js +21 -0
  10. package/dist/es2017/items/_enrichments.js.map +1 -1
  11. package/dist/es2017/org/fetch-org.js +21 -0
  12. package/dist/es2017/org/fetch-org.js.map +1 -0
  13. package/dist/es2017/org/index.js +2 -0
  14. package/dist/es2017/org/index.js.map +1 -0
  15. package/dist/es2017/search/_internal/portalSearchGroups.js.map +1 -1
  16. package/dist/es2017/search/_internal/portalSearchUsers.js +89 -0
  17. package/dist/es2017/search/_internal/portalSearchUsers.js.map +1 -0
  18. package/dist/es2017/search/collectionState.js +1 -1
  19. package/dist/es2017/search/collectionState.js.map +1 -1
  20. package/dist/es2017/search/convertCatalog.js +14 -5
  21. package/dist/es2017/search/convertCatalog.js.map +1 -1
  22. package/dist/es2017/search/hubSearch.js +4 -1
  23. package/dist/es2017/search/hubSearch.js.map +1 -1
  24. package/dist/es2017/urls/getUserHomeUrl.js +12 -0
  25. package/dist/es2017/urls/getUserHomeUrl.js.map +1 -0
  26. package/dist/es2017/urls/index.js +1 -0
  27. package/dist/es2017/urls/index.js.map +1 -1
  28. package/dist/es2017/users/HubUsers.js +64 -0
  29. package/dist/es2017/users/HubUsers.js.map +1 -0
  30. package/dist/es2017/users/_internal/enrichments.js +85 -0
  31. package/dist/es2017/users/_internal/enrichments.js.map +1 -0
  32. package/dist/es2017/users/index.js +2 -0
  33. package/dist/es2017/users/index.js.map +1 -0
  34. package/dist/esm/content/_internal.js +85 -0
  35. package/dist/esm/content/_internal.js.map +1 -1
  36. package/dist/esm/content/compose.js +5 -11
  37. package/dist/esm/content/compose.js.map +1 -1
  38. package/dist/esm/core/types/IHubContent.js +7 -0
  39. package/dist/esm/core/types/IHubContent.js.map +1 -1
  40. package/dist/esm/index.js +2 -0
  41. package/dist/esm/index.js.map +1 -1
  42. package/dist/esm/items/_enrichments.js +21 -0
  43. package/dist/esm/items/_enrichments.js.map +1 -1
  44. package/dist/esm/org/fetch-org.js +22 -0
  45. package/dist/esm/org/fetch-org.js.map +1 -0
  46. package/dist/esm/org/index.js +2 -0
  47. package/dist/esm/org/index.js.map +1 -0
  48. package/dist/esm/search/_internal/portalSearchGroups.js.map +1 -1
  49. package/dist/esm/search/_internal/portalSearchUsers.js +104 -0
  50. package/dist/esm/search/_internal/portalSearchUsers.js.map +1 -0
  51. package/dist/esm/search/collectionState.js +1 -1
  52. package/dist/esm/search/collectionState.js.map +1 -1
  53. package/dist/esm/search/convertCatalog.js +14 -5
  54. package/dist/esm/search/convertCatalog.js.map +1 -1
  55. package/dist/esm/search/hubSearch.js +4 -1
  56. package/dist/esm/search/hubSearch.js.map +1 -1
  57. package/dist/esm/urls/getUserHomeUrl.js +12 -0
  58. package/dist/esm/urls/getUserHomeUrl.js.map +1 -0
  59. package/dist/esm/urls/index.js +1 -0
  60. package/dist/esm/urls/index.js.map +1 -1
  61. package/dist/esm/users/HubUsers.js +66 -0
  62. package/dist/esm/users/HubUsers.js.map +1 -0
  63. package/dist/esm/users/_internal/enrichments.js +86 -0
  64. package/dist/esm/users/_internal/enrichments.js.map +1 -0
  65. package/dist/esm/users/index.js +2 -0
  66. package/dist/esm/users/index.js.map +1 -0
  67. package/dist/node/content/_internal.js +84 -1
  68. package/dist/node/content/_internal.js.map +1 -1
  69. package/dist/node/content/compose.js +6 -10
  70. package/dist/node/content/compose.js.map +1 -1
  71. package/dist/node/core/types/IHubContent.js +8 -0
  72. package/dist/node/core/types/IHubContent.js.map +1 -1
  73. package/dist/node/index.js +2 -0
  74. package/dist/node/index.js.map +1 -1
  75. package/dist/node/items/_enrichments.js +21 -0
  76. package/dist/node/items/_enrichments.js.map +1 -1
  77. package/dist/node/org/fetch-org.js +24 -0
  78. package/dist/node/org/fetch-org.js.map +1 -0
  79. package/dist/node/org/index.js +5 -0
  80. package/dist/node/org/index.js.map +1 -0
  81. package/dist/node/search/_internal/portalSearchGroups.js.map +1 -1
  82. package/dist/node/search/_internal/portalSearchUsers.js +93 -0
  83. package/dist/node/search/_internal/portalSearchUsers.js.map +1 -0
  84. package/dist/node/search/collectionState.js +1 -1
  85. package/dist/node/search/collectionState.js.map +1 -1
  86. package/dist/node/search/convertCatalog.js +14 -5
  87. package/dist/node/search/convertCatalog.js.map +1 -1
  88. package/dist/node/search/hubSearch.js +4 -1
  89. package/dist/node/search/hubSearch.js.map +1 -1
  90. package/dist/node/urls/getUserHomeUrl.js +16 -0
  91. package/dist/node/urls/getUserHomeUrl.js.map +1 -0
  92. package/dist/node/urls/index.js +1 -0
  93. package/dist/node/urls/index.js.map +1 -1
  94. package/dist/node/users/HubUsers.js +68 -0
  95. package/dist/node/users/HubUsers.js.map +1 -0
  96. package/dist/node/users/_internal/enrichments.js +89 -0
  97. package/dist/node/users/_internal/enrichments.js.map +1 -0
  98. package/dist/node/users/index.js +5 -0
  99. package/dist/node/users/index.js.map +1 -0
  100. package/dist/types/content/_internal.d.ts +54 -5
  101. package/dist/types/core/types/IHubContent.d.ts +21 -0
  102. package/dist/types/index.d.ts +2 -0
  103. package/dist/types/org/fetch-org.d.ts +9 -0
  104. package/dist/types/org/index.d.ts +1 -0
  105. package/dist/types/search/_internal/portalSearchUsers.d.ts +8 -0
  106. package/dist/types/search/types/ICatalog.d.ts +14 -3
  107. package/dist/types/search/types/ICollection.d.ts +9 -3
  108. package/dist/types/search/types/types.d.ts +17 -1
  109. package/dist/types/urls/getUserHomeUrl.d.ts +10 -0
  110. package/dist/types/urls/index.d.ts +1 -0
  111. package/dist/types/users/HubUsers.d.ts +11 -0
  112. package/dist/types/users/_internal/enrichments.d.ts +28 -0
  113. package/dist/types/users/index.d.ts +1 -0
  114. package/dist/umd/common.umd.js +422 -38
  115. package/dist/umd/common.umd.js.map +1 -1
  116. package/package.json +1 -1
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchUserEnrichments = void 0;
4
+ const __1 = require("../..");
5
+ const _enrichments_1 = require("../../items/_enrichments");
6
+ const OperationStack_1 = require("../../OperationStack");
7
+ const utils_1 = require("../../utils");
8
+ const enrichUserOrg = (input) => {
9
+ const { data, stack, requestOptions } = input;
10
+ const opId = stack.start("enrichUserOrg");
11
+ const options = Object.assign(Object.assign({}, requestOptions), {
12
+ // In order to get the correct response, we must pass options.portal
13
+ // as a base portal url (e.g., www.arcgis.com, qaext.arcgis.com, etc)
14
+ // **not** an org portal (i.e. org.maps.arcgis.com).
15
+ portal: `${__1.getPortalBaseFromOrgUrl(requestOptions.portal)}/sharing/rest` });
16
+ // TODO: Add Caching
17
+ // Had implemented a simple caching system, but it leads to unstable
18
+ // tests because we can't deterministically clear it
19
+ // if (!orgCache[data.user.orgId]) {
20
+ // orgCache[data.user.orgId] = fetchOrg(data.user.orgId, options);
21
+ // }
22
+ // return (orgCache[data.user.orgId] as Promise<IPortal>)
23
+ return __1.fetchOrg(data.user.orgId, options)
24
+ .then((results) => {
25
+ stack.finish(opId);
26
+ return {
27
+ data: Object.assign(Object.assign({}, data), {
28
+ org: results,
29
+ }),
30
+ stack,
31
+ requestOptions,
32
+ };
33
+ })
34
+ .catch((error) => handleEnrichmentError(error, input, opId));
35
+ };
36
+ /**
37
+ * Simple cache for user org's. This does not expire
38
+ * but that seems reasonable as Org props rarely change
39
+ */
40
+ // This works find at run-time, but it's a problem in tests
41
+ // where we are validating calls. Will work with Randy to
42
+ // create something that's more robust
43
+ // const orgCache: Record<string, any> = {};
44
+ // add the error to the content.errors,
45
+ // log current stack operation as finished with an error
46
+ // and return output that can be piped into the next operation
47
+ const handleEnrichmentError = (error, input, opId) => {
48
+ const { data, stack, requestOptions } = input;
49
+ stack.finish(opId, { error });
50
+ return {
51
+ data: Object.assign(Object.assign({}, data), { errors: _enrichments_1.getEnrichmentErrors(error, data.errors) }),
52
+ stack,
53
+ requestOptions,
54
+ };
55
+ };
56
+ /**
57
+ * Available enrichments for Groups
58
+ */
59
+ const groupEnrichementOperations = {
60
+ org: enrichUserOrg,
61
+ };
62
+ /**
63
+ * Fetch enrichments for Users
64
+ * @param group
65
+ * @param enrichments
66
+ * @param requestOptions
67
+ * @returns
68
+ */
69
+ function fetchUserEnrichments(user, enrichments, requestOptions) {
70
+ // create a pipeline of enrichment operations
71
+ const operations = enrichments.reduce((ops, enrichment) => {
72
+ const operation = groupEnrichementOperations[enrichment];
73
+ // only include the enrichments that we know how to fetch
74
+ operation && ops.push(operation);
75
+ return ops;
76
+ }, []);
77
+ const pipeline = utils_1.createOperationPipeline(operations);
78
+ // execute pipeline and return the item and enrichments
79
+ return pipeline({
80
+ data: { user },
81
+ stack: new OperationStack_1.default(),
82
+ requestOptions,
83
+ }).then((output) => {
84
+ // TODO: send telemetry so we have info on what enrichments are requested and possible errors
85
+ return output.data;
86
+ });
87
+ }
88
+ exports.fetchUserEnrichments = fetchUserEnrichments;
89
+ //# sourceMappingURL=enrichments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enrichments.js","sourceRoot":"","sources":["../../../../src/users/_internal/enrichments.ts"],"names":[],"mappings":";;;AACA,6BAA0D;AAC1D,2DAA+D;AAC/D,yDAAkD;AAElD,uCAAiE;AAgCjE,MAAM,aAAa,GAAG,CACpB,KAAqC,EACI,EAAE;IAC3C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAC1C,MAAM,OAAO,mCACR,cAAc;QACjB,oEAAoE;QACpE,qEAAqE;QACrE,oDAAoD;QACpD,MAAM,EAAE,GAAG,2BAAuB,CAAC,cAAc,CAAC,MAAM,CAAC,eAAe,GACzE,CAAC;IACF,oBAAoB;IACpB,oEAAoE;IACpE,oDAAoD;IACpD,oCAAoC;IACpC,oEAAoE;IACpE,IAAI;IAEJ,yDAAyD;IACzD,OAAO,YAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC;SACtC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QAChB,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO;YACL,IAAI,kCACC,IAAI,GACJ;gBACD,GAAG,EAAE,OAAO;aACb,CACF;YACD,KAAK;YACL,cAAc;SACf,CAAC;IACJ,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF;;;GAGG;AACH,2DAA2D;AAC3D,yDAAyD;AACzD,sCAAsC;AACtC,4CAA4C;AAE5C,uCAAuC;AACvC,wDAAwD;AACxD,8DAA8D;AAC9D,MAAM,qBAAqB,GAAG,CAC5B,KAAqB,EACrB,KAAqC,EACrC,IAAY,EACoB,EAAE;IAClC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAC9C,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9B,OAAO;QACL,IAAI,kCACC,IAAI,KACP,MAAM,EAAE,kCAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAChD;QACD,KAAK;QACL,cAAc;KACf,CAAC;AACJ,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,0BAA0B,GAA8B;IAC5D,GAAG,EAAE,aAAa;CACnB,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAClC,IAAW,EACX,WAA6B,EAC7B,cAAmC;IAEnC,6CAA6C;IAC7C,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,EAAE;QACxD,MAAM,SAAS,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;QACzD,yDAAyD;QACzD,SAAS,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjC,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,MAAM,QAAQ,GAAG,+BAAuB,CAAsB,UAAU,CAAC,CAAC;IAC1E,uDAAuD;IACvD,OAAO,QAAQ,CAAC;QACd,IAAI,EAAE,EAAE,IAAI,EAAE;QACd,KAAK,EAAE,IAAI,wBAAc,EAAE;QAC3B,cAAc;KACf,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;QACjB,6FAA6F;QAC7F,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC;AAtBD,oDAsBC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./HubUsers"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/users/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B"}
@@ -1,6 +1,6 @@
1
- import { IItem } from "@esri/arcgis-rest-portal";
2
- import { ILayerDefinition, ISpatialReference } from "@esri/arcgis-rest-types";
3
- import { IHubContent } from "../core";
1
+ import { IItem, IPortal } from "@esri/arcgis-rest-portal";
2
+ import { ILayerDefinition, ISpatialReference, IUser } from "@esri/arcgis-rest-types";
3
+ import { IHubContent, PublisherSource } from "../core";
4
4
  import { IHubGeography, GeographyProvenance, IHubRequestOptions } from "../types";
5
5
  import { IHubAdditionalResource } from "../core/types/IHubAdditionalResource";
6
6
  /**
@@ -49,6 +49,14 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
49
49
  publishedDate: Date;
50
50
  publishedDateSource?: string;
51
51
  updateFrequency?: string;
52
+ publisher?: {
53
+ name?: string;
54
+ username?: string;
55
+ nameSource: PublisherSource;
56
+ organization?: string;
57
+ orgId?: string;
58
+ organizationSource: PublisherSource;
59
+ };
52
60
  portalHomeUrl?: string;
53
61
  portalApiUrl?: string;
54
62
  portalDataUrl?: string;
@@ -85,8 +93,8 @@ export declare const setContentBoundary: (content: IHubContent, boundary: Geogra
85
93
  };
86
94
  metadata?: any;
87
95
  groupIds?: string[];
88
- ownerUser?: import("@esri/arcgis-rest-portal").IUser;
89
- org?: Partial<import("@esri/arcgis-rest-portal").IPortal>;
96
+ ownerUser?: IUser;
97
+ org?: Partial<IPortal>;
90
98
  errors?: import("../types").IEnrichmentErrorInfo[];
91
99
  server?: Partial<import("@esri/arcgis-rest-feature-layer").IFeatureServiceDefinition>;
92
100
  layers?: Partial<ILayerDefinition>[];
@@ -284,4 +292,45 @@ export declare const getAdditionalResourceUrl: (resource: IAGOAdditionalResource
284
292
  * @returns the correct extent in a bbox format, or undefined
285
293
  */
286
294
  export declare const determineExtent: (item: IItem, extentEnrichment?: any, layer?: ILayerDefinition) => any;
295
+ /**
296
+ * @private
297
+ *
298
+ * Extracts the first contact from a given formal item metadata path.
299
+ * This is particularly helpful if the contact path is either an object or an array.
300
+ *
301
+ * Note: the raw contact object must have the following properties:
302
+ * - `rpIndName`: name of the individual
303
+ * - `rpOrgName`: name of the individual's organization
304
+ *
305
+ * @param metadata formal item metadata
306
+ * @param path path to the contact object/array
307
+ * @returns
308
+ */
309
+ export declare const extractFirstContact: (metadata: any, path: string) => {
310
+ individualName: any;
311
+ organizationName: any;
312
+ };
313
+ /**
314
+ * Determines the correct orgId for an item.
315
+ * Note: it's undocumented, but the portal API will return orgId for items... sometimes.
316
+ *
317
+ * @param item
318
+ * @param ownerUser item owner's hydrated user object
319
+ */
320
+ export declare const getItemOrgId: (item: IItem, ownerUser?: IUser) => any;
321
+ /**
322
+ * Calculates the Publisher display info for the given item.
323
+ * Utilizes this fallback pattern:
324
+ * 1) Formal Item Metadata > Resource > Citation > Contact
325
+ * 2) Formal Item Metadata > Resource > Contact
326
+ * 3) Item’s Owner and Org Name
327
+ * 4) Undefined (Item Owner / Org are private and we can't access additional info)
328
+ *
329
+ * @param item
330
+ * @param metadata
331
+ * @param org portal info of the item's organization
332
+ * @param ownerUser the item owner's hydrated user
333
+ * @returns
334
+ */
335
+ export declare const getPublisherInfo: (item: IItem, metadata?: any, org?: Partial<IPortal>, ownerUser?: IUser) => any;
287
336
  export {};
@@ -5,6 +5,12 @@ import { IStructuredLicense } from "../../items/get-structured-license";
5
5
  import { IHubItemEntity } from ".";
6
6
  import { IHubContentEnrichments } from "./IHubContentEnrichments";
7
7
  import { IHubAdditionalResource } from "./IHubAdditionalResource";
8
+ export declare enum PublisherSource {
9
+ CitationContact = "metadata.resource.citation.contact",
10
+ ResourceContact = "metadata.resource.contact",
11
+ ItemOwner = "item.owner",
12
+ None = "none"
13
+ }
8
14
  /**
9
15
  * Data model for content
10
16
  */
@@ -61,6 +67,21 @@ export interface IHubContent extends IHubItemEntity, IHubContentEnrichments, IIt
61
67
  publishedDateSource?: string;
62
68
  /** Frequency at which the content is updated */
63
69
  updateFrequency?: string;
70
+ /**
71
+ * Info to display about the content's publisher. Follows this fallback pattern:
72
+ * 1) Formal Item Metadata > Resource > Citation > Contact
73
+ * 2) Formal Item Metadata > Resource > Contact
74
+ * 3) Item’s Owner and Org Name
75
+ * 4) Undefined (Item Owner / Org are private and we can't access additional info)
76
+ */
77
+ publisher?: {
78
+ name?: string;
79
+ username?: string;
80
+ nameSource: PublisherSource;
81
+ organization?: string;
82
+ orgId?: string;
83
+ organizationSource: PublisherSource;
84
+ };
64
85
  /** URL of the resource's page in the Portal Home application */
65
86
  portalHomeUrl?: string;
66
87
  /** URL of the Portal API endpoint for the resource */
@@ -25,6 +25,8 @@ export * from "./util";
25
25
  export * from "./utils";
26
26
  export * from "./Hub";
27
27
  export * from "./pages";
28
+ export * from "./org";
29
+ export * from "./users";
28
30
  import OperationStack from "./OperationStack";
29
31
  import OperationError from "./OperationError";
30
32
  import HubError from "./HubError";
@@ -0,0 +1,9 @@
1
+ import { IRequestOptions } from "@esri/arcgis-rest-request";
2
+ /**
3
+ * Fetches the portal for a given org.
4
+ *
5
+ * @param orgId
6
+ * @param options request options
7
+ * @returns
8
+ */
9
+ export declare const fetchOrg: (orgId: string, options?: IRequestOptions) => Promise<import("@esri/arcgis-rest-portal").IPortal>;
@@ -0,0 +1 @@
1
+ export * from "./fetch-org";
@@ -0,0 +1,8 @@
1
+ import { IFilterGroup, IHubSearchOptions, IHubSearchResponse, IHubSearchResult } from "../types";
2
+ /**
3
+ * @private
4
+ * Portal Search implementation for Users
5
+ * @param filterGroups
6
+ * @param options
7
+ */
8
+ export declare function portalSearchUsers(filterGroups: Array<IFilterGroup<"user">>, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
@@ -1,6 +1,6 @@
1
1
  import { ICollection } from "./ICollection";
2
2
  import { IFacet } from "./IFacet";
3
- import { Filter, FilterType, ISortOption } from "./types";
3
+ import { Filter, FilterType, IFilterGroup, ISortOption } from "./types";
4
4
  /**
5
5
  * Catalog is the definition which powers what options
6
6
  * are available in a Gallery. It controls not only
@@ -13,7 +13,11 @@ import { Filter, FilterType, ISortOption } from "./types";
13
13
  * ```ts
14
14
  * const simpleCatalog:Catalog = {
15
15
  * title: "Select Map",
16
- * filter: {
16
+ * filters: [
17
+ * {
18
+ * fitlerType: "item",
19
+ * operation: "AND",
20
+ * fitlers
17
21
  * filterType: "content",
18
22
  * type: "Web Map",
19
23
  * owner: "jsmith"
@@ -57,10 +61,17 @@ export interface ICatalog {
57
61
  * Title for the Gallery
58
62
  */
59
63
  title?: string;
64
+ /**
65
+ * Scope is a set of FilterGroups which define the limits of the Catalog.
66
+ * Typically it is just a set of group ids, but it may be arbitrarily complex.
67
+ * If one was to "search a catalog", this is the description of what would be returned.
68
+ */
69
+ scope?: Array<IFilterGroup<FilterType>>;
60
70
  /**
61
71
  * Filter defines the "scope" of the Catalog, typically a set of groups or orgids
72
+ * DEPRECATED: Use `scope`
62
73
  */
63
- filter: Filter<FilterType>;
74
+ filter?: Filter<FilterType>;
64
75
  /**
65
76
  * Sort options to be shown in the Gallery
66
77
  */
@@ -1,5 +1,5 @@
1
1
  import { IFacet } from "./IFacet";
2
- import { Filter, FilterType, ISortOption } from "./types";
2
+ import { Filter, FilterType, IFilterGroup, ISortOption } from "./types";
3
3
  /**
4
4
  * A Collection is a subset of a Catalog, but can be used independently
5
5
  * in Galleries
@@ -11,12 +11,18 @@ export interface ICollection {
11
11
  * Filter Type used in this collection
12
12
  */
13
13
  filterType?: FilterType;
14
+ /**
15
+ * Scope is a set of FilterGroups which define the limits of the Collection.
16
+ * Typically it is just a set of group ids, but it may be arbitrarily complex.
17
+ * If one was to "search the collection", this is the description of what would be returned.
18
+ */
19
+ scope?: Array<IFilterGroup<FilterType>>;
14
20
  /**
15
21
  * Specify the includes to be requested when working with this collection
16
22
  */
17
23
  include?: string[];
18
- defaultQuery?: string;
19
24
  sortOption: ISortOption;
20
- filter: Filter<FilterType>;
21
25
  facets?: IFacet[];
26
+ filter?: Filter<FilterType>;
27
+ defaultQuery?: string;
22
28
  }
@@ -40,6 +40,7 @@ export interface IFilterTypeMap {
40
40
  item: IItemFilter;
41
41
  user: IUserFilterDefinition;
42
42
  group: IGroupFilterDefinition;
43
+ groupMember: IGroupMemberFilterDefinition;
43
44
  event: IEventFilterDefinition;
44
45
  /**
45
46
  * DEPRECATED use item
@@ -127,7 +128,7 @@ export interface IUserFilterDefinition {
127
128
  email?: string | string[] | IMatchOptions;
128
129
  firstname?: string | string[] | IMatchOptions;
129
130
  fullname?: string | string[] | IMatchOptions;
130
- groups?: string | string[] | IMatchOptions;
131
+ group?: string | string[] | IMatchOptions;
131
132
  lastlogin?: IDateRange<number> | IRelativeDate;
132
133
  lastname?: string | string[] | IMatchOptions;
133
134
  modified?: IDateRange<number> | IRelativeDate;
@@ -135,6 +136,21 @@ export interface IUserFilterDefinition {
135
136
  term?: string;
136
137
  userlicensetype?: string | string[] | IMatchOptions;
137
138
  username?: string | string[] | IMatchOptions;
139
+ emailstatus?: string | string[] | IMatchOptions;
140
+ provider?: string | string[] | IMatchOptions;
141
+ }
142
+ /**
143
+ * These properties must all be passed through
144
+ * so they are sent in separate fields and *not*
145
+ * serialized into a q
146
+ * Also `joined` does not take the same format as
147
+ * dates in `q`
148
+ */
149
+ export interface IGroupMemberFilterDefinition {
150
+ memberType?: "admin" | "member";
151
+ joined?: IDateRange<number> | IRelativeDate;
152
+ name?: string | string[] | IMatchOptions;
153
+ orgIds?: string | string[] | IMatchOptions;
138
154
  }
139
155
  export interface IGroupFilterDefinition {
140
156
  access?: string | string[] | IMatchOptions;
@@ -0,0 +1,10 @@
1
+ import { IRequestOptions } from "@esri/arcgis-rest-request";
2
+ import { IPortal } from "@esri/arcgis-rest-portal";
3
+ import { IHubRequestOptions } from "../types";
4
+ /**
5
+ * Return the URL of the user's page in the Portal Home application
6
+ * @param username The username
7
+ * @param portalUrlOrObject a portal base or API URL, a portal object, or request options containing either of those
8
+ * @returns URL to the user's profile, defaults to `https://www.arcgis.com/home/user.html?user={username}`
9
+ */
10
+ export declare function getUserHomeUrl(username: string, portalUrlOrObject?: string | IPortal | IHubRequestOptions | IRequestOptions): string;
@@ -16,6 +16,7 @@ export * from "./convert-urls-to-anchor-tags";
16
16
  export * from "./getHubApiFromPortalUrl";
17
17
  export * from "./getPortalBaseFromOrgUrl";
18
18
  export * from "./getGroupHomeUrl";
19
+ export * from "./getUserHomeUrl";
19
20
  /**
20
21
  *
21
22
  * @param url
@@ -0,0 +1,11 @@
1
+ import { IUser } from "@esri/arcgis-rest-types";
2
+ import { IHubSearchResult } from "../search";
3
+ import { IHubRequestOptions } from "../types";
4
+ /**
5
+ * Enrich a User object
6
+ * @param user
7
+ * @param includes
8
+ * @param requestOptions
9
+ * @returns
10
+ */
11
+ export declare function enrichUserSearchResult(user: IUser, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
@@ -0,0 +1,28 @@
1
+ import { IUser, IPortal } from "@esri/arcgis-rest-portal";
2
+ import { IEnrichmentErrorInfo, IHubRequestOptions } from "../../types";
3
+ /**
4
+ * Possible additional properties available through enrichments
5
+ */
6
+ export interface IUserEnrichments {
7
+ org?: IPortal;
8
+ /**
9
+ * Any errors encountered when fetching enrichments
10
+ * see https://github.com/ArcGIS/hub-indexer/blob/master/docs/errors.md#response-formatting-for-errors
11
+ */
12
+ errors?: IEnrichmentErrorInfo[];
13
+ }
14
+ export declare type UserEnrichment = keyof IUserEnrichments;
15
+ /**
16
+ * Merging of the Enrichment and the User
17
+ */
18
+ export interface IUserAndEnrichments extends IUserEnrichments {
19
+ user: IUser;
20
+ }
21
+ /**
22
+ * Fetch enrichments for Users
23
+ * @param group
24
+ * @param enrichments
25
+ * @param requestOptions
26
+ * @returns
27
+ */
28
+ export declare function fetchUserEnrichments(user: IUser, enrichments: UserEnrichment[], requestOptions?: IHubRequestOptions): Promise<IUserAndEnrichments>;
@@ -0,0 +1 @@
1
+ export * from "./HubUsers";