@esri/hub-common 17.20.0 → 18.0.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 (107) hide show
  1. package/dist/esm/ArcGISContextManager.js +2 -2
  2. package/dist/esm/ArcGISContextManager.js.map +1 -1
  3. package/dist/esm/core/_internal/getEditorSlug.js +6 -1
  4. package/dist/esm/core/_internal/getEditorSlug.js.map +1 -1
  5. package/dist/esm/core/schemas/internal/addDynamicSlugValidation.js +6 -1
  6. package/dist/esm/core/schemas/internal/addDynamicSlugValidation.js.map +1 -1
  7. package/dist/esm/core/schemas/internal/metrics/editorToEntity.js +5 -1
  8. package/dist/esm/core/schemas/internal/metrics/editorToEntity.js.map +1 -1
  9. package/dist/esm/discussions/_internal/DiscussionBusinessRules.js +1 -0
  10. package/dist/esm/discussions/_internal/DiscussionBusinessRules.js.map +1 -1
  11. package/dist/esm/groups/_internal/GroupBusinessRules.js +1 -0
  12. package/dist/esm/groups/_internal/GroupBusinessRules.js.map +1 -1
  13. package/dist/esm/items/_internal/slugs.js +13 -11
  14. package/dist/esm/items/_internal/slugs.js.map +1 -1
  15. package/dist/esm/items/slugs.js +3 -8
  16. package/dist/esm/items/slugs.js.map +1 -1
  17. package/dist/esm/pages/HubPage.js +1 -1
  18. package/dist/esm/pages/HubPage.js.map +1 -1
  19. package/dist/esm/search/_internal/commonHelpers/getApi.js +7 -27
  20. package/dist/esm/search/_internal/commonHelpers/getApi.js.map +1 -1
  21. package/dist/esm/search/_internal/commonHelpers/shouldUseOgcApi.js +2 -2
  22. package/dist/esm/search/_internal/commonHelpers/shouldUseOgcApi.js.map +1 -1
  23. package/dist/esm/search/_internal/hubSearchItemsHelpers/getOgcAggregationQueryParams.js.map +1 -1
  24. package/dist/esm/search/_internal/hubSearchItemsHelpers/getOgcCollectionUrl.js +4 -7
  25. package/dist/esm/search/_internal/hubSearchItemsHelpers/getOgcCollectionUrl.js.map +1 -1
  26. package/dist/esm/search/_internal/hubSearchItemsHelpers/ogcApiRequest.js +3 -24
  27. package/dist/esm/search/_internal/hubSearchItemsHelpers/ogcApiRequest.js.map +1 -1
  28. package/dist/esm/search/_internal/hubSearchItemsHelpers/searchOgcAggregations.js +1 -1
  29. package/dist/esm/search/_internal/hubSearchItemsHelpers/searchOgcAggregations.js.map +1 -1
  30. package/dist/esm/search/_internal/hubSearchItemsHelpers/searchOgcItems.js +1 -1
  31. package/dist/esm/search/_internal/hubSearchItemsHelpers/searchOgcItems.js.map +1 -1
  32. package/dist/esm/search/hubSearch.js +4 -4
  33. package/dist/esm/search/hubSearch.js.map +1 -1
  34. package/dist/esm/search/searchAssociatedContent.js +4 -4
  35. package/dist/esm/search/searchAssociatedContent.js.map +1 -1
  36. package/dist/esm/search/utils.js +0 -61
  37. package/dist/esm/search/utils.js.map +1 -1
  38. package/dist/esm/sites/HubSites.js +2 -1
  39. package/dist/esm/sites/HubSites.js.map +1 -1
  40. package/dist/esm/sites/_internal/SiteBusinessRules.js +1 -0
  41. package/dist/esm/sites/_internal/SiteBusinessRules.js.map +1 -1
  42. package/dist/esm/users/_internal/UserBusinessRules.js +1 -0
  43. package/dist/esm/users/_internal/UserBusinessRules.js.map +1 -1
  44. package/dist/node/ArcGISContextManager.js +5 -5
  45. package/dist/node/ArcGISContextManager.js.map +1 -1
  46. package/dist/node/core/_internal/getEditorSlug.js +6 -1
  47. package/dist/node/core/_internal/getEditorSlug.js.map +1 -1
  48. package/dist/node/core/schemas/internal/addDynamicSlugValidation.js +6 -1
  49. package/dist/node/core/schemas/internal/addDynamicSlugValidation.js.map +1 -1
  50. package/dist/node/core/schemas/internal/metrics/editorToEntity.js +5 -1
  51. package/dist/node/core/schemas/internal/metrics/editorToEntity.js.map +1 -1
  52. package/dist/node/discussions/_internal/DiscussionBusinessRules.js +1 -0
  53. package/dist/node/discussions/_internal/DiscussionBusinessRules.js.map +1 -1
  54. package/dist/node/groups/_internal/GroupBusinessRules.js +1 -0
  55. package/dist/node/groups/_internal/GroupBusinessRules.js.map +1 -1
  56. package/dist/node/items/_internal/slugs.js +13 -11
  57. package/dist/node/items/_internal/slugs.js.map +1 -1
  58. package/dist/node/items/slugs.js +3 -8
  59. package/dist/node/items/slugs.js.map +1 -1
  60. package/dist/node/pages/HubPage.js +1 -1
  61. package/dist/node/pages/HubPage.js.map +1 -1
  62. package/dist/node/search/_internal/commonHelpers/getApi.js +7 -27
  63. package/dist/node/search/_internal/commonHelpers/getApi.js.map +1 -1
  64. package/dist/node/search/_internal/commonHelpers/shouldUseOgcApi.js +2 -2
  65. package/dist/node/search/_internal/commonHelpers/shouldUseOgcApi.js.map +1 -1
  66. package/dist/node/search/_internal/hubSearchItemsHelpers/getOgcAggregationQueryParams.js.map +1 -1
  67. package/dist/node/search/_internal/hubSearchItemsHelpers/getOgcCollectionUrl.js +4 -7
  68. package/dist/node/search/_internal/hubSearchItemsHelpers/getOgcCollectionUrl.js.map +1 -1
  69. package/dist/node/search/_internal/hubSearchItemsHelpers/ogcApiRequest.js +3 -24
  70. package/dist/node/search/_internal/hubSearchItemsHelpers/ogcApiRequest.js.map +1 -1
  71. package/dist/node/search/_internal/hubSearchItemsHelpers/searchOgcAggregations.js +1 -1
  72. package/dist/node/search/_internal/hubSearchItemsHelpers/searchOgcAggregations.js.map +1 -1
  73. package/dist/node/search/_internal/hubSearchItemsHelpers/searchOgcItems.js +1 -1
  74. package/dist/node/search/_internal/hubSearchItemsHelpers/searchOgcItems.js.map +1 -1
  75. package/dist/node/search/hubSearch.js +4 -4
  76. package/dist/node/search/hubSearch.js.map +1 -1
  77. package/dist/node/search/searchAssociatedContent.js +4 -4
  78. package/dist/node/search/searchAssociatedContent.js.map +1 -1
  79. package/dist/node/search/utils.js +1 -64
  80. package/dist/node/search/utils.js.map +1 -1
  81. package/dist/node/sites/HubSites.js +2 -1
  82. package/dist/node/sites/HubSites.js.map +1 -1
  83. package/dist/node/sites/_internal/SiteBusinessRules.js +1 -0
  84. package/dist/node/sites/_internal/SiteBusinessRules.js.map +1 -1
  85. package/dist/node/users/_internal/UserBusinessRules.js +1 -0
  86. package/dist/node/users/_internal/UserBusinessRules.js.map +1 -1
  87. package/dist/types/ArcGISContextManager.d.ts +3 -0
  88. package/dist/types/items/_internal/slugs.d.ts +1 -1
  89. package/dist/types/items/slugs.d.ts +1 -1
  90. package/dist/types/search/_internal/commonHelpers/getApi.d.ts +4 -7
  91. package/dist/types/search/_internal/hubSearchItemsHelpers/getOgcAggregationQueryParams.d.ts +5 -4
  92. package/dist/types/search/_internal/hubSearchItemsHelpers/ogcApiRequest.d.ts +5 -15
  93. package/dist/types/search/hubSearch.d.ts +4 -1
  94. package/dist/types/search/types/IHubSearchOptions.d.ts +3 -9
  95. package/dist/types/search/types/types.d.ts +3 -18
  96. package/dist/types/search/utils.d.ts +1 -21
  97. package/package.json +1 -1
  98. package/dist/esm/search/_internal/commonHelpers/getDiscussionsApiDefinition.js +0 -10
  99. package/dist/esm/search/_internal/commonHelpers/getDiscussionsApiDefinition.js.map +0 -1
  100. package/dist/esm/search/_internal/commonHelpers/getOgcApiDefinition.js +0 -20
  101. package/dist/esm/search/_internal/commonHelpers/getOgcApiDefinition.js.map +0 -1
  102. package/dist/node/search/_internal/commonHelpers/getDiscussionsApiDefinition.js +0 -14
  103. package/dist/node/search/_internal/commonHelpers/getDiscussionsApiDefinition.js.map +0 -1
  104. package/dist/node/search/_internal/commonHelpers/getOgcApiDefinition.js +0 -24
  105. package/dist/node/search/_internal/commonHelpers/getOgcApiDefinition.js.map +0 -1
  106. package/dist/types/search/_internal/commonHelpers/getDiscussionsApiDefinition.d.ts +0 -2
  107. package/dist/types/search/_internal/commonHelpers/getOgcApiDefinition.d.ts +0 -11
