Socket
Socket
Sign inDemoInstall

ozone-search-helper

Package Overview
Dependencies
Maintainers
5
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ozone-search-helper - npm Package Compare versions

Comparing version 6.0.3 to 6.1.10

dist/functions.d.ts

2

dist/index.d.ts
export * from './ozone-search-helper';
export * from './functions';
export * from './types';
export * from './ozone-search-helper';
export * from './functions';
export * from './types';

140

dist/ozone-search-helper.d.ts
/**
* Created by hubert on 8/06/17.
*/
import { SearchRequest, ModeType, Query, Sort } from 'ozone-type';
export declare type BoolQueryName = 'mustClauses' | 'shouldClauses' | 'mustNotClauses';
export declare type BasicOzoneType = string | boolean | number;
import { SearchRequest, Query, Sort } from 'ozone-type';
import { BoolQueryName } from './types';
/**

@@ -52,3 +51,3 @@ * Class helper to create searchQuery.

* @param {string} collection
* @return {SearchQuery} this to be chained
* @return {this} this to be chained
*/

@@ -67,15 +66,16 @@ on(collection: string): this;

* create boolQuery mustClauses.
* @return {SearchQuery}
* @return {this}
*/
get and(): SearchQuery;
get and(): this;
/**
* create boolQuery shouldClauses.
* @return {SearchQuery}
* @return {this}
*/
get or(): SearchQuery;
get or(): this;
/**
* create boolQuery mustNotClauses (nand).
* @return {SearchQuery}
* @return {this}
*/
get not(): SearchQuery;
get not(): this;
private add;
/**

@@ -85,5 +85,5 @@ * set search request size

* @param {number} size
* @return {SearchQuery} this
* @return {this} this
*/
setSize(size: number): SearchQuery;
setSize(size: number): this;
/**

@@ -93,5 +93,5 @@ * set search request offsed

* @param {number} offset
* @return {SearchQuery} this
* @return {this} this
*/
setOffset(offset: number): SearchQuery;
setOffset(offset: number): this;
/**

@@ -101,5 +101,5 @@ * generic boolQuery

* @param {string} kind kind of bool query
* @return {SearchQuery}
* @return {this}
*/
boolQuery(kind: BoolQueryName): SearchQuery;
boolQuery(kind: BoolQueryName): this;
/**

@@ -109,56 +109,4 @@ * Combine query

*/
combineWith(searchQuery: SearchQuery): SearchQuery;
combineWith(searchQuery: SearchQuery): this;
/**
* ozone QueryStringQuery
* @param {string} searchString string to search
*/
quicksearch(searchString: string): SearchQuery;
/**
* search for a term in a field
* @param {string} field
* @param {string} value
* @param {boolean} ignoreCase
* @return {SearchQuery}
*/
termQuery(field: string, value: BasicOzoneType, ignoreCase?: boolean): SearchQuery;
termsQuery(field: string, ...values: Array<BasicOzoneType>): SearchQuery;
termsQueryOptions(field: string, values: Array<BasicOzoneType>, options?: {
ignoreCase?: boolean;
exactMatch?: boolean;
}): SearchQuery;
/**
* search inside a type.
* Not un subtype
* @param {string} typeIdentifiers
* @return {SearchQuery}
*/
typeQuery(...typeIdentifiers: Array<string>): SearchQuery;
/**
* search array of ids
* @param {string} ids
* @return {SearchQuery}
*/
idsQuery(ids: Array<string>): SearchQuery;
existsQuery(field: string): SearchQuery;
/**
* search inside a type and it's subtype
* @param {string} typeIdentifiers
* @return {SearchQuery}
*/
typeQueryWithSubType(...typeIdentifiers: Array<string>): SearchQuery;
/**
* Search inside a type
* @param {boolean} includeSubTypes
* @param {string} typeIdentifiers
* @return {SearchQuery}
*/
private genericTypeQuery;
/**
* Search inside a tenant
* @param {ModeType} mode
* @param {string} tenantId
* @return {SearchQuery}
*/
tenantQuery(mode: ModeType, tenantId: string): SearchQuery;
/**
* Search for auto complete

@@ -168,5 +116,5 @@ * @param {string} searchString

* @param {number?} size
* @return {SearchQuery}
* @return {this}
*/
suggestion(searchString: string, lastTerm?: string, size?: number): SearchQuery;
suggestion(searchString: string, lastTerm?: string, size?: number): this;
/**

@@ -176,40 +124,30 @@ * create a custom searchRequest.

* @param {SearchRequest} searchParam
* @return {SearchQuery}
*/
custom(searchParam: SearchRequest): void;
/**
* Search in a range of value
* @param field
* @param param {from?: any, to?: any}
*/
rangeQuery(field: string, param: {
existsQuery: (field: string) => this;
idsQuery: (ids: string[]) => this;
quicksearch: (searchString: string) => this;
tenantQuery: (mode: import("ozone-type").ModeType, tenantId: string) => this;
termQuery: (field: string, value: import("./types").BasicOzoneType, ignoreCase?: boolean | undefined) => this;
termsQuery: (field: string, ...values: import("./types").BasicOzoneType[]) => this;
termsQueryOptions: (field: string, values: import("./types").BasicOzoneType[], options?: {
ignoreCase?: boolean | undefined;
exactMatch?: boolean | undefined;
} | undefined) => this;
typeQuery: (...args: string[]) => this;
typeQueryWithSubType: (...args: string[]) => this;
rangeQuery: (field: string, param: {
from?: any;
to?: any;
}): SearchQuery;
lowerIncluded?: boolean | undefined;
upperIncluded?: boolean | undefined;
}) => this;
regexpQuery: (field: string, regexp: string, ignoreCase?: boolean | undefined) => this;
wildcardQuery: (field: string, wildcard: string, ignoreCase?: boolean | undefined, analyzed?: boolean | undefined) => this;
/**
* Search with a regular expression
* @param field
* @param regexp
* @param ignoreCase
*/
regexpQuery(field: string, regexp: string, ignoreCase?: boolean): SearchQuery;
/**
* Matches documents that have fields matching a wildcard expression (not analyzed).
* Supported wildcards are *, which matches any character sequence (including the empty one), and ?,
* which matches any single character. Note that this query can be slow, as it needs to iterate over many terms.
* In order to prevent extremely slow wildcard queries,
* a wildcard term should not start with one of the wildcards * or ?.
* The wildcard query maps to Lucene WildcardQuery.
* @param field
* @param wildcard
* @param ignoreCase
* @param analyzed
*/
wildcardQuery(field: string, wildcard: string, ignoreCase?: boolean, analyzed?: boolean): SearchQuery;
/**
*
* @param {Query} query
* @return {SearchQuery}
* @return {this}
*/
addQuery(query: Query): SearchQuery;
addQuery(query: Query): this;
/**

@@ -216,0 +154,0 @@ * function to an order on a field

@@ -0,1 +1,2 @@

import { existsQuery, idsQuery, quicksearch, rangeQuery, regexpQuery, tenantQuery, termQuery, termsQuery, termsQueryOptions, typeQuery, typeQueryWithSubType, wildcardQuery } from './functions';
/**

@@ -44,2 +45,14 @@ * Class helper to create searchQuery.

};
this.existsQuery = this.add(existsQuery);
this.idsQuery = this.add(idsQuery);
this.quicksearch = this.add(quicksearch);
this.tenantQuery = this.add(tenantQuery);
this.termQuery = this.add(termQuery);
this.termsQuery = this.add(termsQuery);
this.termsQueryOptions = this.add(termsQueryOptions);
this.typeQuery = this.add(typeQuery);
this.typeQueryWithSubType = this.add(typeQueryWithSubType);
this.rangeQuery = this.add(rangeQuery);
this.regexpQuery = this.add(regexpQuery);
this.wildcardQuery = this.add(wildcardQuery);
}

@@ -50,3 +63,3 @@ /**

* @param {string} collection
* @return {SearchQuery} this to be chained
* @return {this} this to be chained
*/

