Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ebi-wp/ebinocle-ng-rsclient

Package Overview
Dependencies
Maintainers
3
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ebi-wp/ebinocle-ng-rsclient - npm Package Compare versions

Comparing version 4.11.0 to 4.11.1

3

lib/common/error-message.d.ts

@@ -16,4 +16,7 @@ /**

*/
/**
* Represents an error message
*/
export interface ErrorMessage {
message: string;
}

@@ -8,3 +8,3 @@ import { HttpClient } from '@angular/common/http';

/**
* Configuration service for REST domain information (e.g. categories, domains, leaves).
* Configuration service for domain-related information from the RESTful API.
*/

@@ -15,6 +15,21 @@ export declare class ConfigService {

private cfg;
/**
* The REST API version
*/
backendVersion: string;
/**
* The root domain as an Observable
*/
root: Observable<Domain>;
/**
* The non-leaf domains as an Observable
*/
categories: Observable<Domain[]>;
/**
* The leaf domains as an Observable
*/
leaves: Observable<Domain[]>;
/**
* All the domains (leaf, non-leaf, and root) as an Observable
*/
domains: Observable<Domain[]>;

@@ -31,14 +46,54 @@ private rootObserver;

constructor(http: HttpClient, endpointTarget: RSEndpointTarget, cfg: Configuration);
/**
* Gets the domains' hierarchy with the indexing information for each leaf domain
* @returns The domains' hierarchy as an Observable
*/
getDomainsHierarchy(): Observable<Domain>;
/**
* Gets the total number of requests per domain
* @returns The domains' total number of requests as an Observable
*/
getDomainsByNumberOfRequests(): Observable<Domain>;
/**
* It should be called once. It keeps using the data obtained from an initial call.
* Loads the domain data.
* It should be called once.
*/
load(): void;
getDomain(db: string): Observable<Domain>;
/**
* Given a domain returns its information
* @param domainId The domain ID
* @returns Domain information as an Observable
*/
getDomain(domainId: string): Observable<Domain>;
/**
* Gets the leaf domains
* @returns Leaf domains as an Observable
*/
getLeaves(): Observable<Domain[]>;
/**
* Gets the category (non-leaf) domains
* @returns Category domains as an Observable
*/
getCategories(): Observable<Domain[]>;
/**
* Gets the root domain
* @returns The root domain as an Observable
*/
getRoot(): Observable<Domain>;
/**
* Refreshes the metadata items.
* This will emit all the observables defined in this service.
*/
update(): void;
/**
* Returns the available fields for a domain with the cross references information.
* @param domainId The leaf domain ID
* @returns The fields information as an Observable
*/
getFieldsWithReferenced(domainId: string): Observable<any>;
/**
* Returns the available fields for a domain.
* @param domainId The leaf domain ID
* @returns The fields information as an Observable
*/
getFields(domainId: string): Observable<any>;

@@ -52,6 +107,6 @@ private findLeaves;

private createDate;
private _getFields;
private get;
private getFieldsRequest;
private getRequest;
static ɵfac: i0.ɵɵFactoryDeclaration<ConfigService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ConfigService>;
}

81

