@esri/hub-common 17.2.0 → 17.4.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 (86) hide show
  1. package/dist/esm/content/_internal/ContentBusinessRules.js +34 -0
  2. package/dist/esm/content/_internal/ContentBusinessRules.js.map +1 -1
  3. package/dist/esm/core/types/HubEntityType.js +9 -6
  4. package/dist/esm/core/types/HubEntityType.js.map +1 -1
  5. package/dist/esm/initiative-templates/_internal/InitiativeTemplateBusinessRules.js +13 -0
  6. package/dist/esm/initiative-templates/_internal/InitiativeTemplateBusinessRules.js.map +1 -1
  7. package/dist/esm/search/_internal/commonHelpers/getApi.js +1 -1
  8. package/dist/esm/search/_internal/commonHelpers/getApi.js.map +1 -1
  9. package/dist/esm/search/_internal/commonHelpers/getOgcApiDefinition.js +2 -2
  10. package/dist/esm/search/_internal/commonHelpers/getOgcApiDefinition.js.map +1 -1
  11. package/dist/esm/search/_internal/hubSearchItems.js +6 -2
  12. package/dist/esm/search/_internal/hubSearchItems.js.map +1 -1
  13. package/dist/esm/search/_internal/hubSearchItemsHelpers/formatOgcItemsResponse.js +7 -7
  14. package/dist/esm/search/_internal/hubSearchItemsHelpers/formatOgcItemsResponse.js.map +1 -1
  15. package/dist/esm/search/_internal/hubSearchItemsHelpers/getNextOgcCallback.js +2 -2
  16. package/dist/esm/search/_internal/hubSearchItemsHelpers/getNextOgcCallback.js.map +1 -1
  17. package/dist/esm/search/_internal/hubSearchItemsHelpers/getOgcItemQueryParams.js +1 -1
  18. package/dist/esm/search/_internal/hubSearchItemsHelpers/getOgcItemQueryParams.js.map +1 -1
  19. package/dist/esm/search/_internal/hubSearchItemsHelpers/getSortByQueryParam.js +1 -1
  20. package/dist/esm/search/_internal/hubSearchItemsHelpers/getSortByQueryParam.js.map +1 -1
  21. package/dist/esm/search/_internal/hubSearchItemsHelpers/ogcApiRequest.js +5 -2
  22. package/dist/esm/search/_internal/hubSearchItemsHelpers/ogcApiRequest.js.map +1 -1
  23. package/dist/esm/search/_internal/hubSearchItemsHelpers/searchOgcItems.js +2 -4
  24. package/dist/esm/search/_internal/hubSearchItemsHelpers/searchOgcItems.js.map +1 -1
  25. package/dist/esm/search/index.js +1 -0
  26. package/dist/esm/search/index.js.map +1 -1
  27. package/dist/esm/search/searchAssociatedContent.js +44 -0
  28. package/dist/esm/search/searchAssociatedContent.js.map +1 -0
  29. package/dist/esm/sites/HubSites.js.map +1 -1
  30. package/dist/esm/surveys/_internal/SurveyBusinessRules.js +13 -0
  31. package/dist/esm/surveys/_internal/SurveyBusinessRules.js.map +1 -1
  32. package/dist/esm/templates/_internal/TemplateBusinessRules.js +13 -0
  33. package/dist/esm/templates/_internal/TemplateBusinessRules.js.map +1 -1
  34. package/dist/node/content/_internal/ContentBusinessRules.js +34 -0
  35. package/dist/node/content/_internal/ContentBusinessRules.js.map +1 -1
  36. package/dist/node/core/types/HubEntityType.js +10 -7
  37. package/dist/node/core/types/HubEntityType.js.map +1 -1
  38. package/dist/node/initiative-templates/_internal/InitiativeTemplateBusinessRules.js +13 -0
  39. package/dist/node/initiative-templates/_internal/InitiativeTemplateBusinessRules.js.map +1 -1
  40. package/dist/node/search/_internal/commonHelpers/getApi.js +1 -1
  41. package/dist/node/search/_internal/commonHelpers/getApi.js.map +1 -1
  42. package/dist/node/search/_internal/commonHelpers/getOgcApiDefinition.js +2 -2
  43. package/dist/node/search/_internal/commonHelpers/getOgcApiDefinition.js.map +1 -1
  44. package/dist/node/search/_internal/hubSearchItems.js +6 -2
  45. package/dist/node/search/_internal/hubSearchItems.js.map +1 -1
  46. package/dist/node/search/_internal/hubSearchItemsHelpers/formatOgcItemsResponse.js +7 -7
  47. package/dist/node/search/_internal/hubSearchItemsHelpers/formatOgcItemsResponse.js.map +1 -1
  48. package/dist/node/search/_internal/hubSearchItemsHelpers/getNextOgcCallback.js +2 -2
  49. package/dist/node/search/_internal/hubSearchItemsHelpers/getNextOgcCallback.js.map +1 -1
  50. package/dist/node/search/_internal/hubSearchItemsHelpers/getOgcItemQueryParams.js +1 -1
  51. package/dist/node/search/_internal/hubSearchItemsHelpers/getOgcItemQueryParams.js.map +1 -1
  52. package/dist/node/search/_internal/hubSearchItemsHelpers/getSortByQueryParam.js +1 -1
  53. package/dist/node/search/_internal/hubSearchItemsHelpers/getSortByQueryParam.js.map +1 -1
  54. package/dist/node/search/_internal/hubSearchItemsHelpers/ogcApiRequest.js +5 -2
  55. package/dist/node/search/_internal/hubSearchItemsHelpers/ogcApiRequest.js.map +1 -1
  56. package/dist/node/search/_internal/hubSearchItemsHelpers/searchOgcItems.js +2 -4
  57. package/dist/node/search/_internal/hubSearchItemsHelpers/searchOgcItems.js.map +1 -1
  58. package/dist/node/search/index.js +1 -0
  59. package/dist/node/search/index.js.map +1 -1
  60. package/dist/node/search/searchAssociatedContent.js +48 -0
  61. package/dist/node/search/searchAssociatedContent.js.map +1 -0
  62. package/dist/node/sites/HubSites.js.map +1 -1
  63. package/dist/node/surveys/_internal/SurveyBusinessRules.js +13 -0
  64. package/dist/node/surveys/_internal/SurveyBusinessRules.js.map +1 -1
  65. package/dist/node/templates/_internal/TemplateBusinessRules.js +13 -0
  66. package/dist/node/templates/_internal/TemplateBusinessRules.js.map +1 -1
  67. package/dist/types/content/_internal/ContentBusinessRules.d.ts +1 -1
  68. package/dist/types/content/_internal/internalContentUtils.d.ts +1 -1
  69. package/dist/types/content/get-family.d.ts +1 -1
  70. package/dist/types/core/types/HubEntityType.d.ts +3 -1
  71. package/dist/types/initiative-templates/_internal/InitiativeTemplateBusinessRules.d.ts +1 -1
  72. package/dist/types/search/_internal/commonHelpers/getOgcApiDefinition.d.ts +2 -2
  73. package/dist/types/search/_internal/hubSearchItemsHelpers/formatOgcItemsResponse.d.ts +2 -3
  74. package/dist/types/search/_internal/hubSearchItemsHelpers/getNextOgcCallback.d.ts +2 -3
  75. package/dist/types/search/_internal/hubSearchItemsHelpers/getOgcItemQueryParams.d.ts +3 -3
  76. package/dist/types/search/_internal/hubSearchItemsHelpers/getSortByQueryParam.d.ts +3 -3
  77. package/dist/types/search/_internal/hubSearchItemsHelpers/interfaces.d.ts +8 -0
  78. package/dist/types/search/_internal/hubSearchItemsHelpers/ogcApiRequest.d.ts +2 -2
  79. package/dist/types/search/_internal/hubSearchItemsHelpers/searchOgcItems.d.ts +2 -2
  80. package/dist/types/search/index.d.ts +1 -0
  81. package/dist/types/search/searchAssociatedContent.d.ts +12 -0
  82. package/dist/types/search/types/types.d.ts +32 -2
  83. package/dist/types/sites/HubSites.d.ts +1 -1
  84. package/dist/types/surveys/_internal/SurveyBusinessRules.d.ts +1 -1
  85. package/dist/types/templates/_internal/TemplateBusinessRules.d.ts +1 -1
  86. package/package.json +4 -4