@@ -70,3 +83,3 @@ on(collection) {

* create boolQuery mustClauses.
* @return {SearchQuery}
* @return {this}
*/

@@ -78,3 +91,3 @@ get and() {

* create boolQuery shouldClauses.
* @return {SearchQuery}
* @return {this}
*/

@@ -86,3 +99,3 @@ get or() {

* create boolQuery mustNotClauses (nand).
* @return {SearchQuery}
* @return {this}
*/

@@ -92,2 +105,7 @@ get not() {

}
add(fun) {
return (...args) => {
return this.addQuery(fun(...args));
};
}
/**

@@ -97,3 +115,3 @@ * set search request size

* @param {number} size
* @return {SearchQuery} this
* @return {this} this
*/

@@ -108,3 +126,3 @@ setSize(size) {

* @param {number} offset
* @return {SearchQuery} this
* @return {this} this
*/

@@ -119,3 +137,3 @@ setOffset(offset) {

* @param {string} kind kind of bool query
* @return {SearchQuery}
* @return {this}
*/

@@ -142,104 +160,5 @@ boolQuery(kind) {

}
else {
throw Error('No query define in combineWith(searchQuery)');
}
throw Error('No query define in combineWith(searchQuery)');
}
/**
* ozone QueryStringQuery
* @param {string} searchString string to search
*/
quicksearch(searchString) {
return this.addQuery({
'$type': 'QueryStringQuery',
field: '_quicksearch',
queryString: `${searchString}*`
});
}
/**
* search for a term in a field
* @param {string} field
* @param {string} value
* @param {boolean} ignoreCase
* @return {SearchQuery}
*/
termQuery(field, value, ignoreCase = false) {
return this.addQuery({
'$type': 'TermQuery',
field: field,
value: value,
ignoreCase
});
}
termsQuery(field, ...values) {
return this.addQuery({
'$type': 'TermsQuery',
field,
values
});
}
termsQueryOptions(field, values, options = {}) {
return this.addQuery(Object.assign({ '$type': 'TermsQuery', field,
values }, options));
}
/**
* search inside a type.
* Not un subtype
* @param {string} typeIdentifiers
* @return {SearchQuery}
*/
typeQuery(...typeIdentifiers) {
return this.genericTypeQuery(false, ...typeIdentifiers);
}
/**
* search array of ids
* @param {string} ids
* @return {SearchQuery}
*/
idsQuery(ids) {
return this.addQuery({
'$type': 'IdsQuery',
ids
});
}
existsQuery(field) {
return this.addQuery({
'$type': 'ExistsQuery',
field
});
}
/**
* search inside a type and it's subtype
* @param {string} typeIdentifiers
* @return {SearchQuery}
*/
typeQueryWithSubType(...typeIdentifiers) {
return this.genericTypeQuery(true, ...typeIdentifiers);
}
/**
* Search inside a type
* @param {boolean} includeSubTypes
* @param {string} typeIdentifiers
* @return {SearchQuery}
*/
genericTypeQuery(includeSubTypes, ...typeIdentifiers) {
return this.addQuery({
'$type': 'TypeQuery',
typeIdentifiers: typeIdentifiers,
includeSubTypes: includeSubTypes
});
}
/**
* Search inside a tenant
* @param {ModeType} mode
* @param {string} tenantId
* @return {SearchQuery}
*/
tenantQuery(mode, tenantId) {
return this.addQuery({
'$type': 'TenantQuery',
mode: mode,
tenantId: tenantId
});
}
/**
* Search for auto complete

@@ -249,3 +168,3 @@ * @param {string} searchString

* @param {number?} size
* @return {SearchQuery}
* @return {this}
*/

@@ -268,3 +187,2 @@ suggestion(searchString, lastTerm = '', size) {

* @param {SearchRequest} searchParam
* @return {SearchQuery}
*/

@@ -275,54 +193,5 @@ custom(searchParam) {

/**
* Search in a range of value
* @param field
* @param param {from?: any, to?: any}
*/
rangeQuery(field, param) {
const query = Object.assign({
'$type': 'RangeQuery',
field
}, param);
return this.addQuery(query);
}
/**
* Search with a regular expression
* @param field
* @param regexp
* @param ignoreCase
*/
regexpQuery(field, regexp, ignoreCase = false) {
const query = {
'$type': 'RegexpQuery',
field,
regexp,
ignoreCase
};
return this.addQuery(query);
}
/**
* Matches documents that have fields matching a wildcard expression (not analyzed).
* Supported wildcards are *, which matches any character sequence (including the empty one), and ?,
* which matches any single character. Note that this query can be slow, as it needs to iterate over many terms.
* In order to prevent extremely slow wildcard queries,
* a wildcard term should not start with one of the wildcards * or ?.
* The wildcard query maps to Lucene WildcardQuery.
* @param field
* @param wildcard
* @param ignoreCase
* @param analyzed
*/
wildcardQuery(field, wildcard, ignoreCase, analyzed) {
const query = {
'$type': 'WildcardQuery',
field,
wildcard,
ignoreCase,
analyzed
};
return this.addQuery(query);
}
/**
*
* @param {Query} query
* @return {SearchQuery}
* @return {this}
*/

@@ -329,0 +198,0 @@ addQuery(query) {

{
"name": "ozone-search-helper",
"version": "6.0.3",
"version": "6.1.10",
"publishConfig": {

@@ -28,3 +28,3 @@ "access": "public"

},
"gitHead": "63cf07815ea2c032870e5c1498d06ebe7ff113ba"
"gitHead": "137a337dce301048d31da1707e763194c829b506"
}
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