@dotcms/client 0.0.1-alpha.40 → 0.0.1-alpha.41

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.
Files changed (53) hide show
  1. package/index.cjs.d.ts +1 -0
  2. package/index.cjs.default.js +1 -0
  3. package/index.cjs.js +1953 -0
  4. package/index.cjs.mjs +2 -0
  5. package/index.esm.d.ts +1 -0
  6. package/index.esm.js +1944 -0
  7. package/package.json +16 -4
  8. package/src/index.d.ts +6 -0
  9. package/src/lib/client/content/builders/collection/{collection.ts → collection.d.ts} +19 -209
  10. package/src/lib/client/content/{content-api.ts → content-api.d.ts} +4 -14
  11. package/src/lib/client/content/shared/{const.ts → const.d.ts} +3 -5
  12. package/src/lib/client/content/shared/{types.ts → types.d.ts} +2 -19
  13. package/src/lib/client/content/shared/{utils.ts → utils.d.ts} +1 -9
  14. package/src/lib/client/models/{index.ts → index.d.ts} +1 -8
  15. package/src/lib/client/models/{types.ts → types.d.ts} +0 -1
  16. package/src/lib/client/{sdk-js-client.ts → sdk-js-client.d.ts} +15 -181
  17. package/src/lib/editor/listeners/listeners.d.ts +50 -0
  18. package/src/lib/editor/models/{client.model.ts → client.model.d.ts} +16 -19
  19. package/src/lib/editor/models/{editor.model.ts → editor.model.d.ts} +5 -9
  20. package/src/lib/editor/models/{listeners.model.ts → listeners.model.d.ts} +6 -9
  21. package/src/lib/editor/sdk-editor-vtl.d.ts +6 -0
  22. package/src/lib/editor/sdk-editor.d.ts +54 -0
  23. package/src/lib/editor/utils/{editor.utils.ts → editor.utils.d.ts} +22 -121
  24. package/src/lib/query-builder/lucene-syntax/{Equals.ts → Equals.d.ts} +11 -45
  25. package/src/lib/query-builder/lucene-syntax/{Field.ts → Field.d.ts} +5 -13
  26. package/src/lib/query-builder/lucene-syntax/{NotOperand.ts → NotOperand.d.ts} +5 -13
  27. package/src/lib/query-builder/lucene-syntax/{Operand.ts → Operand.d.ts} +7 -21
  28. package/src/lib/query-builder/{sdk-query-builder.ts → sdk-query-builder.d.ts} +5 -16
  29. package/src/lib/query-builder/utils/{index.ts → index.d.ts} +12 -49
  30. package/src/lib/utils/graphql/transforms.d.ts +24 -0
  31. package/src/lib/utils/page/common-utils.d.ts +33 -0
  32. package/.eslintrc.json +0 -18
  33. package/jest.config.ts +0 -15
  34. package/project.json +0 -72
  35. package/src/index.ts +0 -30
  36. package/src/lib/client/content/builders/collection/collection.spec.ts +0 -515
  37. package/src/lib/client/sdk-js-client.spec.ts +0 -483
  38. package/src/lib/editor/listeners/listeners.spec.ts +0 -119
  39. package/src/lib/editor/listeners/listeners.ts +0 -223
  40. package/src/lib/editor/sdk-editor-vtl.ts +0 -31
  41. package/src/lib/editor/sdk-editor.spec.ts +0 -116
  42. package/src/lib/editor/sdk-editor.ts +0 -105
  43. package/src/lib/editor/utils/editor.utils.spec.ts +0 -206
  44. package/src/lib/query-builder/sdk-query-builder.spec.ts +0 -159
  45. package/src/lib/utils/graphql/transforms.spec.ts +0 -150
  46. package/src/lib/utils/graphql/transforms.ts +0 -99
  47. package/src/lib/utils/page/common-utils.spec.ts +0 -37
  48. package/src/lib/utils/page/common-utils.ts +0 -64
  49. package/tsconfig.json +0 -22
  50. package/tsconfig.lib.json +0 -13
  51. package/tsconfig.spec.json +0 -9
  52. /package/src/lib/query-builder/lucene-syntax/{index.ts → index.d.ts} +0 -0
  53. /package/src/lib/utils/{index.ts → index.d.ts} +0 -0
