Socket
Socket
Sign inDemoInstall

elastic-dsl-typescript

Package Overview
Dependencies
0
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.3 to 1.1.4

2

package.json
{
"name": "elastic-dsl-typescript",
"version": "1.1.3",
"version": "1.1.4",
"description": "Node.js ElasticSearch search query builder",

@@ -5,0 +5,0 @@ "main": "./",

@@ -19,3 +19,3 @@ import { AbstractBulder } from '../Abstract/AbstractBuilder';

*/
addProps<K extends keyof Omit<RawQuery, "query">>(prop: K, data: RawQuery[K]): this;
addProps<K extends keyof Omit<RawQuery, 'query'>>(prop: K, data: RawQuery[K]): this;
/**

@@ -40,4 +40,6 @@ * Create query (match,bool, etc...)

*/
build(): object;
build(opts?: Partial<{
withoutAggs: boolean;
}>): object;
isNotEmty(): boolean;
}

@@ -41,3 +41,3 @@ "use strict";

get bool() {
if (this.isNotExistInQuery("bool")) {
if (this.isNotExistInQuery('bool')) {
this._query.bool = new Bool_1.Bool();

@@ -61,11 +61,14 @@ }

*/
build() {
build(opts = {}) {
const { withoutAggs } = opts;
const obj = {};
for (const [prop, val] of Object.entries(this._props)) {
switch (prop) {
case "query": {
case 'query': {
break;
}
case "aggs": {
obj[prop] = val.build();
case 'aggs': {
if (!withoutAggs) {
obj[prop] = val.build();
}
break;

@@ -86,5 +89,5 @@ }

}
obj["query"] = query;
obj['query'] = query;
if (this._post_filter.isNotEmty()) {
obj["post_filter"] = this._post_filter.build();
obj['post_filter'] = this._post_filter.build();
}

@@ -91,0 +94,0 @@ return obj;

@@ -11,4 +11,4 @@ import { AbstractBulder } from '../Abstract/AbstractBuilder';

export class Query<BOOL_SCHEMA extends BoolSchema> extends AbstractBulder {
private _props: Omit<RawQuery, "query"> = {};
private _query: RawQuery["query"] = {};
private _props: Omit<RawQuery, 'query'> = {};
private _query: RawQuery['query'] = {};
private _post_filter: Bool = new Bool<BoolSchema>();

@@ -22,3 +22,3 @@

*/
public addProps<K extends keyof Omit<RawQuery, "query">>(prop: K, data: RawQuery[K]) {
public addProps<K extends keyof Omit<RawQuery, 'query'>>(prop: K, data: RawQuery[K]) {
this._props[prop] = data;

@@ -44,3 +44,3 @@ return this;

get bool(): Bool<BOOL_SCHEMA> {
if (this.isNotExistInQuery("bool")) {
if (this.isNotExistInQuery('bool')) {
this._query.bool = new Bool();

@@ -60,3 +60,3 @@ }

private isNotExistInQuery(prop: keyof RawQuery["query"]) {
private isNotExistInQuery(prop: keyof RawQuery['query']) {
return !(prop in this._query);

@@ -69,11 +69,15 @@ }

*/
public build(): object {
public build(opts: Partial<{ withoutAggs: boolean }> = {}): object {
const { withoutAggs } = opts;
const obj = {};
for (const [prop, val] of Object.entries(this._props)) {
switch (prop) {
case "query": {
case 'query': {
break;
}
case "aggs": {
obj[prop] = (val as AbstractBulder).build();
case 'aggs': {
if (!withoutAggs) {
obj[prop] = (val as AbstractBulder).build();
}
break;

@@ -94,5 +98,5 @@ }

}
obj["query"] = query;
obj['query'] = query;
if (this._post_filter.isNotEmty()) {
obj["post_filter"] = this._post_filter.build();
obj['post_filter'] = this._post_filter.build();
}

@@ -99,0 +103,0 @@ return obj;

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc