@sitecore-cloudsdk/search 0.5.1-rc.0 → 0.5.2-rc.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/cjs/package.json +4 -4
- package/dist/cjs/src/lib/request-entities/widgets/interfaces.d.ts +3 -0
- package/dist/cjs/src/lib/request-entities/widgets/questions-answers-widget-item.d.ts +3 -1
- package/dist/cjs/src/lib/request-entities/widgets/questions-answers-widget-item.js +3 -2
- package/dist/cjs/src/lib/request-entities/widgets/recommendation-widget-item.d.ts +3 -1
- package/dist/cjs/src/lib/request-entities/widgets/recommendation-widget-item.js +3 -2
- package/dist/cjs/src/lib/request-entities/widgets/results-widget-item.d.ts +3 -2
- package/dist/cjs/src/lib/request-entities/widgets/results-widget-item.js +3 -2
- package/dist/cjs/src/lib/request-entities/widgets/rule-widget-item.d.ts +3 -1
- package/dist/cjs/src/lib/request-entities/widgets/rule-widget-item.js +3 -2
- package/dist/cjs/src/lib/request-entities/widgets/search-widget-item.d.ts +16 -1
- package/dist/cjs/src/lib/request-entities/widgets/search-widget-item.js +24 -2
- package/dist/cjs/src/lib/request-entities/widgets/widget-item.d.ts +16 -2
- package/dist/cjs/src/lib/request-entities/widgets/widget-item.js +23 -3
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/package.json +4 -4
- package/dist/esm/src/lib/request-entities/widgets/interfaces.d.ts +3 -0
- package/dist/esm/src/lib/request-entities/widgets/questions-answers-widget-item.d.ts +3 -1
- package/dist/esm/src/lib/request-entities/widgets/questions-answers-widget-item.js +3 -2
- package/dist/esm/src/lib/request-entities/widgets/recommendation-widget-item.d.ts +3 -1
- package/dist/esm/src/lib/request-entities/widgets/recommendation-widget-item.js +3 -2
- package/dist/esm/src/lib/request-entities/widgets/results-widget-item.d.ts +3 -2
- package/dist/esm/src/lib/request-entities/widgets/results-widget-item.js +3 -2
- package/dist/esm/src/lib/request-entities/widgets/rule-widget-item.d.ts +3 -1
- package/dist/esm/src/lib/request-entities/widgets/rule-widget-item.js +3 -2
- package/dist/esm/src/lib/request-entities/widgets/search-widget-item.d.ts +16 -1
- package/dist/esm/src/lib/request-entities/widgets/search-widget-item.js +24 -2
- package/dist/esm/src/lib/request-entities/widgets/widget-item.d.ts +16 -2
- package/dist/esm/src/lib/request-entities/widgets/widget-item.js +23 -3
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
package/dist/cjs/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-cloudsdk/search",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2-rc.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"build:es": "tsc -b ."
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@sitecore-cloudsdk/core": "^0.5.
|
|
24
|
-
"@sitecore-cloudsdk/events": "^0.5.
|
|
25
|
-
"@sitecore-cloudsdk/utils": "^0.5.
|
|
23
|
+
"@sitecore-cloudsdk/core": "^0.5.2-rc.0",
|
|
24
|
+
"@sitecore-cloudsdk/events": "^0.5.2-rc.0",
|
|
25
|
+
"@sitecore-cloudsdk/utils": "^0.5.2-rc.0"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"dist",
|
|
@@ -10,6 +10,7 @@ import type { ArrayOfAtLeastOne, Filter, FilterDTO, LogicalOperators } from '../
|
|
|
10
10
|
export interface WidgetItemDTO {
|
|
11
11
|
entity: string;
|
|
12
12
|
rfk_id: string;
|
|
13
|
+
sources?: ArrayOfAtLeastOne<string>;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* Represents the content options property of the results widget item.
|
|
@@ -145,6 +146,7 @@ export interface SearchOptions extends ResultsOptions {
|
|
|
145
146
|
ranking?: ArrayOfAtLeastOne<SearchRankingOptions>;
|
|
146
147
|
personalization?: SearchPersonalizationOptions;
|
|
147
148
|
disableGrouping?: boolean;
|
|
149
|
+
responseContext?: boolean;
|
|
148
150
|
}
|
|
149
151
|
/**
|
|
150
152
|
* Represents the search object of the search widget item in its DTO format.
|
|
@@ -158,6 +160,7 @@ export interface SearchDTO extends ResultsItemDTO {
|
|
|
158
160
|
ranking?: ArrayOfAtLeastOne<SearchRankingOptionsDto>;
|
|
159
161
|
personalization?: SearchPersonalizationOptionsDto;
|
|
160
162
|
disable_grouping?: boolean;
|
|
163
|
+
response_context?: Record<string, never>;
|
|
161
164
|
}
|
|
162
165
|
/**
|
|
163
166
|
* Represents the search widget item object in its DTO format.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ArrayOfAtLeastOne } from '../filters/interfaces';
|
|
1
2
|
import type { ExactAnswerOptions, QuestionsAnswersOptions, QuestionsAnswersWidgetItemDTO, RelatedQuestionsOptions } from './interfaces';
|
|
2
3
|
import { RuleWidgetItem } from './rule-widget-item';
|
|
3
4
|
export declare class QuestionsAnswersWidgetItem extends RuleWidgetItem {
|
|
@@ -9,9 +10,10 @@ export declare class QuestionsAnswersWidgetItem extends RuleWidgetItem {
|
|
|
9
10
|
* @param entity - The widget's item entity.
|
|
10
11
|
* @param widgetId - The widget's item id.
|
|
11
12
|
* @param questionsAnswersOptions - The widget's {@link QuestionsAnswersOptions} object.
|
|
13
|
+
* @param sources - The widget's sources.
|
|
12
14
|
* @throws - {@link ErrorMessages.IV_0007} | {@link ErrorMessages.IV_0008} | {@link ErrorMessages.IV_0009}
|
|
13
15
|
*/
|
|
14
|
-
constructor(entity: string, widgetId: string, questionsAnswersOptions: QuestionsAnswersOptions);
|
|
16
|
+
constructor(entity: string, widgetId: string, questionsAnswersOptions: QuestionsAnswersOptions, sources?: ArrayOfAtLeastOne<string>);
|
|
15
17
|
/**
|
|
16
18
|
* Throws an error if limit is outside of range of 1 ~ 100 or offset is not a positive integer
|
|
17
19
|
* @param relatedQuestions - {@link RelatedQuestionsOptions}
|
|
@@ -10,10 +10,11 @@ class QuestionsAnswersWidgetItem extends rule_widget_item_1.RuleWidgetItem {
|
|
|
10
10
|
* @param entity - The widget's item entity.
|
|
11
11
|
* @param widgetId - The widget's item id.
|
|
12
12
|
* @param questionsAnswersOptions - The widget's {@link QuestionsAnswersOptions} object.
|
|
13
|
+
* @param sources - The widget's sources.
|
|
13
14
|
* @throws - {@link ErrorMessages.IV_0007} | {@link ErrorMessages.IV_0008} | {@link ErrorMessages.IV_0009}
|
|
14
15
|
*/
|
|
15
|
-
constructor(entity, widgetId, questionsAnswersOptions) {
|
|
16
|
-
super(entity, widgetId, questionsAnswersOptions.rule);
|
|
16
|
+
constructor(entity, widgetId, questionsAnswersOptions, sources) {
|
|
17
|
+
super(entity, widgetId, questionsAnswersOptions.rule, sources);
|
|
17
18
|
this._validateStringLengthInRange1To100(consts_1.ErrorMessages.IV_0009, questionsAnswersOptions.keyphrase);
|
|
18
19
|
this._keyphrase = questionsAnswersOptions.keyphrase;
|
|
19
20
|
this._exactAnswer = questionsAnswersOptions.exactAnswer;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ArrayOfAtLeastOne } from '../filters/interfaces';
|
|
1
2
|
import type { Recipe, Recommendation, RecommendationOptions, WidgetItemRecommendationDTO } from './interfaces';
|
|
2
3
|
import { ResultsWidgetItem } from './results-widget-item';
|
|
3
4
|
export declare class RecommendationWidgetItem extends ResultsWidgetItem {
|
|
@@ -7,9 +8,10 @@ export declare class RecommendationWidgetItem extends ResultsWidgetItem {
|
|
|
7
8
|
* @param entity - The widget's item entity.
|
|
8
9
|
* @param widgetId - The widget's item id.
|
|
9
10
|
* @param recommendationOptions - The widget's {@link RecommendationOptions} object.
|
|
11
|
+
* @param sources - The widget's sources.
|
|
10
12
|
* @throws - {@link ErrorMessages.IV_0023} | {@link ErrorMessages.IV_0024}
|
|
11
13
|
*/
|
|
12
|
-
constructor(entity: string, widgetId: string, recommendationOptions?: RecommendationOptions);
|
|
14
|
+
constructor(entity: string, widgetId: string, recommendationOptions?: RecommendationOptions, sources?: ArrayOfAtLeastOne<string>);
|
|
13
15
|
/**
|
|
14
16
|
* Sets the recommendations to an empty object.
|
|
15
17
|
*/
|
|
@@ -10,11 +10,12 @@ class RecommendationWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
10
10
|
* @param entity - The widget's item entity.
|
|
11
11
|
* @param widgetId - The widget's item id.
|
|
12
12
|
* @param recommendationOptions - The widget's {@link RecommendationOptions} object.
|
|
13
|
+
* @param sources - The widget's sources.
|
|
13
14
|
* @throws - {@link ErrorMessages.IV_0023} | {@link ErrorMessages.IV_0024}
|
|
14
15
|
*/
|
|
15
|
-
constructor(entity, widgetId, recommendationOptions) {
|
|
16
|
+
constructor(entity, widgetId, recommendationOptions, sources) {
|
|
16
17
|
const { recipe, ...rest } = recommendationOptions || {};
|
|
17
|
-
super(entity, widgetId, rest);
|
|
18
|
+
super(entity, widgetId, rest, sources);
|
|
18
19
|
if (!recommendationOptions)
|
|
19
20
|
return;
|
|
20
21
|
if (!Object.keys(recommendationOptions).length) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Filter } from '../filters/interfaces';
|
|
1
|
+
import type { ArrayOfAtLeastOne, Filter } from '../filters/interfaces';
|
|
2
2
|
import type { ContentOptions, ResultsItemDTO, ResultsOptions } from './interfaces';
|
|
3
3
|
import { RuleWidgetItem } from './rule-widget-item';
|
|
4
4
|
export declare class ResultsWidgetItem extends RuleWidgetItem {
|
|
@@ -11,9 +11,10 @@ export declare class ResultsWidgetItem extends RuleWidgetItem {
|
|
|
11
11
|
* @param entity - The widget's item entity.
|
|
12
12
|
* @param widgetId - The widget's item id.
|
|
13
13
|
* @param resultOptions - The widget's {@link ResultsOptions} object.
|
|
14
|
+
* @param sources - The widget's sources.
|
|
14
15
|
* @throws - {@link ErrorMessages.IV_0007} | {@link ErrorMessages.IV_0022}
|
|
15
16
|
*/
|
|
16
|
-
constructor(entity: string, widgetId: string, resultOptions?: ResultsOptions);
|
|
17
|
+
constructor(entity: string, widgetId: string, resultOptions?: ResultsOptions, sources?: ArrayOfAtLeastOne<string>);
|
|
17
18
|
/**
|
|
18
19
|
* Sets the search limit for the WidgetItem.
|
|
19
20
|
* This method updates the `limit` property of the search configuration within the WidgetItem instance.
|
|
@@ -10,10 +10,11 @@ class ResultsWidgetItem extends rule_widget_item_1.RuleWidgetItem {
|
|
|
10
10
|
* @param entity - The widget's item entity.
|
|
11
11
|
* @param widgetId - The widget's item id.
|
|
12
12
|
* @param resultOptions - The widget's {@link ResultsOptions} object.
|
|
13
|
+
* @param sources - The widget's sources.
|
|
13
14
|
* @throws - {@link ErrorMessages.IV_0007} | {@link ErrorMessages.IV_0022}
|
|
14
15
|
*/
|
|
15
|
-
constructor(entity, widgetId, resultOptions) {
|
|
16
|
-
super(entity, widgetId, resultOptions?.rule);
|
|
16
|
+
constructor(entity, widgetId, resultOptions, sources) {
|
|
17
|
+
super(entity, widgetId, resultOptions?.rule, sources);
|
|
17
18
|
this._validateNumberInRange1To100(consts_1.ErrorMessages.IV_0007, resultOptions?.limit);
|
|
18
19
|
this._validateGroupBy(resultOptions?.groupBy);
|
|
19
20
|
this._limit = resultOptions?.limit;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ArrayOfAtLeastOne } from '../filters/interfaces';
|
|
1
2
|
import type { SearchRuleDTO, SearchRuleOptions } from './interfaces';
|
|
2
3
|
import { WidgetItem } from './widget-item';
|
|
3
4
|
/** Base class for widgets that support rules functionality */
|
|
@@ -8,9 +9,10 @@ export declare class RuleWidgetItem extends WidgetItem {
|
|
|
8
9
|
* @param entity - the entity value of the RuleWidgetItem.
|
|
9
10
|
* @param widgetId - the widgetId value of the RuleWidgetItem.
|
|
10
11
|
* @param rule - the {@link SearchRuleOptions} of the RuleWidgetItem.
|
|
12
|
+
* @param sources - The widget's sources.
|
|
11
13
|
* @throws - {@link ErrorMessages.IV_0027} | {@link ErrorMessages.IV_0028}
|
|
12
14
|
*/
|
|
13
|
-
constructor(entity: string, widgetId: string, rule?: SearchRuleOptions);
|
|
15
|
+
constructor(entity: string, widgetId: string, rule?: SearchRuleOptions, sources?: ArrayOfAtLeastOne<string>);
|
|
14
16
|
/**
|
|
15
17
|
* Sets the `rule` property
|
|
16
18
|
* @param rule - the {@link SearchRuleOptions} value to be applied.
|
|
@@ -11,10 +11,11 @@ class RuleWidgetItem extends widget_item_1.WidgetItem {
|
|
|
11
11
|
* @param entity - the entity value of the RuleWidgetItem.
|
|
12
12
|
* @param widgetId - the widgetId value of the RuleWidgetItem.
|
|
13
13
|
* @param rule - the {@link SearchRuleOptions} of the RuleWidgetItem.
|
|
14
|
+
* @param sources - The widget's sources.
|
|
14
15
|
* @throws - {@link ErrorMessages.IV_0027} | {@link ErrorMessages.IV_0028}
|
|
15
16
|
*/
|
|
16
|
-
constructor(entity, widgetId, rule) {
|
|
17
|
-
super(entity, widgetId);
|
|
17
|
+
constructor(entity, widgetId, rule, sources) {
|
|
18
|
+
super(entity, widgetId, sources);
|
|
18
19
|
if (rule) {
|
|
19
20
|
this._validateRule(rule);
|
|
20
21
|
this._rule = rule;
|
|
@@ -10,11 +10,13 @@ export declare class SearchWidgetItem extends ResultsWidgetItem {
|
|
|
10
10
|
private _ranking?;
|
|
11
11
|
private _personalization?;
|
|
12
12
|
private _disableGrouping?;
|
|
13
|
+
private _responseContext?;
|
|
13
14
|
/**
|
|
14
15
|
* Creates and holds the functionality of a search widget item.
|
|
15
16
|
* @param entity - The widget's item entity.
|
|
16
17
|
* @param widgetId - The widget's item id.
|
|
17
18
|
* @param searchOptions - The widget's {@link SearchOptions} object.
|
|
19
|
+
* @param sources - The widget's sources.
|
|
18
20
|
* @throws - {@link ErrorMessages.IV_0008} | {@link ErrorMessages.IV_0009};
|
|
19
21
|
* @throws - {@link ErrorMessages.IV_0014} | {@link ErrorMessages.IV_0016};
|
|
20
22
|
* @throws - {@link ErrorMessages.IV_0017} | {@link ErrorMessages.IV_0018};
|
|
@@ -23,7 +25,7 @@ export declare class SearchWidgetItem extends ResultsWidgetItem {
|
|
|
23
25
|
* @throws - {@link ErrorMessages.IV_0029} | {@link ErrorMessages.IV_0030};
|
|
24
26
|
* @throws - {@link ErrorMessages.IV_0031}
|
|
25
27
|
*/
|
|
26
|
-
constructor(entity: string, widgetId: string, searchOptions?: SearchOptions);
|
|
28
|
+
constructor(entity: string, widgetId: string, searchOptions?: SearchOptions, sources?: ArrayOfAtLeastOne<string>);
|
|
27
29
|
/**
|
|
28
30
|
* @param personalization - the object {@link SearchPersonalizationOptions} of the `personalization` param
|
|
29
31
|
*/
|
|
@@ -131,6 +133,19 @@ export declare class SearchWidgetItem extends ResultsWidgetItem {
|
|
|
131
133
|
* Sets the `disableGrouping` property to undefined.
|
|
132
134
|
*/
|
|
133
135
|
resetDisableGrouping(): void;
|
|
136
|
+
/**
|
|
137
|
+
* Sets the `responseContext` property of the SearchWidgetItem.
|
|
138
|
+
* @param responseContext - A boolean indicating if response context has been enabled in Sitecore Search.
|
|
139
|
+
*/
|
|
140
|
+
set responseContext(responseContext: boolean);
|
|
141
|
+
/**
|
|
142
|
+
* @returns The `responseContext` property of the SearchWidgetItem.
|
|
143
|
+
*/
|
|
144
|
+
get responseContext(): boolean | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Resets the `responseContext` property to undefined.
|
|
147
|
+
*/
|
|
148
|
+
resetResponseContext(): void;
|
|
134
149
|
/**
|
|
135
150
|
* Sets the suggestion property for SearchWidgetItem
|
|
136
151
|
* @param suggestion - the {@link SearchSuggestionOptions}[] of objects for the suggestion param
|
|
@@ -11,6 +11,7 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
11
11
|
* @param entity - The widget's item entity.
|
|
12
12
|
* @param widgetId - The widget's item id.
|
|
13
13
|
* @param searchOptions - The widget's {@link SearchOptions} object.
|
|
14
|
+
* @param sources - The widget's sources.
|
|
14
15
|
* @throws - {@link ErrorMessages.IV_0008} | {@link ErrorMessages.IV_0009};
|
|
15
16
|
* @throws - {@link ErrorMessages.IV_0014} | {@link ErrorMessages.IV_0016};
|
|
16
17
|
* @throws - {@link ErrorMessages.IV_0017} | {@link ErrorMessages.IV_0018};
|
|
@@ -19,14 +20,14 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
19
20
|
* @throws - {@link ErrorMessages.IV_0029} | {@link ErrorMessages.IV_0030};
|
|
20
21
|
* @throws - {@link ErrorMessages.IV_0031}
|
|
21
22
|
*/
|
|
22
|
-
constructor(entity, widgetId, searchOptions) {
|
|
23
|
+
constructor(entity, widgetId, searchOptions, sources) {
|
|
23
24
|
super(entity, widgetId, {
|
|
24
25
|
content: searchOptions?.content,
|
|
25
26
|
filter: searchOptions?.filter,
|
|
26
27
|
groupBy: searchOptions?.groupBy,
|
|
27
28
|
limit: searchOptions?.limit,
|
|
28
29
|
rule: searchOptions?.rule
|
|
29
|
-
});
|
|
30
|
+
}, sources);
|
|
30
31
|
if (!searchOptions)
|
|
31
32
|
return;
|
|
32
33
|
if (searchOptions.facet && Object.keys(searchOptions.facet).length) {
|
|
@@ -49,6 +50,7 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
49
50
|
this._validateSuggestion(searchOptions.suggestion);
|
|
50
51
|
this._suggestion = searchOptions.suggestion;
|
|
51
52
|
this._disableGrouping = searchOptions.disableGrouping;
|
|
53
|
+
this._responseContext = searchOptions.responseContext;
|
|
52
54
|
}
|
|
53
55
|
/**
|
|
54
56
|
* @param personalization - the object {@link SearchPersonalizationOptions} of the `personalization` param
|
|
@@ -221,6 +223,25 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
221
223
|
resetDisableGrouping() {
|
|
222
224
|
this._disableGrouping = undefined;
|
|
223
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Sets the `responseContext` property of the SearchWidgetItem.
|
|
228
|
+
* @param responseContext - A boolean indicating if response context has been enabled in Sitecore Search.
|
|
229
|
+
*/
|
|
230
|
+
set responseContext(responseContext) {
|
|
231
|
+
this._responseContext = responseContext;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* @returns The `responseContext` property of the SearchWidgetItem.
|
|
235
|
+
*/
|
|
236
|
+
get responseContext() {
|
|
237
|
+
return this._responseContext;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Resets the `responseContext` property to undefined.
|
|
241
|
+
*/
|
|
242
|
+
resetResponseContext() {
|
|
243
|
+
this._responseContext = undefined;
|
|
244
|
+
}
|
|
224
245
|
/**
|
|
225
246
|
* Sets the suggestion property for SearchWidgetItem
|
|
226
247
|
* @param suggestion - the {@link SearchSuggestionOptions}[] of objects for the suggestion param
|
|
@@ -390,6 +411,7 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
390
411
|
...{ suggestion: this._suggestionToDTO() },
|
|
391
412
|
...{ sort: this._sort },
|
|
392
413
|
...{ disable_grouping: this._disableGrouping },
|
|
414
|
+
...(this._responseContext ? { response_context: {} } : undefined),
|
|
393
415
|
...resultsDTO
|
|
394
416
|
};
|
|
395
417
|
const dto = {
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { ErrorMessages } from '../../consts';
|
|
2
|
+
import type { ArrayOfAtLeastOne } from '../filters/interfaces';
|
|
2
3
|
import type { WidgetItemDTO } from './interfaces';
|
|
3
4
|
export declare class WidgetItem {
|
|
4
5
|
protected _entity: string;
|
|
5
6
|
protected _widgetId: string;
|
|
7
|
+
protected _sources?: ArrayOfAtLeastOne<string>;
|
|
6
8
|
/**
|
|
7
9
|
* Creates and holds the functionality of a widget item.
|
|
8
10
|
* @param entity - The widget's item entity.
|
|
9
11
|
* @param widgetId - The widget's item id.
|
|
10
|
-
*
|
|
12
|
+
* @param sources - The widget's sources.
|
|
11
13
|
*/
|
|
12
|
-
constructor(entity: string, widgetId: string);
|
|
14
|
+
constructor(entity: string, widgetId: string, sources?: ArrayOfAtLeastOne<string>);
|
|
13
15
|
/**
|
|
14
16
|
* Sets the entity for the WidgetItem.
|
|
15
17
|
* This method updates the `entity` property of WidgetItem instance.
|
|
@@ -21,6 +23,18 @@ export declare class WidgetItem {
|
|
|
21
23
|
* @returns The entity property of the WidgetItem.
|
|
22
24
|
*/
|
|
23
25
|
get entity(): string;
|
|
26
|
+
/**
|
|
27
|
+
* @returns The sources property of the WidgetItem.
|
|
28
|
+
*/
|
|
29
|
+
get sources(): ArrayOfAtLeastOne<string> | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Sets the sources for the WidgetItem.
|
|
32
|
+
* This method updates the `sources` property within the WidgetItem instance.
|
|
33
|
+
* The sources are used to define specific search criteria or filters.
|
|
34
|
+
* @param sources - The array of sources {@link ArrayOfAtLeastOne} that specifies the search criteria.
|
|
35
|
+
*/
|
|
36
|
+
set sources(sources: ArrayOfAtLeastOne<string>);
|
|
37
|
+
resetSources(): void;
|
|
24
38
|
/**
|
|
25
39
|
*
|
|
26
40
|
* @param entity - the string to validate
|
|
@@ -8,13 +8,14 @@ class WidgetItem {
|
|
|
8
8
|
* Creates and holds the functionality of a widget item.
|
|
9
9
|
* @param entity - The widget's item entity.
|
|
10
10
|
* @param widgetId - The widget's item id.
|
|
11
|
-
*
|
|
11
|
+
* @param sources - The widget's sources.
|
|
12
12
|
*/
|
|
13
|
-
constructor(entity, widgetId) {
|
|
13
|
+
constructor(entity, widgetId, sources) {
|
|
14
14
|
this._validateWidgetId(widgetId);
|
|
15
15
|
this._validateEntity(entity);
|
|
16
16
|
this._entity = entity;
|
|
17
17
|
this._widgetId = widgetId;
|
|
18
|
+
this._sources = sources;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Sets the entity for the WidgetItem.
|
|
@@ -32,6 +33,24 @@ class WidgetItem {
|
|
|
32
33
|
get entity() {
|
|
33
34
|
return this._entity;
|
|
34
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @returns The sources property of the WidgetItem.
|
|
38
|
+
*/
|
|
39
|
+
get sources() {
|
|
40
|
+
return this._sources;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Sets the sources for the WidgetItem.
|
|
44
|
+
* This method updates the `sources` property within the WidgetItem instance.
|
|
45
|
+
* The sources are used to define specific search criteria or filters.
|
|
46
|
+
* @param sources - The array of sources {@link ArrayOfAtLeastOne} that specifies the search criteria.
|
|
47
|
+
*/
|
|
48
|
+
set sources(sources) {
|
|
49
|
+
this._sources = sources;
|
|
50
|
+
}
|
|
51
|
+
resetSources() {
|
|
52
|
+
this._sources = undefined;
|
|
53
|
+
}
|
|
35
54
|
/**
|
|
36
55
|
*
|
|
37
56
|
* @param entity - the string to validate
|
|
@@ -122,7 +141,8 @@ class WidgetItem {
|
|
|
122
141
|
return {
|
|
123
142
|
entity: this._entity,
|
|
124
143
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
125
|
-
rfk_id: this._widgetId
|
|
144
|
+
rfk_id: this._widgetId,
|
|
145
|
+
...(this._sources && { sources: this._sources })
|
|
126
146
|
};
|
|
127
147
|
}
|
|
128
148
|
}
|