@@ -15,7 +15,6 @@ interface ContentletBound {
15
15
  height: number;
16
16
  payload: string;
17
17
  }
18
-
19
18
  /**
20
19
  * Bound information for a container.
21
20
  *
@@ -35,7 +34,6 @@ interface ContainerBound {
35
34
  payload: string;
36
35
  contentlets: ContentletBound[];
37
36
  }
38
-
39
37
  /**
40
38
  * Calculates the bounding information for each page element within the given containers.
41
39
  *
@@ -49,26 +47,7 @@ interface ContainerBound {
49
47
  * console.log(bounds);
50
48
  * ```
51
49
  */
52
- export function getPageElementBound(containers: HTMLDivElement[]): ContainerBound[] {
53
- return containers.map((container) => {
54
- const containerRect = container.getBoundingClientRect();
55
- const contentlets = Array.from(
56
- container.querySelectorAll('[data-dot-object="contentlet"]')
57
- ) as HTMLDivElement[];
58
-
59
- return {
60
- x: containerRect.x,
61
- y: containerRect.y,
62
- width: containerRect.width,
63
- height: containerRect.height,
64
- payload: JSON.stringify({
65
- container: getContainerData(container)
66
- }),
67
- contentlets: getContentletsBound(containerRect, contentlets)
68
- };
69
- });
70
- }
71
-
50
+ export declare function getPageElementBound(containers: HTMLDivElement[]): ContainerBound[];
72
51
  /**
73
52
  * Calculates the bounding information for each contentlet inside a container.
74
53
  *
@@ -84,33 +63,7 @@ export function getPageElementBound(containers: HTMLDivElement[]): ContainerBoun
84
63
  * console.log(bounds); // Element bounds within the container
85
64
  * ```
86
65
  */
87
- export function getContentletsBound(
88
- containerRect: DOMRect,
89
- contentlets: HTMLDivElement[]
90
- ): ContentletBound[] {
91
- return contentlets.map((contentlet) => {
92
- const contentletRect = contentlet.getBoundingClientRect();
93
-
94
- return {
95
- x: 0,
96
- y: contentletRect.y - containerRect.y,
97
- width: contentletRect.width,
98
- height: contentletRect.height,
99
- payload: JSON.stringify({
100
- container: contentlet.dataset?.['dotContainer']
101
- ? JSON.parse(contentlet.dataset?.['dotContainer'])
102
- : getClosestContainerData(contentlet),
103
- contentlet: {
104
- identifier: contentlet.dataset?.['dotIdentifier'],
105
- title: contentlet.dataset?.['dotTitle'],
106
- inode: contentlet.dataset?.['dotInode'],
107
- contentType: contentlet.dataset?.['dotType']
108
- }
109
- })
110
- };
111
- });
112
- }
113
-
66
+ export declare function getContentletsBound(containerRect: DOMRect, contentlets: HTMLDivElement[]): ContentletBound[];
114
67
  /**
115
68
  * Get container data from VTLS.
116
69
  *
@@ -124,15 +77,12 @@ export function getContentletsBound(
124
77
  * console.log(data);
125
78
  * ```
126
79
  */
127
- export function getContainerData(container: HTMLElement) {
128
- return {
129
- acceptTypes: container.dataset?.['dotAcceptTypes'] || '',
130
- identifier: container.dataset?.['dotIdentifier'] || '',
131
- maxContentlets: container.dataset?.['maxContentlets'] || '',
132
- uuid: container.dataset?.['dotUuid'] || ''
133
- };
134
- }
135
-
80
+ export declare function getContainerData(container: HTMLElement): {
81
+ acceptTypes: string;
82
+ identifier: string;
83
+ maxContentlets: string;
84
+ uuid: string;
85
+ };
136
86
  /**
137
87
  * Get the closest container data from the contentlet.
138
88
  *
@@ -146,22 +96,12 @@ export function getContainerData(container: HTMLElement) {
146
96
  * console.log(data);
147
97
  * ```
148
98
  */
