@sitevision/api 2025.11.1 → 2026.1.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/index.d.ts +4 -0
- package/package.json +2 -2
- package/server/ContentFormat/index.d.ts +20 -0
- package/server/ContentFormat/index.js +12 -0
- package/server/ContentRendererBuilder/index.d.ts +93 -0
- package/server/ContentRendererBuilder/index.js +14 -0
- package/server/CreateContentFactory/index.d.ts +53 -0
- package/server/CreateContentFactory/index.js +13 -0
- package/server/FileUtil/index.d.ts +18 -20
- package/server/FolderUtil/index.d.ts +24 -11
- package/server/ImageUtil/index.d.ts +22 -24
- package/server/OutputUtil/index.d.ts +5 -1
- package/server/PermissionUtil.Permission/index.d.ts +1 -0
- package/server/PermissionUtil.Permission/index.js +2 -1
- package/server/RendererBuilderFactory/index.d.ts +44 -0
- package/server/RendererBuilderFactory/index.js +13 -0
- package/server/TagUtil/index.d.ts +6 -3
- package/server/TextModuleRendererBuilder/index.d.ts +2 -2
- package/server/Utils/index.d.ts +16 -0
- package/server/Utils/index.js +3 -1
- package/server/ai/index.d.ts +19 -1
- package/types/senselogic/sitevision/api/render/ContentRenderer/index.d.ts +127 -0
- package/types/senselogic/sitevision/api/render/ContentRenderer/index.js +16 -0
- package/types/senselogic/sitevision/api/render/TextModuleRenderer/index.d.ts +24 -3
- package/types/senselogic/sitevision/api/render/TextModuleRenderer/index.js +1 -0
- package/types/senselogic/sitevision/api/webresource/webcontent/TextModuleCreator/index.d.ts +157 -0
- package/types/senselogic/sitevision/api/webresource/webcontent/TextModuleCreator/index.js +17 -0
- package/types/senselogic/sitevision/api/webresource/webcontent/TextModuleUpdater/index.d.ts +147 -0
- package/types/senselogic/sitevision/api/webresource/webcontent/TextModuleUpdater/index.js +16 -0
package/index.d.ts
CHANGED
|
@@ -19,7 +19,10 @@ import './server/ColorUtil';
|
|
|
19
19
|
import './server/CompoundAndFilterBuilder';
|
|
20
20
|
import './server/CompoundComparatorBuilder';
|
|
21
21
|
import './server/CompoundOrFilterBuilder';
|
|
22
|
+
import './server/ContentFormat';
|
|
22
23
|
import './server/ContentNodeUtil';
|
|
24
|
+
import './server/ContentRendererBuilder';
|
|
25
|
+
import './server/CreateContentFactory';
|
|
23
26
|
import './server/CurrencyFactory';
|
|
24
27
|
import './server/DateUtil';
|
|
25
28
|
import './server/DecorationUtil';
|
|
@@ -90,6 +93,7 @@ import './server/PublishingUtil';
|
|
|
90
93
|
import './server/QueryStringUtil';
|
|
91
94
|
import './server/RedirectUtil';
|
|
92
95
|
import './server/RelatedValueBuilder';
|
|
96
|
+
import './server/RendererBuilderFactory';
|
|
93
97
|
import './server/Requester';
|
|
94
98
|
import './server/ResourceLocatorUtil';
|
|
95
99
|
import './server/RestApi';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitevision/api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2026.1.1",
|
|
4
4
|
"author": "Sitevision AB",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"access": "public",
|
|
31
31
|
"directory": "dist"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "52e580c21b77cedc38ef73fbec05ded93d37dd6c"
|
|
34
34
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated from JavaDoc. Do not modify it manually.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Content format types for text modules.
|
|
7
|
+
*
|
|
8
|
+
* <p>
|
|
9
|
+
* This enum defines the supported content formats that can be used when creating or updating
|
|
10
|
+
* text modules. The format determines how the raw content string is parsed and converted into
|
|
11
|
+
* rich text elements.
|
|
12
|
+
* </p>
|
|
13
|
+
* @author Jens Kalshoven
|
|
14
|
+
* @since Sitevision 2026.01.1
|
|
15
|
+
*/
|
|
16
|
+
declare enum ContentFormat {
|
|
17
|
+
MARKDOWN,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default ContentFormat;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This file is auto generated. Do not modify it manually.
|
|
9
|
+
*/
|
|
10
|
+
var _default = exports["default"] = {
|
|
11
|
+
MARKDOWN: "MARKDOWN"
|
|
12
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated from JavaDoc. Do not modify it manually.
|
|
3
|
+
*/
|
|
4
|
+
import type { Node } from "../../types/javax/jcr/Node";
|
|
5
|
+
import type { Map } from "../../types/java/util/Map";
|
|
6
|
+
import type { ContentRenderer } from "../../types/senselogic/sitevision/api/render/ContentRenderer";
|
|
7
|
+
import type { Builder } from "../../types/senselogic/sitevision/api/base/Builder";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* <p>
|
|
11
|
+
* Builder for creating a {@link ContentRenderer} instance.
|
|
12
|
+
* </p>
|
|
13
|
+
*
|
|
14
|
+
* <p>
|
|
15
|
+
* ContentRendererBuilder has one <strong>mandatory attribute</strong> and one <em>optional</em> attribute:
|
|
16
|
+
* </p>
|
|
17
|
+
* <ul>
|
|
18
|
+
* <li>
|
|
19
|
+
* <em>page</em> (mandatory) - The page (sv:page, sv:article, sv:sitePage) where the content nodes to render resides.
|
|
20
|
+
* Must not be null and must not be "current page".
|
|
21
|
+
* </li>
|
|
22
|
+
* <li>
|
|
23
|
+
* <em>parameters</em> (optional) - A key/value map of page parameters to use when rendering the content nodes. May be null or empty.
|
|
24
|
+
* </li>
|
|
25
|
+
* </ul>
|
|
26
|
+
*
|
|
27
|
+
* <p>
|
|
28
|
+
* Using the ContentRendererBuilder is pretty straightforward, if you remember that it is <strong>stateful</strong>. Conceptually you
|
|
29
|
+
* would typically use it like this:
|
|
30
|
+
* </p>
|
|
31
|
+
* <ol>
|
|
32
|
+
* <li>Get the ContentRendererBuilder</li>
|
|
33
|
+
* <li>Set the page</li>
|
|
34
|
+
* <li>Potentially set the page parameters</li>
|
|
35
|
+
* <li>Do build</li>
|
|
36
|
+
* </ol>
|
|
37
|
+
* <p>
|
|
38
|
+
* When you have built a <code>ContentRenderer</code> instance, you can re-use the ContentRendererBuilder to build more instances.
|
|
39
|
+
* Typically like:
|
|
40
|
+
* </p>
|
|
41
|
+
* <ol>
|
|
42
|
+
* <li>Set the page</li>
|
|
43
|
+
* <li>Potentially set the page parameters</li>
|
|
44
|
+
* <li>Do build</li>
|
|
45
|
+
* </ol>
|
|
46
|
+
*
|
|
47
|
+
* <p>
|
|
48
|
+
* <strong>Tip!</strong> The {@link senselogic.sitevision.api.base.Builder Builder interface documentation} contains
|
|
49
|
+
* more information about Builders and how to work with them and {@link TextModuleRenderer} has a code example of how
|
|
50
|
+
* this builder and its result can be used.
|
|
51
|
+
* </p>
|
|
52
|
+
*
|
|
53
|
+
* <p>
|
|
54
|
+
* An instance of the Sitevision class implementing this interface can be obtained via
|
|
55
|
+
* {@link RendererBuilderFactory#getContentRendererBuilder()}.
|
|
56
|
+
* See {@link RendererBuilderFactory} for how to obtain an instance of the <code>RendererBuilderFactory</code> interface.
|
|
57
|
+
* </p>
|
|
58
|
+
* @author Magnus Lövgren
|
|
59
|
+
* @since Sitevision 2026.01.1
|
|
60
|
+
*/
|
|
61
|
+
export interface ContentRendererBuilder extends Builder {
|
|
62
|
+
/**
|
|
63
|
+
* Sets the page of this builder.
|
|
64
|
+
*
|
|
65
|
+
* <p>
|
|
66
|
+
* <strong>Note! Due to security reasons (potential never-ending loops) it is prohibited to create a content renderer for
|
|
67
|
+
* the currently executing page (i.e. {@link senselogic.sitevision.api.context.PortletContextUtil#getCurrentPage()})!</strong>
|
|
68
|
+
* </p>
|
|
69
|
+
* @param aPageNode a page node (sv:page, sv:article, sv:sitePage) where current user has READ permission, must not be null or "current page".
|
|
70
|
+
* @return this builder
|
|
71
|
+
*/
|
|
72
|
+
setPage(aPageNode: Node): ContentRendererBuilder;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Sets parameters for the page, to be used when rendering content.
|
|
76
|
+
* @param aParameters a map of parameters
|
|
77
|
+
* @return this builder
|
|
78
|
+
*/
|
|
79
|
+
setParameters(aParameters: Map | {}): ContentRendererBuilder;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Creates a ContentRenderer instance for the page of this builder.
|
|
83
|
+
* @return a content renderer instance
|
|
84
|
+
* @throws IllegalStateException if no page is set or if page is invalid (e.g. "current page")
|
|
85
|
+
*/
|
|
86
|
+
build(): ContentRenderer;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
declare namespace ContentRendererBuilder {}
|
|
90
|
+
|
|
91
|
+
declare var contentRendererBuilder: ContentRendererBuilder;
|
|
92
|
+
|
|
93
|
+
export default contentRendererBuilder;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This file is auto generated. Do not modify it manually.
|
|
9
|
+
*/
|
|
10
|
+
var _default = exports["default"] = {
|
|
11
|
+
setPage: function setPage() {},
|
|
12
|
+
setParameters: function setParameters() {},
|
|
13
|
+
build: function build() {}
|
|
14
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated from JavaDoc. Do not modify it manually.
|
|
3
|
+
*/
|
|
4
|
+
import type { TextModuleCreator } from "../../types/senselogic/sitevision/api/webresource/webcontent/TextModuleCreator";
|
|
5
|
+
import type { TextModuleUpdater } from "../../types/senselogic/sitevision/api/webresource/webcontent/TextModuleUpdater";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Factory for creating and updating web content in Sitevision.
|
|
9
|
+
*
|
|
10
|
+
* <p>
|
|
11
|
+
* This factory provides builder instances for creating and updating content.
|
|
12
|
+
* </p>
|
|
13
|
+
*
|
|
14
|
+
* <p>
|
|
15
|
+
* An instance of the Sitevision class implementing this interface can be obtained via
|
|
16
|
+
* {@link senselogic.sitevision.api.Utils#getCreateContentFactory()}.
|
|
17
|
+
* See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the
|
|
18
|
+
* <code>Utils</code> interface.
|
|
19
|
+
* </p>
|
|
20
|
+
* @author Jens Kalshoven
|
|
21
|
+
* @since Sitevision 2026.01.1
|
|
22
|
+
*/
|
|
23
|
+
export interface CreateContentFactory {
|
|
24
|
+
/**
|
|
25
|
+
* Gets a builder for creating new text modules.
|
|
26
|
+
*
|
|
27
|
+
* <p>
|
|
28
|
+
* The returned builder can be used to configure and create a new text module (text portlet)
|
|
29
|
+
* on a page or within a layout. Each call to this method returns a fresh builder instance
|
|
30
|
+
* with no state carried over from previous operations.
|
|
31
|
+
* </p>
|
|
32
|
+
* @return a new TextModuleCreator builder instance
|
|
33
|
+
*/
|
|
34
|
+
getTextModuleCreator(): TextModuleCreator;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Gets a builder for updating existing text modules.
|
|
38
|
+
*
|
|
39
|
+
* <p>
|
|
40
|
+
* The returned builder can be used to update the content of an existing text module (text portlet).
|
|
41
|
+
* Each call to this method returns a fresh builder instance with no state carried over from
|
|
42
|
+
* previous operations.
|
|
43
|
+
* </p>
|
|
44
|
+
* @return a new TextModuleUpdater builder instance
|
|
45
|
+
*/
|
|
46
|
+
getTextModuleUpdater(): TextModuleUpdater;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare namespace CreateContentFactory {}
|
|
50
|
+
|
|
51
|
+
declare var createContentFactory: CreateContentFactory;
|
|
52
|
+
|
|
53
|
+
export default createContentFactory;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This file is auto generated. Do not modify it manually.
|
|
9
|
+
*/
|
|
10
|
+
var _default = exports["default"] = {
|
|
11
|
+
getTextModuleCreator: function getTextModuleCreator() {},
|
|
12
|
+
getTextModuleUpdater: function getTextModuleUpdater() {}
|
|
13
|
+
};
|
|
@@ -132,26 +132,24 @@ export interface FileUtil {
|
|
|
132
132
|
createFileFromTemporary(aParent: Node, aTemporaryFile: Node): Node;
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
* @since Sitevision 2026.01.1
|
|
154
|
-
*/
|
|
135
|
+
* Copies a file to a given parent.
|
|
136
|
+
*
|
|
137
|
+
* <p>
|
|
138
|
+
* Note that the <code>aParent</code> of the file must be a <code>sv:localFileRepository</code>, <code>sv:fileRepository</code>,
|
|
139
|
+
* <code>sv:personalFileRepository</code> or a <code>sv:folder</code> residing as sub node to a file repository.
|
|
140
|
+
* The <code>aParent</code> must not be trashed.
|
|
141
|
+
* </p>
|
|
142
|
+
* <p>
|
|
143
|
+
* <strong>Permission note!</strong> Current user must be authorized to alter the parent node
|
|
144
|
+
* (e.g. {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE}).
|
|
145
|
+
* </p>
|
|
146
|
+
* @param aFile the file node to copy
|
|
147
|
+
* @param aParent the parent node where the file should be copied to
|
|
148
|
+
* @return a file node corresponding to the newly created file
|
|
149
|
+
* @throws ConstraintViolationException if the user is not authorized to alter the parent node, if an invalid
 parent node is specified, if an invalid file node is specified
|
|
150
|
+
* @throws RepositoryException if something else goes wrong
|
|
151
|
+
* @since Sitevision 2026.01.1
|
|
152
|
+
*/
|
|
155
153
|
copyFile(aFile: Node, aParent: Node): Node;
|
|
156
154
|
|
|
157
155
|
/**
|
|
@@ -22,9 +22,8 @@ import type { String } from "../../types/java/lang/String";
|
|
|
22
22
|
*/
|
|
23
23
|
export interface FolderUtil {
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* </p>
|
|
25
|
+
* Creates a folder as sub node of the specified parent.
|
|
26
|
+
*
|
|
28
27
|
* <p>
|
|
29
28
|
* The parent may be either a {@code sv:sitePage}, {@code sv:page}, {@code sv:folder}, {@code sv:article}, {@code sv:collaborationGroupPage},
|
|
30
29
|
* {@code sv:imageRepository}, {@code sv:localImageRepository}, {@code sv:personalImageRepository},
|
|
@@ -33,10 +32,15 @@ export interface FolderUtil {
|
|
|
33
32
|
* If an other parent is specified an <code>ConstraintViolationException</code> is thrown.
|
|
34
33
|
* </p>
|
|
35
34
|
*
|
|
36
|
-
* <p>
|
|
35
|
+
* <p>
|
|
36
|
+
* Any name can be given the folder. If null is provided a <code>NullPointerException</code> is thrown.
|
|
37
|
+
* </p>
|
|
37
38
|
*
|
|
38
|
-
* <p>
|
|
39
|
-
*
|
|
39
|
+
* <p>
|
|
40
|
+
* The current user must be authorized to create folders and to do write operations on the parent node or a
|
|
41
|
+
* <code>ConstraintViolationException</code> will be thrown. <em>Note that creation of a folder in the sv:personalFileRepository or
|
|
42
|
+
* sv:localImageRepository of a sv:collaborationGroup is also allowed for members of the group.</em>
|
|
43
|
+
* </p>
|
|
40
44
|
*
|
|
41
45
|
* <p>Note that a new folder inherits metadata and permissions from its parent.</p>
|
|
42
46
|
* @param aParent the parent node of the sv:folder. May not be <code>null</code>
|
|
@@ -48,13 +52,22 @@ export interface FolderUtil {
|
|
|
48
52
|
createFolder(aParent: Node, aName: String | string): Node;
|
|
49
53
|
|
|
50
54
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
55
|
+
* Alters the name of a folder.
|
|
56
|
+
*
|
|
57
|
+
* <p>
|
|
58
|
+
* If no folder is specified a <code>NullPointerException</code> is thrown.
|
|
59
|
+
* If the node is not a sv:folder an <code>IllegalArgumentException</code> is thrown.
|
|
60
|
+
* </p>
|
|
53
61
|
*
|
|
54
|
-
* <p>
|
|
62
|
+
* <p>
|
|
63
|
+
* Any name can be given a folder. If null is provided a <code>NullPointerException</code> is thrown.
|
|
64
|
+
* </p>
|
|
55
65
|
*
|
|
56
|
-
* <p>
|
|
57
|
-
*
|
|
66
|
+
* <p>
|
|
67
|
+
* The current user must be authorized to do write operations on the folder or a <code>ConstraintViolationException</code> will be thrown.
|
|
68
|
+
* <em>Note that rename of a folder in the sv:personalFileRepository or sv:localImageRepository of a sv:collaborationGroup is also allowed
|
|
69
|
+
* for members of the group.</em>
|
|
70
|
+
* </p>
|
|
58
71
|
* @param aFolder the sv:folder that should be renamed. May not be <code>null</code>
|
|
59
72
|
* @param aName the new name of the folder. May not be <code>null</code>
|
|
60
73
|
* @throws ConstraintViolationException if the current user is not authorized to alter the name of the folder
|
|
@@ -59,10 +59,10 @@ export interface ImageUtil {
|
|
|
59
59
|
createImages(aParent: Node, aImages: Map | {}): void;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* Creates an image using
|
|
62
|
+
* Creates an image using an uri string.
|
|
63
63
|
*
|
|
64
64
|
* <p>
|
|
65
|
-
* Note that the <code>aParent</code>
|
|
65
|
+
* Note that the <code>aParent</code> for the image must be a <code>sv:localImageRepository</code>, <code>sv:imageRepository</code>,
|
|
66
66
|
* <code>sv:personalImageRepository</code> or a <code>sv:folder</code> residing as sub node to an image repository.
|
|
67
67
|
* </p>
|
|
68
68
|
* <p>
|
|
@@ -103,7 +103,7 @@ export interface ImageUtil {
|
|
|
103
103
|
* The decoder rejects data that contains characters outside the base64 alphabet.
|
|
104
104
|
* </p>
|
|
105
105
|
* <p>
|
|
106
|
-
* Note that the <code>aParent</code>
|
|
106
|
+
* Note that the <code>aParent</code> for the image must be a <code>sv:localImageRepository</code>, <code>sv:imageRepository</code>,
|
|
107
107
|
* <code>sv:personalImageRepository</code> or a <code>sv:folder</code> residing as sub node to an image repository.
|
|
108
108
|
* </p>
|
|
109
109
|
* <p>
|
|
@@ -135,7 +135,7 @@ export interface ImageUtil {
|
|
|
135
135
|
* Creates an image using a sv:temporaryFile.
|
|
136
136
|
*
|
|
137
137
|
* <p>
|
|
138
|
-
* Note that the <code>aParent</code>
|
|
138
|
+
* Note that the <code>aParent</code> for the image must be a <code>sv:localImageRepository</code>, <code>sv:imageRepository</code>,
|
|
139
139
|
* <code>sv:personalImageRepository</code> or a <code>sv:folder</code> residing as sub node to an image repository.
|
|
140
140
|
* </p>
|
|
141
141
|
* <p>
|
|
@@ -159,26 +159,24 @@ export interface ImageUtil {
|
|
|
159
159
|
createImageFromTemporary(aParent: Node, aTemporaryFile: Node): Node;
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
* @since Sitevision 2026.01.1
|
|
181
|
-
*/
|
|
162
|
+
* Copies an image to a given parent.
|
|
163
|
+
*
|
|
164
|
+
* <p>
|
|
165
|
+
* Note that the <code>aParent</code> for the image must be a <code>sv:localImageRepository</code>, <code>sv:imageRepository</code>,
|
|
166
|
+
* <code>sv:personalImageRepository</code> or a <code>sv:folder</code> residing as sub node to an image repository.
|
|
167
|
+
* The <code>aParent</code> must not be trashed.
|
|
168
|
+
* </p>
|
|
169
|
+
* <p>
|
|
170
|
+
* <strong>Permission note!</strong> Current user must be authorized to alter the parent node
|
|
171
|
+
* (e.g. {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE}).
|
|
172
|
+
* </p>
|
|
173
|
+
* @param aImage the image node to copy
|
|
174
|
+
* @param aParent the parent node where the image should be copied to
|
|
175
|
+
* @return an image node corresponding to the newly created image
|
|
176
|
+
* @throws ConstraintViolationException if the user is not authorized to alter the parent node, if an invalid
 parent node is specified, if an invalid image node is specified
|
|
177
|
+
* @throws RepositoryException if something else goes wrong
|
|
178
|
+
* @since Sitevision 2026.01.1
|
|
179
|
+
*/
|
|
182
180
|
copyImage(aImage: Node, aParent: Node): Node;
|
|
183
181
|
|
|
184
182
|
/**
|
|
@@ -298,8 +298,12 @@ export interface OutputUtil extends OutputUtilConstants {
|
|
|
298
298
|
* Gets the output as a specific content-type from a page node or a page content node.
|
|
299
299
|
*
|
|
300
300
|
* <p>
|
|
301
|
-
* <em>Tip
|
|
301
|
+
* <em>Tip!</em> This method has two versatile siblings that might be more suitable depending on your use case:
|
|
302
302
|
* </p>
|
|
303
|
+
* <ul>
|
|
304
|
+
* <li>Consider using {@link TextModuleRenderer} instead if you want the output of one or more Text modules.</li>
|
|
305
|
+
* <li>Consider using {@link ContentRenderer} instead if you want the output of arbitrary page content (layouts, modules).</li>
|
|
306
|
+
* </ul>
|
|
303
307
|
*
|
|
304
308
|
* <p>
|
|
305
309
|
* <strong>Note! Due to security reasons (potential never-ending loops) it is prohibited to get the output of anything from
|
|
@@ -43,5 +43,6 @@ var _default = exports["default"] = {
|
|
|
43
43
|
MANAGE_CUSTOM_SEARCH_INDEX: "MANAGE_CUSTOM_SEARCH_INDEX",
|
|
44
44
|
MANAGE_PUBLISHING_LOCK: "MANAGE_PUBLISHING_LOCK",
|
|
45
45
|
MANAGE_DASHBOARDS: "MANAGE_DASHBOARDS",
|
|
46
|
-
MANAGE_AI: "MANAGE_AI"
|
|
46
|
+
MANAGE_AI: "MANAGE_AI",
|
|
47
|
+
GENERATE_ALT_TEXT_AI: "GENERATE_ALT_TEXT_AI"
|
|
47
48
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated from JavaDoc. Do not modify it manually.
|
|
3
|
+
*/
|
|
4
|
+
import type { TextModuleRendererBuilder } from "../TextModuleRendererBuilder";
|
|
5
|
+
import type { ContentRendererBuilder } from "../ContentRendererBuilder";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Factory for creating various builders for rendering page content.
|
|
9
|
+
*
|
|
10
|
+
* <p>
|
|
11
|
+
* Currently, the factory can create builders for rendering of <strong>content nodes on a given page</strong>:
|
|
12
|
+
* </p>
|
|
13
|
+
* <ul>
|
|
14
|
+
* <li>Use {@link #getTextModuleRendererBuilder()} to create a renderer for Text modules.</li>
|
|
15
|
+
* <li>Use {@link #getContentRendererBuilder()} to create a renderer for other type of content nodes (i.e. layouts, modules etc).</li>
|
|
16
|
+
* </ul>
|
|
17
|
+
*
|
|
18
|
+
* <p>
|
|
19
|
+
* An instance of the Sitevision class implementing this interface can be obtained via
|
|
20
|
+
* {@link senselogic.sitevision.api.Utils#getRendererBuilderFactory()}.
|
|
21
|
+
* See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the <code>Utils</code> interface.
|
|
22
|
+
* </p>
|
|
23
|
+
* @author Magnus Lövgren
|
|
24
|
+
* @since Sitevision 2026.01.1
|
|
25
|
+
*/
|
|
26
|
+
export interface RendererBuilderFactory {
|
|
27
|
+
/**
|
|
28
|
+
* Gets a TextModuleRendererBuilder instance.
|
|
29
|
+
* @return a TextModuleRendererBuilder instance
|
|
30
|
+
*/
|
|
31
|
+
getTextModuleRendererBuilder(): TextModuleRendererBuilder;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Gets a ContentRendererBuilder instance.
|
|
35
|
+
* @return a ContentRendererBuilder instance
|
|
36
|
+
*/
|
|
37
|
+
getContentRendererBuilder(): ContentRendererBuilder;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare namespace RendererBuilderFactory {}
|
|
41
|
+
|
|
42
|
+
declare var rendererBuilderFactory: RendererBuilderFactory;
|
|
43
|
+
|
|
44
|
+
export default rendererBuilderFactory;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This file is auto generated. Do not modify it manually.
|
|
9
|
+
*/
|
|
10
|
+
var _default = exports["default"] = {
|
|
11
|
+
getTextModuleRendererBuilder: function getTextModuleRendererBuilder() {},
|
|
12
|
+
getContentRendererBuilder: function getContentRendererBuilder() {}
|
|
13
|
+
};
|
|
@@ -47,7 +47,8 @@ export interface TagUtil {
|
|
|
47
47
|
*
|
|
48
48
|
* <p>
|
|
49
49
|
* <strong>Permission note:</strong> Current user must have {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE WRITE}
|
|
50
|
-
* permission on the taggable Node that is mutated.
|
|
50
|
+
* permission on the taggable Node that is mutated. <em>Note that members of a sv:collaborationGroup is also allowed to add tags
|
|
51
|
+
* for the group files.</em>
|
|
51
52
|
* </p>
|
|
52
53
|
* <p>
|
|
53
54
|
* <strong>Versioning note:</strong> Mutation of the taggable Node is always executed in the
|
|
@@ -68,7 +69,8 @@ export interface TagUtil {
|
|
|
68
69
|
*
|
|
69
70
|
* <p>
|
|
70
71
|
* <strong>Permission note:</strong> Current user must have {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE WRITE}
|
|
71
|
-
* permission on the taggable Node that is mutated.
|
|
72
|
+
* permission on the taggable Node that is mutated. <em>Note that members of a sv:collaborationGroup is also allowed to add tags
|
|
73
|
+
* for the group files.</em>
|
|
72
74
|
* </p>
|
|
73
75
|
* <p>
|
|
74
76
|
* <strong>Versioning note:</strong> Mutation of the taggable Node is always executed in the
|
|
@@ -99,7 +101,8 @@ export interface TagUtil {
|
|
|
99
101
|
*
|
|
100
102
|
* <p>
|
|
101
103
|
* <strong>Permission note:</strong> Current user must have {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE WRITE}
|
|
102
|
-
* permission on the taggable Node that is mutated.
|
|
104
|
+
* permission on the taggable Node that is mutated. <em>Note that members of a sv:collaborationGroup is also allowed to remove tags
|
|
105
|
+
* for the group files.</em>
|
|
103
106
|
* </p>
|
|
104
107
|
* <p>
|
|
105
108
|
* <strong>Versioning note:</strong> Mutation of the taggable Node is always executed in the
|
|
@@ -45,8 +45,8 @@ import type { Builder } from "../../types/senselogic/sitevision/api/base/Builder
|
|
|
45
45
|
*
|
|
46
46
|
* <p>
|
|
47
47
|
* An instance of the Sitevision class implementing this interface can be obtained via
|
|
48
|
-
* {@link
|
|
49
|
-
* See {@link
|
|
48
|
+
* {@link RendererBuilderFactory#getTextModuleRendererBuilder()}.
|
|
49
|
+
* See {@link RendererBuilderFactory} for how to obtain an instance of the <code>RendererBuilderFactory</code> interface.
|
|
50
50
|
* </p>
|
|
51
51
|
* @author Magnus Lövgren
|
|
52
52
|
* @since Sitevision 7
|
package/server/Utils/index.d.ts
CHANGED
|
@@ -90,6 +90,8 @@ import type { TagUtil } from "../TagUtil";
|
|
|
90
90
|
import type { AliasUtil } from "../AliasUtil";
|
|
91
91
|
import type { MessagesFactory } from "../MessagesFactory";
|
|
92
92
|
import type { TargetAudienceUtil } from "../TargetAudienceUtil";
|
|
93
|
+
import type { RendererBuilderFactory } from "../RendererBuilderFactory";
|
|
94
|
+
import type { CreateContentFactory } from "../CreateContentFactory";
|
|
93
95
|
|
|
94
96
|
/**
|
|
95
97
|
* Main entry point to get instances of interfaces in the Sitevision Utility API.
|
|
@@ -754,6 +756,20 @@ export interface Utils {
|
|
|
754
756
|
* @since Sitevision 2024.09.2
|
|
755
757
|
*/
|
|
756
758
|
getTargetAudienceUtil(): TargetAudienceUtil;
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Gets an instance of a renderer builder factory class.
|
|
762
|
+
* @return a renderer builder factory class
|
|
763
|
+
* @since Sitevision 2026.01.1
|
|
764
|
+
*/
|
|
765
|
+
getRendererBuilderFactory(): RendererBuilderFactory;
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Gets an instance of a content builder factory.
|
|
769
|
+
* @return a content builder factory.
|
|
770
|
+
* @since Sitevision 2026.01.1
|
|
771
|
+
*/
|
|
772
|
+
getCreateContentFactory(): CreateContentFactory;
|
|
757
773
|
}
|
|
758
774
|
|
|
759
775
|
declare namespace Utils {}
|
package/server/Utils/index.js
CHANGED
|
@@ -92,5 +92,7 @@ var _default = exports["default"] = {
|
|
|
92
92
|
getTagUtil: function getTagUtil() {},
|
|
93
93
|
getAliasUtil: function getAliasUtil() {},
|
|
94
94
|
getMessagesFactory: function getMessagesFactory() {},
|
|
95
|
-
getTargetAudienceUtil: function getTargetAudienceUtil() {}
|
|
95
|
+
getTargetAudienceUtil: function getTargetAudienceUtil() {},
|
|
96
|
+
getRendererBuilderFactory: function getRendererBuilderFactory() {},
|
|
97
|
+
getCreateContentFactory: function getCreateContentFactory() {}
|
|
96
98
|
};
|
package/server/ai/index.d.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import type { Node } from '../../types/javax/jcr/Node';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Represents a text part of a message.
|
|
5
|
+
*/
|
|
6
|
+
export interface TextPart {
|
|
7
|
+
type: 'text';
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents an image part of a message.
|
|
13
|
+
*/
|
|
14
|
+
export interface ImagePart {
|
|
15
|
+
type: 'image';
|
|
16
|
+
image: string;
|
|
17
|
+
mimeType: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
3
20
|
/**
|
|
4
21
|
* Represents a message in an AI conversation.
|
|
5
22
|
*/
|
|
@@ -14,8 +31,9 @@ export interface Message {
|
|
|
14
31
|
|
|
15
32
|
/**
|
|
16
33
|
* The actual content of the message.
|
|
34
|
+
* Can be either a string or an array of text and image parts.
|
|
17
35
|
*/
|
|
18
|
-
content: string
|
|
36
|
+
content: string | Array<TextPart | ImagePart>;
|
|
19
37
|
}
|
|
20
38
|
|
|
21
39
|
/**
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated from JavaDoc. Do not modify it manually.
|
|
3
|
+
*/
|
|
4
|
+
import type { Node } from "../../../../../javax/jcr/Node";
|
|
5
|
+
|
|
6
|
+
import type { String } from "../../../../../java/lang/String";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ContentRenderer is a stateful renderer of content on a specific page.
|
|
10
|
+
*
|
|
11
|
+
* <p>
|
|
12
|
+
* This rendering utility is a page content-specific sibling to {@link OutputUtil#getNodeOutput(Node, Node, int)}
|
|
13
|
+
* but it has some nifty advantages:
|
|
14
|
+
* </p>
|
|
15
|
+
* <ul>
|
|
16
|
+
* <li>
|
|
17
|
+
* This renderer is more <em>efficient</em> than {@code OutputUtil} for subsequent rendering of page content.
|
|
18
|
+
* </li>
|
|
19
|
+
* <li>
|
|
20
|
+
* This renderer provides <em>convenience methods</em> for easy access of page content to render.
|
|
21
|
+
* </li>
|
|
22
|
+
* <li>
|
|
23
|
+
* This renderer can use request <em>parameters</em> when rendering page content (if created via the {@link ContentRendererBuilder}).
|
|
24
|
+
* </li>
|
|
25
|
+
* </ul>
|
|
26
|
+
*
|
|
27
|
+
* <p>
|
|
28
|
+
* <strong>Note!</strong> This renderer has generic support for page content (i.e. modules, layouts etc.)
|
|
29
|
+
* but if you should render <em>Text modules</em> - you should use {@link TextModuleRenderer} instead!
|
|
30
|
+
* The TextModuleRenderer is much, much more efficient and provides more versatile behaviour when rendering text modules.
|
|
31
|
+
* </p>
|
|
32
|
+
*
|
|
33
|
+
* <p>
|
|
34
|
+
* Using the ContentRenderer is pretty straightforward, if you remember that it is <strong>stateful</strong> and it adheres to an immutable page
|
|
35
|
+
* determined at creation time.<br>
|
|
36
|
+
* Conceptually you would typically use it like this:
|
|
37
|
+
* </p>
|
|
38
|
+
* <ol>
|
|
39
|
+
* <li>Get the ContentRenderer for a specific page and parameters via {@link ContentRendererBuilder}.</li>
|
|
40
|
+
* <li>Update the renderer with a content node on the page.</li>
|
|
41
|
+
* <li>Check if the renderer is loaded (i.e. could the update process resolve a valid/renderable content node).</li>
|
|
42
|
+
* <li>Do render</li>
|
|
43
|
+
* </ol>
|
|
44
|
+
* <p>
|
|
45
|
+
* When you have rendered once, you can re-use the ContentRenderer until you are done. Something like:
|
|
46
|
+
* </p>
|
|
47
|
+
* <ol>
|
|
48
|
+
* <li>Update the renderer with a another content node on the page.</li>
|
|
49
|
+
* <li>Check if the renderer is loaded (i.e. could the update process resolve a valid/renderable content node).</li>
|
|
50
|
+
* <li>Do render</li>
|
|
51
|
+
* </ol>
|
|
52
|
+
*
|
|
53
|
+
* <p>
|
|
54
|
+
* An instance of the Sitevision class implementing this interface can be obtained via
|
|
55
|
+
* {@link ContentRendererBuilder#build()} .
|
|
56
|
+
* See {@link ContentRendererBuilder} for how to obtain an instance of the <code>ContentRendererBuilder</code> interface.
|
|
57
|
+
* </p>
|
|
58
|
+
* @author Magnus Lövgren
|
|
59
|
+
* @since Sitevision 2026.01.1
|
|
60
|
+
* @see ContentRendererBuilder
|
|
61
|
+
*/
|
|
62
|
+
export type ContentRenderer = {
|
|
63
|
+
/**
|
|
64
|
+
* Updates the state of this renderer using a content Node.
|
|
65
|
+
*
|
|
66
|
+
* <p>
|
|
67
|
+
* <em>
|
|
68
|
+
* Note! If this state update fails (i.e. argument was null or not specifying a supported content part that exists on the page
|
|
69
|
+
* this renderer was created for) there will be nothing to render. The state can always be checked via the
|
|
70
|
+
* {@link #isLoaded()} method.
|
|
71
|
+
* </em>
|
|
72
|
+
* </p>
|
|
73
|
+
* @param aContentNode the content node, typically a sv:portlet, sv:layout or sv:referenceLayout
|
|
74
|
+
*/
|
|
75
|
+
update(aContentNode: Node): void;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Updates the state of this renderer using the identifier of a content Node.
|
|
79
|
+
*
|
|
80
|
+
* <p>
|
|
81
|
+
* The "identifier" is the JCR Node identifier (also the <code>jcr:uuid</code> property) of the content node.
|
|
82
|
+
* </p>
|
|
83
|
+
* <p>
|
|
84
|
+
* <em>
|
|
85
|
+
* Note! If this state update fails (i.e. argument was null or not specifying a supported content part that exists on the page
|
|
86
|
+
* this renderer was created for) there will be nothing to render. The state can always be checked via the
|
|
87
|
+
* {@link #isLoaded()} method.
|
|
88
|
+
* </em>
|
|
89
|
+
* </p>
|
|
90
|
+
* @param aNodeIdentifier the node identifier that specifies the content node (typically a sv:portlet, sv:layout or sv:referenceLayout)
|
|
91
|
+
*/
|
|
92
|
+
updateByIdentifier(aNodeIdentifier: String | string): void;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Updates the state of this renderer using the content identifier of a content Node.
|
|
96
|
+
*
|
|
97
|
+
* <p>
|
|
98
|
+
* The "content identifier" is the <code>contentIdentifier</code> property for the sv:portlet on the context page.
|
|
99
|
+
* </p>
|
|
100
|
+
* <p>
|
|
101
|
+
* <em>
|
|
102
|
+
* Note! If this state update fails (i.e. argument was null or not specifying a supported content part that exists on the page
|
|
103
|
+
* this renderer was created for) there will be nothing to render. The state can always be checked via the
|
|
104
|
+
* {@link #isLoaded()} method.
|
|
105
|
+
* </em>
|
|
106
|
+
* </p>
|
|
107
|
+
* @param aContentIdentifier the content identifier that specifies the content node (i.e. a sv:portlet)
|
|
108
|
+
*/
|
|
109
|
+
updateByContentIdentifier(aContentIdentifier: String | string): void;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Whether this renderer has been updated with a renderable content Node.
|
|
113
|
+
* @return true if this renderer has a valid content Node to render, false otherwise
|
|
114
|
+
*/
|
|
115
|
+
isLoaded(): boolean;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Renders html for the loaded content node.
|
|
119
|
+
*
|
|
120
|
+
* <p>
|
|
121
|
+
* <strong>Note!</strong> The returned value will always be empty string if the {@link #isLoaded()} state is <code>false</code>
|
|
122
|
+
* when invoking this render method <em>(i.e. you would typically always check the loaded state before calling this method).</em>
|
|
123
|
+
* </p>
|
|
124
|
+
* @return the html of the loaded content node, or empty String if rendering fails or no content node is loaded
|
|
125
|
+
*/
|
|
126
|
+
renderHtml(): string;
|
|
127
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This file is auto generated. Do not modify it manually.
|
|
9
|
+
*/
|
|
10
|
+
var _default = exports["default"] = {
|
|
11
|
+
update: function update() {},
|
|
12
|
+
updateByIdentifier: function updateByIdentifier() {},
|
|
13
|
+
updateByContentIdentifier: function updateByContentIdentifier() {},
|
|
14
|
+
isLoaded: function isLoaded() {},
|
|
15
|
+
renderHtml: function renderHtml() {}
|
|
16
|
+
};
|
|
@@ -170,19 +170,40 @@ export type TextModuleRenderer = {
|
|
|
170
170
|
* Updates the state of this renderer (potentially "loads" a Text module for rendering) using the identifier of a Text module Node.
|
|
171
171
|
*
|
|
172
172
|
* <p>
|
|
173
|
+
* The "identifier" is the JCR Node identifier (also the <code>jcr:uuid</code> property) of the Text module.
|
|
174
|
+
* </p>
|
|
175
|
+
* <p>
|
|
173
176
|
* <em>
|
|
174
177
|
* Note! If this state update fails (i.e. argument was null or not specifying a supported Text module that exists on the page
|
|
175
178
|
* this renderer was created for) there will be nothing to render. The state can always be checked via the
|
|
176
179
|
* {@link #isLoaded()} method.
|
|
177
180
|
* </em>
|
|
178
181
|
* </p>
|
|
179
|
-
* @param aTextModuleIdentifier the identifier of the Text module
|
|
182
|
+
* @param aTextModuleIdentifier the node identifier of the Text module
|
|
180
183
|
*/
|
|
181
184
|
updateByIdentifier(aTextModuleIdentifier: String | string): void;
|
|
182
185
|
|
|
183
186
|
/**
|
|
184
|
-
*
|
|
185
|
-
*
|
|
187
|
+
* Updates the state of this renderer (potentially "loads" a Text module for rendering) using the content identifier that specifies a Text module.
|
|
188
|
+
*
|
|
189
|
+
* <p>
|
|
190
|
+
* The "content identifier" is the <code>contentIdentifier</code> property of the sv:portlet (i.e. a Text module).
|
|
191
|
+
* </p>
|
|
192
|
+
* <p>
|
|
193
|
+
* <em>
|
|
194
|
+
* Note! If this state update fails (i.e. argument was null or not specifying a supported Text module that exists on the page
|
|
195
|
+
* this renderer was created for) there will be nothing to render. The state can always be checked via the
|
|
196
|
+
* {@link #isLoaded()} method.
|
|
197
|
+
* </em>
|
|
198
|
+
* </p>
|
|
199
|
+
* @param aContentIdentifier the content identifier that specifies the Text module
|
|
200
|
+
* @since Sitevision 2026.01.1
|
|
201
|
+
*/
|
|
202
|
+
updateByContentIdentifier(aContentIdentifier: String | string): void;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Whether this renderer has been updated with a renderable Text module.
|
|
206
|
+
* @return true if this renderer has a valid Text module to render, false otherwise
|
|
186
207
|
*/
|
|
187
208
|
isLoaded(): boolean;
|
|
188
209
|
|
|
@@ -11,6 +11,7 @@ var _default = exports["default"] = {
|
|
|
11
11
|
update: function update() {},
|
|
12
12
|
updateByName: function updateByName() {},
|
|
13
13
|
updateByIdentifier: function updateByIdentifier() {},
|
|
14
|
+
updateByContentIdentifier: function updateByContentIdentifier() {},
|
|
14
15
|
isLoaded: function isLoaded() {},
|
|
15
16
|
renderHtml: function renderHtml() {},
|
|
16
17
|
renderText: function renderText() {},
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated from JavaDoc. Do not modify it manually.
|
|
3
|
+
*/
|
|
4
|
+
import type { String } from "../../../../../../java/lang/String";
|
|
5
|
+
import type { Node } from "../../../../../../javax/jcr/Node";
|
|
6
|
+
import type ContentFormat from "../../../../../../../server/ContentFormat";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Builder for creating new text modules (text portlets).
|
|
10
|
+
*
|
|
11
|
+
* <p>
|
|
12
|
+
* <strong>Required configuration:</strong>
|
|
13
|
+
* </p>
|
|
14
|
+
* <ul>
|
|
15
|
+
* <li>Parent - the page, layout or portlet where the text module will be created</li>
|
|
16
|
+
* <li>Content - the text content and its format</li>
|
|
17
|
+
* </ul>
|
|
18
|
+
*
|
|
19
|
+
* <p>
|
|
20
|
+
* <strong>Optional configuration:</strong>
|
|
21
|
+
* </p>
|
|
22
|
+
* <ul>
|
|
23
|
+
* <li>Name - the display name/title of the text module</li>
|
|
24
|
+
* </ul>
|
|
25
|
+
*
|
|
26
|
+
* <p>
|
|
27
|
+
* <strong>Usage example:</strong>
|
|
28
|
+
* </p>
|
|
29
|
+
* <pre><code>
|
|
30
|
+
* const factory = utils.getCreateContentFactory();
|
|
31
|
+
*
|
|
32
|
+
* const creator = factory.getTextModuleCreator();
|
|
33
|
+
* creator
|
|
34
|
+
* .setName('Welcome Message')
|
|
35
|
+
* .setParent(pageNode)
|
|
36
|
+
* .setMarkdownContent('# Welcome\n\nThis is a **welcome** message.');
|
|
37
|
+
*
|
|
38
|
+
* // Optionally check if configuration is valid before executing
|
|
39
|
+
* if (creator.isValid()) {
|
|
40
|
+
* const node = creator.execute();
|
|
41
|
+
* }
|
|
42
|
+
* </code></pre>
|
|
43
|
+
*
|
|
44
|
+
* <p>
|
|
45
|
+
* <strong>Permission requirements:</strong>
|
|
46
|
+
* </p>
|
|
47
|
+
* <p>
|
|
48
|
+
* The current user must have permission to update the parent page. An exception will be
|
|
49
|
+
* thrown during {@link #execute()} if the user lacks the necessary permissions.
|
|
50
|
+
* </p>
|
|
51
|
+
*
|
|
52
|
+
* <p>
|
|
53
|
+
* An instance of the Sitevision class implementing this interface can be obtained via
|
|
54
|
+
* {@link senselogic.sitevision.api.webresource.webcontent.CreateContentFactory#getTextModuleCreator()}.
|
|
55
|
+
* See {@link senselogic.sitevision.api.webresource.webcontent.CreateContentFactory} for how to
|
|
56
|
+
* obtain an instance of the <code>CreateContentFactory</code> interface.
|
|
57
|
+
* </p>
|
|
58
|
+
* @author Jens Kalshoven
|
|
59
|
+
* @since Sitevision 2026.01.1
|
|
60
|
+
*/
|
|
61
|
+
export type TextModuleCreator = {
|
|
62
|
+
/**
|
|
63
|
+
* Sets the display name of the text module to be created.
|
|
64
|
+
*
|
|
65
|
+
* <p>
|
|
66
|
+
* The name is displayed as the portlet title and should be descriptive.
|
|
67
|
+
* </p>
|
|
68
|
+
* @param aName The name of the text module
|
|
69
|
+
* @return This builder instance for method chaining
|
|
70
|
+
*/
|
|
71
|
+
setName(aName: String | string): TextModuleCreator;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Sets the parent node where the text module will be created.
|
|
75
|
+
*
|
|
76
|
+
* <p>
|
|
77
|
+
* The parent can be either:
|
|
78
|
+
* </p>
|
|
79
|
+
* <ul>
|
|
80
|
+
* <li>Page (e.g. sv:page, sv:article) - the text module will be appended to the first layout on the page</li>
|
|
81
|
+
* <li>Layout (e.g. sv:layout) - the text module will be appended to the layout</li>
|
|
82
|
+
* <li>Module (sv:portlet) - the text module will be inserted after the module</li>
|
|
83
|
+
* </ul>
|
|
84
|
+
*
|
|
85
|
+
* <p>
|
|
86
|
+
* This is a required configuration parameter.
|
|
87
|
+
* </p>
|
|
88
|
+
* @param aParent The parent node. Must be a valid page or content node
|
|
89
|
+
* @return This builder instance for method chaining
|
|
90
|
+
*/
|
|
91
|
+
setParent(aParent: Node): TextModuleCreator;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Sets the content of the text module using Markdown format.
|
|
95
|
+
*
|
|
96
|
+
* <p>
|
|
97
|
+
* This is a convenience method equivalent to calling
|
|
98
|
+
* {@code setContent(aMarkdownContent, ContentFormat.MARKDOWN)}.
|
|
99
|
+
* The Markdown content will be parsed and converted to rich text elements.
|
|
100
|
+
* </p>
|
|
101
|
+
*
|
|
102
|
+
* <p>
|
|
103
|
+
* See {@link ContentFormat#MARKDOWN} for details on supported syntax.
|
|
104
|
+
* </p>
|
|
105
|
+
* @param aMarkdownContent The Markdown content. Must not be null or empty
|
|
106
|
+
* @return This builder instance for method chaining
|
|
107
|
+
*/
|
|
108
|
+
setMarkdownContent(aMarkdownContent: String | string): TextModuleCreator;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Sets the content of the text module with an explicit format.
|
|
112
|
+
*
|
|
113
|
+
* <p>
|
|
114
|
+
* This method allows you to specify the content and its format explicitly.
|
|
115
|
+
* The content will be parsed according to the specified format and converted
|
|
116
|
+
* to rich text elements.
|
|
117
|
+
* </p>
|
|
118
|
+
* @param aContent The text content. Must not be null or empty
|
|
119
|
+
* @param aContentFormat The format of the content. Must not be null
|
|
120
|
+
* @return This builder instance for method chaining
|
|
121
|
+
*/
|
|
122
|
+
setContent(
|
|
123
|
+
aContent: String | string,
|
|
124
|
+
aContentFormat: ContentFormat
|
|
125
|
+
): TextModuleCreator;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Best-attempt validation of the current builder configuration.
|
|
129
|
+
*
|
|
130
|
+
* <p>
|
|
131
|
+
* Checks if all required parameters are set and valid:
|
|
132
|
+
* </p>
|
|
133
|
+
* <ul>
|
|
134
|
+
* <li>Parent is not null and is a valid page, layout or portlet</li>
|
|
135
|
+
* <li>Content is not null and not empty</li>
|
|
136
|
+
* <li>Content format is not null</li>
|
|
137
|
+
* <li>The page is not trashed</li>
|
|
138
|
+
* <li>The user has permission to update the page</li>
|
|
139
|
+
* </ul>
|
|
140
|
+
* @return true if the configuration is valid, false otherwise
|
|
141
|
+
*/
|
|
142
|
+
isValid(): boolean;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Creates the text module with the configured settings.
|
|
146
|
+
*
|
|
147
|
+
* <p>
|
|
148
|
+
* <strong>Important:</strong> This method modifies the {@link senselogic.sitevision.api.versioning.VersionUtil#OFFLINE_VERSION}
|
|
149
|
+
* of the page content and saves the changes. The operation is performed under a lock to ensure consistency.
|
|
150
|
+
* </p>
|
|
151
|
+
* @return The newly created sv:portlet node
|
|
152
|
+
* @throws IllegalStateException If the configuration is invalid
|
|
153
|
+
* @throws ConstraintViolationException If the parent is invalid, or the user lacks permission to update the page, or the page is trashed
|
|
154
|
+
* @throws RepositoryException If something else goes wrong
|
|
155
|
+
*/
|
|
156
|
+
execute(): Node;
|
|
157
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This file is auto generated. Do not modify it manually.
|
|
9
|
+
*/
|
|
10
|
+
var _default = exports["default"] = {
|
|
11
|
+
setName: function setName() {},
|
|
12
|
+
setParent: function setParent() {},
|
|
13
|
+
setMarkdownContent: function setMarkdownContent() {},
|
|
14
|
+
setContent: function setContent() {},
|
|
15
|
+
isValid: function isValid() {},
|
|
16
|
+
execute: function execute() {}
|
|
17
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated from JavaDoc. Do not modify it manually.
|
|
3
|
+
*/
|
|
4
|
+
import type { Node } from "../../../../../../javax/jcr/Node";
|
|
5
|
+
import type { String } from "../../../../../../java/lang/String";
|
|
6
|
+
import type ContentFormat from "../../../../../../../server/ContentFormat";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Builder for updating existing text modules (text portlets) with new content.
|
|
10
|
+
*
|
|
11
|
+
* <p>
|
|
12
|
+
* <strong>Required configuration:</strong>
|
|
13
|
+
* </p>
|
|
14
|
+
* <ul>
|
|
15
|
+
* <li>Text module - the existing text module node to update</li>
|
|
16
|
+
* <li>Content - the new text content and its format</li>
|
|
17
|
+
* </ul>
|
|
18
|
+
*
|
|
19
|
+
* <p>
|
|
20
|
+
* <strong>Usage example:</strong>
|
|
21
|
+
* </p>
|
|
22
|
+
* <pre><code>
|
|
23
|
+
* const factory = utils.getCreateContentFactory();
|
|
24
|
+
*
|
|
25
|
+
* const updater = factory.getTextModuleUpdater();
|
|
26
|
+
* updater
|
|
27
|
+
* .setTextModule(existingTextModuleNode)
|
|
28
|
+
* .setMarkdownContent('# Updated Title\n\nThis content has been **updated**.');
|
|
29
|
+
*
|
|
30
|
+
* // Optionally check if configuration is valid before executing
|
|
31
|
+
* if (updater.isValid()) {
|
|
32
|
+
* const node = updater.execute();
|
|
33
|
+
* }
|
|
34
|
+
* </code></pre>
|
|
35
|
+
*
|
|
36
|
+
* <p>
|
|
37
|
+
* <strong>Important notes:</strong>
|
|
38
|
+
* </p>
|
|
39
|
+
* <ul>
|
|
40
|
+
* <li>The update operation replaces the entire content of the text module</li>
|
|
41
|
+
* <li>The text module must be a text portlet (portlet ID "text")</li>
|
|
42
|
+
* <li>The text module must be on a page</li>
|
|
43
|
+
* </ul>
|
|
44
|
+
*
|
|
45
|
+
* <p>
|
|
46
|
+
* <strong>Permission requirements:</strong>
|
|
47
|
+
* </p>
|
|
48
|
+
* <p>
|
|
49
|
+
* The current user must have permission to update the parent page. An exception will be
|
|
50
|
+
* thrown during {@link #execute()} if the user lacks the necessary permissions.
|
|
51
|
+
* </p>
|
|
52
|
+
*
|
|
53
|
+
* <p>
|
|
54
|
+
* An instance of the Sitevision class implementing this interface can be obtained via
|
|
55
|
+
* {@link senselogic.sitevision.api.webresource.webcontent.CreateContentFactory#getTextModuleUpdater()}.
|
|
56
|
+
* See {@link senselogic.sitevision.api.webresource.webcontent.CreateContentFactory} for how to
|
|
57
|
+
* obtain an instance of the <code>CreateContentFactory</code> interface.
|
|
58
|
+
* </p>
|
|
59
|
+
* @author Jens Kalshoven
|
|
60
|
+
* @since Sitevision 2026.01.1
|
|
61
|
+
*/
|
|
62
|
+
export type TextModuleUpdater = {
|
|
63
|
+
/**
|
|
64
|
+
* Sets the text module to be updated.
|
|
65
|
+
*
|
|
66
|
+
* <p>
|
|
67
|
+
* The node must be an existing text module sv:portlet (portlet ID "text") that is
|
|
68
|
+
* on a page. The entire content of this text module will be replaced when
|
|
69
|
+
* {@link #execute()} is called.
|
|
70
|
+
* </p>
|
|
71
|
+
*
|
|
72
|
+
* <p>
|
|
73
|
+
* This is a required configuration parameter.
|
|
74
|
+
* </p>
|
|
75
|
+
* @param aTextModule the text module node to update, must be a valid text portlet
|
|
76
|
+
* @return This builder instance for method chaining
|
|
77
|
+
*/
|
|
78
|
+
setTextModule(aTextModule: Node): TextModuleUpdater;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Sets the new content for the text module using Markdown format.
|
|
82
|
+
*
|
|
83
|
+
* <p>
|
|
84
|
+
* This is a convenience method equivalent to calling
|
|
85
|
+
* {@code setContent(aMarkdownContent, ContentFormat.MARKDOWN)}.
|
|
86
|
+
* The Markdown content will be parsed and converted to rich text elements,
|
|
87
|
+
* replacing the existing content.
|
|
88
|
+
* </p>
|
|
89
|
+
*
|
|
90
|
+
* <p>
|
|
91
|
+
* See {@link ContentFormat#MARKDOWN} for details on supported syntax.
|
|
92
|
+
* </p>
|
|
93
|
+
* @param aMarkdownContent The new Markdown content, must not be null or empty
|
|
94
|
+
* @return This builder instance for method chaining
|
|
95
|
+
*/
|
|
96
|
+
setMarkdownContent(aMarkdownContent: String | string): TextModuleUpdater;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Sets the new content for the text module with an explicit format.
|
|
100
|
+
*
|
|
101
|
+
* <p>
|
|
102
|
+
* This method allows you to specify the new content and its format explicitly.
|
|
103
|
+
* The content will be parsed according to the specified format and converted
|
|
104
|
+
* to rich text elements, replacing the existing content.
|
|
105
|
+
* </p>
|
|
106
|
+
* @param aContent The new text content. Must not be null or empty
|
|
107
|
+
* @param aContentFormat The format of the content. Must not be null
|
|
108
|
+
* @return This builder instance for method chaining
|
|
109
|
+
*/
|
|
110
|
+
setContent(
|
|
111
|
+
aContent: String | string,
|
|
112
|
+
aContentFormat: ContentFormat
|
|
113
|
+
): TextModuleUpdater;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Best-effort validation of the current builder configuration.
|
|
117
|
+
*
|
|
118
|
+
* <p>
|
|
119
|
+
* Checks if all required parameters are set and valid:
|
|
120
|
+
* </p>
|
|
121
|
+
* <ul>
|
|
122
|
+
* <li>Text module is not null and is a valid text portlet</li>
|
|
123
|
+
* <li>Text module's parent is a page</li>
|
|
124
|
+
* <li>Content is not null and not empty</li>
|
|
125
|
+
* <li>Content format is not null</li>
|
|
126
|
+
* <li>The page is not trashed</li>
|
|
127
|
+
* <li>The user has permission to update the page</li>
|
|
128
|
+
* </ul>
|
|
129
|
+
* @return true if the configuration is valid, false otherwise
|
|
130
|
+
*/
|
|
131
|
+
isValid(): boolean;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Updates the text module with the new configured content.
|
|
135
|
+
*
|
|
136
|
+
* <p>
|
|
137
|
+
* <strong>Important:</strong> This method modifies {@link senselogic.sitevision.api.versioning.VersionUtil#OFFLINE_VERSION}
|
|
138
|
+
* of the page content and saves the changes. The operation is performed under a lock to ensure consistency. The entire existing
|
|
139
|
+
* content of the text module is replaced.
|
|
140
|
+
* </p>
|
|
141
|
+
* @return The updated sv:portlet node
|
|
142
|
+
* @throws IllegalStateException If the configuration is invalid
|
|
143
|
+
* @throws ConstraintViolationException If the targeted textModule is invalid,
 or the user lacks permission to update the page,
 or the page is trashed
|
|
144
|
+
* @throws RepositoryException If something else goes wrong
|
|
145
|
+
*/
|
|
146
|
+
execute(): Node;
|
|
147
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This file is auto generated. Do not modify it manually.
|
|
9
|
+
*/
|
|
10
|
+
var _default = exports["default"] = {
|
|
11
|
+
setTextModule: function setTextModule() {},
|
|
12
|
+
setMarkdownContent: function setMarkdownContent() {},
|
|
13
|
+
setContent: function setContent() {},
|
|
14
|
+
isValid: function isValid() {},
|
|
15
|
+
execute: function execute() {}
|
|
16
|
+
};
|