@@ -1,26 +1,16 @@
1
+ import { IOgcAggregationQueryParams } from "./getOgcAggregationQueryParams";
2
+ import { IOgcItemQueryParams } from "./getOgcItemQueryParams";
1
3
  import { ISearchOgcItemsOptions } from "./interfaces";
2
4
  /**
3
5
  * Wrapper over fetch for performing common operations when executing a request to an OGC API, such as:
4
6
  * - Creating the query string
5
7
  * - URL encoding query string values
6
- * - Appending the ?target query param if needed
7
8
  * - Checking whether the response is ok
8
9
  * - Returning the .json() of the response body
9
10
  *
10
- * Note: the ?target query param is only appended if the target site (options.site) is _different_ from the
11
- * the site that will have its OGC API hit (url). This allows us to use the environment-level OGC API's url while
12
- * actually targeting a specific Hub Site's catalog. It's a powerful capability that significantly eases local development.
13
- *
14
- * Example: https://hubqa.arcgis.com/api/search/v1?target="my-actual-hub.hub.arcgis.com"
15
- *
16
- * We omit the ?target query when the site and url are the same because it would be redundant.
17
- *
18
- * Bad example: https://hubqa.arcgis.com/api/search/v1?target="hubqa.arcgis.com"
19
- * Good example: https://hubqa.arcgis.com/api/search/v1
20
- *
21
11
  * @param url the OGC API endpoint that should actually be hit
22
- * @param queryParams query params that should be serialized with the request (excluding `target`)
23
- * @param options options to customize the search, such as the site whose catalogs we're targeting
12
+ * @param queryParams query params that should be serialized with the request
13
+ * @param options options to customize the search
24
14
  * @returns the JSON response from the endpoint
25
15
  */