@@ -1,6 +1,5 @@
1
1
  import { IQuery } from "../../types/IHubCatalog";
2
- import { IHubSearchOptions } from "../../types/IHubSearchOptions";
3
2
  import { IHubSearchResponse } from "../../types/IHubSearchResponse";
4
3
  import { IHubSearchResult } from "../../types/IHubSearchResult";
5
- import { IOgcItemsResponse } from "./interfaces";
6
- export declare function getNextOgcCallback(response: IOgcItemsResponse, originalQuery: IQuery, originalOptions: IHubSearchOptions): (params?: any) => Promise<IHubSearchResponse<IHubSearchResult>>;
4
+ import { IOgcItemsResponse, ISearchOgcItemsOptions } from "./interfaces";
5
+ export declare function getNextOgcCallback(response: IOgcItemsResponse, url: string, originalQuery: IQuery, originalOptions: ISearchOgcItemsOptions): (params?: any) => Promise<IHubSearchResponse<IHubSearchResult>>;
@@ -1,5 +1,5 @@
1
1
  import { IQuery } from "../../types/IHubCatalog";
2
- import { IHubSearchOptions } from "../../types/IHubSearchOptions";
2
+ import { ISearchOgcItemsOptions } from "./interfaces";
3
3
  export interface IOgcItemQueryParams {
4
4
  filter?: string;
5
5
  token?: string;
@@ -17,7 +17,7 @@ export interface IOgcItemQueryParams {
17
17
  * to the /items endpoint of an OGC API collection
18
18
  *
19
19
  * @param query an IQuery to derive query params from
20
- * @param options an IHubSearchOptions object to derive query params from
20
+ * @param options an ISearchOgcItemsOptions object to derive query params from
21
21
  * @returns a hash of query params to be included in the request
22
22
  */
23
- export declare function getOgcItemQueryParams(query: IQuery, options: IHubSearchOptions): IOgcItemQueryParams;
23
+ export declare function getOgcItemQueryParams(query: IQuery, options: ISearchOgcItemsOptions): IOgcItemQueryParams;
@@ -1,10 +1,10 @@
1
- import { IHubSearchOptions } from "../../types/IHubSearchOptions";
1
+ import { ISearchOgcItemsOptions } from "./interfaces";
2
2
  /**
3
3
  * @private
4
4
  * Serializes the sort options provided from the request options
5
5
  * object into a string that the OGC API can understand
6
6
  *
7
- * @param options IHubSearchOptions that contain sorting information
7
+ * @param options ISearchOgcItemsOptions that contain sorting information
8
8
  * @returns a serialized sort string
9
9
  */
10
- export declare function getSortByQueryParam(options: IHubSearchOptions): string;
10
+ export declare function getSortByQueryParam(options: ISearchOgcItemsOptions): string;
@@ -1,3 +1,4 @@
1
+ import { IHubSearchOptions } from "../../types/IHubSearchOptions";
1
2
  export interface IOgcItem {
2
3
  id: string;
3
4
  type: "Feature";
@@ -34,4 +35,11 @@ export interface IOgcAggregationsResponse {
34
35
  timestamp: string;
35
36
  links: IOgcLink[];
36
37
  }
38
+ /**
39
+ * @private
40
+ * Interface for the options object passed to the searchOgcItems function.
41
+ * Unlike IHubSearchOptions, this interface does not accept aggregation
42
+ * properties or properties marked for deprecation.
43
+ */
44
+ export declare type ISearchOgcItemsOptions = Omit<IHubSearchOptions, "aggFields" | "aggLimit" | "api" | "authentication" | "page">;
37
45
  export {};
@@ -1,4 +1,4 @@
1
- import { IHubSearchOptions } from "../../types/IHubSearchOptions";
1
+ import { ISearchOgcItemsOptions } from "./interfaces";
2
2
  /**
3
3
  * Wrapper over fetch for performing common operations when executing a request to an OGC API, such as:
4
4
  * - Creating the query string
@@ -23,4 +23,4 @@ import { IHubSearchOptions } from "../../types/IHubSearchOptions";
23
23
  * @param options options to customize the search, such as the site whose catalogs we're targeting
24
24
  * @returns the JSON response from the endpoint
25
25
  */
26
- export declare function ogcApiRequest(url: string, queryParams: Record<string, any>, options: IHubSearchOptions): Promise<any>;
26
+ export declare function ogcApiRequest(url: string, queryParams: Record<string, any>, options: ISearchOgcItemsOptions): Promise<any>;
@@ -1,5 +1,5 @@
1
1
  import { IQuery } from "../../types/IHubCatalog";
2
- import { IHubSearchOptions } from "../../types/IHubSearchOptions";
3
2
  import { IHubSearchResponse } from "../../types/IHubSearchResponse";
4
3
  import { IHubSearchResult } from "../../types/IHubSearchResult";
5
- export declare function searchOgcItems(query: IQuery, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
4
+ import { ISearchOgcItemsOptions } from "./interfaces";
5
+ export declare function searchOgcItems(url: string, query: IQuery, options: ISearchOgcItemsOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
@@ -6,3 +6,4 @@ export * from "./types";
6
6
  export * from "./upgradeCatalogSchema";
7
7
  export * from "./utils";
8
8
  export * from "./wellKnownCatalog";
9
+ export * from "./searchAssociatedContent";
@@ -0,0 +1,12 @@
1
+ import { IHubSearchResponse, IHubSearchResult, ISearchAssociatedContentOptions } from "./types";
2
+ /**
3
+ * Searches for content that is associated with a given entity.
4
+ * Current associations supported are "related" and "connected".
5
+ *
6
+ * If unspecified, the number of results returned is 4.
7
+ *
8
+ * NOTE: only item based entities are supported for now.
9
+ *
10
+ * @returns Search results for the associated content
11
+ */
12
+ export declare function searchAssociatedContent(opts: ISearchAssociatedContentOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
@@ -1,5 +1,6 @@
1
- import { HubEntityType } from "../../core";
2
- import { EntityType, IHubCatalog } from "./IHubCatalog";
1
+ import { HubEntity, HubEntityType } from "../../core";
2
+ import { IHubRequestOptions } from "../../hub-types";
3
+ import { EntityType, IHubCatalog, IQuery } from "./IHubCatalog";
3
4
  import { IHubSearchResponse } from "./IHubSearchResponse";
4
5
  import { IHubSearchResult } from "./IHubSearchResult";
5
6
  /**
@@ -141,3 +142,32 @@ export interface ISearchResponseHash extends Record<string, IHubSearchResponse<I
141
142
  * with units as a type
142
143
  */
143
144
  export declare type Kilobyte = number;
145
+ /**
146
+ * Options for searching associated content for a given entity
147
+ */
148
+ export interface ISearchAssociatedContentOptions {
149
+ /**
150
+ * The entity to search for associated content
151
+ */
152
+ entity: HubEntity;
153
+ /**
154
+ * The type of association to search for (e.g., "related", "connected")
155
+ */
156
+ association: "related" | "connected";
157
+ /**
158
+ * The request options to use for the search
159
+ */
160
+ requestOptions: IHubRequestOptions;
161
+ /**
162
+ * The scope of the search. Must have targetEntity of "item"
163
+ */
164
+ scope: IQuery;
165
+ /**
166
+ * Which layer within the entity should be searched. Required for "connected" associations
167
+ */
168
+ layerId?: string;
169
+ /**
170
+ * The number of results to return
171
+ */
172
+ num?: number;
173
+ }
@@ -1,5 +1,5 @@
1
1
  import { IItem } from "@esri/arcgis-rest-portal";
2
- import { IRequestOptions } from "@esri/arcgis-rest-request";
2
+ import type { IRequestOptions } from "@esri/arcgis-rest-request";
3
3
  import { IHubSite } from "../core/types/IHubSite";
4
4
  import { IHubRequestOptions, IModel } from "../hub-types";
5
5
  import { IHubSearchResult } from "../search/types/IHubSearchResult";
@@ -4,7 +4,7 @@ import { IPermissionPolicy } from "../../permissions/types/IPermissionPolicy";
4
4
  * These define the requirements any user must meet to perform related actions
5
5
  * @private
6
6
  */
7
- export declare const SurveyPermissions: readonly ["hub:survey", "hub:survey:create", "hub:survey:delete", "hub:survey:edit", "hub:survey:view", "hub:survey:owner", "hub:survey:canChangeAccess", "hub:survey:workspace", "hub:survey:workspace:dashboard", "hub:survey:workspace:details", "hub:survey:workspace:settings", "hub:survey:workspace:collaborators", "hub:survey:manage"];
7
+ export declare const SurveyPermissions: readonly ["hub:survey", "hub:survey:create", "hub:survey:delete", "hub:survey:edit", "hub:survey:view", "hub:survey:view:related", "hub:survey:owner", "hub:survey:canChangeAccess", "hub:survey:workspace", "hub:survey:workspace:dashboard", "hub:survey:workspace:details", "hub:survey:workspace:settings", "hub:survey:workspace:collaborators", "hub:survey:manage"];
8
8
  /**
9
9
  * Survey permission policies
10
10
  * @private
@@ -9,7 +9,7 @@ export declare const TemplateDefaultFeatures: IFeatureFlags;
9
9
  * Template permissions: these define the requirements
10
10
  * any user must meet to perform related actions
11
11
  */
12
- export declare const TemplatePermissions: readonly ["hub:template", "hub:template:create", "hub:template:delete", "hub:template:edit", "hub:template:manage", "hub:template:view", "hub:template:canChangeAccess", "hub:template:workspace", "hub:template:workspace:details", "hub:template:workspace:dashboard", "hub:template:workspace:collaborators", "hub:template:workspace:settings"];
12
+ export declare const TemplatePermissions: readonly ["hub:template", "hub:template:create", "hub:template:delete", "hub:template:edit", "hub:template:manage", "hub:template:view", "hub:template:view:related", "hub:template:canChangeAccess", "hub:template:workspace", "hub:template:workspace:details", "hub:template:workspace:dashboard", "hub:template:workspace:collaborators", "hub:template:workspace:settings"];
13
13
  /**
14
14
  * @private
15
15
  * Template permission policies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "17.2.0",
3
+ "version": "17.4.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",
@@ -22,9 +22,9 @@
22
22
  "tslib": "^1.13.0"
23
23
  },
24
24
  "peerDependencies": {
25
- "@esri/arcgis-rest-feature-service": "~4.0.5",
26
- "@esri/arcgis-rest-portal": "~4.4.0",
27
- "@esri/arcgis-rest-request": "~4.2.3"
25
+ "@esri/arcgis-rest-feature-service": "^4.0.0",
26
+ "@esri/arcgis-rest-portal": "^4.0.0",
27
+ "@esri/arcgis-rest-request": "^4.0.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/adlib": "^3.0.1",