@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.
- package/dist/esm/collections.js +1 -1
- package/dist/esm/collections.js.map +1 -1
- package/dist/esm/content/compose.js +1 -0
- package/dist/esm/content/compose.js.map +1 -1
- package/dist/esm/hub-types.js +1 -0
- package/dist/esm/hub-types.js.map +1 -1
- package/dist/esm/search/_internal/commonHelpers/shouldUseDiscussionsApi.js +1 -1
- package/dist/esm/search/_internal/commonHelpers/shouldUseDiscussionsApi.js.map +1 -1
- package/dist/esm/search/_internal/hubDiscussionsHelpers/postToSearchResult.js +25 -0
- package/dist/esm/search/_internal/hubDiscussionsHelpers/postToSearchResult.js.map +1 -0
- package/dist/esm/search/_internal/hubDiscussionsHelpers/processPostFilters.js +69 -0
- package/dist/esm/search/_internal/hubDiscussionsHelpers/processPostFilters.js.map +1 -0
- package/dist/esm/search/_internal/hubDiscussionsHelpers/processPostOptions.js +48 -0
- package/dist/esm/search/_internal/hubDiscussionsHelpers/processPostOptions.js.map +1 -0
- package/dist/esm/search/_internal/hubDiscussionsHelpers/processRelations.js +25 -0
- package/dist/esm/search/_internal/hubDiscussionsHelpers/processRelations.js.map +1 -0
- package/dist/esm/search/_internal/hubSearchEvents.js.map +1 -1
- package/dist/esm/search/_internal/hubSearchPosts.js +80 -0
- package/dist/esm/search/_internal/hubSearchPosts.js.map +1 -0
- package/dist/esm/search/hubSearch.js +2 -0
- package/dist/esm/search/hubSearch.js.map +1 -1
- package/dist/esm/search/types/IHubCatalog.js +1 -0
- package/dist/esm/search/types/IHubCatalog.js.map +1 -1
- package/dist/node/collections.js +1 -1
- package/dist/node/collections.js.map +1 -1
- package/dist/node/content/compose.js +1 -0
- package/dist/node/content/compose.js.map +1 -1
- package/dist/node/hub-types.js +1 -0
- package/dist/node/hub-types.js.map +1 -1
- package/dist/node/search/_internal/commonHelpers/shouldUseDiscussionsApi.js +1 -1
- package/dist/node/search/_internal/commonHelpers/shouldUseDiscussionsApi.js.map +1 -1
- package/dist/node/search/_internal/hubDiscussionsHelpers/postToSearchResult.js +29 -0
- package/dist/node/search/_internal/hubDiscussionsHelpers/postToSearchResult.js.map +1 -0
- package/dist/node/search/_internal/hubDiscussionsHelpers/processPostFilters.js +73 -0
- package/dist/node/search/_internal/hubDiscussionsHelpers/processPostFilters.js.map +1 -0
- package/dist/node/search/_internal/hubDiscussionsHelpers/processPostOptions.js +52 -0
- package/dist/node/search/_internal/hubDiscussionsHelpers/processPostOptions.js.map +1 -0
- package/dist/node/search/_internal/hubDiscussionsHelpers/processRelations.js +29 -0
- package/dist/node/search/_internal/hubDiscussionsHelpers/processRelations.js.map +1 -0
- package/dist/node/search/_internal/hubSearchEvents.js.map +1 -1
- package/dist/node/search/_internal/hubSearchPosts.js +84 -0
- package/dist/node/search/_internal/hubSearchPosts.js.map +1 -0
- package/dist/node/search/hubSearch.js +2 -0
- package/dist/node/search/hubSearch.js.map +1 -1
- package/dist/node/search/types/IHubCatalog.js +1 -0
- package/dist/node/search/types/IHubCatalog.js.map +1 -1
- package/dist/types/content/_internal/internalContentUtils.d.ts +1 -1
- package/dist/types/content/get-family.d.ts +1 -1
- package/dist/types/hub-types.d.ts +5 -1
- package/dist/types/search/_internal/hubDiscussionsHelpers/postToSearchResult.d.ts +8 -0
- package/dist/types/search/_internal/hubDiscussionsHelpers/processPostFilters.d.ts +8 -0
- package/dist/types/search/_internal/hubDiscussionsHelpers/processPostOptions.d.ts +8 -0
- package/dist/types/search/_internal/hubDiscussionsHelpers/processRelations.d.ts +7 -0
- package/dist/types/search/_internal/hubSearchPosts.d.ts +56 -0
- package/dist/types/search/types/IHubCatalog.d.ts +1 -1
- package/dist/types/search/types/IHubSearchResult.d.ts +2 -2
- 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
|
}
|