@jahia/javascript-modules-library 0.5.5 → 0.6.0

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 (33) hide show
  1. package/README.md +215 -22
  2. package/dist/core/server/components/AbsoluteArea.d.ts +43 -18
  3. package/dist/core/server/components/AddResources.d.ts +1 -1
  4. package/dist/core/server/components/Area.d.ts +32 -16
  5. package/dist/core/server/components/render/HydrateInBrowser.d.ts +21 -0
  6. package/dist/core/server/components/render/Render.d.ts +4 -4
  7. package/dist/core/server/components/render/RenderChild.d.ts +16 -0
  8. package/dist/core/server/components/render/RenderChildren.d.ts +33 -0
  9. package/dist/core/server/components/render/RenderInBrowser.d.ts +2 -0
  10. package/dist/core/server/components/render/internal/InBrowser.d.ts +2 -1
  11. package/dist/core/server/framework/jahiaComponent.d.ts +7 -0
  12. package/dist/core/server/hooks/useServerContext.d.ts +4 -2
  13. package/dist/core/server/utils/i18n.d.ts +11 -0
  14. package/dist/core/server/utils/jcr/getChildNodes.d.ts +1 -2
  15. package/dist/core/server/utils/jcr/getNodesByJCRQuery.d.ts +1 -1
  16. package/dist/core/server/utils/urlBuilder/urlBuilder.d.ts +52 -15
  17. package/dist/globals.d.ts +3 -0
  18. package/dist/index.d.ts +6 -3
  19. package/dist/java.io.d.ts +164 -0
  20. package/dist/java.lang.d.ts +16 -0
  21. package/dist/java.util.d.ts +2 -1
  22. package/dist/javax.jcr.d.ts +13 -0
  23. package/dist/javax.servlet.http.d.ts +70 -0
  24. package/dist/nav/server/navBuilder/navBuilder.d.ts +5 -3
  25. package/dist/org.jahia.modules.javascript.modules.engine.js.server.d.ts +56 -50
  26. package/dist/org.jahia.services.content.d.ts +41 -1
  27. package/dist/org.jahia.services.content.decorator.d.ts +97 -2
  28. package/dist/org.jahia.services.render.d.ts +6 -0
  29. package/dist/org.jahia.services.usermanager.d.ts +11 -0
  30. package/dist/package.tgz +0 -0
  31. package/package.json +5 -1
  32. package/dist/core/server/hooks/useUrlBuilder.d.ts +0 -52
  33. package/dist/core/server/utils/jcr/getNodeFromPathOrId.d.ts +0 -14
package/README.md CHANGED
@@ -1,36 +1,229 @@
1
- # javascript-modules-library
1
+ # @jahia/javascript-modules-library
2
2
 
3
- Javascript Library for Javascript Module Engine
3
+ This library exposes common types and utility functions for JavaScript modules running in a Jahia environment. It exposes the following APIs:
4
4
 
5
- ## Generated types
5
+ ## Rendering components
6
6
 
7
- This library contains types generated from Java source code. The types are generated using a tool called java-ts-bind
8
- that was forked here : https://github.com/Jahia/java-ts-bind/tree/finer-excludes . You don't need to checkout this
9
- repository as the scripts will automatically do that for you but we mention it in case you need to make modifications
10
- to it.
7
+ ### `RenderInBrowser`
11
8
 
12
- By default, the generated types are committed in this project, but if you need to rebuild/update them, you can do so by
13
- using the following steps:
9
+ This component is used to render a React component in the browser. It is used to render a component in the browser, skipping the server-side rendering step. Provided children, if any, will be rendered on the server and replaced by the component in the browser.
14
10
 
15
- 1. Change to the project directory :
11
+ ```tsx
12
+ <RenderInBrowser child={MyComponent} props={{ foo: "bar" }}>
13
+ <div>Loading...</div>
14
+ </RenderInBrowser>
15
+ ```
16
16
 
17
- `cd types/generated`
17
+ ### `HydrateInBrowser`
18
18
 
19
- 2. Launch the script that will clone the java-ts-bind repository and build it from source code (it has never been released) :
19
+ This component is used to hydrate a React component in the browser. It will be rendered on the server then hydrated in the browser. Provided children, if any, will be children of the component.
20
20
 
21
- `./build.sh`
21
+ ```tsx
22
+ <HydrateInBrowser child={MyComponent} props={{ foo: "bar" }}>
23
+ <div>I'm a child of MyComponent</div>
24
+ </HydrateInBrowser>
25
+ ```
22
26
 
23
- 3. Update the classes and methods declared in [types/generated/package.json](types/generated/package.json) in case you added/removed classes or methods.
27
+ ### `Render`
24
28
 
25
- 4. Launch the script that will download all the required source code and JARs for the type generation and that will
26
- also compile the source to generated the required symbols JARs. Then it will generate the types, and finally apply
27
- some post-processing to the generated types to make usable :
29
+ This component renders a Jahia component out of a node or a JS object.
28
30
 
29
- `./generate.sh`
31
+ ```tsx
32
+ // Render a JCR node
33
+ <Render node={node} />
30
34
 
31
- Note that the generation will take some time on the initial build as it needs to download all the required source code
32
- and JARs, and build the projects from the source code.
35
+ // Render a JS object
36
+ <Render content={{ nodeType: "ns:nodeType" }}>
37
+ ```
33
38
 
34
- Once completed, the generated types will be in the following directory :
39
+ ### `RenderChild`
35
40
 
36
- types/generated/build/types
41
+ This component renders a child node of the current node. It's a thin wrapper around `Render` and `AddContentButtons`.
42
+
43
+ ```tsx
44
+ <RenderChild name="child" />
45
+ ```
46
+
47
+ ### `RenderChildren`
48
+
49
+ This component renders all children of the current node. It's a thin wrapper around `Render`, `getChildNodes` and `AddContentButtons`.
50
+
51
+ ```tsx
52
+ <RenderChildren />
53
+ ```
54
+
55
+ ## Components
56
+
57
+ ### `AbsoluteArea`
58
+
59
+ This component creates an absolute area in the page. It's an area of user-contributable content, child of the node of your choice.
60
+
61
+ ```tsx
62
+ <AbsoluteArea name="footer" parent={renderContext.getSite().getHome()} />
63
+ ```
64
+
65
+ ### `Area`
66
+
67
+ This component creates an area in the page. It's an area of user-contributable content that is local to the page where it is present.
68
+
69
+ ```tsx
70
+ <Area name="main" />
71
+ ```
72
+
73
+ ### `AddContentButtons`
74
+
75
+ This component renders a set of buttons to add content to the current node.
76
+
77
+ ```tsx
78
+ <AddContentButtons />
79
+ ```
80
+
81
+ ### `AddResources`
82
+
83
+ This component adds resources to the page, making sure they are loaded only once and insert them at the desired position.
84
+
85
+ ```tsx
86
+ <AddResources type="css" resources="styles.css" />
87
+ ```
88
+
89
+ ## Declaration and registration
90
+
91
+ ### `jahiaComponent`
92
+
93
+ This function is used to declare a Jahia component. It takes a component definition as first argument, and a React component as second argument.
94
+
95
+ ```tsx
96
+ jahiaComponent(
97
+ {
98
+ componentType: "view",
99
+ nodeType: "ns:hello",
100
+ },
101
+ ({ name }: { name: string }) => {
102
+ return <h1>Hello {name}!</h1>;
103
+ },
104
+ );
105
+ ```
106
+
107
+ The first argument of the component function is an object containing the JCR properties of the node being rendered. The server context is passed as the second argument. See `useServerContext` for more information.
108
+
109
+ ## Hooks
110
+
111
+ ### `useGQLQuery`
112
+
113
+ This hook is used to execute a GraphQL query on the current Jahia instance.
114
+
115
+ ```tsx
116
+ const { data, errors } = useGQLQuery({
117
+ query: /* GraphQL */ `
118
+ query MyQuery($workspace: Workspace!) {
119
+ jcr(workspace: $workspace) {
120
+ workspace
121
+ }
122
+ }
123
+ `,
124
+ variables: {
125
+ workspace: "LIVE",
126
+ },
127
+ });
128
+ ```
129
+
130
+ ### `useJCRQuery`
131
+
132
+ This hook is used to execute a JCR query on the current Jahia instance.
133
+
134
+ ```tsx
135
+ const pages = useJCRQuery({ query: "SELECT * FROM [jnt:page]" });
136
+ ```
137
+
138
+ ### `useServerContext`
139
+
140
+ This hook is used to access the server context, which contains information about the current node, page, and rendering context.
141
+
142
+ ```tsx
143
+ const {
144
+ /**
145
+ * Jahia's rendering context, it provides access to all kinds of context information, such as the
146
+ * current request, response, user, mode, mainResource and more
147
+ */
148
+ renderContext,
149
+ /**
150
+ * The current resource being rendered, which is a combination of the current node and its
151
+ * template/view information
152
+ */
153
+ currentResource,
154
+ /** The current JCR node being rendered */
155
+ currentNode,
156
+ /** The main JCR node being rendered, which is the root node of the current page */
157
+ mainNode,
158
+ /** The OSGi bundle key of the current module being rendered */
159
+ bundleKey,
160
+ } = useServerContext();
161
+ ```
162
+
163
+ You do not need to use this hook when rendering a component with `jahiaComponent`, as the server context is passed as the second argument of the component function.
164
+
165
+ ## JCR utils
166
+
167
+ ### `getChildNodes`
168
+
169
+ This function is used to get the child nodes of a JCR node.
170
+
171
+ ```tsx
172
+ const children = getChildNodes(node, limit, offset, filter);
173
+ ```
174
+
175
+ ### `getNodeProps`
176
+
177
+ This function is used to get the properties of a JCR node.
178
+
179
+ ```tsx
180
+ const { title, description } = getNodeProps(node, ["title", "description"]);
181
+ ```
182
+
183
+ ### `getNodesByJCRQuery`
184
+
185
+ This function is used to get nodes by a JCR query.
186
+
187
+ ```tsx
188
+ const pages = getNodesByJCRQuery(session, "SELECT * FROM [jnt:page]", limit, offset);
189
+ ```
190
+
191
+ ## URL builder
192
+
193
+ ### `buildEndpointUrl`
194
+
195
+ This function transforms a path to an endpoint into a full URL.
196
+
197
+ ```tsx
198
+ const dashboard = buildEndpointUrl("/jahia/dashboard");
199
+ ```
200
+
201
+ ### `buildNodeUrl`
202
+
203
+ This function transforms a JCR node into a full URL to the node.
204
+
205
+ ```tsx
206
+ const home = buildNodeUrl(renderContext.getSite().getHome().getNode());
207
+ ```
208
+
209
+ ### `buildModuleFileUrl`
210
+
211
+ This function transforms a path to a file in the module into a full URL.
212
+
213
+ ```tsx
214
+ const styles = buildModuleFileUrl("dist/styles.css");
215
+ ```
216
+
217
+ ## Java server API
218
+
219
+ ### `server`
220
+
221
+ This variable provides access to the Java server API.
222
+
223
+ ```tsx
224
+ const bundle = server.osgi.getBundle(bundleKey);
225
+ ```
226
+
227
+ ## Remarks
228
+
229
+ This module does not contain actual implementations of the components and hooks. All accesses to `@jahia/javascript-modules-engine` must be replaced by `javascriptModulesLibraryBuilder.getSharedLibrary('@jahia/javascript-modules-engine')` in the final bundle. This is done automatically during the build process if you use [@jahia/vite-plugin](https://www.npmjs.com/package/@jahia/vite-plugin).
@@ -1,39 +1,64 @@
1
1
  import type React from "react";
2
+ import type { JCRNodeWrapper } from "org.jahia.services.content";
2
3
  /**
3
4
  * Generates an absolute area in which editors may insert content objects.
4
5
  *
5
6
  * @returns The AbsoluteArea component
6
7
  */
7
- export declare function AbsoluteArea({ name, areaView, allowedTypes, numberOfItems, subNodesView, path, editable, level, areaType, limitedAbsoluteAreaEdit, parameters, }: Readonly<{
8
+ export declare function AbsoluteArea({ name, parent, areaView, view, allowedTypes, allowedNodeTypes, numberOfItems, readOnly, areaType, nodeType, parameters, }: Readonly<{
8
9
  /** The name of the area. */
9
- name?: string;
10
- /** The view to use for the area. */
10
+ name: string;
11
+ /**
12
+ * Parent node where the area is stored in the JCR. Can be anywhere in the JCR. The parent node
13
+ * must exist.
14
+ */
15
+ parent: JCRNodeWrapper;
16
+ /**
17
+ * The view to use for the area.
18
+ *
19
+ * @deprecated Use {@link #view} instead
20
+ */
11
21
  areaView?: string;
12
- /** The allowed types for the area. */
22
+ /** The view to use for the area. */
23
+ view?: string;
24
+ /**
25
+ * The allowed types for the area.
26
+ *
27
+ * @deprecated Use {@link #allowedNodeTypes} instead
28
+ */
13
29
  allowedTypes?: string[];
30
+ /** The allowed types for the area. */
31
+ allowedNodeTypes?: string[];
14
32
  /** The number of items to display in the area. */
15
33
  numberOfItems?: number;
16
- /** The view to use for the subnodes. */
17
- subNodesView?: string;
18
- /** Relative (to the current node) or absolute path to the node to include. */
19
- path?: string;
20
34
  /**
21
- * Enables or disables edition of this content in edit mode. Mainly used for absolute or
22
- * references.
35
+ * Makes the area read-only.
36
+ *
37
+ * - When set to `false` (default), the area is editable on all pages.
38
+ * - When set to `true`, the area is read-only on all pages.
39
+ * - When set to `"children"`, the area is read-only on all pages except the one containing its
40
+ * node.
23
41
  *
24
- * @default true
42
+ * @default false
25
43
  */
26
- editable?: boolean;
27
- /** Ancestor level for absolute area - 0 is Home page, 1 first sub-pages, ... */
28
- level?: number;
44
+ readOnly?: boolean | "children";
29
45
  /**
30
- * Content type to be used to create the area
46
+ * Node type to be used to create the area (if the node does not exist yet)
31
47
  *
48
+ * @deprecated Use {@link #nodeType} instead
32
49
  * @default jnt:contentList
33
50
  */
34
51
  areaType?: string;
35
- /** Is the absolute area editable everywhere or only on the page containing its node. */
36
- limitedAbsoluteAreaEdit?: boolean;
37
- /** The parameters to pass to the absolute area */
52
+ /**
53
+ * Node type to be used to create the area (if the node does not exist yet)
54
+ *
55
+ * @default jnt:contentList
56
+ */
57
+ nodeType?: string;
58
+ /**
59
+ * Map of custom parameters that can be passed to the backend engine for advanced logic.
60
+ *
61
+ * @deprecated Not recommended
62
+ */
38
63
  parameters?: Record<string, unknown>;
39
64
  }>): React.JSX.Element;
@@ -24,7 +24,7 @@ export declare function AddResources(props: Readonly<{
24
24
  * The type of the resource. This could be 'javascript' for .js files, 'css' for .css files,
25
25
  * etc.
26
26
  */
27
- type?: "javascript" | "css";
27
+ type?: "javascript" | "css" | "inline";
28
28
  /** The path to the resource file, relative to the module. */
29
29
  resources?: string;
30
30
  /** Inline HTML that markup will be considered as resource. */
@@ -4,34 +4,50 @@ import type { JSX } from "react";
4
4
  *
5
5
  * @returns The Area component
6
6
  */
7
- export declare function Area({ name, areaView, allowedTypes, numberOfItems, subNodesView, path, editable, areaAsSubNode, areaType, parameters, }: Readonly<{
7
+ export declare function Area({ name, areaView, view, allowedTypes, allowedNodeTypes, numberOfItems, readOnly, areaType, nodeType, parameters, }: Readonly<{
8
8
  /** The name of the area. */
9
- name?: string;
10
- /** The view to use for the area. */
9
+ name: string;
10
+ /**
11
+ * The view to use for the area.
12
+ *
13
+ * @deprecated Use {@link #view} instead
14
+ */
11
15
  areaView?: string;
12
- /** The allowed types for the area. */
16
+ /** The view to use for the area. */
17
+ view?: string;
18
+ /**
19
+ * The allowed types for the area.
20
+ *
21
+ * @deprecated Use {@link #allowedNodeTypes} instead
22
+ */
13
23
  allowedTypes?: string[];
24
+ /** The allowed types for the area. */
25
+ allowedNodeTypes?: string[];
14
26
  /** The number of items to display in the area. */
15
27
  numberOfItems?: number;
16
- /** The view to use for the subnodes. */
17
- subNodesView?: string;
18
- /** Relative (to the current node) or absolute path to the node to include. */
19
- path?: string;
20
28
  /**
21
- * Enables or disables edition of this content in edit mode. Mainly used for absolute or
22
- * references.
29
+ * Makes the area read-only.
23
30
  *
24
- * @default true
31
+ * @default false
25
32
  */
26
- editable?: boolean;
27
- /** Allow area to be stored as a subnode */
28
- areaAsSubNode?: boolean;
33
+ readOnly?: boolean;
29
34
  /**
30
- * Content type to be used to create the area
35
+ * Node type to be used to create the area (if the node does not exist yet)
31
36
  *
37
+ * @deprecated Use {@link #nodeType} instead
32
38
  * @default jnt:contentList
33
39
  */
34
40
  areaType?: string;
35
- /** The parameters to pass to the area */
41
+ /**
42
+ * Node type to be used to create the area (if the node does not exist yet)
43
+ *
44
+ * @default jnt:contentList
45
+ */
46
+ nodeType?: string;
47
+ /**
48
+ * Map of custom parameters that can be passed to the backend engine for advanced logic.
49
+ *
50
+ * @deprecated Not recommended
51
+ */
36
52
  parameters?: Record<string, unknown>;
37
53
  }>): JSX.Element;
@@ -5,6 +5,27 @@
5
5
  *
6
6
  * @returns The component to be hydrated in the browser
7
7
  */
8
+ export declare function HydrateInBrowser<T, U>(props: Readonly<{
9
+ /** The React component. */
10
+ child: React.ComponentType<{
11
+ children: U;
12
+ } & T>;
13
+ /**
14
+ * The React component props, these props will be serialized/deserialized to be usable server
15
+ * and client side. The serialization is done using
16
+ * [devalue](https://www.npmjs.com/package/devalue) allowing most standard JS types, including
17
+ * `Set` and `Map`.
18
+ */
19
+ props: Omit<T & React.JSX.IntrinsicAttributes, "children">;
20
+ children: U;
21
+ }>): React.JSX.Element;
22
+ export declare function HydrateInBrowser<U>(props: Readonly<{
23
+ /** The React component. */
24
+ child: React.ComponentType<{
25
+ children: U;
26
+ }>;
27
+ children: U;
28
+ }>): React.JSX.Element;
8
29
  export declare function HydrateInBrowser<T>(props: Readonly<{
9
30
  /** The React component. */
10
31
  child: React.ComponentType<T>;
@@ -4,7 +4,7 @@ import type { JCRNodeWrapper } from "org.jahia.services.content";
4
4
  *
5
5
  * @returns The rendered output of the view for the specified content
6
6
  */
7
- export declare function Render({ content, node, path, editable, advanceRenderingConfig, templateType, view, parameters, }: Readonly<{
7
+ export declare function Render({ content, node, path, readOnly, advanceRenderingConfig, templateType, view, parameters, }: Readonly<{
8
8
  /** The content node to render */
9
9
  content?: unknown;
10
10
  /** The node to render */
@@ -12,11 +12,11 @@ export declare function Render({ content, node, path, editable, advanceRendering
12
12
  /** The path to render */
13
13
  path?: string;
14
14
  /**
15
- * If the content should be editable
15
+ * Makes the child read-only.
16
16
  *
17
- * @default true
17
+ * @default false
18
18
  */
19
- editable?: boolean;
19
+ readOnly?: boolean;
20
20
  /**
21
21
  * Specifies if we should render a node or simply include a view. Acceptable values are : none,
22
22
  * INCLUDE or OPTION
@@ -0,0 +1,16 @@
1
+ import type { JSX } from "react";
2
+ /**
3
+ * Renders a child of the current node, designated by its name.
4
+ *
5
+ * If the child node does not exist, it will display the "Add content" buttons.
6
+ */
7
+ export declare function RenderChild({ name, view, }: {
8
+ /**
9
+ * The name of the child node to render.
10
+ *
11
+ * In the CND file, it's what's after the `+` in the child node definition: `+ name (type)`.
12
+ */
13
+ name: string;
14
+ /** View to use when rendering the child. */
15
+ view?: string | undefined;
16
+ }): JSX.Element;
@@ -0,0 +1,33 @@
1
+ import type { JSX } from "react";
2
+ import type { JCRNodeWrapper } from "org.jahia.services.content";
3
+ /** Renders the children of the current node, and "Add content" buttons afterwards. */
4
+ export declare function RenderChildren({ view, pagination, filter, }: {
5
+ /** View to use when rendering the children. */
6
+ view?: string | undefined;
7
+ /**
8
+ * Pagination parameters:
9
+ *
10
+ * - `{ count: number; start?: number }` to specify the number of children to display and the
11
+ * starting index (defaults to 0).
12
+ * - `{ count: number; page: number }` to specify the number of children to display and the page
13
+ * number.
14
+ *
15
+ * If not provided, all children will be displayed.
16
+ */
17
+ pagination?: {
18
+ count: number;
19
+ start?: number;
20
+ } | {
21
+ count: number;
22
+ page: number;
23
+ };
24
+ /**
25
+ * Filter to apply to the children:
26
+ *
27
+ * - A string to filter by node type.
28
+ * - A function to filter by custom logic.
29
+ *
30
+ * @default "jnt:content"
31
+ */
32
+ filter?: string | ((node: JCRNodeWrapper) => boolean);
33
+ }): JSX.Element;
@@ -14,8 +14,10 @@ export declare function RenderInBrowser<T>(props: Readonly<{
14
14
  * `Set` and `Map`.
15
15
  */
16
16
  props: T & React.JSX.IntrinsicAttributes;
17
+ children?: React.ReactNode;
17
18
  }>): React.JSX.Element;
18
19
  export declare function RenderInBrowser(props: Readonly<{
19
20
  /** The React component */
20
21
  child: React.ComponentType;
22
+ children?: React.ReactNode;
21
23
  }>): React.JSX.Element;
@@ -1,6 +1,7 @@
1
- declare function InBrowser<T>({ child: Child, props, ssr, }: Readonly<{
1
+ declare function InBrowser<T>({ child: Child, props, ssr, children, }: Readonly<{
2
2
  child: React.ComponentType<T>;
3
3
  props: T & React.JSX.IntrinsicAttributes;
4
4
  ssr?: boolean;
5
+ children?: React.ReactNode;
5
6
  }>): React.JSX.Element;
6
7
  export default InBrowser;
@@ -15,6 +15,13 @@ export interface JahiaComponent {
15
15
  componentType: "template" | "view";
16
16
  /** The content node type the component applies to. */
17
17
  nodeType: string;
18
+ /**
19
+ * The priority of the components in case multiple templates/views are applicable to a given
20
+ * resource. The component with the highest priority has precedence over the other components.
21
+ *
22
+ * @default 0
23
+ */
24
+ priority?: number;
18
25
  /** Properties to add on the component, optional. */
19
26
  properties?: Record<string, string>;
20
27
  }
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { RenderContext, Resource } from "org.jahia.services.render";
3
- import type { JCRNodeWrapper } from "org.jahia.services.content";
3
+ import type { JCRNodeWrapper, JCRSessionWrapper } from "org.jahia.services.content";
4
4
  /**
5
5
  * A context object that gives access to the underlying Jahia Java objects that are part of the
6
6
  * current rendering context
@@ -20,6 +20,8 @@ export interface ServerContext {
20
20
  currentNode: JCRNodeWrapper;
21
21
  /** The main JCR node being rendered, which is the root node of the current page */
22
22
  mainNode: JCRNodeWrapper;
23
+ /** The JCR Session of the current user in its current language * */
24
+ jcrSession: JCRSessionWrapper;
23
25
  /** The OSGi bundle key of the current module being rendered */
24
26
  bundleKey: string;
25
27
  }
@@ -29,6 +31,6 @@ export interface ServerContext {
29
31
  * @returns The server context
30
32
  */
31
33
  export declare function useServerContext(): ServerContext;
32
- export declare function ServerContextProvider({ renderContext, currentResource, currentNode, mainNode, bundleKey, children, }: ServerContext & {
34
+ export declare function ServerContextProvider({ renderContext, currentResource, currentNode, mainNode, jcrSession, bundleKey, children, }: ServerContext & {
33
35
  readonly children: ReactNode;
34
36
  }): React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { Locale } from "java.util";
2
+ import type { RenderContext } from "org.jahia.services.render";
3
+ /**
4
+ * Returns the locales available on the site, as a record of language code (e.g. en_US) to locale
5
+ * object.
6
+ *
7
+ * If not provided, the `renderContext` is taken from the current server context.
8
+ */
9
+ export declare function getSiteLocales({ renderContext }?: {
10
+ renderContext: RenderContext;
11
+ }): Record<string, Locale>;
@@ -1,4 +1,3 @@
1
- import type { Node } from "javax.jcr";
2
1
  import type { JCRNodeWrapper } from "org.jahia.services.content";
3
2
  /**
4
3
  * Returns an array of child nodes of a given node.
@@ -11,4 +10,4 @@ import type { JCRNodeWrapper } from "org.jahia.services.content";
11
10
  * @param filter A function to filter the nodes to be returned.
12
11
  * @returns An array of child nodes.
13
12
  */
14
- export declare function getChildNodes(node: JCRNodeWrapper, limit: number, offset?: number, filter?: ((node: Node) => boolean) | undefined): Node[];
13
+ export declare function getChildNodes(node: JCRNodeWrapper, limit?: number | undefined, offset?: number, filter?: ((node: JCRNodeWrapper) => boolean) | undefined): JCRNodeWrapper[];
@@ -11,4 +11,4 @@ import type { JCRSessionWrapper } from "org.jahia.services.content";
11
11
  * @param offset The offset to start from
12
12
  * @returns An array containing the nodes returned by the query
13
13
  */
14
- export declare function getNodesByJCRQuery(session: JCRSessionWrapper, query: string, limit: number, offset?: number): Node[];
14
+ export declare function getNodesByJCRQuery(session: JCRSessionWrapper, query: string, limit?: number | undefined, offset?: number): Node[];