-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate search-types develop branch
- Loading branch information
Showing
20 changed files
with
130 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/search-types/src/facet/filter/facet-filter.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { FilterModelName } from '../../named-model.model'; | ||
import { Facet } from '../facet.model'; | ||
import { Filter } from './filter.model'; | ||
|
||
/** | ||
* A filter which is associated with a {@link Facet}. | ||
* | ||
* @remarks It is like an "abstract" interface because it is not going to be implemented | ||
* but it is extended by other interfaces. There will never be an object with this type. | ||
* | ||
* @public | ||
*/ | ||
export interface FacetFilter extends Filter { | ||
/** The filter {@link ModelNameType | model name} excluding {@link RawFilter#modelName | RawFilter} model name. */ | ||
modelName: Exclude<FilterModelName, 'RawFilter'>; | ||
/** An unique ID that identifies the facet that uses this filter */ | ||
facetId: Facet['id']; | ||
} | ||
|
||
/** | ||
* Type guard to check if a filter is a {@link FacetFilter}. | ||
* | ||
* @param filter - The filter to check. | ||
* | ||
* @public | ||
*/ | ||
export function isFacetFilter(filter: Filter): filter is FacetFilter { | ||
return 'facetId' in filter; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
import { CallbackInfo } from '../../callback-info.model'; | ||
import { Identifiable } from '../../identifiable.model'; | ||
import { FilterModelName, NamedModel } from '../../named-model.model'; | ||
import { Facet } from '../facet.model'; | ||
|
||
/** | ||
* A basic filter used in {@link Facet}, which is used to sift the results. | ||
* A basic filter. | ||
* | ||
* @remarks It is like an "abstract" interface because it is not going to be implemented | ||
* but it is extended by other interfaces. There will never be an object with this type. | ||
* | ||
* @public | ||
*/ | ||
export interface Filter extends NamedModel<FilterModelName>, CallbackInfo, Identifiable { | ||
/** An unique ID that identifies the facet that uses this filter */ | ||
facetId: Facet['id']; | ||
/** Label that represents the filter text. */ | ||
label: string; | ||
export interface Filter extends NamedModel<FilterModelName>, Identifiable { | ||
/** Flag if the filter is selected or not. */ | ||
selected: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/search-types/src/facet/filter/raw-filter.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Filter } from './filter.model'; | ||
|
||
/** | ||
* A filter which id is the value of the filter. It can be selected or not. | ||
* | ||
* @public | ||
*/ | ||
export interface RawFilter extends Filter { | ||
/** Model name to indicate the filter type. */ | ||
modelName: 'RawFilter'; | ||
/** The value of the filter. */ | ||
id: string; | ||
/** Force {@link Filter#selected | Filter selected} property to true */ | ||
selected: true; | ||
} | ||
|
||
/** | ||
* Type guard to check if a filter is a {@link RawFilter}. | ||
* | ||
* @param filter - The filter to check. | ||
* | ||
* @public | ||
*/ | ||
export function isRawFilter(filter: Filter): filter is RawFilter { | ||
return filter.modelName === 'RawFilter'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters