@jahia/javascript-modules-library 0.4.0 → 0.5.1
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 +11 -10
- package/bin/jahia-deploy.mjs +24 -11
- package/{types → dist}/core/server/components/AbsoluteArea.d.ts +7 -3
- package/dist/core/server/components/AddContentButtons.d.ts +47 -0
- package/dist/core/server/components/AddResources.d.ts +63 -0
- package/{types → dist}/core/server/components/Area.d.ts +8 -4
- package/{types → dist}/core/server/components/render/HydrateInBrowser.d.ts +9 -4
- package/{types → dist}/core/server/components/render/Render.d.ts +7 -7
- package/dist/core/server/components/render/RenderInBrowser.d.ts +21 -0
- package/dist/core/server/components/render/internal/InBrowser.d.ts +6 -0
- package/dist/core/server/framework/defineJahiaComponent.d.ts +9 -0
- package/dist/core/server/framework/jahiaComponent.d.ts +28 -0
- package/dist/core/server/framework/register.d.ts +11 -0
- package/dist/core/server/hooks/useGQLQuery.d.ts +17 -0
- package/dist/core/server/hooks/useJCRQuery.d.ts +10 -0
- package/dist/core/server/hooks/useServerContext.d.ts +34 -0
- package/dist/core/server/hooks/useUrlBuilder.d.ts +52 -0
- package/dist/core/server/utils/jcr/getChildNodes.d.ts +14 -0
- package/dist/core/server/utils/jcr/getNodeFromPathOrId.d.ts +14 -0
- package/dist/core/server/utils/jcr/getNodeProps.d.ts +9 -0
- package/dist/core/server/utils/jcr/getNodesByJCRQuery.d.ts +14 -0
- package/dist/core/server/utils/urlBuilder/urlBuilder.d.ts +25 -0
- package/dist/globals.d.ts +47 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +5 -0
- package/dist/nav/server/navBuilder/navBuilder.d.ts +29 -0
- package/{types → dist}/org.jahia.modules.javascript.modules.engine.js.server.d.ts +1 -2
- package/dist/package.tgz +0 -0
- package/package.json +33 -58
- package/core/server/components/AbsoluteArea.js +0 -1
- package/core/server/components/AddContentButtons.js +0 -1
- package/core/server/components/AddResources.js +0 -1
- package/core/server/components/Area.js +0 -1
- package/core/server/components/render/HydrateInBrowser.js +0 -1
- package/core/server/components/render/Render.js +0 -1
- package/core/server/components/render/RenderInBrowser.js +0 -1
- package/core/server/components/render/internal/InBrowser.js +0 -1
- package/core/server/framework/defineJahiaComponent.js +0 -1
- package/core/server/framework/register.js +0 -1
- package/core/server/hooks/useGQLQuery.js +0 -1
- package/core/server/hooks/useJCRQuery.js +0 -1
- package/core/server/hooks/useServerContext.js +0 -1
- package/core/server/hooks/useUrlBuilder.js +0 -1
- package/core/server/utils/jcr/getChildNodes.js +0 -1
- package/core/server/utils/jcr/getNodeFromPathOrId.js +0 -1
- package/core/server/utils/jcr/getNodeProps.js +0 -1
- package/core/server/utils/jcr/getNodesByJCRQuery.js +0 -1
- package/core/server/utils/urlBuilder/urlBuilder.js +0 -1
- package/index.js +0 -1
- package/nav/server/navBuilder/navBuilder.js +0 -24
- package/types/@jahia/javascript-modules-library-private.d.ts +0 -60
- package/types/bin/jahia-deploy.d.mts +0 -1
- package/types/core/server/components/AddContentButtons.d.ts +0 -19
- package/types/core/server/components/AddResources.d.ts +0 -31
- package/types/core/server/components/render/RenderInBrowser.d.ts +0 -17
- package/types/core/server/components/render/internal/InBrowser.d.ts +0 -8
- package/types/core/server/framework/defineJahiaComponent.d.ts +0 -20
- package/types/core/server/framework/register.d.ts +0 -11
- package/types/core/server/hooks/useGQLQuery.d.ts +0 -5
- package/types/core/server/hooks/useJCRQuery.d.ts +0 -3
- package/types/core/server/hooks/useServerContext.d.ts +0 -14
- package/types/core/server/hooks/useUrlBuilder.d.ts +0 -31
- package/types/core/server/utils/jcr/getChildNodes.d.ts +0 -9
- package/types/core/server/utils/jcr/getNodeFromPathOrId.d.ts +0 -12
- package/types/core/server/utils/jcr/getNodeProps.d.ts +0 -7
- package/types/core/server/utils/jcr/getNodesByJCRQuery.d.ts +0 -9
- package/types/core/server/utils/urlBuilder/urlBuilder.d.ts +0 -27
- package/types/globals.d.ts +0 -11
- package/types/index.d.ts +0 -36
- package/types/nav/server/navBuilder/navBuilder.d.ts +0 -78
- package/types/server.d.ts +0 -27
- package/types/servercontext.d.ts +0 -29
- /package/{types → dist}/java.io.d.ts +0 -0
- /package/{types → dist}/java.net.d.ts +0 -0
- /package/{types → dist}/java.security.d.ts +0 -0
- /package/{types → dist}/java.util.d.ts +0 -0
- /package/{types → dist}/javax.jcr.d.ts +0 -0
- /package/{types → dist}/javax.servlet.d.ts +0 -0
- /package/{types → dist}/javax.servlet.http.d.ts +0 -0
- /package/{types → dist}/org.jahia.services.content.d.ts +0 -0
- /package/{types → dist}/org.jahia.services.content.decorator.d.ts +0 -0
- /package/{types → dist}/org.jahia.services.query.d.ts +0 -0
- /package/{types → dist}/org.jahia.services.render.d.ts +0 -0
- /package/{types → dist}/org.jahia.services.usermanager.d.ts +0 -0
- /package/{types → dist}/org.osgi.framework.d.ts +0 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export { RenderInBrowser } from "./core/server/components/render/RenderInBrowser.js";
|
|
2
|
+
export { HydrateInBrowser } from "./core/server/components/render/HydrateInBrowser.js";
|
|
3
|
+
export { Render } from "./core/server/components/render/Render.js";
|
|
4
|
+
export { AbsoluteArea } from "./core/server/components/AbsoluteArea.js";
|
|
5
|
+
export { AddContentButtons } from "./core/server/components/AddContentButtons.js";
|
|
6
|
+
export { AddResources } from "./core/server/components/AddResources.js";
|
|
7
|
+
export { Area } from "./core/server/components/Area.js";
|
|
8
|
+
export { defineJahiaComponent } from "./core/server/framework/defineJahiaComponent.js";
|
|
9
|
+
export { jahiaComponent } from "./core/server/framework/jahiaComponent.js";
|
|
10
|
+
export { registerJahiaComponents } from "./core/server/framework/register.js";
|
|
11
|
+
export { useGQLQuery } from "./core/server/hooks/useGQLQuery.js";
|
|
12
|
+
export { useJCRQuery } from "./core/server/hooks/useJCRQuery.js";
|
|
13
|
+
export { useServerContext, ServerContextProvider } from "./core/server/hooks/useServerContext.js";
|
|
14
|
+
export { useUrlBuilder } from "./core/server/hooks/useUrlBuilder.js";
|
|
15
|
+
export { getChildNodes } from "./core/server/utils/jcr/getChildNodes.js";
|
|
16
|
+
export { getNodeFromPathOrId } from "./core/server/utils/jcr/getNodeFromPathOrId.js";
|
|
17
|
+
export { getNodeProps } from "./core/server/utils/jcr/getNodeProps.js";
|
|
18
|
+
export { getNodesByJCRQuery } from "./core/server/utils/jcr/getNodesByJCRQuery.js";
|
|
19
|
+
export { buildUrl, initUrlBuilder } from "./core/server/utils/urlBuilder/urlBuilder.js";
|
|
20
|
+
export { buildNavMenu } from "./nav/server/navBuilder/navBuilder.js";
|
|
21
|
+
export { default as server } from "virtual:jahia-server";
|
|
22
|
+
|
|
23
|
+
// Include declarations for all Java types
|
|
24
|
+
export * from "./globals";
|
|
25
|
+
export * from "./java.io";
|
|
26
|
+
export * from "./java.net";
|
|
27
|
+
export * from "./java.security";
|
|
28
|
+
export * from "./java.util";
|
|
29
|
+
export * from "./javax.jcr";
|
|
30
|
+
export * from "./javax.servlet";
|
|
31
|
+
export * from "./javax.servlet.http";
|
|
32
|
+
export * from "./org.jahia.modules.javascript.modules.engine.js.server";
|
|
33
|
+
export * from "./org.jahia.services.content";
|
|
34
|
+
export * from "./org.jahia.services.content.decorator";
|
|
35
|
+
export * from "./org.jahia.services.query";
|
|
36
|
+
export * from "./org.jahia.services.render";
|
|
37
|
+
export * from "./org.jahia.services.usermanager";
|
|
38
|
+
export * from "./org.osgi.framework";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
console.error(
|
|
2
|
+
"You cannot import and run '@jahia/javascript-modules-library' because it's a virtual module.\n" +
|
|
3
|
+
"Something is wrong with your build configuration: instead of bundling '@jahia/javascript-modules-library', it should be replaced with 'javascriptModulesLibraryBuilder.getSharedLibrary(\"@jahia/javascript-modules-library\")'."
|
|
4
|
+
);
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { JCRNodeWrapper } from "org.jahia.services.content";
|
|
2
|
+
import type { RenderContext, Resource } from "org.jahia.services.render";
|
|
3
|
+
interface MenuEntry {
|
|
4
|
+
/** The HTML rendered HTML menu entry */
|
|
5
|
+
render: string;
|
|
6
|
+
/** The node object for the menu entry */
|
|
7
|
+
node: JCRNodeWrapper;
|
|
8
|
+
/** Whether the node is in the path */
|
|
9
|
+
inPath: boolean;
|
|
10
|
+
/** Whether the node is selected */
|
|
11
|
+
selected: boolean;
|
|
12
|
+
/** The level of the node */
|
|
13
|
+
level: number;
|
|
14
|
+
/** The children of the node */
|
|
15
|
+
children?: MenuEntry[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Build a navigation menu
|
|
19
|
+
*
|
|
20
|
+
* @param maxDepth The maximum depth of the menu
|
|
21
|
+
* @param base The base path of the menu
|
|
22
|
+
* @param menuEntryView The view to use for each menu entry
|
|
23
|
+
* @param startLevelValue The level at which to start the menu
|
|
24
|
+
* @param renderContext The current render context
|
|
25
|
+
* @param currentResource The current resource
|
|
26
|
+
* @returns An array of menu entries objects
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildNavMenu(maxDepth: number, base: string, menuEntryView: string, startLevelValue: number, renderContext: RenderContext, currentResource: Resource): MenuEntry[];
|
|
29
|
+
export {};
|
|
@@ -5,8 +5,8 @@ import { Collection, List, Map } from 'java.util';
|
|
|
5
5
|
import { JCRNodeWrapper, JCRCallback } from 'org.jahia.services.content';
|
|
6
6
|
|
|
7
7
|
import { JCRSiteNode } from 'org.jahia.services.content.decorator';
|
|
8
|
+
import { Promise } from 'org.jahia.modules.javascript.modules.engine.jsengine';
|
|
8
9
|
import { RenderContext, Resource } from 'org.jahia.services.render';
|
|
9
|
-
import { Promise, Registry, ContextProvider } from 'org.jahia.modules.javascript.modules.engine.jsengine';
|
|
10
10
|
/**
|
|
11
11
|
* Java helper to expose OSGi configuration values to Javascript code
|
|
12
12
|
*/
|
|
@@ -184,7 +184,6 @@ export class RegistryHelper {
|
|
|
184
184
|
* @param key the key of the object to remove within the type
|
|
185
185
|
*/
|
|
186
186
|
remove(type: string, key: string): void;
|
|
187
|
-
getRegistry(): Registry;
|
|
188
187
|
}
|
|
189
188
|
/**
|
|
190
189
|
* Helper class to provide rendering functions to the Javascript engine
|
package/dist/package.tgz
ADDED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,40 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jahia/javascript-modules-library",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com:Jahia/javascript-modules.git",
|
|
7
|
+
"directory": "javascript-modules-library"
|
|
8
|
+
},
|
|
7
9
|
"license": "MIT",
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"build": "run build:production",
|
|
13
|
-
"minify": "node minify",
|
|
14
|
-
"doc": "typedoc",
|
|
15
|
-
"clean": "rm -rf dist",
|
|
16
|
-
"lint": "eslint --ext js,jsx,json,ts src/",
|
|
17
|
-
"lint:fix": "eslint --ext js,jsx,json,ts --fix src/",
|
|
18
|
-
"prepack": "echo 'Please run 'mvn package' to create the tgz so the Maven version can be injected in the package.json' && exit 1"
|
|
10
|
+
"type": "module",
|
|
11
|
+
"exports": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
19
14
|
},
|
|
20
15
|
"bin": {
|
|
21
16
|
"jahia-deploy": "bin/jahia-deploy.mjs"
|
|
22
17
|
},
|
|
23
18
|
"files": [
|
|
19
|
+
"bin",
|
|
24
20
|
"dist"
|
|
25
21
|
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc && node post-build.js && mkdir -p dist && yarn pack --out dist/package.tgz && publint",
|
|
24
|
+
"clean": "rm -rf dist",
|
|
25
|
+
"lint": "yarn run --top-level lint"
|
|
26
|
+
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"dotenv": "^16.4.7"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
28
|
+
"dotenv": "^16.4.7"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/react": "^19.0.8",
|
|
32
|
+
"devalue": "^5.1.1",
|
|
33
|
+
"graphql": "^16.10.0",
|
|
34
|
+
"i18next": "^23.10.1",
|
|
35
|
+
"publint": "^0.3.6",
|
|
36
|
+
"react-i18next": "^15.4.0",
|
|
37
|
+
"typescript": "^5.7.3"
|
|
31
38
|
},
|
|
32
39
|
"peerDependencies": {
|
|
33
|
-
"i18next": "
|
|
34
|
-
"react": "
|
|
35
|
-
"react-dom": "
|
|
36
|
-
"react-i18next": "
|
|
37
|
-
"styled-jsx": "
|
|
40
|
+
"i18next": "^23.0.0",
|
|
41
|
+
"react": "^19.0.0",
|
|
42
|
+
"react-dom": "^19.0.0",
|
|
43
|
+
"react-i18next": "^15.4.0",
|
|
44
|
+
"styled-jsx": "^5.0.0"
|
|
38
45
|
},
|
|
39
46
|
"peerDependenciesMeta": {
|
|
40
47
|
"i18next": {
|
|
@@ -52,37 +59,5 @@
|
|
|
52
59
|
"styled-jsx": {
|
|
53
60
|
"optional": true
|
|
54
61
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
"minimist": "^1.2.6",
|
|
58
|
-
"set-getter": "^0.1.1"
|
|
59
|
-
},
|
|
60
|
-
"devDependencies": {
|
|
61
|
-
"@babel/cli": "^7.23.4",
|
|
62
|
-
"@babel/core": "^7.23.7",
|
|
63
|
-
"@babel/preset-env": "^7.23.8",
|
|
64
|
-
"@babel/preset-react": "^7.23.3",
|
|
65
|
-
"@jahia/eslint-config": "^2.1.2",
|
|
66
|
-
"@types/node-fetch": "^2.6.11",
|
|
67
|
-
"@types/react": "^18.2.48",
|
|
68
|
-
"@typescript-eslint/eslint-plugin": "^4.29.3",
|
|
69
|
-
"@typescript-eslint/parser": "^4.29.3",
|
|
70
|
-
"babel-loader": "^9.1.3",
|
|
71
|
-
"babel-plugin-transform-react-jsx": "^6.24.1",
|
|
72
|
-
"eslint": "^7.32.0",
|
|
73
|
-
"eslint-plugin-cypress": "^2.11.3",
|
|
74
|
-
"eslint-plugin-jest": "^27.2.1",
|
|
75
|
-
"eslint-plugin-json": "^3.1.0",
|
|
76
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
77
|
-
"eslint-plugin-react": "^7.32.2",
|
|
78
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
79
|
-
"i18next": "^23.10.1",
|
|
80
|
-
"ncp": "^2.0.0",
|
|
81
|
-
"react": "^18.2.0",
|
|
82
|
-
"react-i18next": "^14.1.0",
|
|
83
|
-
"terser": "^5.36.0",
|
|
84
|
-
"typedoc": "^0.25.13",
|
|
85
|
-
"typescript": "^4.3.5"
|
|
86
|
-
},
|
|
87
|
-
"packageManager": "yarn@4.5.0"
|
|
88
|
-
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React from"react";import{useServerContext}from"../hooks/useServerContext";import{server}from"@jahia/javascript-modules-library-private";export function AbsoluteArea({name:e,areaView:r,allowedTypes:t,numberOfItems:a,subNodesView:o,path:s,editable:n=!0,level:i,areaType:l="jnt:contentList",limitedAbsoluteAreaEdit:m,parameters:d}){const{renderContext:u}=useServerContext();return React.createElement("unwanteddiv",{dangerouslySetInnerHTML:{__html:server.render.renderAbsoluteArea({name:e,areaView:r,allowedTypes:t,numberOfItems:a,subNodesView:o,path:s,editable:n,level:i,areaType:l,limitedAbsoluteAreaEdit:m,parameters:d},u)}})}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React from"react";import{server}from"@jahia/javascript-modules-library-private";import{useServerContext}from"../hooks/useServerContext";export function AddContentButtons({nodeTypes:e,childName:t="*",editCheck:r=!1}){const{renderContext:n,currentResource:o}=useServerContext();return React.createElement("unwanteddiv",{dangerouslySetInnerHTML:{__html:server.render.createContentButtons(t,e,r,n,o)}})}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React from"react";import{server}from"@jahia/javascript-modules-library-private";import{useServerContext}from"../hooks/useServerContext";export function AddResources(e){const{renderContext:r}=useServerContext();return React.createElement("unwanteddiv",{dangerouslySetInnerHTML:{__html:server.render.addResources(e,r)}})}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React from"react";import{useServerContext}from"../hooks/useServerContext";import{server}from"@jahia/javascript-modules-library-private";export function Area({name:e,areaView:r,allowedTypes:a,numberOfItems:t,subNodesView:n,path:o,editable:s=!0,areaAsSubNode:m,areaType:i="jnt:contentList",parameters:d}){const{renderContext:p}=useServerContext();return React.createElement("unwanteddiv",{dangerouslySetInnerHTML:{__html:server.render.renderArea({name:e,areaView:r,allowedTypes:a,numberOfItems:t,subNodesView:n,path:o,editable:s,areaAsSubNode:m,areaType:i,parameters:d},p)}})}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React from"react";import InBrowser from"./internal/InBrowser";export function HydrateInBrowser({child:r,props:e}){return React.createElement(InBrowser,{preRender:!0,child:r,props:e,dataKey:"data-reacthydrate"})}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React from"react";import{server}from"@jahia/javascript-modules-library-private";import{useServerContext}from"../../hooks/useServerContext";export function Render({content:e,node:r,path:t,editable:n=!0,advanceRenderingConfig:a,templateType:o,view:i,parameters:d}){const{renderContext:p,currentResource:c}=useServerContext();return React.createElement("unwanteddiv",{dangerouslySetInnerHTML:{__html:server.render.render({content:e,node:r,path:t,editable:n,advanceRenderingConfig:a,templateType:o,view:i,parameters:d},p,c)}})}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React from"react";import InBrowser from"./internal/InBrowser";export function RenderInBrowser({child:r,props:e}){return React.createElement(InBrowser,{preRender:!1,child:r,props:e,dataKey:"data-reactrender"})}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React from"react";import{useServerContext}from"../../../hooks/useServerContext";import{AddResources}from"../../AddResources";import{I18nextProvider}from"react-i18next";import i18n from"i18next";import{buildUrl}from"../../../utils/urlBuilder/urlBuilder";const getClientI18nStoreScript=(e,t)=>{const r=i18n.getResourceBundle(e,t);if(r){const n={[e]:{[t]:r}};return`<script type="text/javascript">\n if(!window.__APPSHELL_INIT_DATA__) {\n window.__APPSHELL_INIT_DATA__ = {};\n }\n if(!window.__APPSHELL_INIT_DATA__.initialI18nStore) {\n window.__APPSHELL_INIT_DATA__.initialI18nStore = [];\n }\n window.__APPSHELL_INIT_DATA__.initialI18nStore.push(${JSON.stringify(n)});\n <\/script>`}},getAppShellInitData=e=>`<script type="text/javascript">\n if(!window.__APPSHELL_INIT_DATA__) {\n window.__APPSHELL_INIT_DATA__ = {};\n }\n window.__APPSHELL_INIT_DATA__.moduleBaseUrl = ${JSON.stringify(e)};\n <\/script>`;function InBrowser({child:e,props:t,dataKey:r,preRender:n}){const{bundleKey:i,currentResource:o,renderContext:a}=useServerContext(),s=o.getLocale().getLanguage(),c=getAppShellInitData(buildUrl({value:"/modules"},a,o)),l=getClientI18nStoreScript(s,i),_=buildUrl({value:"/modules/"+i+"/javascript/client/remote.js"},a,o),d=buildUrl({value:"/modules/javascript-modules-engine/javascript/apps/reactAppShell.js"},a,o),u={[r]:encodeURIComponent(JSON.stringify({name:e.name,lang:s,bundle:i,props:t||{}}))};return React.createElement(React.Fragment,null,React.createElement("div",{...u},n&&React.createElement(I18nextProvider,{i18n:i18n},React.createElement(e,{...t}))),l&&React.createElement(AddResources,{key:`i18n_initialStore_${i}`,insert:!0,inlineResource:l}),React.createElement(AddResources,{key:"npm-engine-appShellInitData",insert:!0,inlineResource:c}),React.createElement(AddResources,{insert:!0,type:"javascript",targetTag:"body",resources:_}),React.createElement(AddResources,{type:"javascript",targetTag:"body",resources:d}))}export default InBrowser;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function defineJahiaComponent(n){return n}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{server}from"@jahia/javascript-modules-library-private";export function registerJahiaComponents(e){if(!bundle)return void console.error("registerJahiaComponents: bundle is not available, make sure you are using this function inside the initialization of the bundle");const n=bundle.getSymbolicName(),o=server.registry.get("view","react");for(const t of Object.values(e)){const{id:e,...i}=t.jahiaComponent;if(!i.nodeType||!i.componentType)return void console.warn(`registerJahiaComponents(bundle=${n}: Missing mandatory property nodeType and/or componentType, skipping component name=${i.name} nodeType=${i.nodeType} id=${e} registration`);const r={name:"default",templateType:"html",component:t,...i};server.registry.add("view",e??`${n}_${r.componentType}_${r.nodeType}_${r.name}`,o,r)}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useServerContext}from"./useServerContext";import{server}from"@jahia/javascript-modules-library-private";export const useGQLQuery=({query:e,variables:r,operationName:t})=>{const{renderContext:o}=useServerContext();return server.gql.executeQuerySync({query:e,variables:r,operationName:t,renderContext:o})};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useServerContext}from"./useServerContext";import{getNodesByJCRQuery}from"../utils/jcr/getNodesByJCRQuery";export const useJCRQuery=({query:e})=>{const{renderContext:r}=useServerContext();return getNodesByJCRQuery(r.getMainResource().getNode().getSession(),e,-1,0)};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import React,{useContext}from"react";const ServerContext=React.createContext({});export function useServerContext(){return useContext(ServerContext)}export function ServerContextProvider({renderContext:e,currentResource:r,currentNode:t,mainNode:n,bundleKey:o,children:c}){return React.createElement(ServerContext.Provider,{value:{renderContext:e,currentResource:r,currentNode:t,mainNode:n,bundleKey:o}},c)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useServerContext}from"./useServerContext";import{buildUrl as originalBuildUrl}from"../utils/urlBuilder/urlBuilder";export function useUrlBuilder(){const{renderContext:e,currentResource:r}=useServerContext(),t=({nodePath:t,extension:a,language:l,mode:n,parameters:u})=>originalBuildUrl({path:t,extension:a,language:l,mode:n,parameters:u},e,r);return{buildStaticUrl:({assetPath:t,moduleName:a=e?.getURLGenerator()?.getCurrentModule(),parameters:l})=>{let n=a+"/static"+(t?.startsWith("/")?"":"/")+t;return originalBuildUrl({value:n,parameters:l},e,r)},buildNodeUrl:t,buildHtmlFragmentUrl:({nodePath:e,language:r,mode:a,parameters:l})=>t({nodePath:e,extension:".html.ajax",language:r,mode:a,parameters:l})}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function getChildNodes(e,o,t=0,n=void 0){let r=[];if(!e||!o)return console.warn("Missing one or more mandatory parameters (node, limit) to getChildNodes"),r;const s=e.getNodes();let i=0;for(;s.hasNext();){const e=s.nextNode();if(i<t)n&&!n(e)||i++;else if((!n||n(e))&&(r.push(e),o>0&&r.length===o))break}return r}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function getNodeFromPathOrId(e,t){return e.identifier?t.getNodeByIdentifier(e.identifier):e.path?t.getNode(e.path):null}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const STRING=1,LONG=3,DOUBLE=4,DATE=5,BOOLEAN=6,NAME=7,PATH=8,REFERENCE=9,WEAKREFERENCE=10,URI=11,DECIMAL=12,extractProp=(e,t)=>{if(e.hasProperty(t)){const r=e.getProperty(t);if(r.isMultiple()){const t=r.getValues(),o=[];for(const s of t)o.push(extractPropValue(e.getSession(),s,r.getType()));return o}return extractPropValue(e.getSession(),r.getValue(),r.getType())}},extractPropValue=(e,t,r)=>{switch(r){case 1:case 5:case 7:case 8:case 11:case 12:return t.getString();case 3:return t.getLong();case 4:return t.getDouble();case 6:return t.getBoolean();case 9:case 10:try{return e.getNodeByIdentifier(t.getString())}catch(e){return}default:return}};export function getNodeProps(e,t){let r={};if(e&&t&&t.length>0)for(const o of t)e.hasProperty(o)&&(r[o]=extractProp(e,o));return r}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function getNodesByJCRQuery(e,t,r,o=0){let s=[];if(!e||!t||!r)return console.warn("Missing one or more mandatory parameters (session, query, limit) to getNodesByJCRQuery"),s;const n=e.getWorkspace().getQueryManager().createQuery(t,"JCR-SQL2");r>0&&n.setLimit(r),o&&o>0&&n.setOffset(o);const a=n.execute().getNodes();for(;a.hasNext();)s.push(a.nextNode());return s}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getNodeFromPathOrId}from"../jcr/getNodeFromPathOrId";import{server}from"@jahia/javascript-modules-library-private";const absoluteUrlRegExp=/^(?:[a-z+]+:)?\/\//i,finalizeUrl=(e,r)=>absoluteUrlRegExp.test(e)?e:(e=e.startsWith("/")?r.getRequest().getContextPath()+e:e,r.getResponse().encodeURL(e));function appendParameters(e,r){const t=e.includes("?")?"&":"?";return`${e}${t}${Object.keys(r).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(r[e])}`)).join("&")}`}export function initUrlBuilder(){server.registry.add("urlBuilder","nt:file",{priority:1,buildURL:({jcrNode:e,mode:r,currentResource:t})=>"/files/"+(r?"edit"===r||"preview"===r?"default":"live":t.getWorkspace())+server.render.escapePath(e.getCanonicalPath())}),server.registry.add("urlBuilder","*",{priority:0,buildURL:({jcrNode:e,mode:r,language:t,extension:a,renderContext:n,currentResource:o})=>{let i,l;if(r)switch(r){case"edit":l="/cms/edit",i="default";break;case"preview":l="/cms/render",i="default";break;default:l="/cms/render",i="live"}else l=n.getServletPath(),i=o.getWorkspace();return l+"/"+i+"/"+(t||o.getLocale().toString())+server.render.escapePath(e.getPath())+(a||".html")}})}export function buildUrl(e,r,t){let a;if(e.path){let n;try{n=getNodeFromPathOrId({path:e.path},t.getNode().getSession())}catch(r){return console.warn(`Unable to find node for path: ${e.path}\n Replacing by #`),"#"}if(n){const o=server.registry.find({type:"urlBuilder"},"priority");for(const i of o)if("*"===i.key||n.isNodeType(i.key)){a=i.buildURL({jcrNode:n,mode:e.mode,language:e.language,extension:e.extension,renderContext:r,currentResource:t});break}}}else{if(!e.value)return console.warn("Missing parameter to build url, please provide either a content path using 'path' parameter, or a prebuild valid url using 'value' parameter\n replacing by #"),"#";a=e.value}return a?(e.parameters&&"[object Object]"===Object.prototype.toString.call(e.parameters)&&(a=appendParameters(a,e.parameters)),finalizeUrl(a,r)):(console.warn(`Unable to build url for: ${JSON.stringify(e)}\n Replacing by #`),"#")}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{RenderInBrowser}from"./core/server/components/render/RenderInBrowser";export{HydrateInBrowser}from"./core/server/components/render/HydrateInBrowser";export{Render}from"./core/server/components/render/Render";export{AbsoluteArea}from"./core/server/components/AbsoluteArea";export{AddContentButtons}from"./core/server/components/AddContentButtons";export{AddResources}from"./core/server/components/AddResources";export{Area}from"./core/server/components/Area";export{defineJahiaComponent}from"./core/server/framework/defineJahiaComponent";export{registerJahiaComponents}from"./core/server/framework/register";export{useGQLQuery}from"./core/server/hooks/useGQLQuery";export{useJCRQuery}from"./core/server/hooks/useJCRQuery";export{useServerContext,ServerContextProvider}from"./core/server/hooks/useServerContext";export{useUrlBuilder}from"./core/server/hooks/useUrlBuilder";export{getChildNodes}from"./core/server/utils/jcr/getChildNodes";export{getNodeFromPathOrId}from"./core/server/utils/jcr/getNodeFromPathOrId";export{getNodeProps}from"./core/server/utils/jcr/getNodeProps";export{getNodesByJCRQuery}from"./core/server/utils/jcr/getNodesByJCRQuery";export{buildUrl,initUrlBuilder}from"./core/server/utils/urlBuilder/urlBuilder";export{buildNavMenu}from"./nav/server/navBuilder/navBuilder";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{server}from"@jahia/javascript-modules-library-private";import{print}from"graphql";import gql from"graphql-tag";const getPageAncestors=(e,t,r)=>{const n=server.gql.executeQuerySync({query:print(gql`
|
|
2
|
-
query ($workspace: Workspace!, $path: String!, $types: [String]!){
|
|
3
|
-
jcr(workspace: $workspace) {
|
|
4
|
-
nodeByPath(path: $path) {
|
|
5
|
-
ancestors(fieldFilter: {filters:[{fieldName:"isNodeType", value:"true"}]}) {
|
|
6
|
-
path
|
|
7
|
-
isNodeType(type: {types: $types})
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
`),variables:{workspace:e,path:t,types:r}});return n.data?n.data.jcr.nodeByPath.ancestors:[]},getMenuItemsChildren=(e,t,r)=>{const n=server.gql.executeQuerySync({query:print(gql`
|
|
13
|
-
query childrenOfType($workspace: Workspace!, $path: String!, $types: [String]!){
|
|
14
|
-
jcr(workspace: $workspace) {
|
|
15
|
-
nodeByPath(path: $path) {
|
|
16
|
-
children(typesFilter: {types:$types}) {
|
|
17
|
-
nodes {
|
|
18
|
-
path
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
`),variables:{workspace:e,path:t,types:r}});return n.data?n.data.jcr.nodeByPath.children.nodes:[]},getBaseNode=(e,t,r)=>{const n=t.getMainResource().getNode(),a=getPageAncestors(r,n.getPath(),["jnt:page"]);if(!e||"home"===e)return t.getSite().getHome();if("currentPage"===e){if(t.getMainResource().getNode().isNodeType("jnt:page"))return n;if(a.length>0)return n.getSession().getNode(a.slice(-1)[0].path)}return n},buildMenu=(e,t,r,n)=>{let a=[];if(e){const s=e.getSession();n||(n=getMenuItemsChildren(r.workspace,e.getPath(),["jmix:navMenuItem"]));for(let e=0;e<n.length;e++){const o={},i=n[e].path,p=s.getNode(i),c=r.mainResourceNode.getPath()===i||r.mainResourceNode.getPath().startsWith(i+"/");let g=!1,u=!1,d=!0;if(p.isNodeType("jmix:nodeReference")){r.currentResource.getDependencies().add(p.getPropertyAsString("j:node"));const e=p.getProperty("j:node").getNode();e?g=r.mainResourceNode.getPath()===e.getPath():(g=!1,u=!0)}else g=r.mainResourceNode.getPath()===p.getPath();if(p.hasProperty["j:displayInMenuName"]&&(d=!1,p.getProperty("j:displayInMenuName").getValues().forEach((e=>{d=d||e.getString()===r.menuName}))),!u&&d&&(r.startLevelValue<t||c)){if(t<r.maxDepth){const e=getMenuItemsChildren(r.workspace,p.getPath(),["jmix:navMenuItem"]);e.length>0&&(o.children=buildMenu(p,t+1,r,e))}r.startLevelValue<t&&(r.currentResource.getDependencies().add(p.getCanonicalPath()),o.render=server.render.render({path:p.getPath(),view:r.menuEntryView||"menuElement"},r.renderContext,r.currentResource)),o.node=p,o.inPath=c,o.selected=g,o.level=t}a.push(o)}}return a};export function buildNavMenu(e,t,r,n,a,s){const o=a.isLiveMode()?"LIVE":"EDIT";return buildMenu(getBaseNode(t,a,o),1,{renderContext:a,mainResourceNode:a.getMainResource().getNode(),currentResource:s,workspace:o,menuName:s.getNode().getName(),startLevelValue:n,maxDepth:e,menuEntryView:r})}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import {ConfigHelper, GQLHelper, OSGiHelper, RegistryHelper, RenderHelper} from 'org.jahia.modules.javascript.modules.engine.js.server';
|
|
2
|
-
import {JCRNodeWrapper} from 'org.jahia.services.content';
|
|
3
|
-
import {Resource, RenderContext} from 'org.jahia.services.render';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* This module is used for internal compilation of the project. It should not be used directly in your code.
|
|
7
|
-
*/
|
|
8
|
-
declare module '@jahia/javascript-modules-library-private' {
|
|
9
|
-
/**
|
|
10
|
-
* A set of helpers that provide common functionality provided by Jahia for Javascript server-side rendering
|
|
11
|
-
*/
|
|
12
|
-
export const server: {
|
|
13
|
-
/**
|
|
14
|
-
* This helper provides access to OSGi configuration
|
|
15
|
-
*/
|
|
16
|
-
config: ConfigHelper,
|
|
17
|
-
/**
|
|
18
|
-
* This helper provides access Jahia's GraphQL API, to execute queries and mutations
|
|
19
|
-
*/
|
|
20
|
-
gql: GQLHelper,
|
|
21
|
-
/**
|
|
22
|
-
* This helper provides access to OSGi bundle for resource loading and service access
|
|
23
|
-
*/
|
|
24
|
-
osgi: OSGiHelper,
|
|
25
|
-
/**
|
|
26
|
-
* This helper provides access to Jahia's registry API, to register new UI objects or retrieving existing ones
|
|
27
|
-
*/
|
|
28
|
-
registry: RegistryHelper,
|
|
29
|
-
/**
|
|
30
|
-
* This helper provides rendering functions such as registering page resources, adding cache dependencies or rendering components
|
|
31
|
-
*/
|
|
32
|
-
render: RenderHelper
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* A context object that gives access to the underlying Jahia Java objects that are part of the current rendering context
|
|
37
|
-
*/
|
|
38
|
-
export interface ServerContext {
|
|
39
|
-
/**
|
|
40
|
-
* Jahia's rendering context, it provides access to all kinds of context information, such as the current request, response, user, mode, mainResource and more
|
|
41
|
-
*/
|
|
42
|
-
renderContext : RenderContext;
|
|
43
|
-
/**
|
|
44
|
-
* The current resource being rendered, which is a combination of the current node and its template/view information
|
|
45
|
-
*/
|
|
46
|
-
currentResource : Resource;
|
|
47
|
-
/**
|
|
48
|
-
* The current JCR node being rendered
|
|
49
|
-
*/
|
|
50
|
-
currentNode : JCRNodeWrapper;
|
|
51
|
-
/**
|
|
52
|
-
* The main JCR node being rendered, which is the root node of the current page
|
|
53
|
-
*/
|
|
54
|
-
mainNode : JCRNodeWrapper;
|
|
55
|
-
/**
|
|
56
|
-
* The OSGi bundle key of the current module being rendered
|
|
57
|
-
*/
|
|
58
|
-
bundleKey : string;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Generates add content buttons for a content object
|
|
4
|
-
* @returns The add content buttons.
|
|
5
|
-
*/
|
|
6
|
-
export declare function AddContentButtons({ nodeTypes, childName, editCheck }: Readonly<{
|
|
7
|
-
/** The node types to add. */
|
|
8
|
-
nodeTypes?: string;
|
|
9
|
-
/**
|
|
10
|
-
* The child name.
|
|
11
|
-
* @default *
|
|
12
|
-
*/
|
|
13
|
-
childName?: string;
|
|
14
|
-
/**
|
|
15
|
-
* If true, the edit check will be performed.
|
|
16
|
-
* @default false
|
|
17
|
-
*/
|
|
18
|
-
editCheck?: boolean;
|
|
19
|
-
}>): React.JSX.Element;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Adds a resources to the head tag of the HTML page.
|
|
4
|
-
* @returns A React element that renders a script or link tag.
|
|
5
|
-
*/
|
|
6
|
-
export declare function AddResources(props: Readonly<{
|
|
7
|
-
/** If true, the resource will be inserted into the document. Typically used for on-demand loading of resources. */
|
|
8
|
-
insert?: boolean;
|
|
9
|
-
/** If true, the resource will be loaded asynchronously. For scripts, this means the script will be executed as soon as it's available, without blocking the rest of the page. */
|
|
10
|
-
async?: boolean;
|
|
11
|
-
/** If true, the resource will be deferred, i.e., loaded after the document has been parsed. For scripts, this means the script will not be executed until after the page has loaded. */
|
|
12
|
-
defer?: boolean;
|
|
13
|
-
/** The type of the resource. This could be 'javascript' for .js files, 'css' for .css files, etc. */
|
|
14
|
-
type?: 'javascript' | 'css';
|
|
15
|
-
/** The path to the resource file, relative to the module. */
|
|
16
|
-
resources?: string;
|
|
17
|
-
/** Inline HTML that markup will be considered as resource. */
|
|
18
|
-
inlineResource?: string;
|
|
19
|
-
/** The title of the resource. This is typically not used for scripts or stylesheets, but may be used for other types of resources. */
|
|
20
|
-
title?: string;
|
|
21
|
-
/** A unique key for the resource. This could be used to prevent duplicate resources from being added to the document. */
|
|
22
|
-
key?: string;
|
|
23
|
-
/** The HTML tag where the resource should be added. This could be 'head' for resources that should be added to the <head> tag, 'body' for resources that should be added to the <body> tag, etc. */
|
|
24
|
-
targetTag?: 'head' | 'body';
|
|
25
|
-
/** The relationship of the resource to the document. This is typically 'stylesheet' for CSS files. */
|
|
26
|
-
rel?: string;
|
|
27
|
-
/** The media for which the resource is intended. This is typically used for CSS files, with values like 'screen', 'print', etc. */
|
|
28
|
-
media?: string;
|
|
29
|
-
/** A condition that must be met for the resource to be loaded. This could be used for conditional comments in IE, for example. */
|
|
30
|
-
condition?: string;
|
|
31
|
-
}>): React.JSX.Element;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Will render the given React component in the browser.
|
|
4
|
-
* Be careful, the component will not have access to the '@jahia/javascript-modules-library' library from the browser.
|
|
5
|
-
*
|
|
6
|
-
* @returns The component to be rendered in the browser
|
|
7
|
-
* */
|
|
8
|
-
export declare function RenderInBrowser<T>(props: Readonly<{
|
|
9
|
-
/** The React component */
|
|
10
|
-
child: React.ComponentType<T>;
|
|
11
|
-
/** The React component props, this props will be serialized/deserialized to be usable server and client side. The serialization and deserialization is done using JSON.stringify server side and JSON.parse in the browser. Please make sure that the props are serializable. */
|
|
12
|
-
props: T & React.JSX.IntrinsicAttributes;
|
|
13
|
-
}>): React.JSX.Element;
|
|
14
|
-
export declare function RenderInBrowser(props: Readonly<{
|
|
15
|
-
/** The React component */
|
|
16
|
-
child: React.ComponentType;
|
|
17
|
-
}>): React.JSX.Element;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare function InBrowser<T>({ child: Child, props, dataKey, preRender }: Readonly<{
|
|
3
|
-
child: React.ComponentType<T>;
|
|
4
|
-
props: T & React.JSX.IntrinsicAttributes;
|
|
5
|
-
dataKey: string;
|
|
6
|
-
preRender?: boolean;
|
|
7
|
-
}>): React.JSX.Element;
|
|
8
|
-
export default InBrowser;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface JahiaComponent {
|
|
2
|
-
/** The ID of the component (autogenerated but can be overridden) */
|
|
3
|
-
id?: string;
|
|
4
|
-
/** The name of the component. */
|
|
5
|
-
name: string;
|
|
6
|
-
/** The display name of the component (in jahia's UI), optional. */
|
|
7
|
-
displayName?: string;
|
|
8
|
-
/** The type of the component. */
|
|
9
|
-
componentType: 'template' | 'view';
|
|
10
|
-
/** The content node type the component applies to. */
|
|
11
|
-
nodeType: string;
|
|
12
|
-
/** Properties to add on the component, optional. */
|
|
13
|
-
properties?: Record<string, string>;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Using this function provides autocomplete on the jahiaComponent properties.
|
|
17
|
-
* @param jahiaComponent - An object containing the Jahia component to define.
|
|
18
|
-
* @returns The jahiaComponent object.
|
|
19
|
-
*/
|
|
20
|
-
export declare function defineJahiaComponent(jahiaComponent: JahiaComponent): JahiaComponent;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { JahiaComponent } from './defineJahiaComponent';
|
|
3
|
-
/**
|
|
4
|
-
* Registers Jahia components into the global registry as views
|
|
5
|
-
* @param jahiaComponents an object containing the jahia components to register
|
|
6
|
-
* TODO We will probably want to revisit this function once we handle global component registration in ticket https://jira.jahia.org/browse/BACKLOG-22400
|
|
7
|
-
*/
|
|
8
|
-
export declare function registerJahiaComponents(jahiaComponents: Record<string | number | symbol, {
|
|
9
|
-
(): React.JSX.Element;
|
|
10
|
-
jahiaComponent: JahiaComponent;
|
|
11
|
-
}>): void;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the current server context
|
|
3
|
-
* @returns {import('@jahia/javascript-modules-library').ServerContext} the server context
|
|
4
|
-
*/
|
|
5
|
-
export function useServerContext(): import('@jahia/javascript-modules-library').ServerContext;
|
|
6
|
-
export function ServerContextProvider({ renderContext, currentResource, currentNode, mainNode, bundleKey, children }: {
|
|
7
|
-
renderContext: any;
|
|
8
|
-
currentResource: any;
|
|
9
|
-
currentNode: any;
|
|
10
|
-
mainNode: any;
|
|
11
|
-
bundleKey: any;
|
|
12
|
-
children: any;
|
|
13
|
-
}): React.JSX.Element;
|
|
14
|
-
import React from "react";
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object} UrlBuilderType
|
|
3
|
-
* @property {function({assetPath: string, moduleName?: string, parameters?: object}): string} buildStaticUrl
|
|
4
|
-
* @property {function({nodePath: string, extension?: string, language?:string, mode?:string, parameters?: object}): string} buildNodeUrl
|
|
5
|
-
* @property {function({nodePath: string, extension?: string, language?:string, mode?:string, parameters?: object}): string} buildHtmlFragmentUrl
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* @returns {UrlBuilderType}
|
|
9
|
-
*/
|
|
10
|
-
export function useUrlBuilder(): UrlBuilderType;
|
|
11
|
-
export type UrlBuilderType = {
|
|
12
|
-
buildStaticUrl: (arg0: {
|
|
13
|
-
assetPath: string;
|
|
14
|
-
moduleName?: string;
|
|
15
|
-
parameters?: object;
|
|
16
|
-
}) => string;
|
|
17
|
-
buildNodeUrl: (arg0: {
|
|
18
|
-
nodePath: string;
|
|
19
|
-
extension?: string;
|
|
20
|
-
language?: string;
|
|
21
|
-
mode?: string;
|
|
22
|
-
parameters?: object;
|
|
23
|
-
}) => string;
|
|
24
|
-
buildHtmlFragmentUrl: (arg0: {
|
|
25
|
-
nodePath: string;
|
|
26
|
-
extension?: string;
|
|
27
|
-
language?: string;
|
|
28
|
-
mode?: string;
|
|
29
|
-
parameters?: object;
|
|
30
|
-
}) => string;
|
|
31
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns an array of child nodes of a given node.
|
|
3
|
-
* @param {import("org.jahia.services.content").JCRNodeWrapper} node - The node to get the child nodes from.
|
|
4
|
-
* @param {number} limit the maximum number of nodes to return (-1 to return all nodes, but be careful with this as it can be very slow and memory consuming, it's better to use a reasonable limit and use pagination if needed)
|
|
5
|
-
* @param {number} [offset=0] the offset to start from
|
|
6
|
-
* @param {function} [filter] - A function to filter the nodes to be returned.
|
|
7
|
-
* @returns {import("org.jahia.services.content").JCRNodeWrapper[]} An array of child nodes.
|
|
8
|
-
*/
|
|
9
|
-
export function getChildNodes(node: import("org.jahia.services.content").JCRNodeWrapper, limit: number, offset?: number, filter?: Function): import("org.jahia.services.content").JCRNodeWrapper[];
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a node from a path or identifier
|
|
3
|
-
* @param {object} props - The properties object containing either the node identifier or the node path.
|
|
4
|
-
* @param {string} [props.identifier] - The node identifier.
|
|
5
|
-
* @param {string} [props.path] - The node path.
|
|
6
|
-
* @param {import("org.jahia.services.content").JCRSessionWrapper} session - The JCR session.
|
|
7
|
-
* @returns {import("org.jahia.services.content").JCRNodeWrapper} The node.
|
|
8
|
-
*/
|
|
9
|
-
export function getNodeFromPathOrId(props: {
|
|
10
|
-
identifier?: string;
|
|
11
|
-
path?: string;
|
|
12
|
-
}, session: import("org.jahia.services.content").JCRSessionWrapper): import("org.jahia.services.content").JCRNodeWrapper;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts the properties from a node
|
|
3
|
-
* @param {import("org.jahia.services.content").JCRNodeWrapper} node the node on which to extract the properties
|
|
4
|
-
* @param {Array} props the name of the properties to extract
|
|
5
|
-
* @returns {Object} an object containing the property values
|
|
6
|
-
*/
|
|
7
|
-
export function getNodeProps(node: import("org.jahia.services.content").JCRNodeWrapper, props: any[]): any;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Execute a JCR SQL2 query and return the result as an array of nodes
|
|
3
|
-
* @param {import("org.jahia.services.content").JCRSessionWrapper} session the JCR session to use
|
|
4
|
-
* @param {string} query the JCR SQL2 query to execute
|
|
5
|
-
* @param {number} limit the maximum number of nodes to return (-1 to return all nodes, but be careful with this as it can be very slow and memory consuming, it's better to use a reasonable limit and use pagination if needed)
|
|
6
|
-
* @param {number} [offset=0] the offset to start from
|
|
7
|
-
* @returns {import('org.jahia.services.content').JCRNodeWrapper[]} an array containing the nodes returned by the query
|
|
8
|
-
*/
|
|
9
|
-
export function getNodesByJCRQuery(session: import("org.jahia.services.content").JCRSessionWrapper, query: string, limit: number, offset?: number): import('org.jahia.services.content').JCRNodeWrapper[];
|