26
- export declare function ogcApiRequest(url: string, queryParams: Record<string, any>, options: ISearchOgcItemsOptions): Promise<any>;
16
+ export declare function ogcApiRequest(url: string, queryParams: IOgcItemQueryParams | IOgcAggregationQueryParams, options: ISearchOgcItemsOptions): Promise<unknown>;
@@ -1,4 +1,7 @@
1
- import { IHubSearchOptions, IHubSearchResponse, IHubSearchResult, IQuery } from "./types";
1
+ import { IQuery } from "./types/IHubCatalog";
2
+ import { IHubSearchResponse } from "./types/IHubSearchResponse";
3
+ import { IHubSearchOptions } from "./types/IHubSearchOptions";
4
+ import { IHubSearchResult } from "./types/IHubSearchResult";
2
5
  /**
3
6
  * Main entrypoint for searching via Hub
4
7
  *
@@ -1,8 +1,8 @@
1
1
  import type { ArcGISIdentityManager } from "@esri/arcgis-rest-request";
2
2
  import { IHubRequestOptions } from "../../hub-types";
3
3
  import { EntityType } from "./IHubCatalog";
4
- import { NamedApis, IApiDefinition } from "./types";
5
4
  import { HTTPMethods } from "@esri/arcgis-rest-request";
5
+ import { ApiTarget } from "./types";
6
6
  export declare type Enrichments = "data" | "metadata" | "org" | "service" | "layers";
7
7
  /**
8
8
  * Paging Options
@@ -46,15 +46,9 @@ export interface IHubSearchOptions extends IPagingOptions, ISortOptions {
46
46
  */
47
47
  aggLimit?: number;
48
48
  /**
49
- * TODO: Deprecate in favor of `requestOptions` and `siteUrl`
50
- * Specify API to call. Defaults to ArcGIS Online Portal API
49
+ * Specify API to call. Defaults to Portal API defined in requestOptions.
51
50
  */
52
- api?: NamedApis | IApiDefinition;
53
- /**
54
- * Site whose API should be targeted. Ignored in an enterprise context.
55
- * e.g., https://my-site.hub.arcgis.com
56
- */
57
- site?: string;
51
+ api?: ApiTarget;
58
52
  /**
59
53
  * DEPRECATE in favor of requestOptions
60
54
  */
