@esri/hub-common 13.36.1 → 13.37.1
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/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/search/_internal/expandPredicate.js +33 -18
- package/dist/esm/search/_internal/expandPredicate.js.map +1 -1
- package/dist/esm/search/_internal/explainFilter.js +34 -0
- package/dist/esm/search/_internal/explainFilter.js.map +1 -0
- package/dist/esm/search/_internal/explainHelpers.js +193 -0
- package/dist/esm/search/_internal/explainHelpers.js.map +1 -0
- package/dist/esm/search/_internal/explainPredicate.js +35 -0
- package/dist/esm/search/_internal/explainPredicate.js.map +1 -0
- package/dist/esm/search/_internal/portalSearchItems.js +20 -9
- package/dist/esm/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/esm/search/explainQueryResult.js +53 -0
- package/dist/esm/search/explainQueryResult.js.map +1 -0
- package/dist/esm/sites/domains/add-domain.js +4 -0
- package/dist/esm/sites/domains/add-domain.js.map +1 -1
- package/dist/esm/sites/domains/update-domain.js +4 -0
- package/dist/esm/sites/domains/update-domain.js.map +1 -1
- package/dist/node/index.js +3 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/search/_internal/expandPredicate.js +34 -19
- package/dist/node/search/_internal/expandPredicate.js.map +1 -1
- package/dist/node/search/_internal/explainFilter.js +38 -0
- package/dist/node/search/_internal/explainFilter.js.map +1 -0
- package/dist/node/search/_internal/explainHelpers.js +202 -0
- package/dist/node/search/_internal/explainHelpers.js.map +1 -0
- package/dist/node/search/_internal/explainPredicate.js +39 -0
- package/dist/node/search/_internal/explainPredicate.js.map +1 -0
- package/dist/node/search/_internal/portalSearchItems.js +22 -10
- package/dist/node/search/_internal/portalSearchItems.js.map +1 -1
- package/dist/node/search/explainQueryResult.js +57 -0
- package/dist/node/search/explainQueryResult.js.map +1 -0
- package/dist/node/sites/domains/add-domain.js +4 -0
- package/dist/node/sites/domains/add-domain.js.map +1 -1
- package/dist/node/sites/domains/update-domain.js +4 -0
- package/dist/node/sites/domains/update-domain.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/search/_internal/expandPredicate.d.ts +15 -0
- package/dist/types/search/_internal/explainFilter.d.ts +11 -0
- package/dist/types/search/_internal/explainHelpers.d.ts +38 -0
- package/dist/types/search/_internal/explainPredicate.d.ts +12 -0
- package/dist/types/search/_internal/portalSearchItems.d.ts +8 -0
- package/dist/types/search/explainQueryResult.d.ts +102 -0
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
2
|
+
import { GenericResult, IMatchReason, IPredicateExplanation } from "../explainQueryResult";
|
|
3
|
+
import { IMatchOptions } from "../types";
|
|
4
|
+
export declare function explainDatePredicate(predicate: Record<string, IMatchOptions>, result: GenericResult, requestOptions: IRequestOptions): Promise<IPredicateExplanation>;
|
|
5
|
+
export declare function explainPropPredicate(predicate: Record<string, IMatchOptions>, result: GenericResult, requestOptions: IRequestOptions): Promise<IPredicateExplanation>;
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
* Create explanation for an IMatchOptions predicate
|
|
9
|
+
* @param predicate
|
|
10
|
+
* @param result
|
|
11
|
+
* @param requestOptions
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export declare function explainMatchOptionPredicate(predicate: Record<string, IMatchOptions>, result: GenericResult, requestOptions: IRequestOptions): Promise<IPredicateExplanation>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns information about the match between a result value and the .any property of an IMatchOptions predicate
|
|
17
|
+
* @param attribute
|
|
18
|
+
* @param option
|
|
19
|
+
* @param resultValue
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
export declare function checkAny(attribute: string, option: string | string[], resultValue: string | string[]): IMatchReason;
|
|
23
|
+
/**
|
|
24
|
+
* * Returns information about the match between a result value and the .all property of an IMatchOptions predicate
|
|
25
|
+
* @param attribute
|
|
26
|
+
* @param option
|
|
27
|
+
* @param resultValue
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
export declare function checkAll(attribute: string, option: string | string[], resultValue: string | string[]): IMatchReason;
|
|
31
|
+
/**
|
|
32
|
+
* * Returns information about the match between a result value and the .not property of an IMatchOptions predicate
|
|
33
|
+
* @param attribute
|
|
34
|
+
* @param option
|
|
35
|
+
* @param resultValue
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
export declare function checkNot(attribute: string, option: string | string[], resultValue: string | string[]): IMatchReason;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
2
|
+
import { GenericResult, IPredicateExplanation } from "../explainQueryResult";
|
|
3
|
+
import { IMatchOptions } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Geneate an explanation if a specific result passes the predicate's criteria
|
|
6
|
+
* This will delegate to more specific functions based on the predicate's key
|
|
7
|
+
* @param predicate
|
|
8
|
+
* @param result
|
|
9
|
+
* @param requestOptions
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function explainPredicate(predicate: Record<string, IMatchOptions>, result: GenericResult, requestOptions: IRequestOptions): Promise<IPredicateExplanation>;
|
|
@@ -17,6 +17,14 @@ export declare function portalSearchItems(query: IQuery, options: IHubSearchOpti
|
|
|
17
17
|
* @returns
|
|
18
18
|
*/
|
|
19
19
|
export declare function portalSearchItemsAsItems(query: IQuery, options: IHubSearchOptions): Promise<IHubSearchResponse<IItem>>;
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
* Expand an IQuery by applying well-known filters and predicates,
|
|
23
|
+
* and then expanding all the predicates into IMatchOption objects.
|
|
24
|
+
* @param query `IQuery` to expand
|
|
25
|
+
* @returns IQuery
|
|
26
|
+
*/
|
|
27
|
+
export declare function expandQuery(query: IQuery): IQuery;
|
|
20
28
|
/**
|
|
21
29
|
* Convert an `IItem` to a `IHubSearchResult`
|
|
22
30
|
* Fetches the enrichments, and attaches them as directed in the `include` list
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
2
|
+
import { IFilter, IPredicate, IQuery } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Explanation of why a result matched a query
|
|
5
|
+
*/
|
|
6
|
+
export interface IQueryExplanation {
|
|
7
|
+
/**
|
|
8
|
+
* Copy of result; Useful when doing bulk calls
|
|
9
|
+
*/
|
|
10
|
+
result: GenericResult;
|
|
11
|
+
/**
|
|
12
|
+
* Copy of query; Useful when doing bulk calls
|
|
13
|
+
*/
|
|
14
|
+
query: IQuery;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the result matched the query
|
|
17
|
+
*/
|
|
18
|
+
matched: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Array of explanations for each filter
|
|
21
|
+
*/
|
|
22
|
+
reasons: IFilterExplanation[];
|
|
23
|
+
/**
|
|
24
|
+
* Summary of all reasons for the result matching the query
|
|
25
|
+
*/
|
|
26
|
+
summary: IMatchReason[];
|
|
27
|
+
}
|
|
28
|
+
export interface IQueryExplanationDetails {
|
|
29
|
+
value: string;
|
|
30
|
+
description: string;
|
|
31
|
+
details: [];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Explanation of why a filter matched a query
|
|
35
|
+
*/
|
|
36
|
+
export interface IFilterExplanation {
|
|
37
|
+
/**
|
|
38
|
+
* Copy of the Filter
|
|
39
|
+
*/
|
|
40
|
+
filter: IFilter;
|
|
41
|
+
/**
|
|
42
|
+
* Did the filter match the query?
|
|
43
|
+
*/
|
|
44
|
+
matched: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Array of explanations for each predicate in the Filter
|
|
47
|
+
*/
|
|
48
|
+
reasons: IPredicateExplanation[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Explanation of why a predicate matched a query
|
|
52
|
+
*/
|
|
53
|
+
export interface IPredicateExplanation {
|
|
54
|
+
/**
|
|
55
|
+
* Copy of the Predicate
|
|
56
|
+
*/
|
|
57
|
+
predicate: IPredicate;
|
|
58
|
+
/**
|
|
59
|
+
* Did the predicate match the query?
|
|
60
|
+
*/
|
|
61
|
+
matched: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Array of reasons why the predicate matched the query
|
|
64
|
+
*/
|
|
65
|
+
reasons: IMatchReason[];
|
|
66
|
+
/**
|
|
67
|
+
* Additional information about the predicate which can be useful
|
|
68
|
+
* when preparing a UI to display the explanation
|
|
69
|
+
*/
|
|
70
|
+
meta?: Record<string, any>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Match condition
|
|
74
|
+
*/
|
|
75
|
+
export declare type MatchCondition = "IN" | "NOT_IN" | "ALL";
|
|
76
|
+
/**
|
|
77
|
+
* Reason why a result matched a query
|
|
78
|
+
*/
|
|
79
|
+
export interface IMatchReason {
|
|
80
|
+
attribute: string;
|
|
81
|
+
values?: string;
|
|
82
|
+
condition?: MatchCondition;
|
|
83
|
+
matched: boolean;
|
|
84
|
+
requirement?: string;
|
|
85
|
+
message?: string;
|
|
86
|
+
meta?: Record<string, any>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Wide type allowing any object to be passed in as a result
|
|
90
|
+
*/
|
|
91
|
+
export declare type GenericResult = Record<string, any>;
|
|
92
|
+
/**
|
|
93
|
+
* Explain why a specific result was included in a Query.
|
|
94
|
+
*
|
|
95
|
+
* NOTE: This only works for entityType: "item" queries and does not
|
|
96
|
+
* cover all possible permutations.
|
|
97
|
+
* @param queryResult
|
|
98
|
+
* @param query
|
|
99
|
+
* @param requestOptions
|
|
100
|
+
* @returns
|
|
101
|
+
*/
|
|
102
|
+
export declare function explainQueryResult(queryResult: GenericResult, query: IQuery, requestOptions: IRequestOptions): Promise<IQueryExplanation>;
|