@esri/hub-common 20.13.0 → 20.15.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 (57) hide show
  1. package/dist/esm/collections.js +1 -1
  2. package/dist/esm/collections.js.map +1 -1
  3. package/dist/esm/content/compose.js +1 -0
  4. package/dist/esm/content/compose.js.map +1 -1
  5. package/dist/esm/hub-types.js +1 -0
  6. package/dist/esm/hub-types.js.map +1 -1
  7. package/dist/esm/search/_internal/commonHelpers/shouldUseDiscussionsApi.js +1 -1
  8. package/dist/esm/search/_internal/commonHelpers/shouldUseDiscussionsApi.js.map +1 -1
  9. package/dist/esm/search/_internal/hubDiscussionsHelpers/postToSearchResult.js +25 -0
  10. package/dist/esm/search/_internal/hubDiscussionsHelpers/postToSearchResult.js.map +1 -0
  11. package/dist/esm/search/_internal/hubDiscussionsHelpers/processPostFilters.js +69 -0
  12. package/dist/esm/search/_internal/hubDiscussionsHelpers/processPostFilters.js.map +1 -0
  13. package/dist/esm/search/_internal/hubDiscussionsHelpers/processPostOptions.js +48 -0
  14. package/dist/esm/search/_internal/hubDiscussionsHelpers/processPostOptions.js.map +1 -0
  15. package/dist/esm/search/_internal/hubDiscussionsHelpers/processRelations.js +25 -0
  16. package/dist/esm/search/_internal/hubDiscussionsHelpers/processRelations.js.map +1 -0
  17. package/dist/esm/search/_internal/hubSearchEvents.js.map +1 -1
  18. package/dist/esm/search/_internal/hubSearchPosts.js +80 -0
  19. package/dist/esm/search/_internal/hubSearchPosts.js.map +1 -0
  20. package/dist/esm/search/hubSearch.js +2 -0
  21. package/dist/esm/search/hubSearch.js.map +1 -1
  22. package/dist/esm/search/types/IHubCatalog.js +1 -0
  23. package/dist/esm/search/types/IHubCatalog.js.map +1 -1
  24. package/dist/node/collections.js +1 -1
  25. package/dist/node/collections.js.map +1 -1
  26. package/dist/node/content/compose.js +1 -0
  27. package/dist/node/content/compose.js.map +1 -1
  28. package/dist/node/hub-types.js +1 -0
  29. package/dist/node/hub-types.js.map +1 -1
  30. package/dist/node/search/_internal/commonHelpers/shouldUseDiscussionsApi.js +1 -1
  31. package/dist/node/search/_internal/commonHelpers/shouldUseDiscussionsApi.js.map +1 -1
  32. package/dist/node/search/_internal/hubDiscussionsHelpers/postToSearchResult.js +29 -0
  33. package/dist/node/search/_internal/hubDiscussionsHelpers/postToSearchResult.js.map +1 -0
  34. package/dist/node/search/_internal/hubDiscussionsHelpers/processPostFilters.js +73 -0
  35. package/dist/node/search/_internal/hubDiscussionsHelpers/processPostFilters.js.map +1 -0
  36. package/dist/node/search/_internal/hubDiscussionsHelpers/processPostOptions.js +52 -0
  37. package/dist/node/search/_internal/hubDiscussionsHelpers/processPostOptions.js.map +1 -0
  38. package/dist/node/search/_internal/hubDiscussionsHelpers/processRelations.js +29 -0
  39. package/dist/node/search/_internal/hubDiscussionsHelpers/processRelations.js.map +1 -0
  40. package/dist/node/search/_internal/hubSearchEvents.js.map +1 -1
  41. package/dist/node/search/_internal/hubSearchPosts.js +84 -0
  42. package/dist/node/search/_internal/hubSearchPosts.js.map +1 -0
  43. package/dist/node/search/hubSearch.js +2 -0
  44. package/dist/node/search/hubSearch.js.map +1 -1
  45. package/dist/node/search/types/IHubCatalog.js +1 -0
  46. package/dist/node/search/types/IHubCatalog.js.map +1 -1
  47. package/dist/types/content/_internal/internalContentUtils.d.ts +1 -1
  48. package/dist/types/content/get-family.d.ts +1 -1
  49. package/dist/types/hub-types.d.ts +5 -1
  50. package/dist/types/search/_internal/hubDiscussionsHelpers/postToSearchResult.d.ts +8 -0
  51. package/dist/types/search/_internal/hubDiscussionsHelpers/processPostFilters.d.ts +8 -0
  52. package/dist/types/search/_internal/hubDiscussionsHelpers/processPostOptions.d.ts +8 -0
  53. package/dist/types/search/_internal/hubDiscussionsHelpers/processRelations.d.ts +7 -0
  54. package/dist/types/search/_internal/hubSearchPosts.d.ts +56 -0
  55. package/dist/types/search/types/IHubCatalog.d.ts +1 -1
  56. package/dist/types/search/types/IHubSearchResult.d.ts +2 -2
  57. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import { ISearchPosts } from "../../../discussions";