@@ -61,20 +61,7 @@ export interface IMatchOptions {
61
61
  */
62
62
  exact?: string | string[];
63
63
  }
64
- export interface IWellKnownApis {
65
- arcgis: IApiDefinition;
66
- arcgisQA: IApiDefinition;
67
- arcgisDEV: IApiDefinition;
68
- hub: IApiDefinition;
69
- hubQA: IApiDefinition;
70
- hubDEV: IApiDefinition;
71
- }
72
- export declare type NamedApis = keyof IWellKnownApis;
73
- export interface IApiDefinition {
74
- label?: string;
75
- url: string;
76
- type: "arcgis" | "arcgis-hub";
77
- }
64
+ export declare type ApiTarget = "portal" | "hub";
78
65
  /**
79
66
  * Base options when checking catalog containment
80
67
  */
@@ -92,8 +79,7 @@ export interface IContainsOptions {
92
79
  /**
93
80
  * Basic information about a catalog
94
81
  */
95
- export interface ICatalogInfo extends Partial<IDeepCatalogInfo> {
96
- }
82
+ export declare type ICatalogInfo = Partial<IDeepCatalogInfo>;
97
83
  /**
98
84
  * Cacheable information about a catalog
99
85
  */
@@ -134,8 +120,7 @@ export interface ICatalogSearchResponse {
134
120
  * Response from a Catalog search operation where the responses for different collections
135
121
  * or entities are grouped into a single object.
136
122
  */
137
- export interface ISearchResponseHash extends Record<string, IHubSearchResponse<IHubSearchResult>> {
138
- }
123
+ export declare type ISearchResponseHash = Record<string, IHubSearchResponse<IHubSearchResult>>;
139
124
  /**
140
125
  * Type wrapper for a kilobyte
141
126
  * This is complete syntactic sugar, it makes sizes easier to understand
@@ -3,29 +3,9 @@ import { IGroup, SearchQueryBuilder } from "@esri/arcgis-rest-portal";
3
3
  import { IHubSite } from "../core";
4
4
  import { IHubSearchResult } from "./types";
5
5
  import { IPredicate, IQuery } from "./types/IHubCatalog";
6
- import { IMatchOptions, IDateRange, IRelativeDate, IWellKnownApis, IApiDefinition, NamedApis, Kilobyte } from "./types/types";
6
+ import { IMatchOptions, IDateRange, IRelativeDate, Kilobyte } from "./types/types";
7
7
  import { WellKnownCollection } from "./wellKnownCatalog";
8
8
  import { LegacySearchCategory } from "./_internal/commonHelpers/isLegacySearchCategory";
9
- /**
10
- * Well known APIs
11
- * Short-forms for specifying common APIs
12
- * We will likely deprecate this
13
- */
14
- export declare const SEARCH_APIS: IWellKnownApis;
15
- /**
16
- * @private
17
- * Convert array of api "names" into full ApiDefinitions
18
- * @param apis
19
- * @returns
20
- */
21
- export declare function expandApis(apis: Array<NamedApis | IApiDefinition>): IApiDefinition[];
22
- /**
23
- * @private
24
- * Convert an api "name" into a full ApiDefinition
25
- * @param api
26
- * @returns
27
- */
28
- export declare function expandApi(api: NamedApis | IApiDefinition): IApiDefinition;
29
9
  /**
30
10
  * @private
31
11
  * Convert a field value into a MatchOptions if it's not already one
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "17.20.0",
3
+ "version": "18.0.0",
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",
@@ -1,10 +0,0 @@
1
- export function getDiscussionsApiDefinition() {
2
- // Currently, url is null because this is handled internally by the
3
- // discussions request method called by searchChannels, which relies on
4
- // the URL defined in the request options.hubApiUrl
5
- return {
6
- type: "arcgis-hub",
7
- url: null,
8
- };
9
- }
10
- //# sourceMappingURL=getDiscussionsApiDefinition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDiscussionsApiDefinition.js","sourceRoot":"","sources":["../../../../../src/search/_internal/commonHelpers/getDiscussionsApiDefinition.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,2BAA2B;IACzC,mEAAmE;IACnE,uEAAuE;IACvE,mDAAmD;IACnD,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,GAAG,EAAE,IAAI;KACV,CAAC;AACJ,CAAC"}
@@ -1,20 +0,0 @@
1
- /**
2
- * @private
3
- * Returns information about the current environment's OGC API
4
- *
5
- * @param options IHubRequestOptions to derive OGC API info from
6
- * @returns an IApiDefinition with needed info to target the OGC API
7
- */
8
- export function getOgcApiDefinition(targetEntity, requestOptions) {
9
- const umbrellaDomain = new URL(requestOptions.hubApiUrl).hostname;
10
- return targetEntity === "discussionPost"
11
- ? {
12
- type: "arcgis-hub",
13
- url: `https://${umbrellaDomain}/api/search/v2`,
14
- }
15
- : {
16
- type: "arcgis-hub",
17
- url: `https://${umbrellaDomain}/api/search/v1`,
18
- };
19
- }
20
- //# sourceMappingURL=getOgcApiDefinition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getOgcApiDefinition.js","sourceRoot":"","sources":["../../../../../src/search/_internal/commonHelpers/getOgcApiDefinition.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,YAAwB,EACxB,cAAkC;IAElC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC;IAClE,OAAO,YAAY,KAAK,gBAAgB;QACtC,CAAC,CAAC;YACE,IAAI,EAAE,YAAY;YAClB,GAAG,EAAE,WAAW,cAAc,gBAAgB;SAC/C;QACH,CAAC,CAAC;YACE,IAAI,EAAE,YAAY;YAClB,GAAG,EAAE,WAAW,cAAc,gBAAgB;SAC/C,CAAC;AACR,CAAC"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDiscussionsApiDefinition = void 0;
4
- function getDiscussionsApiDefinition() {
5
- // Currently, url is null because this is handled internally by the
6
- // discussions request method called by searchChannels, which relies on
7
- // the URL defined in the request options.hubApiUrl
8
- return {
9
- type: "arcgis-hub",
10
- url: null,
11
- };
12
- }
13
- exports.getDiscussionsApiDefinition = getDiscussionsApiDefinition;
14
- //# sourceMappingURL=getDiscussionsApiDefinition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDiscussionsApiDefinition.js","sourceRoot":"","sources":["../../../../../src/search/_internal/commonHelpers/getDiscussionsApiDefinition.ts"],"names":[],"mappings":";;;AAEA,SAAgB,2BAA2B;IACzC,mEAAmE;IACnE,uEAAuE;IACvE,mDAAmD;IACnD,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,GAAG,EAAE,IAAI;KACV,CAAC;AACJ,CAAC;AARD,kEAQC"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOgcApiDefinition = void 0;
4
- /**
5
- * @private
6
- * Returns information about the current environment's OGC API
7
- *
8
- * @param options IHubRequestOptions to derive OGC API info from
9
- * @returns an IApiDefinition with needed info to target the OGC API
10
- */
11
- function getOgcApiDefinition(targetEntity, requestOptions) {
12
- const umbrellaDomain = new URL(requestOptions.hubApiUrl).hostname;
13
- return targetEntity === "discussionPost"
14
- ? {
15
- type: "arcgis-hub",
16
- url: `https://${umbrellaDomain}/api/search/v2`,
17
- }
18
- : {
19
- type: "arcgis-hub",
20
- url: `https://${umbrellaDomain}/api/search/v1`,
21
- };
22
- }
23
- exports.getOgcApiDefinition = getOgcApiDefinition;
24
- //# sourceMappingURL=getOgcApiDefinition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getOgcApiDefinition.js","sourceRoot":"","sources":["../../../../../src/search/_internal/commonHelpers/getOgcApiDefinition.ts"],"names":[],"mappings":";;;AAIA;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,YAAwB,EACxB,cAAkC;IAElC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC;IAClE,OAAO,YAAY,KAAK,gBAAgB;QACtC,CAAC,CAAC;YACE,IAAI,EAAE,YAAY;YAClB,GAAG,EAAE,WAAW,cAAc,gBAAgB;SAC/C;QACH,CAAC,CAAC;YACE,IAAI,EAAE,YAAY;YAClB,GAAG,EAAE,WAAW,cAAc,gBAAgB;SAC/C,CAAC;AACR,CAAC;AAdD,kDAcC"}
@@ -1,2 +0,0 @@
1
- import { IApiDefinition } from "../../types/types";
2
- export declare function getDiscussionsApiDefinition(): IApiDefinition;
@@ -1,11 +0,0 @@
1
- import { IHubRequestOptions } from "../../../hub-types";
2
- import { EntityType } from "../../types";
3
- import { IApiDefinition } from "../../types/types";
4
- /**
5
- * @private
6
- * Returns information about the current environment's OGC API
7
- *
8
- * @param options IHubRequestOptions to derive OGC API info from
9
- * @returns an IApiDefinition with needed info to target the OGC API
10
- */
11
- export declare function getOgcApiDefinition(targetEntity: EntityType, requestOptions: IHubRequestOptions): IApiDefinition;