ozone-search-helper
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -10,3 +10,3 @@ { | ||
], | ||
"homepage": "https://github.com/Polymer/sinon.js", | ||
"homepage": "https://github.com/blittle/sinon.js", | ||
"_release": "1.17.1", | ||
@@ -18,5 +18,5 @@ "_resolution": { | ||
}, | ||
"_source": "https://github.com/Polymer/sinon.js.git", | ||
"_target": "^1.17.1", | ||
"_originalSource": "Polymer/sinon.js" | ||
"_source": "https://github.com/blittle/sinon.js.git", | ||
"_target": "^1.14.1", | ||
"_originalSource": "sinonjs" | ||
} |
{ | ||
"name": "web-component-tester", | ||
"description": "web-component-tester makes testing your web components a breeze!", | ||
"version": "6.5.1", | ||
"version": "6.0.0", | ||
"main": [ | ||
@@ -35,3 +35,3 @@ "browser.js" | ||
"sinon-chai": "^2.7.0", | ||
"sinonjs": "Polymer/sinon.js#^1.17.1", | ||
"sinonjs": "^1.14.1", | ||
"stacky": "^1.3.0", | ||
@@ -38,0 +38,0 @@ "test-fixture": "^3.0.0" |
{ | ||
"name": "web-component-tester", | ||
"version": "6.5.1", | ||
"version": "6.5.0", | ||
"--private-wct--": { | ||
@@ -5,0 +5,0 @@ "client-side-version-range": "4 - 6 || ^6.0.0-prerelease.1", |
@@ -1,1 +0,6 @@ | ||
export * from "./ozone-search-helper"; | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./ozone-search-helper")); |
@@ -53,12 +53,10 @@ /** | ||
on(collection: string): this; | ||
get collection(): string | undefined; | ||
get searchQuery(): string; | ||
readonly collection: string | undefined; | ||
readonly searchQuery: string; | ||
/** | ||
* searchRequest getter | ||
*/ | ||
get searchRequest(): SearchRequest; | ||
get size(): number; | ||
set size(size: number); | ||
get offset(): number; | ||
set offset(size: number); | ||
readonly searchRequest: SearchRequest; | ||
size: number; | ||
offset: number; | ||
/** | ||
@@ -68,3 +66,3 @@ * create boolQuery mustClauses. | ||
*/ | ||
get and(): SearchQuery; | ||
readonly and: SearchQuery; | ||
/** | ||
@@ -74,3 +72,3 @@ * create boolQuery shouldClauses. | ||
*/ | ||
get or(): SearchQuery; | ||
readonly or: SearchQuery; | ||
/** | ||
@@ -80,3 +78,3 @@ * create boolQuery mustNotClauses (nand). | ||
*/ | ||
get not(): SearchQuery; | ||
readonly not: SearchQuery; | ||
/** | ||
@@ -225,5 +223,5 @@ * set search request size | ||
constructor(request: SearchQuery, field: string); | ||
get ASC(): SearchQuery; | ||
get DESC(): SearchQuery; | ||
get NONE(): SearchQuery; | ||
readonly ASC: SearchQuery; | ||
readonly DESC: SearchQuery; | ||
readonly NONE: SearchQuery; | ||
} |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
@@ -39,4 +41,4 @@ * Class helper to create searchQuery. | ||
*/ | ||
export class SearchQuery { | ||
constructor() { | ||
var SearchQuery = /** @class */ (function () { | ||
function SearchQuery() { | ||
this._searchRequest = { | ||
@@ -51,40 +53,72 @@ size: 10 | ||
*/ | ||
on(collection) { | ||
SearchQuery.prototype.on = function (collection) { | ||
this._collection = collection; | ||
return this; | ||
} | ||
get collection() { | ||
return this._collection; | ||
} | ||
get searchQuery() { return JSON.stringify(this._searchRequest); } | ||
}; | ||
Object.defineProperty(SearchQuery.prototype, "collection", { | ||
get: function () { | ||
return this._collection; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(SearchQuery.prototype, "searchQuery", { | ||
get: function () { return JSON.stringify(this._searchRequest); }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(SearchQuery.prototype, "searchRequest", { | ||
/** | ||
* searchRequest getter | ||
*/ | ||
get: function () { return this._searchRequest; }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(SearchQuery.prototype, "size", { | ||
get: function () { return this._searchRequest.size || 0; }, | ||
set: function (size) { this._searchRequest.size = size; }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(SearchQuery.prototype, "offset", { | ||
get: function () { return this._searchRequest.offset || 0; }, | ||
set: function (size) { this._searchRequest.offset = size; }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(SearchQuery.prototype, "and", { | ||
/** | ||
* create boolQuery mustClauses. | ||
* @return {SearchQuery} | ||
*/ | ||
get: function () { | ||
return this.boolQuery('mustClauses'); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(SearchQuery.prototype, "or", { | ||
/** | ||
* create boolQuery shouldClauses. | ||
* @return {SearchQuery} | ||
*/ | ||
get: function () { | ||
return this.boolQuery('shouldClauses'); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(SearchQuery.prototype, "not", { | ||
/** | ||
* create boolQuery mustNotClauses (nand). | ||
* @return {SearchQuery} | ||
*/ | ||
get: function () { | ||
return this.boolQuery('mustNotClauses'); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* searchRequest getter | ||
*/ | ||
get searchRequest() { return this._searchRequest; } | ||
get size() { return this._searchRequest.size || 0; } | ||
set size(size) { this._searchRequest.size = size; } | ||
get offset() { return this._searchRequest.offset || 0; } | ||
set offset(size) { this._searchRequest.offset = size; } | ||
/** | ||
* create boolQuery mustClauses. | ||
* @return {SearchQuery} | ||
*/ | ||
get and() { | ||
return this.boolQuery('mustClauses'); | ||
} | ||
/** | ||
* create boolQuery shouldClauses. | ||
* @return {SearchQuery} | ||
*/ | ||
get or() { | ||
return this.boolQuery('shouldClauses'); | ||
} | ||
/** | ||
* create boolQuery mustNotClauses (nand). | ||
* @return {SearchQuery} | ||
*/ | ||
get not() { | ||
return this.boolQuery('mustNotClauses'); | ||
} | ||
/** | ||
* set search request size | ||
@@ -95,6 +129,6 @@ * Can be chain. | ||
*/ | ||
setSize(size) { | ||
SearchQuery.prototype.setSize = function (size) { | ||
this.size = size; | ||
return this; | ||
} | ||
}; | ||
/** | ||
@@ -106,6 +140,6 @@ * set search request offsed | ||
*/ | ||
setOffset(offset) { | ||
SearchQuery.prototype.setOffset = function (offset) { | ||
this.offset = offset; | ||
return this; | ||
} | ||
}; | ||
/** | ||
@@ -117,4 +151,4 @@ * generic boolQuery | ||
*/ | ||
boolQuery(kind) { | ||
const currentQuery = this._searchRequest.query ? Object.assign({}, this._searchRequest.query) : undefined; | ||
SearchQuery.prototype.boolQuery = function (kind) { | ||
var currentQuery = this._searchRequest.query ? Object.assign({}, this._searchRequest.query) : undefined; | ||
this._searchRequest.query = { | ||
@@ -128,3 +162,3 @@ '$type': 'BoolQuery' | ||
return this; | ||
} | ||
}; | ||
/** | ||
@@ -134,3 +168,3 @@ * Combine query | ||
*/ | ||
combineWith(searchQuery) { | ||
SearchQuery.prototype.combineWith = function (searchQuery) { | ||
if (searchQuery._searchRequest && searchQuery._searchRequest.query) { | ||
@@ -143,3 +177,3 @@ this.addQuery(searchQuery._searchRequest.query); | ||
} | ||
} | ||
}; | ||
/** | ||
@@ -149,9 +183,9 @@ * ozone QueryStringQuery | ||
*/ | ||
quicksearch(searchString) { | ||
SearchQuery.prototype.quicksearch = function (searchString) { | ||
return this.addQuery({ | ||
'$type': 'QueryStringQuery', | ||
field: '_quicksearch', | ||
queryString: `${searchString}*` | ||
queryString: searchString + "*" | ||
}); | ||
} | ||
}; | ||
/** | ||
@@ -164,3 +198,4 @@ * search for a term in a field | ||
*/ | ||
termQuery(field, value, ignoreCase = false) { | ||
SearchQuery.prototype.termQuery = function (field, value, ignoreCase) { | ||
if (ignoreCase === void 0) { ignoreCase = false; } | ||
return this.addQuery({ | ||
@@ -170,12 +205,16 @@ '$type': 'TermQuery', | ||
value: value, | ||
ignoreCase | ||
ignoreCase: ignoreCase | ||
}); | ||
} | ||
termsQuery(field, ...values) { | ||
}; | ||
SearchQuery.prototype.termsQuery = function (field) { | ||
var values = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
values[_i - 1] = arguments[_i]; | ||
} | ||
return this.addQuery({ | ||
'$type': 'TermsQuery', | ||
field, | ||
values | ||
field: field, | ||
values: values | ||
}); | ||
} | ||
}; | ||
/** | ||
@@ -187,5 +226,9 @@ * search inside a type. | ||
*/ | ||
typeQuery(...typeIdentifiers) { | ||
return this.genericTypeQuery(false, ...typeIdentifiers); | ||
} | ||
SearchQuery.prototype.typeQuery = function () { | ||
var typeIdentifiers = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
typeIdentifiers[_i] = arguments[_i]; | ||
} | ||
return this.genericTypeQuery.apply(this, [false].concat(typeIdentifiers)); | ||
}; | ||
/** | ||
@@ -196,14 +239,14 @@ * search array of ids | ||
*/ | ||
idsQuery(ids) { | ||
SearchQuery.prototype.idsQuery = function (ids) { | ||
return this.addQuery({ | ||
'$type': 'IdsQuery', | ||
ids | ||
ids: ids | ||
}); | ||
} | ||
existsQuery(field) { | ||
}; | ||
SearchQuery.prototype.existsQuery = function (field) { | ||
return this.addQuery({ | ||
'$type': 'ExistsQuery', | ||
field | ||
field: field | ||
}); | ||
} | ||
}; | ||
/** | ||
@@ -214,5 +257,9 @@ * search inside a type and it's subtype | ||
*/ | ||
typeQueryWithSubType(...typeIdentifiers) { | ||
return this.genericTypeQuery(true, ...typeIdentifiers); | ||
} | ||
SearchQuery.prototype.typeQueryWithSubType = function () { | ||
var typeIdentifiers = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
typeIdentifiers[_i] = arguments[_i]; | ||
} | ||
return this.genericTypeQuery.apply(this, [true].concat(typeIdentifiers)); | ||
}; | ||
/** | ||
@@ -224,3 +271,7 @@ * Search inside a type | ||
*/ | ||
genericTypeQuery(includeSubTypes, ...typeIdentifiers) { | ||
SearchQuery.prototype.genericTypeQuery = function (includeSubTypes) { | ||
var typeIdentifiers = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
typeIdentifiers[_i - 1] = arguments[_i]; | ||
} | ||
return this.addQuery({ | ||
@@ -231,3 +282,3 @@ '$type': 'TypeQuery', | ||
}); | ||
} | ||
}; | ||
/** | ||
@@ -239,3 +290,3 @@ * Search inside a tenant | ||
*/ | ||
tenantQuery(mode, tenantId) { | ||
SearchQuery.prototype.tenantQuery = function (mode, tenantId) { | ||
return this.addQuery({ | ||
@@ -246,3 +297,3 @@ '$type': 'TenantQuery', | ||
}); | ||
} | ||
}; | ||
/** | ||
@@ -255,4 +306,5 @@ * Search for auto complete | ||
*/ | ||
suggestion(searchString, lastTerm = '', size) { | ||
const suggestSize = size || this.size; | ||
SearchQuery.prototype.suggestion = function (searchString, lastTerm, size) { | ||
if (lastTerm === void 0) { lastTerm = ''; } | ||
var suggestSize = size || this.size; | ||
this._searchRequest.aggregations = [{ | ||
@@ -264,6 +316,6 @@ '$type': 'TermsAggregation', | ||
size: suggestSize, | ||
includePattern: `${lastTerm}.*` | ||
includePattern: lastTerm + ".*" | ||
}]; | ||
return this.quicksearch(searchString); | ||
} | ||
}; | ||
/** | ||
@@ -275,5 +327,5 @@ * create a custom searchRequest. | ||
*/ | ||
custom(searchParam) { | ||
SearchQuery.prototype.custom = function (searchParam) { | ||
this._searchRequest = searchParam; | ||
} | ||
}; | ||
/** | ||
@@ -284,9 +336,9 @@ * Search in a range of value | ||
*/ | ||
rangeQuery(field, param) { | ||
const query = Object.assign({ | ||
SearchQuery.prototype.rangeQuery = function (field, param) { | ||
var query = Object.assign({ | ||
'$type': 'RangeQuery', | ||
field | ||
field: field | ||
}, param); | ||
return this.addQuery(query); | ||
} | ||
}; | ||
/** | ||
@@ -298,11 +350,12 @@ * Search with a regular expression | ||
*/ | ||
regexpQuery(field, regexp, ignoreCase = false) { | ||
const query = { | ||
SearchQuery.prototype.regexpQuery = function (field, regexp, ignoreCase) { | ||
if (ignoreCase === void 0) { ignoreCase = false; } | ||
var query = { | ||
'$type': 'RegexpQuery', | ||
field, | ||
regexp, | ||
ignoreCase | ||
field: field, | ||
regexp: regexp, | ||
ignoreCase: ignoreCase | ||
}; | ||
return this.addQuery(query); | ||
} | ||
}; | ||
/** | ||
@@ -320,12 +373,12 @@ * Matches documents that have fields matching a wildcard expression (not analyzed). | ||
*/ | ||
wildcardQuery(field, wildcard, ignoreCase, analyzed) { | ||
const query = { | ||
SearchQuery.prototype.wildcardQuery = function (field, wildcard, ignoreCase, analyzed) { | ||
var query = { | ||
'$type': 'WildcardQuery', | ||
field, | ||
wildcard, | ||
ignoreCase, | ||
analyzed | ||
field: field, | ||
wildcard: wildcard, | ||
ignoreCase: ignoreCase, | ||
analyzed: analyzed | ||
}; | ||
return this.addQuery(query); | ||
} | ||
}; | ||
/** | ||
@@ -336,5 +389,5 @@ * | ||
*/ | ||
addQuery(query) { | ||
SearchQuery.prototype.addQuery = function (query) { | ||
if (this._searchRequest.query && this._searchRequest.query.$type === 'BoolQuery') { | ||
const currentQuery = this._searchRequest.query; | ||
var currentQuery = this._searchRequest.query; | ||
if (currentQuery.mustClauses) { | ||
@@ -357,3 +410,3 @@ currentQuery.mustClauses.push(query); | ||
return this; | ||
} | ||
}; | ||
/** | ||
@@ -365,10 +418,10 @@ * function to an order on a field | ||
*/ | ||
addOrderOn(field, order) { | ||
SearchQuery.prototype.addOrderOn = function (field, order) { | ||
this._searchRequest.sorts = this._searchRequest.sorts || []; | ||
this._searchRequest.sorts.push({ | ||
field, | ||
order | ||
field: field, | ||
order: order | ||
}); | ||
return this; | ||
} | ||
}; | ||
/** | ||
@@ -380,14 +433,30 @@ * Short hand to field oder in chain configuration. | ||
*/ | ||
order(field) { | ||
SearchQuery.prototype.order = function (field) { | ||
return new OrderRequest(this, field); | ||
} | ||
} | ||
export class OrderRequest { | ||
constructor(request, field) { | ||
}; | ||
return SearchQuery; | ||
}()); | ||
exports.SearchQuery = SearchQuery; | ||
var OrderRequest = /** @class */ (function () { | ||
function OrderRequest(request, field) { | ||
this.request = request; | ||
this.field = field; | ||
} | ||
get ASC() { return this.request.addOrderOn(this.field, 'ASC'); } | ||
get DESC() { return this.request.addOrderOn(this.field, 'DESC'); } | ||
get NONE() { return this.request.addOrderOn(this.field, 'NONE'); } | ||
} | ||
Object.defineProperty(OrderRequest.prototype, "ASC", { | ||
get: function () { return this.request.addOrderOn(this.field, 'ASC'); }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(OrderRequest.prototype, "DESC", { | ||
get: function () { return this.request.addOrderOn(this.field, 'DESC'); }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(OrderRequest.prototype, "NONE", { | ||
get: function () { return this.request.addOrderOn(this.field, 'NONE'); }, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
return OrderRequest; | ||
}()); | ||
exports.OrderRequest = OrderRequest; |
@@ -1,12 +0,14 @@ | ||
import { SearchQuery } from '../src/ozone-search-helper'; | ||
import { expect } from 'chai'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var ozone_search_helper_1 = require("../src/ozone-search-helper"); | ||
var chai_1 = require("chai"); | ||
describe('ozone-search-helper', function () { | ||
it('SearchQuery is exposed as a global class', function () { | ||
const mySearchQuery = new SearchQuery(); | ||
expect(mySearchQuery).to.be.an.instanceof(SearchQuery); | ||
var mySearchQuery = new ozone_search_helper_1.SearchQuery(); | ||
chai_1.expect(mySearchQuery).to.be.an.instanceof(ozone_search_helper_1.SearchQuery); | ||
}); | ||
it('SearchGenerator quicksearch', function () { | ||
const searchQuery = new SearchQuery(); | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.quicksearch('search value'); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -21,5 +23,5 @@ query: { | ||
it('SearchGenerator suggestion', function () { | ||
const searchQuery = new SearchQuery(); | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.suggestion('search value', 'new'); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -42,6 +44,6 @@ query: { | ||
it('SearchGenerator tenant', function () { | ||
const searchQuery = new SearchQuery(); | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.tenantQuery('OWN_AND_PARENTS', 'my_tenantId'); | ||
console.log(searchQuery.searchQuery); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -55,11 +57,11 @@ query: { | ||
}); | ||
it('SearchGenerator custom', () => { | ||
const searchQuery = new SearchQuery(); | ||
it('SearchGenerator custom', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.custom({ size: 8 }); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ size: 8 }); | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ size: 8 }); | ||
}); | ||
it('SearchGenerator termQuery', () => { | ||
const searchQuery = new SearchQuery(); | ||
it('SearchGenerator termQuery', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.termQuery('myField', 'aText'); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -74,6 +76,6 @@ query: { | ||
}); | ||
it('SearchGenerator typeQuery', () => { | ||
const searchQuery = new SearchQuery(); | ||
searchQuery.typeQuery(...['type1', 'type2']); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
it('SearchGenerator typeQuery', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.typeQuery.apply(searchQuery, ['type1', 'type2']); | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -87,6 +89,6 @@ query: { | ||
}); | ||
it('SearchGenerator typeQueryWithSubType', () => { | ||
const searchQuery = new SearchQuery(); | ||
searchQuery.typeQueryWithSubType(...['type1', 'type2']); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
it('SearchGenerator typeQueryWithSubType', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.typeQueryWithSubType.apply(searchQuery, ['type1', 'type2']); | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -100,7 +102,7 @@ query: { | ||
}); | ||
describe('SearchGenerator should combine queries', () => { | ||
it('typeQuery and TermQuery', () => { | ||
const searchQuery = new SearchQuery(); | ||
describe('SearchGenerator should combine queries', function () { | ||
it('typeQuery and TermQuery', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.typeQuery('aType').and.quicksearch('hello'); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -124,6 +126,6 @@ query: { | ||
}); | ||
it('TypeQuery or quicksearch', () => { | ||
const searchQuery = new SearchQuery(); | ||
it('TypeQuery or quicksearch', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.typeQuery('aType').or.quicksearch('hello'); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -147,8 +149,8 @@ query: { | ||
}); | ||
it('(typeQuery or quicksearch) and termQuery', () => { | ||
const searchQuery = new SearchQuery(); | ||
it('(typeQuery or quicksearch) and termQuery', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.typeQuery('aType') | ||
.or.quicksearch('hello') | ||
.and.termQuery('myField', 'aText'); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -183,8 +185,8 @@ query: { | ||
}); | ||
it('(typeQuery or quicksearch or termQuery)', () => { | ||
const searchQuery = new SearchQuery(); | ||
it('(typeQuery or quicksearch or termQuery)', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.typeQuery('aType') | ||
.or.quicksearch('hello') | ||
.termQuery('myField', 'aText'); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -215,7 +217,7 @@ query: { | ||
}); | ||
describe('should order', () => { | ||
it('search and order ascending', () => { | ||
const searchQuery = new SearchQuery(); | ||
describe('should order', function () { | ||
it('search and order ascending', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.termQuery('myField', 'aText').order('aField').ASC; | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -236,6 +238,6 @@ query: { | ||
}); | ||
it('order ascending and search', () => { | ||
const searchQuery = new SearchQuery(); | ||
it('order ascending and search', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.order('aField').ASC.termQuery('myField', 'aText', true); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -256,6 +258,6 @@ query: { | ||
}); | ||
it('order descending', () => { | ||
const searchQuery = new SearchQuery(); | ||
it('order descending', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.order('aField').DESC.termQuery('myField', 'aText'); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -276,8 +278,8 @@ query: { | ||
}); | ||
it('compose order', () => { | ||
const searchQuery = new SearchQuery(); | ||
it('compose order', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.order('aField').ASC.termQuery('myField', 'aText') | ||
.order('bField').DESC | ||
.order('cField').NONE; | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -307,10 +309,10 @@ query: { | ||
}); | ||
describe('combineWith order', () => { | ||
it('shoud combine two query', () => { | ||
const searchQuery = new SearchQuery(); | ||
const searchQueryToCombine = new SearchQuery(); | ||
describe('combineWith order', function () { | ||
it('shoud combine two query', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
var searchQueryToCombine = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.termQuery('myField', 'aText').order('aField').ASC; | ||
searchQueryToCombine.termQuery('otherField', 'aValue'); | ||
searchQuery.or.combineWith(searchQueryToCombine); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -342,9 +344,9 @@ query: { | ||
}); | ||
it('shoud combine two BoolQuery query', () => { | ||
const searchQuery = new SearchQuery(); | ||
const searchQueryToCombine = new SearchQuery(); | ||
it('shoud combine two BoolQuery query', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
var searchQueryToCombine = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.termQuery('myField', 'aText').order('aField').ASC; | ||
searchQueryToCombine.not.termQuery('otherField', 'aValue'); | ||
searchQuery.and.combineWith(searchQueryToCombine); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -382,7 +384,7 @@ query: { | ||
}); | ||
describe('rangeQuery', () => { | ||
it('should create a range query', () => { | ||
const searchQuery = new SearchQuery(); | ||
describe('rangeQuery', function () { | ||
it('should create a range query', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.rangeQuery('aField', { from: 1, to: 2 }); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -398,7 +400,7 @@ query: { | ||
}); | ||
describe('regexpQuery', () => { | ||
it('should create a RegexpQuery', () => { | ||
const searchQuery = new SearchQuery(); | ||
describe('regexpQuery', function () { | ||
it('should create a RegexpQuery', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.regexpQuery('aField', 'match.*', true); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -414,7 +416,7 @@ query: { | ||
}); | ||
describe('wildcardQuery', () => { | ||
it('should create a WildcardQuery', () => { | ||
const searchQuery = new SearchQuery(); | ||
describe('wildcardQuery', function () { | ||
it('should create a WildcardQuery', function () { | ||
var searchQuery = new ozone_search_helper_1.SearchQuery(); | ||
searchQuery.wildcardQuery('aField', 'match'); | ||
expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
chai_1.expect(JSON.parse(searchQuery.searchQuery)).to.be.deep.equal({ | ||
size: 10, | ||
@@ -421,0 +423,0 @@ query: { |
{ | ||
"name": "ozone-search-helper", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"publishConfig": { | ||
@@ -26,5 +26,5 @@ "access": "public" | ||
"devDependencies": { | ||
"ozone-type": "^6.0.0" | ||
"ozone-type": "^6.0.1" | ||
}, | ||
"gitHead": "1c98ef43283bbd0b01a06b4c36cbdf9fa2a47ef6" | ||
"gitHead": "04ca4f3e497426c77b6a8da61034c959770f6fe6" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
6508929
173
63710
5