2
+ import { IHubSearchOptions } from "../../types";
3
+ /**
4
+ * Builds a Partial<ISearchPosts> for the given IHubSearchOptions
5
+ * @param options An IHubSearchOptions object
6
+ * @returns a Partial<ISearchPosts> for the given IHubSearchOptions
7
+ */
8
+ export declare function processPostOptions(options: IHubSearchOptions): Partial<ISearchPosts>;
@@ -0,0 +1,7 @@
1
+ import { PostRelation } from "../../../discussions/api/types";
2
+ /**
3
+ * Convert an array of `include` into an array of PostRelation enum values.
4
+ * @param relations array of include (e.g. ["channel", "replies"]).
5
+ * @returns PostRelation[] with order of first appearance preserved and duplicates removed.
6
+ */
7
+ export declare function processRelations(relations?: string[]): PostRelation[];
@@ -0,0 +1,56 @@
1
+ import { IHubSearchResult } from "../types/IHubSearchResult";
2
+ import { IHubSearchOptions } from "../types/IHubSearchOptions";
3
+ import { IHubSearchResponse } from "../types/IHubSearchResponse";
4
+ import { IQuery } from "../types/IHubCatalog";
5
+ /**
6
+ * @private
7
+ * Executes a Discussions API (v2) post search and resolves an IHubSearchResponse<IHubSearchResult>.
8
+ * Currently supported filters include (filter predicate key => accepted values):
9
+ * - access: 'public' | 'private' | 'org' | Array<'public' | 'private' | 'org'>
10
+ * - body: string
11
+ * - channel: string | string[] (mapped internally to `channels`)
12
+ * - owner: string | string[] (first value mapped to `creator`)
13
+ * - discussion: string | string[]
14
+ * - editor: string | string[]
15
+ * - status: 'pending' | 'approved' | 'rejected' | 'deleted' | 'hidden' | 'blocked' | Array<...>
16
+ * - title: string | string[]
17
+ * - parentId: string | string[] (mapped internally to `parents`)
18
+ * - groups: string | string[]
19
+ * - postType: 'text' | 'announcement' | 'poll' | 'question'
20
+ * - created: IDateRange<string | number> (mapped to createdAfter / createdBefore)
21
+ * - modified: IDateRange<string | number> (mapped to updatedAfter / updatedBefore)
22
+ *
23
+ * Notes / constraints:
24
+ * - For single-value filters where an array is provided (e.g., owner, editor, discussion, title, body), only the first value is used.
25
+ * - Date range predicates use the shape: { from: string|number; to: string|number }.
26
+ * - Unsupported filters are ignored silently.
27
+ *
28
+ * INCLUDE SUPPORT (options.include tokens mapped to post relations - bare tokens only)
29
+ * channel -> PostRelation.CHANNEL
30
+ * parent -> PostRelation.PARENT
31
+ * replies -> PostRelation.REPLIES (returns replies collection or paging info)
32
+ * replyCount -> PostRelation.REPLY_COUNT (numeric aggregate)
33
+ * reactions -> PostRelation.REACTIONS
34
+ * channelAcl -> PostRelation.CHANNEL_ACL
35
+ * Unknown tokens are ignored; no namespaced forms (e.g. `post:channel`) are supported.
36
+ *
37
+ * Currently supported sort fields include (pass via `options.sortField`):
38
+ * - body
39
+ * - channelId
40
+ * - created (maps to createdAt)
41
+ * - modified (maps to updatedAt)
42
+ * - owner (maps to creator)
43
+ * - discussion
44
+ * - editor
45
+ * - id
46
+ * - parentId
47
+ * - status
48
+ * - title
49
+ * Sort order: 'ASC' | 'DESC' (via `options.sortOrder`).
50
+ * Pagination options: `options.num` (page size), `options.start` (1-based offset handled by API).
51
+ *
52
+ * @param query An IQuery object (must include `filters` and `targetEntity: 'post'` upstream)
53
+ * @param options An IHubSearchOptions object
54
+ * @returns a promise that resolves an IHubSearchResponse<IHubSearchResult>
55
+ */
56
+ export declare function hubSearchPosts(query: IQuery, options: IHubSearchOptions): Promise<IHubSearchResponse<IHubSearchResult>>;
@@ -74,7 +74,7 @@ export interface IHubCollection {
74
74
  */
75
75
  displayConfig?: IGalleryDisplayConfig;
76
76
  }
77
- export declare const targetEntities: readonly ["item", "group", "user", "portalUser", "communityUser", "groupMember", "event", "channel", "discussionPost", "eventAttendee", "organization"];
77
+ export declare const targetEntities: readonly ["item", "group", "user", "portalUser", "communityUser", "groupMember", "event", "channel", "discussionPost", "eventAttendee", "organization", "post"];
78
78
  export declare type EntityType = (typeof targetEntities)[number];
79
79
  /**
80
80
  * IQuery is the fundamental unit used to execute a search. By composing
@@ -1,7 +1,7 @@
1
1
  import { IGroup, IItem, IUser } from "@esri/arcgis-rest-portal";
2
2
  import { HubFamily, IHubGeography } from "../../hub-types";
3
3
  import { IOgcItem } from "../_internal/hubSearchItemsHelpers/interfaces";
4
- import { IChannel } from "../../discussions/api/types";
4
+ import { IChannel, IPost } from "../../discussions/api/types";
5
5
  import { IEvent, IRegistration } from "../../events/api/orval/api/orval-events";
6
6
  import { IHubLocation } from "../../core/types/IHubLocation";
7
7
  import { AccessLevel } from "../../core/types/types";
@@ -61,7 +61,7 @@ export interface IHubSearchResult extends IHubEntityBase {
61
61
  * Note: We will need to cast to the approproate type
62
62
  * in order to access the properties
63
63
  */
64
- rawResult?: IItem | IGroup | IUser | IOgcItem | IChannel | IEvent | IRegistration;
64
+ rawResult?: IItem | IGroup | IUser | IOgcItem | IChannel | IEvent | IRegistration | IPost;
65
65
  /** Allow any additional properties to be added */
66
66
  [key: string]: any;
67
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "20.13.0",
3
+ "version": "20.15.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",