149
- export function getClosestContainerData(element: Element) {
150
- // Find the closest ancestor element with data-dot-object="container" attribute
151
- const container = element.closest('[data-dot-object="container"]') as HTMLElement;
152
-
153
- // If a container element is found
154
- if (container) {
155
- // Return the dataset of the container element
156
- return getContainerData(container);
157
- } else {
158
- // If no container element is found, return null
159
- console.warn('No container found for the contentlet');
160
-
161
- return null;
162
- }
163
- }
164
-
99
+ export declare function getClosestContainerData(element: Element): {
100
+ acceptTypes: string;
101
+ identifier: string;
102
+ maxContentlets: string;
103
+ uuid: string;
104
+ } | null;
165
105
  /**
166
106
  * Find the closest contentlet element based on HTMLElement.
167
107
  *
@@ -173,19 +113,7 @@ export function getClosestContainerData(element: Element) {
173
113
  * const contentlet = findDotElement(element);
174
114
  * console.log(contentlet);
175
115
  */
176
- export function findDotElement(element: HTMLElement | null): HTMLElement | null {
177
- if (!element) return null;
178
-
179
- if (
180
- element?.dataset?.['dotObject'] === 'contentlet' ||
181
- (element?.dataset?.['dotObject'] === 'container' && element.children.length === 0)
182
- ) {
183
- return element;
184
- }
185
-
186
- return findDotElement(element?.['parentElement']);
187
- }
188
-
116
+ export declare function findDotElement(element: HTMLElement | null): HTMLElement | null;
189
117
  /**
190
118
  * Find the closest VTL file element based on HTMLElement.
191
119
  *
@@ -197,16 +125,7 @@ export function findDotElement(element: HTMLElement | null): HTMLElement | null
197
125
  * const vtlFile = findDotVTLElement(element);
198
126
  * console.log(vtlFile);
199
127
  */
200
- export function findDotVTLElement(element: HTMLElement | null): HTMLElement | null {
201
- if (!element) return null;
202
-
203
- if (element.dataset && element.dataset?.['dotObject'] === 'vtl-file') {
204
- return element;
205
- } else {
206
- return findDotElement(element?.['parentElement']);
207
- }
208
- }
209
-
128
+ export declare function findDotVTLElement(element: HTMLElement | null): HTMLElement | null;
210
129
  /**
211
130
  * Find VTL data within a target element.
212
131
  *
@@ -220,23 +139,10 @@ export function findDotVTLElement(element: HTMLElement | null): HTMLElement | nu
220
139
  * console.log(vtlData);
221
140
  * ```
222
141
  */
223
- export function findVTLData(target: HTMLElement) {
224
- const vltElements = target.querySelectorAll(
225
- '[data-dot-object="vtl-file"]'
226
- ) as NodeListOf<HTMLElement>;
227
-
228
- if (!vltElements.length) {
229
- return null;
230
- }
231
-
232
- return Array.from(vltElements).map((vltElement) => {
233
- return {
234
- inode: vltElement.dataset?.['dotInode'],
235
- name: vltElement.dataset?.['dotUrl']
236
- };
237
- });
238
- }
239
-
142
+ export declare function findVTLData(target: HTMLElement): {
143
+ inode: string | undefined;
144
+ name: string | undefined;
145
+ }[] | null;
240
146
  /**
241
147
  * Check if the scroll position is at the bottom of the page.
242
148
  *
@@ -249,10 +155,5 @@ export function findVTLData(target: HTMLElement) {
249
155
  * }
250
156
  * ```
251
157
  */
252
- export function scrollIsInBottom() {
253
- const documentHeight = document.documentElement.scrollHeight;
254
- const viewportHeight = window.innerHeight;
255
- const scrollY = window.scrollY;
256
-
257
- return scrollY + viewportHeight >= documentHeight;
258
- }
158
+ export declare function scrollIsInBottom(): boolean;
159
+ export {};
@@ -1,17 +1,6 @@
1
1
  import { Field } from './Field';
2
2
  import { NotOperand } from './NotOperand';
3
3
  import { Operand } from './Operand';
4
-
5
- import {
6
- OPERAND,
7
- buildExcludeField,
8
- buildField,
9
- buildNotOperand,
10
- buildOperand,
11
- buildRawEquals,
12
- sanitizeQuery
13
- } from '../utils';
14
-
15
4
  /**
16
5
  * 'Equal' Is a Typescript class that provides the ability to use terms in the lucene query string.
17
6
  * A term is a value used to search for a specific value in a document. It can be a word or a phrase.
@@ -21,13 +10,10 @@ import {
21
10
  * @export
22
11
  * @class Equal
23
12
  */