lib/config/configuration.d.ts
import * as i0 from "@angular/core";
/**
* Represents a domain field sort configuration
*/
export interface SearchDomainSortingItem {
/**
* Whether it is the default field to sort on
*/
default: boolean;
/**
* The label to display
*/
label: string;
/**
* The REST API request value
*/
rest_value: string;
/**
* The query parameter in the browser URL
*/
browser_value: string;
}
/**
* Fields configuration for the REST API.
* This service is used by other services (e.g. ConfigService) to retrieve important search configuration.
*/
export declare class Configuration {
/**
* Whether debug mode is enabled
*/
DEBUG: boolean;
/**
* Number of entries to be displayed in a results page when more categories are present
* Number of entries to be displayed in a results page when more than one category is present
*/

@@ -26,14 +48,20 @@ MINIMUM_PAGE_SIZE: number;

DEFAULT_REST_HLFIELDS: string;
/**
* Whether to enable highlighting
*/
DEFAULT_REST_ENABLE_HLFIELDS: boolean;
/**
* Default list of domain IDs to use for suggestion/autocomplete
*/
DEFAULT_SUGGEST_DOMAINS: string[];
/**
* Search query minimum lenght
* Search query minimum length
*/
SEARCH_QUERY_MIN_LENGTH: number;
/**
* Search query maximum lenght
* Search query maximum length
*/
SEARCH_QUERY_MAX_LENGTH: number;
/**
* Max number of results the service can return
* Maximum number of results the service can return
*/

@@ -45,49 +73,36 @@ SEARCH_MAX_NUM_RESULTS: number;

TOOLS_URL_PREFIX: string;
/**
* Domain IDs to exclude in cross-referencing
*/
XREF_SEARCH_EXCLUDED_DOMAINS: string[];
/**
* Per-domain REST fields configuration
* Per-domain REST fields configuration.
* Here you can define, for each domain ID, the list of fields to retrieve.
*
* Example:
* ```
* @example
* REST_FIELDS = {
* biotools: 'name,description,version'
* }
* ```
*/
REST_FIELDS: Record<string, string>;
/**
* Per-domain REST highlighting fields configuration
* Per-domain REST highlighting fields configuration.
*
* @example
* REST_HLFIELDS = {
* arrayexpress_repository: 'description'
* }
*/
REST_HLFIELDS: Record<string, string>;
/**
* If you need to display a subset of availalbe facets, specify facet fields of the subset.
* The fields will be used as a value of facetfields parameter in a REST call.
* If a domain is not specified here, all available facets will be displayed.
*
* NOTE: rnacentral has a specific order of required facets, to test a weired error on
* returned organism facets with query 'tarbase'. This order
* is preventing the error to manifest
* Per-domain facet fields configuration. By default all facets are retrieved if `facetcount` is defined;
* if you need to display a subset of such facets, use this map.
* The fields will be used as a value of the `facetfields` parameter in a REST call.
*/
VISIBLE_FACETS: Record<string, string>;
/**
* REST response headers
* REST API response headers
*/
REST_RESP_HEADERS: Record<string, string>;
/**
* Search sorting default configurations; example:
"test_domain": [
{
"default": true, // if no URL/user specification the default will be used
"label": "Relevance", // label to use in the UI
"rest_value": "_relevance:descending", // value to use in the REST calls
"browser_value": "relevance" // value use in the browser URL
}
}
NOTE "rest_value" and "browser_value" need to be unique inside a domain configuration
because will be used to identify the sorting when translating between REST call and browser URL
*/
/**
* Search sorting configuration.

@@ -94,0 +109,0 @@ *

@@ -18,11 +18,39 @@ /**

import { IndexInfo } from './index-info';
/**
* Represents a domain with fields and indexing information.
*/
export interface Domain {
/**
* The domain ID. Used in REST API calls.
*/
id: string;
/**
* The human-readable domain name.
*/
name: string;
/**
* The domain description.
*/
description?: string;
/**
* The subdomains of the domain, if applicable.
* For leaf domains this is empty.
*/
subdomains?: Domain[];
/**
* The list of fields available in the domain.
*/
fields?: FieldInfo[];
/**
* The information about the domain search index.
*/
indexInfo?: IndexInfo;
/**
* The domain's parent ID. Empty if it's the root domain.
*/
parentId?: string;
/**
* The domain's parent name.
*/
parentName?: string;
}

@@ -16,14 +16,62 @@ /**

*/
/**
* Represents a field within a domain.
*/
export interface FieldInfo {
/**
* The field ID.
*/
id: string;
/**
* The field human-readable name.
*/
name: string;
/**
* The field alias name.
*/
alias?: string;
/**
* The field description.
*/
description: string;
/**
* Whether the field can be searched upon.
*/
searchable?: boolean;
/**
* Whether the field is retrievable.
*/
retrievable?: boolean;
/**
* Whether the field is sortable.
*/
sortable?: boolean;
/**
* Whether faceting is enabled for the field.
*/
facet?: boolean;
/**
* The field type.
*
* Available types:
* - text
* - keyword
* - xref
* - unknownxref
* - int
* - long
* - double
* - float
* - date
* - int_range
*/
type?: string;
/**
* The referenced domain, if a cross-reference field.
*/
referencedDomain?: string;
/**
* The referenced field, if a cross-reference field.
*/
referencedField?: string;
}

@@ -16,13 +16,43 @@ /**

*/
/**
* Represents the search index information for a domain.
*/
export interface IndexInfo {
/**
* The number of entries in a domain index.
*/
numberOfEntities: number;
/**
* The last modification date of the domain index.
*/
lastModificationDate?: Date;
/**
* The update date of the source data (from the data provider).
*/
updateDate?: Date;
releaseDate?: Date;
/**
* The domain URL.
*/
domainMainUrl?: string;
/**
* The human-readable index size.
*/
indexSize?: string;
/**
* The index size in bytes.
*/
indexSizeBytes?: string;
/**
* Whether the domain is hidden.
*/
isHiddenDomain?: boolean;
/**
* Whether a dictionary index is available.
*/
isDictionaryAvailable?: boolean;
/**
* The domain release version as specified by the data provider.
*/
releaseVersion?: string;
}

@@ -18,10 +18,18 @@ /**

import { NotificationMessageService } from '../notification-message/notification-message.service';
import * as i0 from "@angular/core";
/**
* EBI Search specific Angular error handler.
*
* It tracks errors through the `NotificationMessageService`
*
* @example
* {
* provide: ErrorHandler,
* useClass: EBExceptionHandler
* }
*/
export declare class EBExceptionHandler extends ErrorHandler {
private errMsgService;
private notificationMessageService;
private ngZone;
constructor(errMsgService: NotificationMessageService, ngZone: NgZone);
constructor(notificationMessageService: NotificationMessageService, ngZone: NgZone);
handleError(error: any): void;
static ɵfac: i0.ɵɵFactoryDeclaration<EBExceptionHandler, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<EBExceptionHandler>;
}

@@ -22,2 +22,7 @@ /**

blocking: boolean;
/**
* Creates an EBI Search exception.
* @param message The exception message.
* @param blocking Whether the error is blocking or it doesn't affect the display of the page.
*/
constructor(message: string, blocking?: boolean);

@@ -33,3 +38,3 @@ toString(): string;

/**
* Represents an EBI Search HTTP expcetion.
* Represents an EBI Search HTTP exception.
*/

@@ -39,3 +44,10 @@ export declare class HttpException extends EBException {

url: string;
/**
* Creates an EBI Search HTTP exception.
* @param message The exception message.
* @param httpStatus The HTTP status code.
* @param url The URL generating the HTTP exception.
* @param blocking Whether the error is blocking or it doesn't affect the display of the page.
*/
constructor(message: string, httpStatus: number, url?: string, blocking?: boolean);
}

@@ -5,2 +5,3 @@ import { Observable } from 'rxjs';

* Error service used to provide errors generated in `EBExceptionHandler`.
*
* It currently holds the last shown `ErrorEvent` date to understand if the error was already shown to the user.

@@ -48,5 +49,9 @@ */

*/
declare abstract class AbstractMessageEvent implements MessageEvent {
export declare abstract class AbstractMessageEvent implements MessageEvent {
private date;
private aknowledged;
/**
* Creates a timestamped event.
* @param date The event timestamp.
*/
constructor(date: Date);

@@ -60,3 +65,3 @@ abstract getTitle(): string;

/**
* Describes a notification message.
* Describes a generic notification message.
*/

@@ -66,2 +71,8 @@ export declare class NotificationMessage extends AbstractMessageEvent {

private message;
/**
* Creates a timestamped notification with message information.
* @param date The event timestamp.
* @param title The notification title.
* @param message The notification message.
*/
constructor(date: Date, title: string, message: string);

@@ -81,2 +92,1 @@ getTitle(): string;

}
export {};
import * as i0 from "@angular/core";
/**
* Represents the EBI Search endpoint details.
*
* @example
* export const envBasedRSTarget = () => ({
* name: environment.name,
* restClientName: 'cv19-portal',
* url: environment.ebisearch_rest_ep,
* });
*
* // ...
*
* `@NgModule`({
* providers: [
* { provide: RSEndpointTarget, useFactory: envBasedRSTarget }
* ]
* })
* export class AppModule {}
*/
export declare class RSEndpointTarget {
/**
* The environment name.
*/
name: string;
/**
* The application/client name.
*/
restClientName: string;
/**
* The EBI Search API endpoint.
*/
url: string;
constructor();
static ɵfac: i0.ɵɵFactoryDeclaration<RSEndpointTarget, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<RSEndpointTarget>;
}

@@ -16,2 +16,5 @@ /**

*/
/**
* Represents a deep link entity associated with a field.
*/
export interface DeepLinkFragment {

@@ -21,6 +24,18 @@ id: string;

}
/**
* Represents a deep link fragment.
*/
export interface Fragment {
/**
* The fragment prefix.
*/
prefix: string;
/**
* The fragment suffix.
*/
suffix: string;
/**
* The matched token/term.
*/
token: string;
}

@@ -16,9 +16,28 @@ /**

*/
/**
* Represents the context to the search results.
*/
export declare class ResponseInfo {
/**
* The query that generated the search results.
*/
query: string;
/**
* The original URL.
*/
url: string;
private queryParams;
private params;
/**
* Creates a `ResponseInfo` object given the context.
* @param queryString The query.
* @param queryParams The query parameters.
* @param url The original URL.
*/
constructor(queryString: string, queryParams: string, url?: string);
/**
* Gets the domain ID from the query parameters.
* @returns The domain ID.
*/
getDomainId(): string;
}

@@ -16,11 +16,36 @@ /**

*/
/**
* Represents a domain in the domain hierarchy.
*/
export interface SearchDomain {
/**
* The domain ID.
*/
id: string;
/**
* The domain human-readable name.
*/
name?: string;
/**
* The number of entris in this domain.
*/
hitCount: number;
/**
* The children domains.
*/
subdomains?: SearchDomain[];
}
/**
* Represents a domain hierarchy.
* This is returned by `getDomainsTree`.
*/
export interface SearchDomains {
/**
* The number of entries in the root domain.
*/
hitCount: number;
/**
* The children domains.
*/
domains: SearchDomain[];
}

@@ -16,12 +16,39 @@ /**

*/
/**
* Represents a single facet value corresponding to a facet.
*/
export interface SearchFacetValue {
/**
* The human-readable label.
*/
label: string;
/**
* The facet value.
*/
value: string;
/**
* The number of entries that match this individual facet value.
*/
count: number;
}
/**
* Represents a facet result.
*/
export interface SearchFacet {
/**
* The facet ID.
*/
id: string;
/**
* The facet's human-readable label.
*/
label: string;
/**
* The number of entries that match the facet.
*/
total: number;
/**
* The values for this facet.
*/
facetValues: SearchFacetValue[];
}

@@ -16,8 +16,26 @@ /**

*/
/**
* Represents an entry's field.
*/
export interface SearchField {
/**
* The ID of the entry.
*/
id: string[];
/**
* The accession of the entry (usually the ID).
*/
acc?: string[];
/**
* The name field (common).
*/
name?: string[];
/**
* The description field (common).
*/
description?: string[];
/**
* Generic fields.
*/
[propName: string]: string[];
}

@@ -18,9 +18,30 @@ /**

import { SearchURL } from './search-url';
/**
* Represents a single reference entry.
*/
export interface SearchReference {
/**
* The entry ID.
*/
id: string;
/**
* The entry accession (usually the ID).
*/
acc?: string;
/**
* The entry source domain.
*/
source: string;
/**
* @see SearchResultEntry
*/
fields?: SearchField;
/**
* @see SearchResultEntry
*/
fieldURLs?: SearchURL[];
/**
* @see SearchResultEntry
*/
viewURLs?: SearchURL[];
}

@@ -16,6 +16,18 @@ /**

*/
/**
* Represents a referenced/target domain.
*/
export interface SearchReferencedDomain {
/**
* The domain ID.
*/
id: string;
/**
* The domain alias ID. Used to distinguish referenced domains with the same ID but different queries.
*/
alias?: string;
/**
* The number of entries for the referenced domains against the source entry.
*/
referenceEntryCount?: number;
}

@@ -21,15 +21,55 @@ /**

import { DeepLinkFragment } from './deep-link-fragment';
/**
* Represents and individual search results entry.
*/
export interface SearchResultEntry {
/**
* The accession number. Usually corresponds to the ID.
*/
acc?: string;
/**
* The ID of the entry.
*/
id: string;
/**
* The source domain of the entry.
*/
source: string;
/**
* The results score of the entry.
*/
score?: number;
/**
* The number of referenced entries (used in cross reference searching).
*/
referenceCount?: number;
/**
* The entries referenced by this entry (used in cross reference searching).
*/
references?: SearchReference[];
/**
* The facets used in cross reference searching.
*/
referenceFacets?: SearchFacet[];
/**
* The entry fields.
*/
fields?: SearchField;
/**
* The highlighted entry fields.
*/
highlights?: SearchField;
/**
* URLs specific to the entry.
* For example this contains the URL of the entry in the source repository.
*/
fieldURLs?: SearchURL[];
/**
* Other URLs for the entry in other resources (e.g. in portals).
*/
viewURLs?: SearchURL[];
/**
* The fragments used for deep linking.
*/
deepLinkFragments?: DeepLinkFragment[];
}

@@ -21,10 +21,34 @@ /**

import { ErrorMessage } from '../../common/error-message';
/**
* Represents the search results returned from different API endpoints.
*/
export interface SearchResults {
/**
* The response context (e.g. originating url).
*/
responseInfo?: ResponseInfo;
/**
* Number of results.
*/
hitCount?: number;
/**
* Search results entries.
*/
entries?: SearchResultEntry[];
/**
* Domains referred by an entry. Used in cross reference searching.
*/
domains?: SearchReferencedDomain[];
/**
* The facets associated with the set of results.
*/
facets?: SearchFacet[];
/**
* Diagnostic error message.
*/
diagnostics?: ErrorMessage;
/**
* The suggested query in case of misspelling.
*/
suggestedQuery?: string;
}

@@ -16,5 +16,14 @@ /**

*/
/**
* Represents a URL associated with an entry.
*/
export interface SearchURL {
/**
* The URL value.
*/
value: string;
/**
* The name of the URL entity.
*/
name?: string;
}

@@ -19,11 +19,13 @@ /**

/**
* Representation of the search REST API request.
* Represents a search REST API request.
*/
export declare class SearchRequest {
private cfg;
/**
* Domain ID in JSON/snake case format (used for `REST_FIELDS`).
*/
dbJSONFormat: string;
/**
* Search request query.
*
* See also: `t`
* @alias `t`
*/

@@ -33,4 +35,3 @@ query: string;

* Search request query.
*
* See also: `query`
* @alias `query`
*/

@@ -43,3 +44,3 @@ t: string;

/**
* Fields that should be highlighted.
* Search request fields that should be highlighted.
*/

@@ -58,11 +59,27 @@ hlfields: string;

*
* Example:
* ```
* @example
* 'center_name:University of Birmingham,coverage:90,taxonomy:10090'
* ```
*/
facets: string;
/**
* RSS feed title.
*
* Required when the selected format parameter is 'rss'.
*/
feedtitle: string;
/**
* The maximum amount of days for the feed to be available.
*
* @see `feedmaxdaysfield`
*/
feedmaxdays: string;
/**
* The field that holds the maximum amount of days for the feed.
*
* @see `feedmaxdays`
*/
feedmaxdaysfield: string;
/**
* Comma separated values of additional entry attributes. Valid with XML and JSON formats only.
*/
entryattrs: string;

@@ -73,11 +90,11 @@ /**

* Valid formats are:
* - xml
* - json
* - rss
* - csv
* - tsv
* - idlist (ID list)
* - acclist (Accession number list)
* - cs_idlist (Comma separated ID list)
* - cs_acclist (Comma separated accession number list)
* - `xml`
* - `json`
* - `rss`
* - `csv`
* - `tsv`
* - `idlist` (ID list)
* - `acclist` (Accession number list)
* - `cs_idlist` (Comma separated ID list)
* - `cs_acclist` (Comma separated accession number list)
*/

@@ -87,4 +104,6 @@ format: string;

* Whether field links are included.
*
* The returned links mean direct URLs to the data entries in the original portals.
* Valid with XML/JSON response formats only.
*
* Valid with XML and JSON response formats only.
*/

@@ -94,18 +113,21 @@ fieldurl: boolean;

* Whether other view links on an entry are included.
* Valid with XML/JSON response formats only.
*
* Valid with XML and JSON response formats only.
*/
viewurl: boolean;
/**
* Custom name for the requesting application (for identification purposes).
*/
requestFrom: string;
/**
* Comma separated values of sorting criteria.
* Should not be used in conjunction with any of 'sortfield' and 'order' parameters.
*
* Example:
* ```
* Should not be used in conjunction with any of `sortfield` and `order` parameters.
*
* @example
* 'boost:descending,length:descending'
* ```
*/
sort: string;
/**
* A single field identifier to sort on. Not allowed to use with 'sort' parameter.
* A single field identifier to sort on. Not allowed to use with the `sort` parameter.
*/

@@ -123,3 +145,3 @@ sortfield: string;

/**
* Used when converting from SearchRequest to a backend REST querystring.
* Used when converting from `SearchRequest` to a backend REST API query string.
*/

@@ -138,3 +160,7 @@ private _queryStringHiddenParams;

/**
* @returns The index of the first entry in the results. Limit is 1,000,000.
* Gets the index of the first entry in the results.
*
* Limit is 1,000,000.
*
* @returns The index of the first entry in the results.
*/

@@ -148,3 +174,7 @@ getStart(): number;

/**
* @returns The number of entries to retrieve. Limit of 10,000 for list type and 100 for other types.
* The number of entries to retrieve.
*
* Limit of 10,000 for list type and 100 for other types.
*
* @returns The number of entries.
*/

@@ -158,6 +188,6 @@ getSize(): number;

/**
* Set 'start' parameter based on 'size' and the passed page number
*/
/**
* Set the page number. This will internally set the `start` parameter based on the `size` parameter.
* Set the page number.
*
* This will internally set the `start` parameter based on the `size` parameter.
*
* @param page The page number.

@@ -177,14 +207,14 @@ */

/**
* Validate all fields and throw ValidationException if needed
* Validate all fields.
*
* @throws `ValidationException`
*/
validateFields(): void;
/**
* Use this method to clear fields that can be specific to some domains and the values
* can be not valid for other domains.
*
* i.e.: navigation to other domain, you need to reset fields that where valid only in the
* previous domain
* Clears domain-specific fields. Useful when navigating to another domain.
*/
clearDomainDefaultFields(): void;
/**
* Gets the list of applied facets.
*
* @returns List of applied facet IDs

@@ -194,6 +224,7 @@ */

/**
* @param fId The facet ID.
* @returns List of selected facet values for a specific facet ID.
* Gets the list of selected values for a specific facet ID.
* @param facetId The facet ID.
* @returns List of selected facet values.
*/
getFacetSelectedValues(fId: string): string[];
getFacetSelectedValues(facetId: string): string[];
/**

@@ -231,12 +262,17 @@ * Adds a facet.

/**
* Set the domain/db for this search request.
* @param db The domain.
* Set the domain ID for this search request.
* @param db The domain ID.
*/
setDB(db: string): void;
/**
* @returns Gets the domain/db.
* Gets the domain ID.
* @returns The domain ID.
*/
getDB(): string;
/**
* @returns Gets the JSON format for the `db` field (e.g. used in `REST_FIELDS`)
* Gets the JSON/snake case format of the domain ID.
*
* This is mainly used in `REST_FIELDS`.
*
* @returns The formatted domain ID.
*/

@@ -274,7 +310,12 @@ getDBJSONFormat(): string;

/**
* To prepare the WS REST url. This is used internally to call the backend.
* All the parameter are URL encoded at this point
* Gets the corresponding REST API query parameters string.
*
* This is used internally to call the backend.
*
* @returns The query parameters string.
*/
toQueryString(): string;
/**
* Gets the query submitted by the user.
*
* @returns The `query` or the `t` parameter.

@@ -281,0 +322,0 @@ */

@@ -11,2 +11,5 @@ import { HttpClient } from '@angular/common/http';

import * as i0 from "@angular/core";
/**
* Represents the service that makes REST API calls to the EBI Search backend.
*/
export declare class SearchService {

@@ -22,25 +25,133 @@ private readonly http;

constructor(http: HttpClient, configService: ConfigService, rsendpoint_target: RSEndpointTarget, cfg: Configuration);
/**
* Gets the percentage of fulfilled REST API calls.
* @returns Percentage of fulfilled calls.
*/
getGlobalCallsProgressPercentage(): number;
/**
* TODO these fields needs to be recognised in SearchRequest in case you need to blank them
* Prepares the fields items for searching.
*
* @param req The search request
*/
setDomainSpecificFields(req: SearchRequest): void;
/**
* Gets the search results given a search request.
* @param req The search request.
* @returns The search results as an Observable.
*/
getSearchResults(req: SearchRequest): Observable<SearchResults>;
/**
* Return the default number of values (11) for the facet
* Gets search facets results given the search request.
*
* The number of facets for each field is limited to the default (11).
*
* @param req The search request.
* @returns The search results as an Observable.
*/
getStandardSearchFacets(req: SearchRequest): Observable<SearchResults>;
/**
* Return the number of facet values (1000) for the 'More' functionality
* Gets search facets results given the search request.
*
* The number of facets for each field is limited to 1000, suitable for the 'more facets' functionality.
*
* @param req The search request.
* @returns The search results as an Observable.
*/
getMoreSearchFacets(req: SearchRequest): Observable<SearchResults>;
getMoreReferenceFacets(db: string, id: string, ref: string, facetId: string): Observable<SearchResults>;
/**
* Gets search facets results given the search request.
* @param req The search request.
* @returns The search results as an Observable.
*/
getSearchFacets(req: SearchRequest): Observable<SearchResults>;
/**
* Gets the entries (target) referenced by an entry in a domain (source).
* @param db The source domain.
* @param id The source entry.
* @param ref The target entry.
* @param page The page number.
* @param facets The facet to apply.
* @param useFacetFieldsFromConfig Whether to use the facet fields from the configuration.
* @param includeHidden Whether to include hidden domains
* @returns The referenced entries as an Observable.
*/
getReferencedEntries(db: string, id: string, ref: string, page: number, facets?: string, useFacetFieldsFromConfig?: boolean, includeHidden?: boolean): Observable<SearchResults>;
/**
* Gets the entries (target) referenced by an entry in a domain (source) constrained by a query.
*
* This is useful within portals that have a subset of the data in EBI Search.
*
* @param db The source domain.
* @param id The source entry.
* @param ref The target entry.
* @param page The page number.
* @param facets The facet to apply.
* @param query The query to constrain the source.
* @param useFacetFieldsFromConfig Whether to use the facet fields from the configuration.
* @param includeHidden Whether to include hidden domains.
* @returns The referenced entries as an Observable.
*/
getConstrainedReferencedEntries(db: string, id: string, ref: string, page: number, facets?: string, query?: string, useFacetFieldsFromConfig?: boolean, includeHidden?: boolean): Observable<SearchResults>;
/**
* Gets the facets (target) referenced by an entry in a domain (source).
* @param db The source domain.
* @param id The source entry.
* @param ref The target entry.
* @param facets The facet to apply.
* @returns The referenced facets as an Observable.
*/
getReferenceFacet(db: string, id: string, ref: string, facets?: string): Observable<SearchResults>;
/**
* Gets the facets (target) referenced by an entry in a domain (source).
*
* In this case the limit is 1000, suitable for the 'more facets' functionality.
*
* @param db The source domain.
* @param id The source entry.
* @param ref The target entry.
* @param facetId
* @returns The referenced facets as an Observable.
*/
getMoreReferenceFacets(db: string, id: string, ref: string, facetId: string): Observable<SearchResults>;
/**
* Gets the domains (targets) referenced by an entry in a source domain.
* @param db The source domain.
* @param id The source entry.
* @param requestFrom Custom name for the requesting application (for identification purposes).
* @param includeHidden Whether to include hidden domains.
* @returns The referenced domains as an Observable.
*/
getReferencedDomains(db: string, id: string, requestFrom?: string, includeHidden?: boolean): Observable<SearchResults>;
/**
* Gets the domains (targets) referenced by an entry in a source domain.
*
* The results are constrained by a set of queries corresponding to each target domain.
*
* @param db The source domain.
* @param id The source entry.
* @param queries The target domains' queries.
* @param includeHidden Whether to include hidden domains.
* @param requestFrom Custom name for the requesting application (for identification purposes).
* @returns The referenced domains as an Observable.
*/
getConstrainedReferencedDomains(db: string, id: string, queries: any, includeHidden?: boolean, requestFrom?: string): Observable<SearchResults>;
/**
* Gets the URL for a specific entry.
* @param db The domain ID.
* @param id The entry ID.
* @returns The results as an Observable.
*/
getFieldLink(db: string, id: string): Observable<SearchResults>;
/**
* Gets the hit counts for each domain in the hierarchy given a query.
* @param req The search request.
* @returns The results as an Observable.
*/
getDomainsTree(req: SearchRequest): Observable<SearchDomains>;
/**
* Gets suggestions for a term.
* @param db The domain ID.
* @param query The query term.
* @returns The suggestion results as an Observable.
*/
getSuggestions(db: string, query: string): Observable<SuggestResults>;

@@ -52,9 +163,9 @@ private getNoMap;

private post;
private _handleError;
private handleError;
private uniqueStringArray;
private getSearchResultsAndResponseInfo;
private _getRESTfields;
private _getStart;
private getRESTfields;
private getStart;
static ɵfac: i0.ɵɵFactoryDeclaration<SearchService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<SearchService>;
}
import { SearchResults } from '../entities/search-results';
import { SearchResultsSorter } from './search-results-sorter';
import * as i0 from "@angular/core";
/**
* The comparator for alphabetically sorting search results based on domain ID.
* @param r1 The first search results object to compare.
* @param r2 The second search results object to compare.
* @returns Positive integer if `r1` comes after `r2` and negative otherwise. Returns 0 if the objects are equal.
*/
export declare const alphaCatResultsComparator: (r1: SearchResults, r2: SearchResults) => number;
/**
* Represents a search results sorter that sorts alphabetically based on the domain ID.
*/
export declare class AlphaCatResultsSorter extends SearchResultsSorter {

@@ -6,0 +15,0 @@ sort(results: SearchResults[]): SearchResults[];

import { SearchResults } from '../entities/search-results';
import { SearchResultsSorter } from './search-results-sorter';
import * as i0 from "@angular/core";
/**
* The comparator for sorting search results based on search score.
* @param r1 The first search results object to compare.
* @param r2 The second search results object to compare.
* @returns Positive number if `r2` is more relevant than `r1` and negative otherwise. Returns 0 if the objects are equally relevant.
*/
export declare const scoreCatResultsComparator: (r1: SearchResults, r2: SearchResults) => number;
/**
* Represents a search results sorter that sorts based on the score of the first entries.
*/
export declare class ScoreCatResultsSorter extends SearchResultsSorter {

@@ -6,0 +15,0 @@ sort(results: SearchResults[]): SearchResults[];

import { SearchResults } from '../entities/search-results';
import * as i0 from "@angular/core";
/**
* Default implementations that does nothing
* Default search results sorter.
*
* This does nothing. You should use the subclasses.
*/
export declare class SearchResultsSorter {
/**
* Sorts the search results according to a specific criteria.
* @param results The search results.
* @returns The sorted search results.
*/
sort(results: SearchResults[]): SearchResults[];

@@ -8,0 +15,0 @@ static ɵfac: i0.ɵɵFactoryDeclaration<SearchResultsSorter, never>;

@@ -17,4 +17,10 @@ /**

import { Suggestion } from './suggestion';
/**
* Represents the suggestion results.
*/
export interface SuggestResults {
/**
* The suggestions array for a single term.
*/
suggestions: Suggestion[];
}

@@ -16,5 +16,14 @@ /**

*/
/**
* Represents a suggestion for a term.
*/
export interface Suggestion {
/**
* The formatted suggestion highlighting the matched terms in the suggestion.
*/
formatted?: string;
/**
* The raw suggestion term.
*/
suggestion: string;
}
{
"name": "@ebi-wp/ebinocle-ng-rsclient",
"version": "4.11.0",
"version": "4.11.1",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "homepage": "https://www.ebi.ac.uk/ebisearch/",

@@ -17,25 +17,187 @@ <!---

# EbinocleNgRsclient
# ebinocle-ng-rsclient
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.1.0.
> EBI Search Angular REST client
## Code scaffolding
## Documentation
Run `ng generate component component-name --project ebinocle-ng-rsclient` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ebinocle-ng-rsclient`.
> Note: Don't forget to add `--project ebinocle-ng-rsclient` or else it will be added to the default project in your `angular.json` file.
The documentation can be found at: http://ebi-wp.gitdocs.ebi.ac.uk/ebinocle-ng-rsclient
## Build
## Install
Run `ng build ebinocle-ng-rsclient` to build the project. The build artifacts will be stored in the `dist/` directory.
```
npm i @ebi-wp/ebinocle-ng-rsclient
```
## Publishing
## Usage example
After building your library with `ng build ebinocle-ng-rsclient`, go to the dist folder `cd dist/ebinocle-ng-rsclient` and run `npm publish`.
The following example, creates a `SearchRequest` object, sets the domain and query.
Then it gets the search results using that object.
## Running unit tests
```
import { Component } from '@angular/core';
import { Configuration, SearchRequest, SearchService } from '@ebi-wp/ebinocle-ng-rsclient';
Run `ng test ebinocle-ng-rsclient` to execute the unit tests via [Karma](https://karma-runner.github.io).
@Component({
selector: 'app-search',
templateUrl: './search.component.html'
})
export class SearchComponent {
constructor(private readonly searchService: SearchService) {}
## Further help
public search() {
const searchRequest = new SearchRequest(new Configuration());
searchRequest.setDB('embl');
searchRequest.query = 'mouse';
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
return this.searchService.getSearchResults(searchRequest);
}
}
```
## Simple search
In the following example we use the `SearchService` to submit a search to the `embl` domain with the query `"mouse"`.
```
import { Component, OnInit } from '@angular/core';
import { Configuration, SearchRequest, SearchResults, SearchService } from '@ebi-wp/ebinocle-ng-rsclient';
import { Observable } from 'rxjs';
@Component({
selector: 'app-search',
templateUrl: './search.component.html'
})
export class SearchComponent implements OnInit {
public searchResults: SearchResults;
constructor(private readonly searchService: SearchService) {}
public ngOnInit(): void {
this.search().subscribe((searchResults) => {
this.searchResults = searchResults;
});
}
public search(): Observable<SearchResults> {
const searchRequest = new SearchRequest(new Configuration());
searchRequest.setDB('embl');
searchRequest.query = 'mouse';
return this.searchService.getSearchResults(searchRequest);
}
}
```
Then in the HTML template:
```
<ng-container *ngIf="searchResults && searchResults.hitCount > 0">
<div *ngFor="let entry of searchResults.entries">
<p>{{ entry.id }}</p>
<p>{{ entry.fields.description[0] }}</p>
</div>
</ng-container>
```
## Faceted search
To get facets along with a search result, the query and facetcount parameters are needed:
```
// ...
public search(): Observable<SearchResults> {
const searchRequest = new SearchRequest(new Configuration());
searchRequest.setDB('embl');
searchRequest.query = 'mouse';
searchRequest.facetcount = 10;
return this.searchService.getSearchResults(searchRequest);
}
// ...
```
To extract the facets use:
```
// ...
this.search().subscribe((searchResults) => {
this.facets = searchResults.facets;
});
// ...
```
To filter out by a list of selected facet values, the `facets` parameter can help. The value format for the parameter is a comma separated list of _facet id:facet value_:
```
// ...
public search(): Observable<SearchResults> {
const searchRequest = new SearchRequest(new Configuration());
searchRequest.setDB('embl');
searchRequest.query = 'plantae';
searchRequest.facetcount = 10;
searchRequest.facets = 'taxonomy:1842';
return this.searchService.getSearchResults(searchRequest);
}
// ...
```
## Cross reference searching
### Finding domains referred by an entry
Given a source domain and an entry we want to retrieve the referenced (target) domains:
```
// ...
public search(): Observable<SearchResults> {
return this.searchService.getReferencedDomains('uniprot', 'Q9BYF1');
}
// ...
```
To extract the results:
```
// ...
this.search().subscribe((searchResults) => {
for (const domain of searchResults.domains) {
console.log(`Referenced domain ${domain.id} with ${domain.referenceEntryCount} entries`);
}
});
// ...
```
### Cross reference searching
To find entries in a target domain (`europepmc` in this case) referred to by a source domain (`uniprot`) and entry (`Q9BYF1`) use the following:
```
// ...
public search(): Observable<SearchResults> {
return this.searchService.getReferencedEntries(
'uniprot',
'Q9BYF1',
'europepmc',
1
);
}
// ...
```
To extract the results:
```
// ...
this.search().subscribe((searchResults) => {
const reference = this.searchResults.entries[0];
this.referencesResult = {
hitCount: reference?.referenceCount,
entries: reference?.references
};
});
// ...
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc