@dotcms/client 0.0.1-alpha.38 → 0.0.1-alpha.39

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/.eslintrc.json +18 -0
  2. package/jest.config.ts +15 -0
  3. package/package.json +3 -15
  4. package/project.json +72 -0
  5. package/src/index.ts +30 -0
  6. package/src/lib/client/content/builders/collection/collection.spec.ts +515 -0
  7. package/src/lib/client/content/builders/collection/{collection.d.ts → collection.ts} +209 -19
  8. package/src/lib/client/content/{content-api.d.ts → content-api.ts} +14 -4
  9. package/src/lib/client/content/shared/{const.d.ts → const.ts} +5 -3
  10. package/src/lib/client/content/shared/{types.d.ts → types.ts} +19 -2
  11. package/src/lib/client/content/shared/{utils.d.ts → utils.ts} +9 -1
  12. package/src/lib/client/models/{index.d.ts → index.ts} +8 -1
  13. package/src/lib/client/models/{types.d.ts → types.ts} +1 -0
  14. package/src/lib/client/sdk-js-client.spec.ts +483 -0
  15. package/src/lib/client/{sdk-js-client.d.ts → sdk-js-client.ts} +181 -15
  16. package/src/lib/editor/listeners/listeners.spec.ts +119 -0
  17. package/src/lib/editor/listeners/listeners.ts +223 -0
  18. package/src/lib/editor/models/{client.model.d.ts → client.model.ts} +19 -16
  19. package/src/lib/editor/models/{editor.model.d.ts → editor.model.ts} +9 -5
  20. package/src/lib/editor/models/{listeners.model.d.ts → listeners.model.ts} +9 -6
  21. package/src/lib/editor/sdk-editor-vtl.ts +31 -0
  22. package/src/lib/editor/sdk-editor.spec.ts +116 -0
  23. package/src/lib/editor/sdk-editor.ts +105 -0
  24. package/src/lib/editor/utils/editor.utils.spec.ts +206 -0
  25. package/src/lib/editor/utils/{editor.utils.d.ts → editor.utils.ts} +121 -22
  26. package/src/lib/query-builder/lucene-syntax/{Equals.d.ts → Equals.ts} +45 -11
  27. package/src/lib/query-builder/lucene-syntax/{Field.d.ts → Field.ts} +13 -5
  28. package/src/lib/query-builder/lucene-syntax/{NotOperand.d.ts → NotOperand.ts} +13 -5
  29. package/src/lib/query-builder/lucene-syntax/{Operand.d.ts → Operand.ts} +21 -7
  30. package/src/lib/query-builder/sdk-query-builder.spec.ts +159 -0
  31. package/src/lib/query-builder/{sdk-query-builder.d.ts → sdk-query-builder.ts} +16 -5
  32. package/src/lib/query-builder/utils/{index.d.ts → index.ts} +49 -12
  33. package/src/lib/utils/graphql/transforms.spec.ts +150 -0
  34. package/src/lib/utils/graphql/transforms.ts +99 -0
  35. package/src/lib/utils/page/common-utils.spec.ts +37 -0
  36. package/src/lib/utils/page/common-utils.ts +64 -0
  37. package/tsconfig.json +22 -0
  38. package/tsconfig.lib.json +13 -0
  39. package/tsconfig.spec.json +9 -0
  40. package/index.cjs.d.ts +0 -1
  41. package/index.cjs.default.js +0 -1
  42. package/index.cjs.js +0 -1953
  43. package/index.cjs.mjs +0 -2
  44. package/index.esm.d.ts +0 -1
  45. package/index.esm.js +0 -1944
  46. package/src/index.d.ts +0 -6
  47. package/src/lib/editor/listeners/listeners.d.ts +0 -50
  48. package/src/lib/editor/sdk-editor-vtl.d.ts +0 -6
  49. package/src/lib/editor/sdk-editor.d.ts +0 -54
  50. package/src/lib/utils/graphql/transforms.d.ts +0 -24
  51. package/src/lib/utils/page/common-utils.d.ts +0 -33
  52. /package/src/lib/query-builder/lucene-syntax/{index.d.ts → index.ts} +0 -0
  53. /package/src/lib/utils/{index.d.ts → index.ts} +0 -0
