@dotcms/client 0.0.1-alpha.4 → 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 (41) hide show
  1. package/README.md +17 -6
  2. package/index.cjs.d.ts +1 -0
  3. package/index.cjs.default.js +1 -0
  4. package/index.cjs.js +1953 -0
  5. package/index.cjs.mjs +2 -0
  6. package/index.esm.d.ts +1 -0
  7. package/index.esm.js +1944 -0
  8. package/package.json +19 -7
  9. package/src/index.d.ts +6 -2
  10. package/src/lib/client/content/builders/collection/collection.d.ts +226 -0
  11. package/src/lib/client/content/content-api.d.ts +129 -0
  12. package/src/lib/client/content/shared/const.d.ts +13 -0
  13. package/src/lib/client/content/shared/types.d.ts +138 -0
  14. package/src/lib/client/content/shared/utils.d.ts +20 -0
  15. package/src/lib/client/models/index.d.ts +12 -0
  16. package/src/lib/client/models/types.d.ts +13 -0
  17. package/src/lib/client/sdk-js-client.d.ts +276 -0
  18. package/src/lib/editor/listeners/listeners.d.ts +50 -0
  19. package/src/lib/{postMessageToEditor.d.ts → editor/models/client.model.d.ts} +33 -2
  20. package/src/lib/editor/models/editor.model.d.ts +49 -0
  21. package/src/lib/editor/models/listeners.model.d.ts +47 -0
  22. package/src/lib/editor/sdk-editor-vtl.d.ts +6 -0
  23. package/src/lib/editor/sdk-editor.d.ts +54 -0
  24. package/src/lib/editor/utils/editor.utils.d.ts +159 -0
  25. package/src/lib/query-builder/lucene-syntax/Equals.d.ts +114 -0
  26. package/src/lib/query-builder/lucene-syntax/Field.d.ts +32 -0
  27. package/src/lib/query-builder/lucene-syntax/NotOperand.d.ts +26 -0
  28. package/src/lib/query-builder/lucene-syntax/Operand.d.ts +44 -0
  29. package/src/lib/query-builder/lucene-syntax/index.d.ts +4 -0
  30. package/src/lib/query-builder/sdk-query-builder.d.ts +76 -0
  31. package/src/lib/query-builder/utils/index.d.ts +142 -0
  32. package/src/lib/utils/graphql/transforms.d.ts +24 -0
  33. package/src/lib/utils/index.d.ts +2 -0
  34. package/src/lib/utils/page/common-utils.d.ts +33 -0
  35. package/src/index.js +0 -3
  36. package/src/index.js.map +0 -1
  37. package/src/lib/postMessageToEditor.js +0 -42
  38. package/src/lib/postMessageToEditor.js.map +0 -1
  39. package/src/lib/sdk-js-client.d.ts +0 -183
  40. package/src/lib/sdk-js-client.js +0 -145
  41. package/src/lib/sdk-js-client.js.map +0 -1
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Bound information for a contentlet.
3
+ *
4
+ * @interface ContentletBound
5
+ * @property {number} x - The x-coordinate of the contentlet.
6
+ * @property {number} y - The y-coordinate of the contentlet.
7
+ * @property {number} width - The width of the contentlet.
8
+ * @property {number} height - The height of the contentlet.
9
+ * @property {string} payload - The payload data of the contentlet in JSON format.
10
+ */
11
+ interface ContentletBound {
12
+ x: number;
13
+ y: number;
14
+ width: number;
15
+ height: number;
16
+ payload: string;
17
+ }
18
+ /**
19
+ * Bound information for a container.
20
+ *
21
+ * @interface ContainerBound
22
+ * @property {number} x - The x-coordinate of the container.
23
+ * @property {number} y - The y-coordinate of the container.
24
+ * @property {number} width - The width of the container.
25
+ * @property {number} height - The height of the container.
26
+ * @property {string} payload - The payload data of the container in JSON format.
27
+ * @property {ContentletBound[]} contentlets - An array of contentlets within the container.
28
+ */
29
+ interface ContainerBound {
30
+ x: number;
31
+ y: number;
32
+ width: number;
33
+ height: number;
34
+ payload: string;
35
+ contentlets: ContentletBound[];
36
+ }
37
+ /**
38
+ * Calculates the bounding information for each page element within the given containers.
39
+ *
40
+ * @export
41
+ * @param {HTMLDivElement[]} containers - An array of HTMLDivElement representing the containers.
42
+ * @return {ContainerBound[]} An array of objects containing the bounding information for each page element.
43
+ * @example
44
+ * ```ts
45
+ * const containers = document.querySelectorAll('.container');
46
+ * const bounds = getPageElementBound(containers);
47
+ * console.log(bounds);
48
+ * ```
49
+ */
50
+ export declare function getPageElementBound(containers: HTMLDivElement[]): ContainerBound[];
51
+ /**
52
+ * Calculates the bounding information for each contentlet inside a container.
53
+ *
54
+ * @export
55
+ * @param {DOMRect} containerRect - The bounding rectangle of the container.
56
+ * @param {HTMLDivElement[]} contentlets - An array of HTMLDivElement representing the contentlets.
57
+ * @return {ContentletBound[]} An array of objects containing the bounding information for each contentlet.
58
+ * @example
59
+ * ```ts
60
+ * const containerRect = container.getBoundingClientRect();
61
+ * const contentlets = container.querySelectorAll('.contentlet');
62
+ * const bounds = getContentletsBound(containerRect, contentlets);
63
+ * console.log(bounds); // Element bounds within the container
64
+ * ```
65
+ */
66
+ export declare function getContentletsBound(containerRect: DOMRect, contentlets: HTMLDivElement[]): ContentletBound[];
67
+ /**
68
+ * Get container data from VTLS.
69
+ *
70
+ * @export
71
+ * @param {HTMLElement} container - The container element.
72
+ * @return {object} An object containing the container data.
73
+ * @example
74
+ * ```ts
75
+ * const container = document.querySelector('.container');
76
+ * const data = getContainerData(container);
77
+ * console.log(data);
78
+ * ```
79
+ */
80
+ export declare function getContainerData(container: HTMLElement): {
81
+ acceptTypes: string;
82
+ identifier: string;
83
+ maxContentlets: string;
84
+ uuid: string;
85
+ };
86
+ /**
87
+ * Get the closest container data from the contentlet.
88
+ *
89
+ * @export
90
+ * @param {Element} element - The contentlet element.
91
+ * @return {object | null} An object containing the closest container data or null if no container is found.
92
+ * @example
93
+ * ```ts
94
+ * const contentlet = document.querySelector('.contentlet');
95
+ * const data = getClosestContainerData(contentlet);
96
+ * console.log(data);
97
+ * ```
98
+ */
99
+ export declare function getClosestContainerData(element: Element): {
100
+ acceptTypes: string;
101
+ identifier: string;
102
+ maxContentlets: string;
103
+ uuid: string;
104
+ } | null;
105
+ /**
106
+ * Find the closest contentlet element based on HTMLElement.
107
+ *
108
+ * @export
109
+ * @param {HTMLElement | null} element - The starting element.
110
+ * @return {HTMLElement | null} The closest contentlet element or null if not found.
111
+ * @example
112
+ * const element = document.querySelector('.some-element');
113
+ * const contentlet = findDotElement(element);
114
+ * console.log(contentlet);
115
+ */
116
+ export declare function findDotElement(element: HTMLElement | null): HTMLElement | null;
117
+ /**
118
+ * Find the closest VTL file element based on HTMLElement.
119
+ *
120
+ * @export
121
+ * @param {HTMLElement | null} element - The starting element.
122
+ * @return {HTMLElement | null} The closest VTL file element or null if not found.
123
+ * @example
124
+ * const element = document.querySelector('.some-element');
125
+ * const vtlFile = findDotVTLElement(element);
126
+ * console.log(vtlFile);
127
+ */
128
+ export declare function findDotVTLElement(element: HTMLElement | null): HTMLElement | null;
129
+ /**
130
+ * Find VTL data within a target element.
131
+ *
132
+ * @export
133
+ * @param {HTMLElement} target - The target element to search within.
134
+ * @return {Array<{ inode: string, name: string }> | null} An array of objects containing VTL data or null if none found.
135
+ * @example
136
+ * ```ts
137
+ * const target = document.querySelector('.target-element');
138
+ * const vtlData = findVTLData(target);
139
+ * console.log(vtlData);
140
+ * ```
141
+ */
142
+ export declare function findVTLData(target: HTMLElement): {
143
+ inode: string | undefined;
144
+ name: string | undefined;
145
+ }[] | null;
146
+ /**
147
+ * Check if the scroll position is at the bottom of the page.
148
+ *
149
+ * @export
150
+ * @return {boolean} True if the scroll position is at the bottom, otherwise false.
151
+ * @example
152
+ * ```ts
153
+ * if (scrollIsInBottom()) {
154
+ * console.log('Scrolled to the bottom');
155
+ * }
156
+ * ```
157
+ */
158
+ export declare function scrollIsInBottom(): boolean;
159
+ export {};
@@ -0,0 +1,114 @@
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
+ * @example
21
+ * ```ts
22
+ * const equals = new Equals("+myField: myValue");
23
+ * equals.excludeField("myField2").equals("myValue2"); // Current query: "+myField: myValue -myField2: myValue2"
24
+ * ```
25
+ *
26
+ * @param {string} field - The field that should be excluded in the search.
27
+ * @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
28
+ * @memberof Equal
29
+ */
30
+ excludeField(field: string): Field;
31
+ /**
32
+ * This method appends to the query a field that should be included in the search.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const equals = new Equals("+myField: myValue");
37
+ * equals.field("myField2").equals("myValue2"); // Current query: "+myField: myValue +myField2: myValue2"
38
+ *```
39
+ * @param {string} field - The field that should be included in the search.
40
+ * @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
41
+ * @memberof Equal
42
+ */
43
+ field(field: string): Field;
44
+ /**
45
+ * This method appends to the query an operand to use logic operators in the query.
46
+ *
47
+ * @example
48
+ * @example
49
+ * ```ts
50
+ * const equals = new Equals("+myField: myValue");
51
+ * equals.or().field("myField2").equals("myValue2"); // Current query: "+myField: myValue OR +myField2: myValue2"
52
+ * ```
53
+ *
54
+ * @return {*} {Operand} - An instance of a Lucene Operand. An operand is a logical operator used to combine terms or phrases in a query.
55
+ * @memberof Equal
56
+ */
57
+ or(): Operand;
58
+ /**
59
+ * This method appends to the query an operand to use logic operators in the query.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const equals = new Equals("+myField: myValue");
64
+ * equals.and().field("myField2").equals("myValue2"); // Current query: "+myField: myValue AND +myField2: myValue2"
65
+ * ```
66
+ *
67
+ * @return {*} {Operand} - An instance of a Lucene Operand. An operand is a logical operator used to combine terms or phrases in a query.
68
+ * @memberof Equal
69
+ */
70
+ and(): Operand;
71
+ /**
72
+ * This method appends to the query an operand to use logic operators in the query.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const equals = new Equals("+myField: myValue");
77
+ * equals.not().field("myField").equals("myValue2"); // Current query: "+myField: myValue NOT +myField: myValue2"
78
+ * ```
79
+ *
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.
81
+ * @memberof Equal
82
+ */
83
+ not(): NotOperand;
84
+ /**
85
+ * This method allows to pass a raw query string to the query builder.
86
+ * This raw query should end in a Lucene Equal.
87
+ * This method is useful when you want to append a complex query or an already written query to the query builder.
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * // This builds the follow raw query "+myField: value AND (someOtherValue OR anotherValue)"
92
+ * const equals = new Equals("+myField: value");
93
+ * equals.raw("+myField2: value2"); // Current query: "+myField: value +myField2: anotherValue"
94
+ * ```
95
+ *
96
+ * @param {string} query - A raw query string.
97
+ * @return {*} {Equal} - An instance of a Lucene Equal. A term is a value used to search for a specific value in a document.
98
+ * @memberof QueryBuilder
99
+ */
100
+ raw(query: string): Equals;
101
+ /**
102
+ * This method returns the final query string.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * const equals = new Equals("+myField: myValue");
107
+ * equals.field("myField2").equals("myValue2").build(); // Returns "+myField: myValue +myField2: myValue2"
108
+ * ```
109
+ *
110
+ * @return {*} {string} - The final query string.
111
+ * @memberof Equal
112
+ */
113
+ build(): string;
114
+ }
@@ -0,0 +1,32 @@
1
+ import { Equals } from './Equals';
2
+ /**
3
+ * The `Field` class is used to build a query with a specific 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
+ /**
13
+ * Creates an instance of the `Field` class.
14
+ *
15
+ * @param {string} query - The initial query string.
16
+ */
17
+ constructor(query: string);
18
+ /**
19
+ * Appends a term to the query that should be included in the search.
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const field = new Field("+myField");
24
+ * field.equals("myValue");
25
+ * ```
26
+ *
27
+ * @param {string} term - The term that should be included in the search.
28
+ * @return {Equals} - An instance of `Equals`.
29
+ * @memberof Field
30
+ */
31
+ equals(term: string): Equals;
32
+ }
@@ -0,0 +1,26 @@
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
+ * @example
16
+ * ```typescript
17
+ * const notOperand = new NotOperand("+myField");
18
+ * notOperand.equals("myValue");
19
+ * ```
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: string): Equals;
26
+ }
@@ -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,4 @@
1
+ export * from './Equals';
2
+ export * from './Field';
3
+ export * from './NotOperand';
4
+ export * from './Operand';
@@ -0,0 +1,76 @@
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
+ * @example
5
+ * ```ts
6
+ * const qb = new QueryBuilder();
7
+ * const query = qb
8
+ * .field('contentType')
9
+ * .equals('Blog')
10
+ * .field('conhost')
11
+ * .equals('my-super-cool-site')
12
+ * .build(); // Output: `+contentType:Blog +conhost:my-super-cool-site"`
13
+ * ```
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const qb = new QueryBuilder();
18
+ * const query = qb
19
+ * .field('contentType')
20
+ * .equals('Blog')
21
+ * .field('title')
22
+ * .equals('Football')
23
+ * .excludeField('summary')
24
+ * .equals('Lionel Messi')
25
+ * .build(); // Output: `+contentType:Blog +title:Football -summary:"Lionel Messi"`
26
+ * ```
27
+ * @export
28
+ * @class QueryBuilder
29
+ */
30
+ export declare class QueryBuilder {
31
+ #private;
32
+ /**
33
+ * This method appends to the query a field that should be included in the search.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const qb = new QueryBuilder();
38
+ * qb.field("+myField: ", "myValue"); // Current query: "+myField: myValue"
39
+ * ```
40
+ *
41
+ * @param {string} field - The field that should be included in the search.
42
+ * @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
43
+ * @memberof QueryBuilder
44
+ */
45
+ field(field: string): Field;
46
+ /**
47
+ * This method appends to the query a field that should be excluded from the search.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const qb = new QueryBuilder();
52
+ * qb.excludeField("myField").equals("myValue"); // Current query: "-myField: myValue"
53
+ * ```
54
+ *
55
+ * @param {string} field - The field that should be excluded from the search.
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.
57
+ * @memberof QueryBuilder
58
+ */
59
+ excludeField(field: string): Field;
60
+ /**
61
+ * This method allows to pass a raw query string to the query builder.
62
+ * This raw query should end in Equals.
63
+ * This method is useful when you want to append a complex query or an already written query to the query builder.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const qb = new QueryBuilder();
68
+ * qb.raw("+myField: value AND (someOtherValue OR anotherValue)"); // Current query: "+myField: value AND (someOtherValue OR anotherValue)"
69
+ * ```
70
+ *
71
+ * @param {string} query - A raw query string.
72
+ * @return {*} {Equals} - An instance of Equals. 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
+ }
@@ -0,0 +1,142 @@
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
+ * @example
20
+ * ```ts
21
+ * sanitizeQuery(" my query "); // Output: "my query"
22
+ * ```
23
+ *
24
+ * @export
25
+ * @param {string} str
26
+ * @return {*} {string}
27
+ */
28
+ export declare function sanitizeQuery(str: string): string;
29
+ /**
30
+ * This function sanitizes a term by adding quotes if it contains spaces.
31
+ * In lucene, a term with spaces should be enclosed in quotes.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * sanitizePhrases(`my term`); // Output: `"my term"`
36
+ * sanitizePhrases(`myterm`); // Output: `myterm`
37
+ * ```
38
+ *
39
+ * @export
40
+ * @param {string} term
41
+ * @return {*} {string}
42
+ */
43
+ export declare function sanitizePhrases(term: string): string;
44
+ /**
45
+ * This function builds a term to be used in a lucene query.
46
+ * We need to sanitize the term before adding it to the query.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const equals = buildEquals("+myField: ", "myValue"); // Current query: "+myField: myValue"
51
+ * ```
52
+ *
53
+ * @export
54
+ * @param {string} query
55
+ * @param {string} term
56
+ * @return {*} {Equals}
57
+ */
58
+ export declare function buildEquals(query: string, term: string): Equals;
59
+ /**
60
+ * This function builds a term to be used in a lucene query.
61
+ * We need to sanitize the raw query before adding it to the query.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * const query = "+myField: myValue";
66
+ * const field = buildRawEquals(query, "-myField2: myValue2"); // Current query: "+myField: myValue -myField2: myValue"
67
+ * ```
68
+ *
69
+ * @export
70
+ * @param {string} query
71
+ * @param {string} raw
72
+ * @return {*} {Equals}
73
+ */
74
+ export declare function buildRawEquals(query: string, raw: string): Equals;
75
+ /**
76
+ * This function builds a field to be used in a lucene query.
77
+ * We need to format the field before adding it to the query.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const field = buildField("+myField: ", "myValue"); // Current query: "+myField: myValue"
82
+ * ```
83
+ *
84
+ * @export
85
+ * @param {string} query
86
+ * @param {string} field
87
+ * @return {*} {Field}
88
+ */
89
+ export declare function buildField(query: string, field: string): Field;
90
+ /**
91
+ * This function builds an exclude field to be used in a lucene query.
92
+ * We need to format the field before adding it to the query.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * const query = "+myField: myValue";
97
+ * const field = buildExcludeField(query, "myField2"); // Current query: "+myField: myValue -myField2:"
98
+ * ```
99
+ *
100
+ * @export
101
+ * @param {string} query
102
+ * @param {string} field
103
+ * @return {*} {Field}
104
+ */
105
+ export declare function buildExcludeField(query: string, field: string): Field;
106
+ /**
107
+ * This function builds an operand to be used in a lucene query.
108
+ * We need to format the operand before adding it to the query.
109
+ *
110
+ * @example
111
+ * <caption>E.g. Using the AND operand</caption>
112
+ * ```ts
113
+ * const query = "+myField: myValue";
114
+ * const field = buildOperand(query, OPERAND.AND); // Current query: "+myField: myValue AND"
115
+ * ```
116
+ * @example
117
+ * <caption>E.g. Using the OR operand</caption>
118
+ * ```ts
119
+ * const query = "+myField: myValue";
120
+ * const field = buildOperand(query, OPERAND.OR); // Current query: "+myField: myValue OR"
121
+ * ```
122
+ * @export
123
+ * @param {string} query
124
+ * @param {OPERAND} operand
125
+ * @return {*} {Operand}
126
+ */
127
+ export declare function buildOperand(query: string, operand: OPERAND): Operand;
128
+ /**
129
+ * This function builds a NOT operand to be used in a lucene query.
130
+ * We need to format the operand before adding it to the query.
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * const query = "+myField: myValue";
135
+ * const field = buildNotOperand(query); // Current query: "+myField: myValue NOT"
136
+ * ```
137
+ *
138
+ * @export
139
+ * @param {string} query
140
+ * @return {*} {NotOperand}
141
+ */
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,2 @@
1
+ export * from './graphql/transforms';
2
+ export * from './page/common-utils';
@@ -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;
package/src/index.js DELETED
@@ -1,3 +0,0 @@
1
- export * from './lib/sdk-js-client';
2
- export * from './lib/postMessageToEditor';
3
- //# sourceMappingURL=index.js.map
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/sdk/client/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC"}