24
- export class Equals {
25
- #query = '';
26
-
27
- constructor(private query: string) {
28
- this.#query = this.query;
29
- }
30
-
13
+ export declare class Equals {
14
+ #private;
15
+ private query;
16
+ constructor(query: string);
31
17
  /**
32
18
  * This method appends to the query a term that should be excluded in the search.
33
19
  *
@@ -41,10 +27,7 @@ export class Equals {
41
27
  * @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
42
28
  * @memberof Equal
43
29
  */
44
- excludeField(field: string): Field {
45
- return buildExcludeField(this.#query, field);
46
- }
47
-
30
+ excludeField(field: string): Field;
48
31
  /**
49
32
  * This method appends to the query a field that should be included in the search.
50
33
  *
@@ -57,10 +40,7 @@ export class Equals {
57
40
  * @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
58
41
  * @memberof Equal
59
42
  */
60
- field(field: string): Field {
61
- return buildField(this.#query, field);
62
- }
63
-
43
+ field(field: string): Field;
64
44
  /**
65
45
  * This method appends to the query an operand to use logic operators in the query.
66
46
  *
@@ -74,10 +54,7 @@ export class Equals {
74
54
  * @return {*} {Operand} - An instance of a Lucene Operand. An operand is a logical operator used to combine terms or phrases in a query.
75
55
  * @memberof Equal
76
56
  */
77
- or(): Operand {
78
- return buildOperand(this.#query, OPERAND.OR);
79
- }
80
-
57
+ or(): Operand;
81
58
  /**
82
59
  * This method appends to the query an operand to use logic operators in the query.
83
60
  *
@@ -90,10 +67,7 @@ export class Equals {
90
67
  * @return {*} {Operand} - An instance of a Lucene Operand. An operand is a logical operator used to combine terms or phrases in a query.
91
68
  * @memberof Equal
92
69
  */
93
- and(): Operand {
94
- return buildOperand(this.#query, OPERAND.AND);
95
- }
96
-
70
+ and(): Operand;
97
71
  /**
98
72
  * This method appends to the query an operand to use logic operators in the query.
99
73
  *
@@ -106,10 +80,7 @@ export class Equals {
106
80
  * @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.
107
81
  * @memberof Equal
108
82
  */
109
- not(): NotOperand {
110
- return buildNotOperand(this.#query);
111
- }
112
-
83
+ not(): NotOperand;
113
84
  /**
114
85
  * This method allows to pass a raw query string to the query builder.
115
86
  * This raw query should end in a Lucene Equal.
@@ -126,10 +97,7 @@ export class Equals {
126
97
  * @return {*} {Equal} - An instance of a Lucene Equal. A term is a value used to search for a specific value in a document.
127
98
  * @memberof QueryBuilder
128
99
  */
129
- raw(query: string): Equals {
130
- return buildRawEquals(this.#query, query);
131
- }
132
-
100
+ raw(query: string): Equals;
133
101
  /**
134
102
  * This method returns the final query string.
135
103
  *
@@ -142,7 +110,5 @@ export class Equals {
142
110
  * @return {*} {string} - The final query string.
143
111
  * @memberof Equal
144
112
  */
145
- build(): string {
146
- return sanitizeQuery(this.#query);
147
- }
113
+ build(): string;
148
114
  }
@@ -1,7 +1,4 @@
1
1
  import { Equals } from './Equals';
2
-
3
- import { buildEquals } from '../utils';
4
-
5
2
  /**
6
3
  * The `Field` class is used to build a query with a specific field.
7
4
  * A Lucene Field is a key used to search for a specific value in a document.
@@ -9,18 +6,15 @@ import { buildEquals } from '../utils';
9
6
  * @export
10
7
  * @class Field
11
8
  */
12
- export class Field {
13
- #query = '';
14
-
9
+ export declare class Field {
10
+ #private;
11
+ private query;
15
12
  /**
16
13
  * Creates an instance of the `Field` class.
17
14
  *
18
15
  * @param {string} query - The initial query string.
19
16
  */
20
- constructor(private query: string) {
21
- this.#query = this.query;
22
- }
23
-
17
+ constructor(query: string);
24
18
  /**
25
19
  * Appends a term to the query that should be included in the search.
26
20
  *
@@ -34,7 +28,5 @@ export class Field {
34
28
  * @return {Equals} - An instance of `Equals`.
35
29
  * @memberof Field
36
30
  */
37
- equals(term: string): Equals {
38
- return buildEquals(this.#query, term);
39
- }
31
+ equals(term: string): Equals;
40
32
  }
@@ -1,20 +1,14 @@
1
1
  import { Equals } from './Equals';
2
-
3
- import { buildEquals } from '../utils';
4
-
5
2
  /**
6
3
  * 'NotOperand' Is a Typescript class that provides the ability to use the NOT operand in the lucene query string.
7
4
  *
8
5
  * @export
9
6
  * @class NotOperand
10
7
  */
11
- export class NotOperand {
12
- #query = '';
13
-
14
- constructor(private query: string) {
15
- this.#query = this.query;
16
- }
17
-
8
+ export declare class NotOperand {
9
+ #private;
10
+ private query;
11
+ constructor(query: string);
18
12
  /**
19
13
  * This method appends to the query a term that should be included in the search.
20
14
  *
@@ -28,7 +22,5 @@ export class NotOperand {
28
22
  * @return {*} {Equals} - An instance of Equals.
29
23
  * @memberof NotOperand
30
24
  */
31
- equals(term: string): Equals {
32
- return buildEquals(this.#query, term);
33
- }
25
+ equals(term: string): Equals;
34
26
  }
@@ -1,8 +1,5 @@
1
1
  import { Equals } from './Equals';
2
2
  import { Field } from './Field';
3
-
4
- import { buildExcludeField, buildField, buildEquals } from '../utils';
5
-
6
3
  /**
7
4
  * 'Operand' Is a Typescript class that provides the ability to use operands in the lucene query string.}
8
5
  * An operand is a logical operator used to join two or more conditions in a query.
@@ -10,13 +7,10 @@ import { buildExcludeField, buildField, buildEquals } from '../utils';
10
7
  * @export
11
8
  * @class Operand
12
9
  */
13
- export class Operand {
14
- #query = '';
15
-
16
- constructor(private query: string) {
17
- this.#query = this.query;
18
- }
19
-
10
+ export declare class Operand {
11
+ #private;
12
+ private query;
13
+ constructor(query: string);
20
14
  /**
21
15
  * This method appends to the query a term that should be excluded in the search.
22
16
  *
@@ -26,10 +20,7 @@ export class Operand {
26
20
  * @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
27
21
  * @memberof Operand
28
22
  */
29
- excludeField(field: string): Field {
30
- return buildExcludeField(this.#query, field);
31
- }
32
-
23
+ excludeField(field: string): Field;
33
24
  /**
34
25
  * This method appends to the query a field that should be included in the search.
35
26
  *
@@ -39,10 +30,7 @@ export class Operand {
39
30
  * @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
40
31
  * @memberof Operand
41
32
  */
42
- field(field: string): Field {
43
- return buildField(this.#query, field);
44
- }
45
-
33
+ field(field: string): Field;
46
34
  /**
47
35
  * This method appends to the query a term that should be included in the search.
48
36
  *
@@ -52,7 +40,5 @@ export class Operand {
52
40
  * @return {*} {Equals} - An instance of Equals.
53
41
  * @memberof Operand
54
42
  */
55
- equals(term: string): Equals {
56
- return buildEquals(this.#query, term);
57
- }
43
+ equals(term: string): Equals;
58
44
  }
@@ -1,6 +1,4 @@
1
1
  import { Equals, Field } from './lucene-syntax/index';
2
- import { buildExcludeField, buildField, buildRawEquals } from './utils';
3
-
4
2
  /**
5
3
  * 'QueryBuilder' Is a Typescript class that provides the ability to build a query string using the Lucene syntax in a more readable way.
6
4
  * @example
@@ -29,9 +27,8 @@ import { buildExcludeField, buildField, buildRawEquals } from './utils';
29
27
  * @export
30
28
  * @class QueryBuilder
31
29
  */
32
- export class QueryBuilder {
33
- #query = '';
34
-
30
+ export declare class QueryBuilder {
31
+ #private;
35
32
  /**
36
33
  * This method appends to the query a field that should be included in the search.
37
34
  *
@@ -45,10 +42,7 @@ export class QueryBuilder {
45
42
  * @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
46
43
  * @memberof QueryBuilder
47
44
  */
48
- field(field: string): Field {
49
- return buildField(this.#query, field);
50
- }
51
-
45
+ field(field: string): Field;
52
46
  /**
53
47
  * This method appends to the query a field that should be excluded from the search.
54
48
  *
@@ -62,10 +56,7 @@ export class QueryBuilder {
62
56
  * @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.
63
57
  * @memberof QueryBuilder
64
58
  */
65
- excludeField(field: string): Field {
66
- return buildExcludeField(this.#query, field);
67
- }
68
-
59
+ excludeField(field: string): Field;
69
60
  /**
70
61
  * This method allows to pass a raw query string to the query builder.
71
62
  * This raw query should end in Equals.
@@ -81,7 +72,5 @@ export class QueryBuilder {
81
72
  * @return {*} {Equals} - An instance of Equals. A term is a value used to search for a specific value in a document.
82
73
  * @memberof QueryBuilder
83
74
  */
84
- raw(query: string): Equals {
85
- return buildRawEquals(this.#query, query);
86
- }
75
+ raw(query: string): Equals;
87
76
  }
@@ -2,19 +2,17 @@ import { Equals } from '../lucene-syntax/Equals';
2
2
  import { Field } from '../lucene-syntax/Field';
3
3
  import { NotOperand } from '../lucene-syntax/NotOperand';
4
4
  import { Operand } from '../lucene-syntax/Operand';
5
-
6
5
  /**
7
6
  * Enum for common Operands
8
7
  *
9
8
  * @export
10
9
  * @enum {number}
11
10
  */
12
- export enum OPERAND {
13
- OR = 'OR',
14
- AND = 'AND',
15
- NOT = 'NOT'
11
+ export declare enum OPERAND {
12
+ OR = "OR",
13
+ AND = "AND",
14
+ NOT = "NOT"
16
15
  }
17
-
18
16
  /**
19
17
  * This function removes extra spaces from a string.
20
18
  *
@@ -27,10 +25,7 @@ export enum OPERAND {
27
25
  * @param {string} str
28
26
  * @return {*} {string}
29
27
  */
30
- export function sanitizeQuery(str: string): string {
31
- return str.replace(/\s{2,}/g, ' ').trim();
32
- }
33
-
28
+ export declare function sanitizeQuery(str: string): string;
34
29
  /**
35
30
  * This function sanitizes a term by adding quotes if it contains spaces.
36
31
  * In lucene, a term with spaces should be enclosed in quotes.
@@ -45,10 +40,7 @@ export function sanitizeQuery(str: string): string {
45
40
  * @param {string} term
46
41
  * @return {*} {string}
47
42
  */
48
- export function sanitizePhrases(term: string): string {
49
- return term.includes(' ') ? `"${term}"` : term;
50
- }
51
-
43
+ export declare function sanitizePhrases(term: string): string;
52
44
  /**
53
45
  * This function builds a term to be used in a lucene query.
54
46
  * We need to sanitize the term before adding it to the query.
@@ -63,12 +55,7 @@ export function sanitizePhrases(term: string): string {
63
55
  * @param {string} term
64
56
  * @return {*} {Equals}
65
57
  */
66
- export function buildEquals(query: string, term: string): Equals {
67
- const newQuery = query + sanitizePhrases(term);
68
-
69
- return new Equals(newQuery);
70
- }
71
-
58
+ export declare function buildEquals(query: string, term: string): Equals;
72
59
  /**
73
60
  * This function builds a term to be used in a lucene query.
74
61
  * We need to sanitize the raw query before adding it to the query.
@@ -84,12 +71,7 @@ export function buildEquals(query: string, term: string): Equals {
84
71
  * @param {string} raw
85
72
  * @return {*} {Equals}
86
73
  */
87
- export function buildRawEquals(query: string, raw: string): Equals {
88
- const newQuery = query + ` ${raw}`;
89
-
90
- return new Equals(sanitizeQuery(newQuery));
91
- }
92
-
74
+ export declare function buildRawEquals(query: string, raw: string): Equals;
93
75
  /**
94
76
  * This function builds a field to be used in a lucene query.
95
77
  * We need to format the field before adding it to the query.
@@ -104,12 +86,7 @@ export function buildRawEquals(query: string, raw: string): Equals {
104
86
  * @param {string} field
105
87
  * @return {*} {Field}
106
88
  */
107
- export function buildField(query: string, field: string): Field {
108
- const newQuery = query + ` +${field}:`;
109
-
110
- return new Field(newQuery);
111
- }
112
-
89
+ export declare function buildField(query: string, field: string): Field;
113
90
  /**
114
91
  * This function builds an exclude field to be used in a lucene query.
115
92
  * We need to format the field before adding it to the query.
@@ -125,12 +102,7 @@ export function buildField(query: string, field: string): Field {
125
102
  * @param {string} field
126
103
  * @return {*} {Field}
127
104
  */
128
- export function buildExcludeField(query: string, field: string): Field {
129
- const newQuery = query + ` -${field}:`;
130
-
131
- return new Field(newQuery);
132
- }
133
-
105
+ export declare function buildExcludeField(query: string, field: string): Field;
134
106
  /**
135
107
  * This function builds an operand to be used in a lucene query.
136
108
  * We need to format the operand before adding it to the query.
@@ -152,12 +124,7 @@ export function buildExcludeField(query: string, field: string): Field {
152
124
  * @param {OPERAND} operand
153
125
  * @return {*} {Operand}
154
126
  */
155
- export function buildOperand(query: string, operand: OPERAND): Operand {
156
- const newQuery = query + ` ${operand} `;
157
-
158
- return new Operand(newQuery);
159
- }
160
-
127
+ export declare function buildOperand(query: string, operand: OPERAND): Operand;
161
128
  /**
162
129
  * This function builds a NOT operand to be used in a lucene query.
163
130
  * We need to format the operand before adding it to the query.
@@ -172,8 +139,4 @@ export function buildOperand(query: string, operand: OPERAND): Operand {
172
139
  * @param {string} query
173
140
  * @return {*} {NotOperand}
174
141
  */
175
- export function buildNotOperand(query: string): NotOperand {
176
- const newQuery = query + ` ${OPERAND.NOT} `;
177
-
178
- return new NotOperand(newQuery);
179
- }
142
+ export declare function buildNotOperand(query: string): NotOperand;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Represents the response from a GraphQL query for a page.
3
+ *
4
+ * @interface GraphQLPageResponse
5
+ * @property {Record<string, unknown>} page - The main page data.
6
+ * @property {unknown} [key: string] - Additional properties that may be included in the response.
7
+ */
8
+ interface GraphQLPageResponse {
9
+ page: Record<string, unknown>;
10
+ [key: string]: unknown;
11
+ }
12
+ /**
13
+ * Transforms a GraphQL Page response to a Page Entity.
14
+ *
15
+ * @param {GraphQLPageResponse} graphQLPageResponse - The GraphQL Page response object.
16
+ * @returns {object|null} The transformed Page Entity or null if the page is not present.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const pageEntity = graphqlToPageEntity(graphQLPageResponse);
21
+ * ```
22
+ */
23
+ export declare const graphqlToPageEntity: (graphQLPageResponse: GraphQLPageResponse) => any;
24
+ export {};
@@ -0,0 +1,33 @@
1
+ import { PageApiOptions } from '../../client/sdk-js-client';
2
+ /**
3
+ * Interface representing the properties for page request parameters.
4
+ *
5
+ * @export
6
+ * @interface PageRequestParamsProps
7
+ */
8
+ export interface PageRequestParamsProps {
9
+ /**
10
+ * The API endpoint path.
11
+ * @type {string}
12
+ */
13
+ path: string;
14
+ /**
15
+ * The query parameters for the API request.
16
+ * Can be an object with key-value pairs or a URLSearchParams instance.
17
+ * @type {{ [key: string]: unknown } | URLSearchParams}
18
+ */
19
+ params: {
20
+ [key: string]: unknown;
21
+ } | URLSearchParams;
22
+ }
23
+ /**
24
+ * Generates the page request parameters to be used in the API call.
25
+ *
26
+ * @param {PageRequestParamsProps} PageRequestParamsProps - The properties for the page request.
27
+ * @returns {PageApiOptions} The options for the page API.
28
+ * @example
29
+ * ```ts
30
+ * const pageApiOptions = getPageRequestParams({ path: '/api/v1/page', params: queryParams });
31
+ * ```
32
+ */
33
+ export declare const getPageRequestParams: ({ path, params }: PageRequestParamsProps) => PageApiOptions;