package/src/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { ClientConfig, DotCmsClient } from './lib/client/sdk-js-client';
2
- import { CUSTOMER_ACTIONS, postMessageToEditor } from './lib/editor/models/client.model';
3
- import { CustomClientParams, DotCMSPageEditorConfig, EditorConfig } from './lib/editor/models/editor.model';
4
- import { destroyEditor, initEditor, isInsideEditor, updateNavigation } from './lib/editor/sdk-editor';
5
- import { getPageRequestParams, graphqlToPageEntity } from './lib/utils';
6
- export { graphqlToPageEntity, getPageRequestParams, isInsideEditor, DotCmsClient, DotCMSPageEditorConfig, CUSTOMER_ACTIONS, CustomClientParams, postMessageToEditor, EditorConfig, initEditor, updateNavigation, destroyEditor, ClientConfig };
@@ -1,50 +0,0 @@
1
- import { DotCMSPageEditorSubscription } from '../models/listeners.model';
2
- declare global {
3
- interface Window {
4
- lastScrollYPosition: number;
5
- }
6
- }
7
- /**
8
- * Represents an array of DotCMSPageEditorSubscription objects.
9
- * Used to store the subscriptions for the editor and unsubscribe later.
10
- */
11
- export declare const subscriptions: DotCMSPageEditorSubscription[];
12
- /**
13
- * Listens for editor messages and performs corresponding actions based on the received message.
14
- *
15
- * @private
16
- * @memberof DotCMSPageEditor
17
- */
18
- export declare function listenEditorMessages(): void;
19
- /**
20
- * Listens for pointer move events and extracts information about the hovered contentlet.
21
- *
22
- * @private
23
- * @memberof DotCMSPageEditor
24
- */
25
- export declare function listenHoveredContentlet(): void;
26
- /**
27
- * Attaches a scroll event listener to the window
28
- * and sends a message to the editor when the window is scrolled.
29
- *
30
- * @private
31
- * @memberof DotCMSPageEditor
32
- */
33
- export declare function scrollHandler(): void;
34
- /**
35
- * Restores the scroll position of the window when an iframe is loaded.
36
- * Only used in VTL Pages.
37
- * @export
38
- * @example
39
- * ```ts
40
- * preserveScrollOnIframe();
41
- * ```
42
- */
43
- export declare function preserveScrollOnIframe(): void;
44
- /**
45
- * Sends a message to the editor to get the page data.
46
- * @param {string} pathname - The pathname of the page.
47
- * @private
48
- * @memberof DotCMSPageEditor
49
- */
50
- export declare function fetchPageDataFromInsideUVE(pathname: string): void;
@@ -1,6 +0,0 @@
1
- declare global {
2
- interface Window {
3
- lastScrollYPosition: number;
4
- }
5
- }
6
- export {};
@@ -1,54 +0,0 @@
1
- import { DotCMSPageEditorConfig } from './models/editor.model';
2
- /**
3
- * Updates the navigation in the editor.
4
- *
5
- * @param {string} pathname - The pathname to update the navigation with.
6
- * @memberof DotCMSPageEditor
7
- * @example
8
- * updateNavigation('/home'); // Sends a message to the editor to update the navigation to '/home'
9
- */
10
- export declare function updateNavigation(pathname: string): void;
11
- /**
12
- * Checks if the code is running inside an editor.
13
- *
14
- * @returns {boolean} Returns true if the code is running inside an editor, otherwise false.
15
- * @example
16
- * ```ts
17
- * if (isInsideEditor()) {
18
- * console.log('Running inside the editor');
19
- * } else {
20
- * console.log('Running outside the editor');
21
- * }
22
- * ```
23
- */
24
- export declare function isInsideEditor(): boolean;
25
- /**
26
- * Initializes the DotCMS page editor.
27
- *
28
- * @param {DotCMSPageEditorConfig} config - Optional configuration for the editor.
29
- * @example
30
- * ```ts
31
- * const config = { pathname: '/home' };
32
- * initEditor(config); // Initializes the editor with the provided configuration
33
- * ```
34
- */
35
- export declare function initEditor(config: DotCMSPageEditorConfig): void;
36
- /**
37
- * Destroys the editor by removing event listeners and disconnecting observers.
38
- *
39
- * @example
40
- * ```ts
41
- * destroyEditor(); // Cleans up the editor by removing all event listeners and disconnecting observers
42
- * ```
43
- */
44
- export declare function destroyEditor(): void;
45
- /**
46
- * Adds a style class to empty contentlets.
47
- *
48
- * @export
49
- * @example
50
- * ```ts
51
- * addClassToEmptyContentlets(); // Adds the 'empty-contentlet' class to all contentlets that have no height
52
- * ```
53
- */
54
- export declare function addClassToEmptyContentlets(): void;
@@ -1,24 +0,0 @@
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 {};
@@ -1,33 +0,0 @@
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;
File without changes