@dotcms/client 0.0.1-alpha.3 → 0.0.1-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/package.json +7 -3
- package/src/index.d.ts +6 -2
- package/src/index.js +6 -2
- package/src/index.js.map +1 -1
- package/src/lib/client/content/builders/collection/collection.d.ts +148 -0
- package/src/lib/client/content/builders/collection/collection.js +264 -0
- package/src/lib/client/content/builders/collection/collection.js.map +1 -0
- package/src/lib/client/content/content-api.d.ts +78 -0
- package/src/lib/client/content/content-api.js +87 -0
- package/src/lib/client/content/content-api.js.map +1 -0
- package/src/lib/client/content/shared/const.d.ts +3 -0
- package/src/lib/client/content/shared/const.js +5 -0
- package/src/lib/client/content/shared/const.js.map +1 -0
- package/src/lib/client/content/shared/types.d.ts +62 -0
- package/src/lib/client/content/shared/types.js +2 -0
- package/src/lib/client/content/shared/types.js.map +1 -0
- package/src/lib/client/content/shared/utils.d.ts +12 -0
- package/src/lib/client/content/shared/utils.js +20 -0
- package/src/lib/client/content/shared/utils.js.map +1 -0
- package/src/lib/client/models/index.d.ts +1 -0
- package/src/lib/client/models/index.js +9 -0
- package/src/lib/client/models/index.js.map +1 -0
- package/src/lib/client/models/types.d.ts +5 -0
- package/src/lib/client/models/types.js +2 -0
- package/src/lib/client/models/types.js.map +1 -0
- package/src/lib/{sdk-js-client.d.ts → client/sdk-js-client.d.ts} +33 -23
- package/src/lib/{sdk-js-client.js → client/sdk-js-client.js} +87 -38
- package/src/lib/client/sdk-js-client.js.map +1 -0
- package/src/lib/editor/listeners/listeners.d.ts +46 -0
- package/src/lib/editor/listeners/listeners.js +180 -0
- package/src/lib/editor/listeners/listeners.js.map +1 -0
- package/src/lib/{postMessageToEditor.d.ts → editor/models/client.model.d.ts} +33 -1
- package/src/lib/editor/models/client.model.js +73 -0
- package/src/lib/editor/models/client.model.js.map +1 -0
- package/src/lib/editor/models/editor.model.d.ts +49 -0
- package/src/lib/editor/models/editor.model.js +2 -0
- package/src/lib/editor/models/editor.model.js.map +1 -0
- package/src/lib/editor/models/listeners.model.d.ts +47 -0
- package/src/lib/editor/models/listeners.model.js +26 -0
- package/src/lib/editor/models/listeners.model.js.map +1 -0
- package/src/lib/editor/sdk-editor-vtl.d.ts +6 -0
- package/src/lib/editor/sdk-editor-vtl.js +20 -0
- package/src/lib/editor/sdk-editor-vtl.js.map +1 -0
- package/src/lib/editor/sdk-editor.d.ts +29 -0
- package/src/lib/editor/sdk-editor.js +65 -0
- package/src/lib/editor/sdk-editor.js.map +1 -0
- package/src/lib/editor/utils/editor.utils.d.ts +83 -0
- package/src/lib/editor/utils/editor.utils.js +134 -0
- package/src/lib/editor/utils/editor.utils.js.map +1 -0
- package/src/lib/query-builder/lucene-syntax/Equals.d.ts +83 -0
- package/src/lib/query-builder/lucene-syntax/Equals.js +101 -0
- package/src/lib/query-builder/lucene-syntax/Equals.js.map +1 -0
- package/src/lib/query-builder/lucene-syntax/Field.d.ts +23 -0
- package/src/lib/query-builder/lucene-syntax/Field.js +31 -0
- package/src/lib/query-builder/lucene-syntax/Field.js.map +1 -0
- package/src/lib/query-builder/lucene-syntax/NotOperand.d.ts +22 -0
- package/src/lib/query-builder/lucene-syntax/NotOperand.js +30 -0
- package/src/lib/query-builder/lucene-syntax/NotOperand.js.map +1 -0
- package/src/lib/query-builder/lucene-syntax/Operand.d.ts +44 -0
- package/src/lib/query-builder/lucene-syntax/Operand.js +55 -0
- package/src/lib/query-builder/lucene-syntax/Operand.js.map +1 -0
- package/src/lib/query-builder/lucene-syntax/index.d.ts +4 -0
- package/src/lib/query-builder/lucene-syntax/index.js +5 -0
- package/src/lib/query-builder/lucene-syntax/index.js.map +1 -0
- package/src/lib/query-builder/sdk-query-builder.d.ts +42 -0
- package/src/lib/query-builder/sdk-query-builder.js +54 -0
- package/src/lib/query-builder/sdk-query-builder.js.map +1 -0
- package/src/lib/query-builder/utils/index.d.ts +91 -0
- package/src/lib/query-builder/utils/index.js +115 -0
- package/src/lib/query-builder/utils/index.js.map +1 -0
- package/src/lib/utils/graphql/transforms.d.ts +11 -0
- package/src/lib/utils/graphql/transforms.js +52 -0
- package/src/lib/utils/graphql/transforms.js.map +1 -0
- package/src/lib/utils/index.d.ts +2 -0
- package/src/lib/utils/index.js +3 -0
- package/src/lib/utils/index.js.map +1 -0
- package/src/lib/utils/page/common-utils.d.ts +14 -0
- package/src/lib/utils/page/common-utils.js +12 -0
- package/src/lib/utils/page/common-utils.js.map +1 -0
- package/src/lib/postMessageToEditor.js +0 -41
- package/src/lib/postMessageToEditor.js.map +0 -1
- package/src/lib/sdk-js-client.js.map +0 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Field } from './Field';
|
|
2
|
+
import { NotOperand } from './NotOperand';
|
|
3
|
+
import { Operand } from './Operand';
|
|
4
|
+
/**
|
|
5
|
+
* 'Equal' Is a Typescript class that provides the ability to use terms in the lucene query string.
|
|
6
|
+
* A term is a value used to search for a specific value in a document. It can be a word or a phrase.
|
|
7
|
+
*
|
|
8
|
+
* Ex: myValue or "My Value"
|
|
9
|
+
*
|
|
10
|
+
* @export
|
|
11
|
+
* @class Equal
|
|
12
|
+
*/
|
|
13
|
+
export declare class Equals {
|
|
14
|
+
#private;
|
|
15
|
+
private query;
|
|
16
|
+
constructor(query: string);
|
|
17
|
+
/**
|
|
18
|
+
* This method appends to the query a term that should be excluded in the search.
|
|
19
|
+
*
|
|
20
|
+
* Ex: "-myValue"
|
|
21
|
+
*
|
|
22
|
+
* @param {string} field - The field that should be excluded in the search.
|
|
23
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
24
|
+
* @memberof Equal
|
|
25
|
+
*/
|
|
26
|
+
excludeField(field: string): Field;
|
|
27
|
+
/**
|
|
28
|
+
* This method appends to the query a field that should be included in the search.
|
|
29
|
+
*
|
|
30
|
+
* Ex: "+myField:"
|
|
31
|
+
*
|
|
32
|
+
* @param {string} field - The field that should be included in the search.
|
|
33
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
34
|
+
* @memberof Equal
|
|
35
|
+
*/
|
|
36
|
+
field(field: string): Field;
|
|
37
|
+
/**
|
|
38
|
+
* This method appends to the query an operand to use logic operators in the query.
|
|
39
|
+
*
|
|
40
|
+
* Ex: "OR"
|
|
41
|
+
*
|
|
42
|
+
* @return {*} {Operand} - An instance of a Lucene Operand. An operand is a logical operator used to combine terms or phrases in a query.
|
|
43
|
+
* @memberof Equal
|
|
44
|
+
*/
|
|
45
|
+
or(): Operand;
|
|
46
|
+
/**
|
|
47
|
+
* This method appends to the query an operand to use logic operators in the query.
|
|
48
|
+
*
|
|
49
|
+
* Ex: "AND"
|
|
50
|
+
*
|
|
51
|
+
* @return {*} {Operand} - An instance of a Lucene Operand. An operand is a logical operator used to combine terms or phrases in a query.
|
|
52
|
+
* @memberof Equal
|
|
53
|
+
*/
|
|
54
|
+
and(): Operand;
|
|
55
|
+
/**
|
|
56
|
+
* This method appends to the query an operand to use logic operators in the query.
|
|
57
|
+
*
|
|
58
|
+
* Ex: "NOT"
|
|
59
|
+
*
|
|
60
|
+
* @return {*} {NotOperand} - An instance of a Lucene Not Operand. A not operand is a logical operator used to exclude terms or phrases in a query.
|
|
61
|
+
* @memberof Equal
|
|
62
|
+
*/
|
|
63
|
+
not(): NotOperand;
|
|
64
|
+
/**
|
|
65
|
+
* This method allows to pass a raw query string to the query builder.
|
|
66
|
+
* This raw query should end in a Lucene Equal.
|
|
67
|
+
* This method is useful when you want to append a complex query or an already written query to the query builder.
|
|
68
|
+
*
|
|
69
|
+
* Ex: "+myField: value AND (someOtherValue OR anotherValue)"
|
|
70
|
+
*
|
|
71
|
+
* @param {string} query - A raw query string.
|
|
72
|
+
* @return {*} {Equal} - An instance of a Lucene Equal. A term is a value used to search for a specific value in a document.
|
|
73
|
+
* @memberof QueryBuilder
|
|
74
|
+
*/
|
|
75
|
+
raw(query: string): Equals;
|
|
76
|
+
/**
|
|
77
|
+
* This method returns the final query string.
|
|
78
|
+
*
|
|
79
|
+
* @return {*} {string} - The final query string.
|
|
80
|
+
* @memberof Equal
|
|
81
|
+
*/
|
|
82
|
+
build(): string;
|
|
83
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var _Equals_query;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
import { OPERAND, buildExcludeField, buildField, buildNotOperand, buildOperand, buildRawEquals, sanitizeQuery } from '../utils';
|
|
4
|
+
/**
|
|
5
|
+
* 'Equal' Is a Typescript class that provides the ability to use terms in the lucene query string.
|
|
6
|
+
* A term is a value used to search for a specific value in a document. It can be a word or a phrase.
|
|
7
|
+
*
|
|
8
|
+
* Ex: myValue or "My Value"
|
|
9
|
+
*
|
|
10
|
+
* @export
|
|
11
|
+
* @class Equal
|
|
12
|
+
*/
|
|
13
|
+
export class Equals {
|
|
14
|
+
constructor(query) {
|
|
15
|
+
this.query = query;
|
|
16
|
+
_Equals_query.set(this, '');
|
|
17
|
+
__classPrivateFieldSet(this, _Equals_query, this.query, "f");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* This method appends to the query a term that should be excluded in the search.
|
|
21
|
+
*
|
|
22
|
+
* Ex: "-myValue"
|
|
23
|
+
*
|
|
24
|
+
* @param {string} field - The field that should be excluded in the search.
|
|
25
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
26
|
+
* @memberof Equal
|
|
27
|
+
*/
|
|
28
|
+
excludeField(field) {
|
|
29
|
+
return buildExcludeField(__classPrivateFieldGet(this, _Equals_query, "f"), field);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* This method appends to the query a field that should be included in the search.
|
|
33
|
+
*
|
|
34
|
+
* Ex: "+myField:"
|
|
35
|
+
*
|
|
36
|
+
* @param {string} field - The field that should be included in the search.
|
|
37
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
38
|
+
* @memberof Equal
|
|
39
|
+
*/
|
|
40
|
+
field(field) {
|
|
41
|
+
return buildField(__classPrivateFieldGet(this, _Equals_query, "f"), field);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* This method appends to the query an operand to use logic operators in the query.
|
|
45
|
+
*
|
|
46
|
+
* Ex: "OR"
|
|
47
|
+
*
|
|
48
|
+
* @return {*} {Operand} - An instance of a Lucene Operand. An operand is a logical operator used to combine terms or phrases in a query.
|
|
49
|
+
* @memberof Equal
|
|
50
|
+
*/
|
|
51
|
+
or() {
|
|
52
|
+
return buildOperand(__classPrivateFieldGet(this, _Equals_query, "f"), OPERAND.OR);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* This method appends to the query an operand to use logic operators in the query.
|
|
56
|
+
*
|
|
57
|
+
* Ex: "AND"
|
|
58
|
+
*
|
|
59
|
+
* @return {*} {Operand} - An instance of a Lucene Operand. An operand is a logical operator used to combine terms or phrases in a query.
|
|
60
|
+
* @memberof Equal
|
|
61
|
+
*/
|
|
62
|
+
and() {
|
|
63
|
+
return buildOperand(__classPrivateFieldGet(this, _Equals_query, "f"), OPERAND.AND);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* This method appends to the query an operand to use logic operators in the query.
|
|
67
|
+
*
|
|
68
|
+
* Ex: "NOT"
|
|
69
|
+
*
|
|
70
|
+
* @return {*} {NotOperand} - An instance of a Lucene Not Operand. A not operand is a logical operator used to exclude terms or phrases in a query.
|
|
71
|
+
* @memberof Equal
|
|
72
|
+
*/
|
|
73
|
+
not() {
|
|
74
|
+
return buildNotOperand(__classPrivateFieldGet(this, _Equals_query, "f"));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* This method allows to pass a raw query string to the query builder.
|
|
78
|
+
* This raw query should end in a Lucene Equal.
|
|
79
|
+
* This method is useful when you want to append a complex query or an already written query to the query builder.
|
|
80
|
+
*
|
|
81
|
+
* Ex: "+myField: value AND (someOtherValue OR anotherValue)"
|
|
82
|
+
*
|
|
83
|
+
* @param {string} query - A raw query string.
|
|
84
|
+
* @return {*} {Equal} - An instance of a Lucene Equal. A term is a value used to search for a specific value in a document.
|
|
85
|
+
* @memberof QueryBuilder
|
|
86
|
+
*/
|
|
87
|
+
raw(query) {
|
|
88
|
+
return buildRawEquals(__classPrivateFieldGet(this, _Equals_query, "f"), query);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* This method returns the final query string.
|
|
92
|
+
*
|
|
93
|
+
* @return {*} {string} - The final query string.
|
|
94
|
+
* @memberof Equal
|
|
95
|
+
*/
|
|
96
|
+
build() {
|
|
97
|
+
return sanitizeQuery(__classPrivateFieldGet(this, _Equals_query, "f"));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
_Equals_query = new WeakMap();
|
|
101
|
+
//# sourceMappingURL=Equals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Equals.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/query-builder/lucene-syntax/Equals.ts"],"names":[],"mappings":";;AAIA,OAAO,EACH,OAAO,EACP,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,EAChB,MAAM,UAAU,CAAC;AAElB;;;;;;;;GAQG;AACH,MAAM,OAAO,MAAM;IAGf,YAAoB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QAFjC,wBAAS,EAAE,EAAC;QAGR,uBAAA,IAAI,iBAAU,IAAI,CAAC,KAAK,MAAA,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,KAAa;QACtB,OAAO,iBAAiB,CAAC,uBAAA,IAAI,qBAAO,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAa;QACf,OAAO,UAAU,CAAC,uBAAA,IAAI,qBAAO,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;OAOG;IACH,EAAE;QACE,OAAO,YAAY,CAAC,uBAAA,IAAI,qBAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;OAOG;IACH,GAAG;QACC,OAAO,YAAY,CAAC,uBAAA,IAAI,qBAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;;OAOG;IACH,GAAG;QACC,OAAO,eAAe,CAAC,uBAAA,IAAI,qBAAO,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;OAUG;IACH,GAAG,CAAC,KAAa;QACb,OAAO,cAAc,CAAC,uBAAA,IAAI,qBAAO,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACH,KAAK;QACD,OAAO,aAAa,CAAC,uBAAA,IAAI,qBAAO,CAAC,CAAC;IACtC,CAAC;CACJ"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Equals } from './Equals';
|
|
2
|
+
/**
|
|
3
|
+
* 'Field' class is used to build a query with a field.
|
|
4
|
+
* A Lucene Field is a key used to search for a specific value in a document.
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @class Field
|
|
8
|
+
*/
|
|
9
|
+
export declare class Field {
|
|
10
|
+
#private;
|
|
11
|
+
private query;
|
|
12
|
+
constructor(query: string);
|
|
13
|
+
/**
|
|
14
|
+
* This method appends to the query a term that should be included in the search..
|
|
15
|
+
*
|
|
16
|
+
* Ex: myValue or "My value"
|
|
17
|
+
*
|
|
18
|
+
* @param {string} term - The term that should be included in the search.
|
|
19
|
+
* @return {*} {Equals} - An instance of Equals.
|
|
20
|
+
* @memberof Field
|
|
21
|
+
*/
|
|
22
|
+
equals(term: string): Equals;
|
|
23
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var _Field_query;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
import { buildEquals } from '../utils';
|
|
4
|
+
/**
|
|
5
|
+
* 'Field' class is used to build a query with a field.
|
|
6
|
+
* A Lucene Field is a key used to search for a specific value in a document.
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @class Field
|
|
10
|
+
*/
|
|
11
|
+
export class Field {
|
|
12
|
+
constructor(query) {
|
|
13
|
+
this.query = query;
|
|
14
|
+
_Field_query.set(this, '');
|
|
15
|
+
__classPrivateFieldSet(this, _Field_query, this.query, "f");
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* This method appends to the query a term that should be included in the search..
|
|
19
|
+
*
|
|
20
|
+
* Ex: myValue or "My value"
|
|
21
|
+
*
|
|
22
|
+
* @param {string} term - The term that should be included in the search.
|
|
23
|
+
* @return {*} {Equals} - An instance of Equals.
|
|
24
|
+
* @memberof Field
|
|
25
|
+
*/
|
|
26
|
+
equals(term) {
|
|
27
|
+
return buildEquals(__classPrivateFieldGet(this, _Field_query, "f"), term);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
_Field_query = new WeakMap();
|
|
31
|
+
//# sourceMappingURL=Field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/query-builder/lucene-syntax/Field.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,OAAO,KAAK;IAEd,YAAoB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QADjC,uBAAS,EAAE,EAAC;QAER,uBAAA,IAAI,gBAAU,IAAI,CAAC,KAAK,MAAA,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAY;QACf,OAAO,WAAW,CAAC,uBAAA,IAAI,oBAAO,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;CACJ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Equals } from './Equals';
|
|
2
|
+
/**
|
|
3
|
+
* 'NotOperand' Is a Typescript class that provides the ability to use the NOT operand in the lucene query string.
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @class NotOperand
|
|
7
|
+
*/
|
|
8
|
+
export declare class NotOperand {
|
|
9
|
+
#private;
|
|
10
|
+
private query;
|
|
11
|
+
constructor(query: string);
|
|
12
|
+
/**
|
|
13
|
+
* This method appends to the query a term that should be included in the search.
|
|
14
|
+
*
|
|
15
|
+
* Ex: myValue or "My value"
|
|
16
|
+
*
|
|
17
|
+
* @param {string} term - The term that should be included in the search.
|
|
18
|
+
* @return {*} {Equals} - An instance of Equals.
|
|
19
|
+
* @memberof NotOperand
|
|
20
|
+
*/
|
|
21
|
+
equals(term: string): Equals;
|
|
22
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var _NotOperand_query;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
import { buildEquals } from '../utils';
|
|
4
|
+
/**
|
|
5
|
+
* 'NotOperand' Is a Typescript class that provides the ability to use the NOT operand in the lucene query string.
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @class NotOperand
|
|
9
|
+
*/
|
|
10
|
+
export class NotOperand {
|
|
11
|
+
constructor(query) {
|
|
12
|
+
this.query = query;
|
|
13
|
+
_NotOperand_query.set(this, '');
|
|
14
|
+
__classPrivateFieldSet(this, _NotOperand_query, this.query, "f");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* This method appends to the query a term that should be included in the search.
|
|
18
|
+
*
|
|
19
|
+
* Ex: myValue or "My value"
|
|
20
|
+
*
|
|
21
|
+
* @param {string} term - The term that should be included in the search.
|
|
22
|
+
* @return {*} {Equals} - An instance of Equals.
|
|
23
|
+
* @memberof NotOperand
|
|
24
|
+
*/
|
|
25
|
+
equals(term) {
|
|
26
|
+
return buildEquals(__classPrivateFieldGet(this, _NotOperand_query, "f"), term);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
_NotOperand_query = new WeakMap();
|
|
30
|
+
//# sourceMappingURL=NotOperand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotOperand.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/query-builder/lucene-syntax/NotOperand.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IAGnB,YAAoB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QAFjC,4BAAS,EAAE,EAAC;QAGR,uBAAA,IAAI,qBAAU,IAAI,CAAC,KAAK,MAAA,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAY;QACf,OAAO,WAAW,CAAC,uBAAA,IAAI,yBAAO,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;CACJ"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Equals } from './Equals';
|
|
2
|
+
import { Field } from './Field';
|
|
3
|
+
/**
|
|
4
|
+
* 'Operand' Is a Typescript class that provides the ability to use operands in the lucene query string.}
|
|
5
|
+
* An operand is a logical operator used to join two or more conditions in a query.
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @class Operand
|
|
9
|
+
*/
|
|
10
|
+
export declare class Operand {
|
|
11
|
+
#private;
|
|
12
|
+
private query;
|
|
13
|
+
constructor(query: string);
|
|
14
|
+
/**
|
|
15
|
+
* This method appends to the query a term that should be excluded in the search.
|
|
16
|
+
*
|
|
17
|
+
* Ex: "-myValue"
|
|
18
|
+
*
|
|
19
|
+
* @param {string} field - The field that should be excluded in the search.
|
|
20
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
21
|
+
* @memberof Operand
|
|
22
|
+
*/
|
|
23
|
+
excludeField(field: string): Field;
|
|
24
|
+
/**
|
|
25
|
+
* This method appends to the query a field that should be included in the search.
|
|
26
|
+
*
|
|
27
|
+
* Ex: "+myField:"
|
|
28
|
+
*
|
|
29
|
+
* @param {string} field - The field that should be included in the search.
|
|
30
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
31
|
+
* @memberof Operand
|
|
32
|
+
*/
|
|
33
|
+
field(field: string): Field;
|
|
34
|
+
/**
|
|
35
|
+
* This method appends to the query a term that should be included in the search.
|
|
36
|
+
*
|
|
37
|
+
* Ex: myValue or "My value"
|
|
38
|
+
*
|
|
39
|
+
* @param {string} term - The term that should be included in the search.
|
|
40
|
+
* @return {*} {Equals} - An instance of Equals.
|
|
41
|
+
* @memberof Operand
|
|
42
|
+
*/
|
|
43
|
+
equals(term: string): Equals;
|
|
44
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var _Operand_query;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
import { buildExcludeField, buildField, buildEquals } from '../utils';
|
|
4
|
+
/**
|
|
5
|
+
* 'Operand' Is a Typescript class that provides the ability to use operands in the lucene query string.}
|
|
6
|
+
* An operand is a logical operator used to join two or more conditions in a query.
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @class Operand
|
|
10
|
+
*/
|
|
11
|
+
export class Operand {
|
|
12
|
+
constructor(query) {
|
|
13
|
+
this.query = query;
|
|
14
|
+
_Operand_query.set(this, '');
|
|
15
|
+
__classPrivateFieldSet(this, _Operand_query, this.query, "f");
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* This method appends to the query a term that should be excluded in the search.
|
|
19
|
+
*
|
|
20
|
+
* Ex: "-myValue"
|
|
21
|
+
*
|
|
22
|
+
* @param {string} field - The field that should be excluded in the search.
|
|
23
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
24
|
+
* @memberof Operand
|
|
25
|
+
*/
|
|
26
|
+
excludeField(field) {
|
|
27
|
+
return buildExcludeField(__classPrivateFieldGet(this, _Operand_query, "f"), field);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* This method appends to the query a field that should be included in the search.
|
|
31
|
+
*
|
|
32
|
+
* Ex: "+myField:"
|
|
33
|
+
*
|
|
34
|
+
* @param {string} field - The field that should be included in the search.
|
|
35
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
36
|
+
* @memberof Operand
|
|
37
|
+
*/
|
|
38
|
+
field(field) {
|
|
39
|
+
return buildField(__classPrivateFieldGet(this, _Operand_query, "f"), field);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* This method appends to the query a term that should be included in the search.
|
|
43
|
+
*
|
|
44
|
+
* Ex: myValue or "My value"
|
|
45
|
+
*
|
|
46
|
+
* @param {string} term - The term that should be included in the search.
|
|
47
|
+
* @return {*} {Equals} - An instance of Equals.
|
|
48
|
+
* @memberof Operand
|
|
49
|
+
*/
|
|
50
|
+
equals(term) {
|
|
51
|
+
return buildEquals(__classPrivateFieldGet(this, _Operand_query, "f"), term);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_Operand_query = new WeakMap();
|
|
55
|
+
//# sourceMappingURL=Operand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operand.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/query-builder/lucene-syntax/Operand.ts"],"names":[],"mappings":";;AAGA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,OAAO,OAAO;IAGhB,YAAoB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QAFjC,yBAAS,EAAE,EAAC;QAGR,uBAAA,IAAI,kBAAU,IAAI,CAAC,KAAK,MAAA,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,KAAa;QACtB,OAAO,iBAAiB,CAAC,uBAAA,IAAI,sBAAO,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAa;QACf,OAAO,UAAU,CAAC,uBAAA,IAAI,sBAAO,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAY;QACf,OAAO,WAAW,CAAC,uBAAA,IAAI,sBAAO,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/query-builder/lucene-syntax/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Equals, Field } from './lucene-syntax/index';
|
|
2
|
+
/**
|
|
3
|
+
* 'QueryBuilder' Is a Typescript class that provides the ability to build a query string using the Lucene syntax in a more readable way.
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @class QueryBuilder
|
|
7
|
+
*/
|
|
8
|
+
export declare class QueryBuilder {
|
|
9
|
+
#private;
|
|
10
|
+
/**
|
|
11
|
+
* This method appends to the query a field that should be included in the search.
|
|
12
|
+
*
|
|
13
|
+
* Ex: "+myField:"
|
|
14
|
+
*
|
|
15
|
+
* @param {string} field - The field that should be included in the search.
|
|
16
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
17
|
+
* @memberof QueryBuilder
|
|
18
|
+
*/
|
|
19
|
+
field(field: string): Field;
|
|
20
|
+
/**
|
|
21
|
+
* This method appends to the query a field that should be excluded from the search.
|
|
22
|
+
*
|
|
23
|
+
* Ex: "-myField:"
|
|
24
|
+
*
|
|
25
|
+
* @param {string} field - The field that should be excluded from the search.
|
|
26
|
+
* @return {*} {Field} - An instance of a Lucene Exclude Field. An exclude field is a key used to exclude for a specific value in a document.
|
|
27
|
+
* @memberof QueryBuilder
|
|
28
|
+
*/
|
|
29
|
+
excludeField(field: string): Field;
|
|
30
|
+
/**
|
|
31
|
+
* This method allows to pass a raw query string to the query builder.
|
|
32
|
+
* This raw query should end in Equals.
|
|
33
|
+
* This method is useful when you want to append a complex query or an already written query to the query builder.
|
|
34
|
+
*
|
|
35
|
+
* Ex: "+myField: value AND (someOtherValue OR anotherValue)"
|
|
36
|
+
*
|
|
37
|
+
* @param {string} query - A raw query string.
|
|
38
|
+
* @return {*} {Equals} - An instance of Equals. A term is a value used to search for a specific value in a document.
|
|
39
|
+
* @memberof QueryBuilder
|
|
40
|
+
*/
|
|
41
|
+
raw(query: string): Equals;
|
|
42
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var _QueryBuilder_query;
|
|
2
|
+
import { __classPrivateFieldGet } from "tslib";
|
|
3
|
+
import { buildExcludeField, buildField, buildRawEquals } from './utils';
|
|
4
|
+
/**
|
|
5
|
+
* 'QueryBuilder' Is a Typescript class that provides the ability to build a query string using the Lucene syntax in a more readable way.
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @class QueryBuilder
|
|
9
|
+
*/
|
|
10
|
+
export class QueryBuilder {
|
|
11
|
+
constructor() {
|
|
12
|
+
_QueryBuilder_query.set(this, '');
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* This method appends to the query a field that should be included in the search.
|
|
16
|
+
*
|
|
17
|
+
* Ex: "+myField:"
|
|
18
|
+
*
|
|
19
|
+
* @param {string} field - The field that should be included in the search.
|
|
20
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
21
|
+
* @memberof QueryBuilder
|
|
22
|
+
*/
|
|
23
|
+
field(field) {
|
|
24
|
+
return buildField(__classPrivateFieldGet(this, _QueryBuilder_query, "f"), field);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* This method appends to the query a field that should be excluded from the search.
|
|
28
|
+
*
|
|
29
|
+
* Ex: "-myField:"
|
|
30
|
+
*
|
|
31
|
+
* @param {string} field - The field that should be excluded from the search.
|
|
32
|
+
* @return {*} {Field} - An instance of a Lucene Exclude Field. An exclude field is a key used to exclude for a specific value in a document.
|
|
33
|
+
* @memberof QueryBuilder
|
|
34
|
+
*/
|
|
35
|
+
excludeField(field) {
|
|
36
|
+
return buildExcludeField(__classPrivateFieldGet(this, _QueryBuilder_query, "f"), field);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* This method allows to pass a raw query string to the query builder.
|
|
40
|
+
* This raw query should end in Equals.
|
|
41
|
+
* This method is useful when you want to append a complex query or an already written query to the query builder.
|
|
42
|
+
*
|
|
43
|
+
* Ex: "+myField: value AND (someOtherValue OR anotherValue)"
|
|
44
|
+
*
|
|
45
|
+
* @param {string} query - A raw query string.
|
|
46
|
+
* @return {*} {Equals} - An instance of Equals. A term is a value used to search for a specific value in a document.
|
|
47
|
+
* @memberof QueryBuilder
|
|
48
|
+
*/
|
|
49
|
+
raw(query) {
|
|
50
|
+
return buildRawEquals(__classPrivateFieldGet(this, _QueryBuilder_query, "f"), query);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
_QueryBuilder_query = new WeakMap();
|
|
54
|
+
//# sourceMappingURL=sdk-query-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-query-builder.js","sourceRoot":"","sources":["../../../../../../../libs/sdk/client/src/lib/query-builder/sdk-query-builder.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAExE;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IAAzB;QACI,8BAAS,EAAE,EAAC;IA0ChB,CAAC;IAxCG;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAa;QACf,OAAO,UAAU,CAAC,uBAAA,IAAI,2BAAO,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,KAAa;QACtB,OAAO,iBAAiB,CAAC,uBAAA,IAAI,2BAAO,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;;;OAUG;IACH,GAAG,CAAC,KAAa;QACb,OAAO,cAAc,CAAC,uBAAA,IAAI,2BAAO,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;CACJ"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Equals } from '../lucene-syntax/Equals';
|
|
2
|
+
import { Field } from '../lucene-syntax/Field';
|
|
3
|
+
import { NotOperand } from '../lucene-syntax/NotOperand';
|
|
4
|
+
import { Operand } from '../lucene-syntax/Operand';
|
|
5
|
+
/**
|
|
6
|
+
* Enum for common Operands
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @enum {number}
|
|
10
|
+
*/
|
|
11
|
+
export declare enum OPERAND {
|
|
12
|
+
OR = "OR",
|
|
13
|
+
AND = "AND",
|
|
14
|
+
NOT = "NOT"
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* This function removes extra spaces from a string.
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @param {string} str
|
|
21
|
+
* @return {*} {string}
|
|
22
|
+
*/
|
|
23
|
+
export declare function sanitizeQuery(str: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* This function sanitizes a term by adding quotes if it contains spaces.
|
|
26
|
+
* In lucene, a term with spaces should be enclosed in quotes.
|
|
27
|
+
*
|
|
28
|
+
* @export
|
|
29
|
+
* @param {string} term
|
|
30
|
+
* @return {*} {string}
|
|
31
|
+
*/
|
|
32
|
+
export declare function sanitizePhrases(term: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* This function builds a term to be used in a lucene query.
|
|
35
|
+
* We need to sanitize the term before adding it to the query.
|
|
36
|
+
*
|
|
37
|
+
* @export
|
|
38
|
+
* @param {string} query
|
|
39
|
+
* @param {string} term
|
|
40
|
+
* @return {*} {Equals}
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildEquals(query: string, term: string): Equals;
|
|
43
|
+
/**
|
|
44
|
+
* This function builds a term to be used in a lucene query.
|
|
45
|
+
* We need to sanitize the raw query before adding it to the query.
|
|
46
|
+
*
|
|
47
|
+
* @export
|
|
48
|
+
* @param {string} query
|
|
49
|
+
* @param {string} raw
|
|
50
|
+
* @return {*} {Equals}
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildRawEquals(query: string, raw: string): Equals;
|
|
53
|
+
/**
|
|
54
|
+
* This function builds a field to be used in a lucene query.
|
|
55
|
+
* We need to format the field before adding it to the query.
|
|
56
|
+
*
|
|
57
|
+
* @export
|
|
58
|
+
* @param {string} query
|
|
59
|
+
* @param {string} field
|
|
60
|
+
* @return {*} {Field}
|
|
61
|
+
*/
|
|
62
|
+
export declare function buildField(query: string, field: string): Field;
|
|
63
|
+
/**
|
|
64
|
+
* This function builds an exclude field to be used in a lucene query.
|
|
65
|
+
* We need to format the field before adding it to the query.
|
|
66
|
+
*
|
|
67
|
+
* @export
|
|
68
|
+
* @param {string} query
|
|
69
|
+
* @param {string} field
|
|
70
|
+
* @return {*} {Field}
|
|
71
|
+
*/
|
|
72
|
+
export declare function buildExcludeField(query: string, field: string): Field;
|
|
73
|
+
/**
|
|
74
|
+
* This function builds an operand to be used in a lucene query.
|
|
75
|
+
* We need to format the operand before adding it to the query.
|
|
76
|
+
*
|
|
77
|
+
* @export
|
|
78
|
+
* @param {string} query
|
|
79
|
+
* @param {OPERAND} operand
|
|
80
|
+
* @return {*} {Operand}
|
|
81
|
+
*/
|
|
82
|
+
export declare function buildOperand(query: string, operand: OPERAND): Operand;
|
|
83
|
+
/**
|
|
84
|
+
* This function builds a NOT operand to be used in a lucene query.
|
|
85
|
+
* We need to format the operand before adding it to the query.
|
|
86
|
+
*
|
|
87
|
+
* @export
|
|
88
|
+
* @param {string} query
|
|
89
|
+
* @return {*} {NotOperand}
|
|
90
|
+
*/
|
|
91
|
+
export declare function buildNotOperand(query: string): NotOperand;
|