@sitevision/api 2024.10.1 → 2025.1.2
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/common/router/index.d.ts +1 -0
- package/index.d.ts +1 -0
- package/package.json +2 -2
- package/server/LinkValueBuilder/index.d.ts +3 -3
- package/server/MimeTypeUtil/index.d.ts +40 -0
- package/server/MimeTypeUtil/index.js +3 -1
- package/server/NodeFilterUtil/index.d.ts +31 -0
- package/server/NodeFilterUtil/index.js +1 -0
- package/server/NodeIteratorUtil/index.d.ts +38 -12
- package/server/NodeIteratorUtil/index.js +1 -0
- package/server/NodeTreeUtil/index.d.ts +16 -0
- package/server/NodeTreeUtil/index.js +1 -0
- package/server/NodeTypeUtil/index.d.ts +7 -0
- package/server/OutputUtil/index.d.ts +16 -1
- package/server/ai/index.d.ts +211 -0
- package/server/ai/index.js +10 -0
- package/types/senselogic/sitevision/api/collaboration/CollaborationGroupWrapper/index.d.ts +5 -0
- package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.NodeTypeUtilConstants/index.d.ts +7 -0
- package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.NodeTypeUtilConstants/index.js +2 -1
package/common/router/index.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -132,6 +132,7 @@ import './server/WebContentUtil';
|
|
|
132
132
|
import './server/WebResourceFactory';
|
|
133
133
|
import './server/XSLTUtil';
|
|
134
134
|
import './server/XmlParserUtil';
|
|
135
|
+
import './server/ai';
|
|
135
136
|
import './server/appData';
|
|
136
137
|
import './server/appInfo';
|
|
137
138
|
import './server/appResource';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitevision/api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2025.1.2",
|
|
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": "fad9ce2f6b699279e49c3bf5fb234b0f37605dc8"
|
|
34
34
|
}
|
|
@@ -69,11 +69,11 @@ import type { Builder } from "../../types/senselogic/sitevision/api/base/Builder
|
|
|
69
69
|
export interface LinkValueBuilder extends Builder {
|
|
70
70
|
/**
|
|
71
71
|
* Sets the target.
|
|
72
|
-
* @param
|
|
72
|
+
* @param aURL the link target URL
|
|
73
73
|
* @return this builder
|
|
74
|
-
* @throws IllegalArgumentException if <code>
|
|
74
|
+
* @throws IllegalArgumentException if <code>aURL</code> is <code>null</code> or whitespace only
|
|
75
75
|
*/
|
|
76
|
-
setExternalTarget(
|
|
76
|
+
setExternalTarget(aURL: String | string): LinkValueBuilder;
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Sets the target.
|
|
@@ -235,6 +235,46 @@ export interface MimeTypeUtil extends MimeTypeUtilConstants {
|
|
|
235
235
|
* @since Sitevision 2024.04.1
|
|
236
236
|
*/
|
|
237
237
|
isAudioType(aFileExtensionExpression: String | string): boolean;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Checks if a specified file extension is a JSON type (according to its mapped MIME type).
|
|
241
|
+
* @param aFileExtensionExpression a file extension (e.g "json") or an expression that ends with a period and a file extension
 (e.g "myfile.json" or "https://www.xyz.com/files/myfile.json"). Case insensitive.
|
|
242
|
+
* @return true if aFileExtensionExpression is mapped to a MIME type that depicts the JSON format, false otherwise
|
|
243
|
+
* @see #isJsonMime(String)
|
|
244
|
+
* @since Sitevision 2025.01.2
|
|
245
|
+
*/
|
|
246
|
+
isJsonType(aFileExtensionExpression: String | string): boolean;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Checks if a specified MIME type depicts the JSON format.
|
|
250
|
+
*
|
|
251
|
+
* <p>
|
|
252
|
+
* The primary JSON format MIME is <code>"application/json"</code> and should always be handled as UTF-8 text. Other MIME:s that uses the JSON
|
|
253
|
+
* format typically has a <code>"+json"</code> suffix (see <a href="https://www.rfc-editor.org/rfc/rfc6839#section-3.1">RFC 6839</a>)
|
|
254
|
+
* or a <code>"+json-seq"</code> suffix (see <a href="https://www.rfc-editor.org/rfc/rfc8091#section-3">RFC 8091</a>). But there
|
|
255
|
+
* are also some legacy/unofficial MIME:s that also depicts the JSON format (e.g. "text/json", "application/jsonrequest").
|
|
256
|
+
* Example of typical MIME types that depicts the JSON format:
|
|
257
|
+
* </p>
|
|
258
|
+
* <ul>
|
|
259
|
+
* <li>application/json</li>
|
|
260
|
+
* <li>application/vnd.api+json</li>
|
|
261
|
+
* <li>application/vnd.restful+json</li>
|
|
262
|
+
* <li>application/ld+json</li>
|
|
263
|
+
* <li>application/ld-frame+json</li>
|
|
264
|
+
* <li>application/jsonml+json</li>
|
|
265
|
+
* <li>application/geo+json</li>
|
|
266
|
+
* <li>application/calendar+json</li>
|
|
267
|
+
* </ul>
|
|
268
|
+
*
|
|
269
|
+
* <p>
|
|
270
|
+
* A <code>Content-Type</code> header value for a JSON response is typically <code>"application/json; charset=utf-8"</code>.
|
|
271
|
+
* This method handles such values, only the leading MIME part will be checked (any semicolon suffix part will be completely ignored).
|
|
272
|
+
* </p>
|
|
273
|
+
* @param aMimeType a MIME value or Content-Type header value
|
|
274
|
+
* @return true if aMimeType matches a MIME that depicts the JSON format, false otherwise
|
|
275
|
+
* @since Sitevision 2025.01.2
|
|
276
|
+
*/
|
|
277
|
+
isJsonMime(aMimeType: String | string): boolean;
|
|
238
278
|
}
|
|
239
279
|
|
|
240
280
|
declare namespace MimeTypeUtil {}
|
|
@@ -17,5 +17,7 @@ var _default = exports["default"] = {
|
|
|
17
17
|
isMSPowerpointType: function isMSPowerpointType() {},
|
|
18
18
|
isMSOfficeType: function isMSOfficeType() {},
|
|
19
19
|
isFontType: function isFontType() {},
|
|
20
|
-
isAudioType: function isAudioType() {}
|
|
20
|
+
isAudioType: function isAudioType() {},
|
|
21
|
+
isJsonType: function isJsonType() {},
|
|
22
|
+
isJsonMime: function isJsonMime() {}
|
|
21
23
|
};
|
|
@@ -5,6 +5,7 @@ import type { Collection } from "../../types/java/util/Collection";
|
|
|
5
5
|
import type { FilterSplit } from "../../types/senselogic/sitevision/api/base/FilterSplit";
|
|
6
6
|
import type { CompoundAndFilterBuilder } from "../CompoundAndFilterBuilder";
|
|
7
7
|
import type { CompoundOrFilterBuilder } from "../CompoundOrFilterBuilder";
|
|
8
|
+
|
|
8
9
|
import type { String } from "../../types/java/lang/String";
|
|
9
10
|
|
|
10
11
|
import type { Calendar } from "../../types/java/util/Calendar";
|
|
@@ -202,6 +203,36 @@ export interface NodeFilterUtil {
|
|
|
202
203
|
*/
|
|
203
204
|
getNonNullFilter(): Filter;
|
|
204
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Gets a filter that skips a given number of nodes.
|
|
208
|
+
*
|
|
209
|
+
* <p>
|
|
210
|
+
* <em>Note!</em> The skip filter is typically used in combination with a <em>Compound AND Filter</em>.
|
|
211
|
+
* Example:
|
|
212
|
+
* </p>
|
|
213
|
+
* <ul>
|
|
214
|
+
* <li>
|
|
215
|
+
* This filter skips 5 nodes, regardless of type:<br>
|
|
216
|
+
* <pre><code> filter = nodeFilterUtil.getSkipFilter(5);</code></pre>
|
|
217
|
+
* </li>
|
|
218
|
+
* <li>
|
|
219
|
+
* This page filter skips 5 nodes <em>(i.e. rejects first 5 sv:page nodes that otherwise would have been accepted)</em>:<br>
|
|
220
|
+
* <pre><code> filter = nodeFilterUtil.getCompoundAndFilterBuilder()
|
|
221
|
+
* .addFilter(nodeFilterUtil.getPrimaryNodeTypeFilter("sv:page"))
|
|
222
|
+
* .addFilter(nodeFilterUtil.getSkipFilter(5))
|
|
223
|
+
* .build();</code></pre>
|
|
224
|
+
* </li>
|
|
225
|
+
* </ul>
|
|
226
|
+
* <p>
|
|
227
|
+
* Also note that this filter is <em>stateful</em>, i.e. a created filter instance can't be used more than one time.
|
|
228
|
+
* </p>
|
|
229
|
+
* @param aSkip the number of nodes to skip
|
|
230
|
+
* @return a filter that rejects aSkip number of nodes
|
|
231
|
+
* @throws IllegalArgumentException if aSkip is less than zero
|
|
232
|
+
* @since Sitevision 2025.01.1
|
|
233
|
+
*/
|
|
234
|
+
getSkipFilter(aSkip: number): Filter;
|
|
235
|
+
|
|
205
236
|
/**
|
|
206
237
|
* Gets a filter that inverts the result of another filter.
|
|
207
238
|
* @param aFilter the filter to invert
|
|
@@ -15,6 +15,7 @@ var _default = exports["default"] = {
|
|
|
15
15
|
getNeverAcceptFilter: function getNeverAcceptFilter() {},
|
|
16
16
|
getNullFilter: function getNullFilter() {},
|
|
17
17
|
getNonNullFilter: function getNonNullFilter() {},
|
|
18
|
+
getSkipFilter: function getSkipFilter() {},
|
|
18
19
|
getInvertedFilter: function getInvertedFilter() {},
|
|
19
20
|
getIdentifierFilter: function getIdentifierFilter() {},
|
|
20
21
|
getIdentifierPrefixFilter: function getIdentifierPrefixFilter() {},
|
|
@@ -42,15 +42,15 @@ export interface NodeIteratorUtil {
|
|
|
42
42
|
* ...
|
|
43
43
|
* }</code></pre>
|
|
44
44
|
* @param aNodeIterator a NodeIterator, must not be null
|
|
45
|
-
* @param
|
|
45
|
+
* @param aFilter a Node Filter, must not be null
|
|
46
46
|
* @return a filtered NodeIterator
|
|
47
|
-
* @throws NullPointerException if aNodeIterator or
|
|
47
|
+
* @throws NullPointerException if aNodeIterator or aFilter is null
|
|
48
48
|
* @see NodeFilterUtil
|
|
49
49
|
* @since Sitevision 8.1
|
|
50
50
|
*/
|
|
51
51
|
getFilteredNodeIterator(
|
|
52
52
|
aNodeIterator: NodeIterator,
|
|
53
|
-
|
|
53
|
+
aFilter: Filter
|
|
54
54
|
): NodeIterator;
|
|
55
55
|
|
|
56
56
|
/**
|
|
@@ -61,8 +61,8 @@ export interface NodeIteratorUtil {
|
|
|
61
61
|
* </p>
|
|
62
62
|
* <ul>
|
|
63
63
|
* <li>
|
|
64
|
-
* <em>Convenience.</em> This method combines {@link
|
|
65
|
-
* i.e. a shortcut to get an iterator without having to actually lookup/resolve the parent node.
|
|
64
|
+
* <em>Convenience.</em> This method combines {@link senselogic.sitevision.api.resource.ResourceLocatorUtil#getNodeByIdentifier(String)}
|
|
65
|
+
* and {@link Node#getNodes()}, i.e. a shortcut to get an iterator without having to actually lookup/resolve the parent node.
|
|
66
66
|
* </li>
|
|
67
67
|
* <li>
|
|
68
68
|
* <em>Permission workaround.</em> This method does <em>not</em> do any permission checks on the resolved parent Node, i.e.
|
|
@@ -90,8 +90,8 @@ export interface NodeIteratorUtil {
|
|
|
90
90
|
* </p>
|
|
91
91
|
* <ul>
|
|
92
92
|
* <li>
|
|
93
|
-
* <em>Convenience.</em> This method combines {@link
|
|
94
|
-
* i.e. a shortcut to get a menu iterator without having to actually lookup/resolve the parent node.
|
|
93
|
+
* <em>Convenience.</em> This method combines {@link senselogic.sitevision.api.resource.ResourceLocatorUtil#getNodeByIdentifier(String)}
|
|
94
|
+
* and {@link #getMenuItems(Node)}, i.e. a shortcut to get a menu iterator without having to actually lookup/resolve the parent node.
|
|
95
95
|
* </li>
|
|
96
96
|
* <li>
|
|
97
97
|
* <em>Permission workaround.</em> This method does <em>not</em> do any permission checks on the resolved parent Node, i.e.
|
|
@@ -121,7 +121,7 @@ export interface NodeIteratorUtil {
|
|
|
121
121
|
* </p>
|
|
122
122
|
* <ul>
|
|
123
123
|
* <li>
|
|
124
|
-
* <em>Convenience.</em> This method combines {@link
|
|
124
|
+
* <em>Convenience.</em> This method combines {@link senselogic.sitevision.api.resource.ResourceLocatorUtil#getNodeByIdentifier(String)} and
|
|
125
125
|
* {@link #getMenuItemsIncludingFolders(Node)}, i.e. a shortcut to get a menu iterator without having to actually
|
|
126
126
|
* lookup/resolve the parent node.
|
|
127
127
|
* </li>
|
|
@@ -164,20 +164,46 @@ export interface NodeIteratorUtil {
|
|
|
164
164
|
* </p>
|
|
165
165
|
* @param aNodeIterator a node iterator
|
|
166
166
|
* @param aFilter a node filter
|
|
167
|
-
* @param
|
|
168
|
-
* @return a list of nodes that matches <code>aFilter</code>, never <code>null</code>.
 The list will contain at most
|
|
167
|
+
* @param aLimit max number of nodes to include in the result
|
|
168
|
+
* @return a list of nodes that matches <code>aFilter</code>, never <code>null</code>.
 The list will contain at most aLimit nodes.
 If aNodeIterator is null, an empty list will be returned.
 If aFilter is null, the filter will be ignored (all nodes will be accepted).
 If aLimit is negative or zero, an empty list will be returned.
|
|
169
169
|
* @since Sitevision 3.6.2
|
|
170
170
|
*/
|
|
171
|
-
findNodes(
|
|
171
|
+
findNodes(aNodeIterator: NodeIterator, aFilter: Filter, aLimit: number): List;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Gets a max-sized node list from a node iterator that matches a specified filter, skipping a specified number of matching nodes.
|
|
175
|
+
*
|
|
176
|
+
* <p>
|
|
177
|
+
* Executing <code>findMoreNodes(nodeIterator, filter, 0, 10)</code> is conceptually equivalent
|
|
178
|
+
* to executing <code>findNodes(nodeIterator, filter, 10)</code>.
|
|
179
|
+
* </p>
|
|
180
|
+
*
|
|
181
|
+
* <p>
|
|
182
|
+
* <em>Tip!</em> Use {@link senselogic.sitevision.api.node.NodeFilterUtil} to get an appropriate node filter.
|
|
183
|
+
* </p>
|
|
184
|
+
* @param aNodeIterator a node iterator
|
|
185
|
+
* @param aFilter a node filter
|
|
186
|
+
* @param aSkip number of matching nodes to skip
|
|
187
|
+
* @param aLimit max number of nodes to include in the result
|
|
188
|
+
* @return a list of nodes that matches aFilter, never null.
 The list will contain at most aLimit number of nodes and aSkip number of nodes will be ignored.
 If aNodeIterator is null, an empty list will be returned.
 If aFilter is null, the filter will be ignored (all nodes will be accepted).
 If aSkip is negative or zero, no nodes will be skipped.
 If aLimit is negative or zero, an empty list will be returned.
|
|
189
|
+
* @since Sitevision 2025.01.1
|
|
190
|
+
*/
|
|
191
|
+
findMoreNodes(
|
|
172
192
|
aNodeIterator: NodeIterator,
|
|
173
193
|
aFilter: Filter,
|
|
174
|
-
|
|
194
|
+
aSkip: number,
|
|
195
|
+
aLimit: number
|
|
175
196
|
): List;
|
|
176
197
|
|
|
177
198
|
/**
|
|
178
199
|
* Gets a list of all nodes from a node iterator that matches a specified filter.
|
|
179
200
|
*
|
|
180
201
|
* <p>
|
|
202
|
+
* Executing <code>findAll(nodeIterator, null)</code> is conceptually equivalent
|
|
203
|
+
* to executing <code>toList(nodeIterator)</code>.
|
|
204
|
+
* </p>
|
|
205
|
+
*
|
|
206
|
+
* <p>
|
|
181
207
|
* <em>Tip!</em> Use {@link senselogic.sitevision.api.node.NodeFilterUtil} to get
|
|
182
208
|
* an appropriate node filter. If the list of nodes should be sorted by a specific property value,
|
|
183
209
|
* you would typically use {@link senselogic.sitevision.api.node.NodeComparatorUtil}
|
|
@@ -13,6 +13,7 @@ var _default = exports["default"] = {
|
|
|
13
13
|
getMenuItemsIncludingFoldersByIdentifier: function getMenuItemsIncludingFoldersByIdentifier() {},
|
|
14
14
|
findFirst: function findFirst() {},
|
|
15
15
|
findNodes: function findNodes() {},
|
|
16
|
+
findMoreNodes: function findMoreNodes() {},
|
|
16
17
|
findAll: function findAll() {},
|
|
17
18
|
toList: function toList() {},
|
|
18
19
|
split: function split() {}
|
|
@@ -84,6 +84,22 @@ export interface NodeTreeUtil {
|
|
|
84
84
|
*/
|
|
85
85
|
getWebPathNodes(aDescendantNode: Node): List;
|
|
86
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Find a portlet with a specific content identifier on a page node.
|
|
89
|
+
*
|
|
90
|
+
* <p>
|
|
91
|
+
* The <em>content identifier</em> of the portlet is determined by the <em>contentIdentifier</em> property.
|
|
92
|
+
* </p>
|
|
93
|
+
* @param aPageNode the page node that has content, typically a sv:page or sv:article
|
|
94
|
+
* @param aContentIdentifier the content identifier of the sv:portlet that should be found
|
|
95
|
+
* @return the first occurrence of a sv:portlet with matching aContentIdentifier, or null if no such portlet can be found
 or if aPageNode is not a page node
|
|
96
|
+
* @since Sitevision 2025.01.1
|
|
97
|
+
*/
|
|
98
|
+
findPortletByContentIdentifier(
|
|
99
|
+
aPageNode: Node,
|
|
100
|
+
aContentIdentifier: String | string
|
|
101
|
+
): Node;
|
|
102
|
+
|
|
87
103
|
/**
|
|
88
104
|
* Find a portlet with a specific name on a page node.
|
|
89
105
|
*
|
|
@@ -9,6 +9,7 @@ var _default = exports["default"] = {
|
|
|
9
9
|
getParent: function getParent() {},
|
|
10
10
|
isDescendantOf: function isDescendantOf() {},
|
|
11
11
|
getWebPathNodes: function getWebPathNodes() {},
|
|
12
|
+
findPortletByContentIdentifier: function findPortletByContentIdentifier() {},
|
|
12
13
|
findPortletByName: function findPortletByName() {},
|
|
13
14
|
findPortletsByName: function findPortletsByName() {},
|
|
14
15
|
findPortletsByType: function findPortletsByType() {},
|
|
@@ -1260,6 +1260,12 @@ export interface NodeTypeUtil extends NodeTypeUtilConstants {
|
|
|
1260
1260
|
*/
|
|
1261
1261
|
METADATA_GEOLOCATION_DEFINITION_TYPE: "sv:metadataGeolocationDefinition";
|
|
1262
1262
|
|
|
1263
|
+
/**
|
|
1264
|
+
* The primary node type name for the metadata module definition type
|
|
1265
|
+
* @since Sitevision 2025.01.1
|
|
1266
|
+
*/
|
|
1267
|
+
METADATA_MODULE_DEFINITION_TYPE: "sv:metadataModuleDefinition";
|
|
1268
|
+
|
|
1263
1269
|
/**
|
|
1264
1270
|
* Checks if a node is a layout.
|
|
1265
1271
|
* @param aNode the node to be checked
|
|
@@ -1625,6 +1631,7 @@ export interface NodeTypeUtil extends NodeTypeUtilConstants {
|
|
|
1625
1631
|
* <li>{@link #METADATA_SINGLE_TARGET_AUDIENCE_DEFINITION_TYPE sv:metadataSingleTargetAudienceDefinition}</li>
|
|
1626
1632
|
* <li>{@link #METADATA_MULTIPLE_TARGET_AUDIENCE_DEFINITION_TYPE sv:metadataMultipleTargetAudienceDefinition}</li>
|
|
1627
1633
|
* <li>{@link #METADATA_GEOLOCATION_DEFINITION_TYPE sv:metadataGeolocationDefinition}</li>
|
|
1634
|
+
* <li>{@link #METADATA_MODULE_DEFINITION_TYPE sv:metadataModuleDefinition}</li>
|
|
1628
1635
|
* </ul>
|
|
1629
1636
|
* @param aNode the node to be checked
|
|
1630
1637
|
* @return whether aNode is a "metadata definition node" or not.
|
|
@@ -276,6 +276,21 @@ export interface OutputUtil extends OutputUtilConstants {
|
|
|
276
276
|
*/
|
|
277
277
|
getNodeAsText(aNode: Node): string;
|
|
278
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Gets the output as a specific content-type from a page node.
|
|
281
|
+
*
|
|
282
|
+
* <p>
|
|
283
|
+
* <strong>Note! Due to security reasons (potential never-ending loops) it is prohibited to get the output of
|
|
284
|
+
* the currently executing page (i.e. {@link senselogic.sitevision.api.context.PortletContextUtil#getCurrentPage()})!</strong>
|
|
285
|
+
* </p>
|
|
286
|
+
* @param aPageNode a page node (sv:page, sv:article, sv:sitePage) where current user has READ permission, must not be null or "current page".
|
|
287
|
+
* @param aContentType a content-type marker, i.e. {@link #CONTENT_TYPE_TEXT_PLAIN}, {@link #CONTENT_TYPE_TEXT_HTML} or
 {@link #CONTENT_TYPE_TEXT_XML}
|
|
288
|
+
* @return the output result for specified aContentType.
 If aPageNode is null or "current page", an empty String is returned.
 If current user doesn't have READ permission on aPageNode, an empty String is returned.
|
|
289
|
+
* @see #getNodeOutput(Node, Node, int)
|
|
290
|
+
* @since Sitevision 2025.01.2
|
|
291
|
+
*/
|
|
292
|
+
getNodeOutput(aPageNode: Node, aContentType: number): string;
|
|
293
|
+
|
|
279
294
|
/**
|
|
280
295
|
* Gets the output as a specific content-type from a page node or a page content node.
|
|
281
296
|
*
|
|
@@ -289,7 +304,7 @@ export interface OutputUtil extends OutputUtilConstants {
|
|
|
289
304
|
* </p>
|
|
290
305
|
* @param aPageNode a page node (sv:page, sv:article, sv:sitePage) where current user has READ permission, must not be null or "current page".
|
|
291
306
|
* @param aPagePartNode a page part node that exist as content on aPageNode (or null if you want the complete output from aPageNode).
|
|
292
|
-
* @param aContentType a content-type marker, i.e
|
|
307
|
+
* @param aContentType a content-type marker, i.e. {@link #CONTENT_TYPE_TEXT_PLAIN}, {@link #CONTENT_TYPE_TEXT_HTML} or
 {@link #CONTENT_TYPE_TEXT_XML}
|
|
293
308
|
* @return the output result for specified aContentType.
 If aPageNode is null or "current page", an empty String is returned.
 If current user doesn't have READ permission on aPageNode, an empty String is returned.
 If aPagePartNode is null, the output result of aPageNode is returned.
 If aPagePartNode doesn't exist as content on aPageNode, an empty String is returned.
|
|
294
309
|
* @since Sitevision 2.6
|
|
295
310
|
*/
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import type { Node } from '../../types/javax/jcr/Node';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents a message in an AI conversation.
|
|
5
|
+
*/
|
|
6
|
+
export interface Message {
|
|
7
|
+
/**
|
|
8
|
+
* The role of the entity generating the message.
|
|
9
|
+
* - `system`: Provides context or instructions.
|
|
10
|
+
* - `user`: Represents the end user.
|
|
11
|
+
* - `assistant`: Represents the AI model.
|
|
12
|
+
*/
|
|
13
|
+
role: 'system' | 'user' | 'assistant';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The actual content of the message.
|
|
17
|
+
*/
|
|
18
|
+
content: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Options for generating text using an AI model.
|
|
23
|
+
*/
|
|
24
|
+
export interface GenerateTextOptions {
|
|
25
|
+
/**
|
|
26
|
+
* Messages that form the conversation context.
|
|
27
|
+
*/
|
|
28
|
+
messages: Message[];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Maximum duration (in milliseconds) before timing out.
|
|
32
|
+
* The default value and valid range are environment-dependent and can be
|
|
33
|
+
* configured via a system property. If not explicitly set, the system
|
|
34
|
+
* determines an appropriate timeout value.
|
|
35
|
+
*/
|
|
36
|
+
timeout?: number;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The maximum number of tokens (words/word fragments) the model can generate.
|
|
40
|
+
*/
|
|
41
|
+
maxTokens?: number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Controls response randomness:
|
|
45
|
+
* - Lower values (e.g., 0) make responses deterministic.
|
|
46
|
+
* - Higher values (e.g., 1) increase variability.
|
|
47
|
+
*/
|
|
48
|
+
temperature?: number;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Reduces repeated token usage in generated text.
|
|
52
|
+
* Higher values promote more diverse output.
|
|
53
|
+
*/
|
|
54
|
+
frequencyPenalty?: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Result object for text generation.
|
|
59
|
+
*/
|
|
60
|
+
export interface GenerateTextResult {
|
|
61
|
+
/**
|
|
62
|
+
* The generated text output from the AI model.
|
|
63
|
+
*/
|
|
64
|
+
text: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Contains an error message if something went wrong, otherwise an empty string.
|
|
68
|
+
*/
|
|
69
|
+
error: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The reason why the generation process stopped.
|
|
73
|
+
* Possible values:
|
|
74
|
+
* - `stop`: Completed successfully.
|
|
75
|
+
* - `length`: Stopped due to reaching max tokens.
|
|
76
|
+
* - `error`: Failed unexpectedly.
|
|
77
|
+
* - `other`: Other reasons (model/system behavior).
|
|
78
|
+
*/
|
|
79
|
+
finishReason: string;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* (Optional) Token usage statistics for this request.
|
|
83
|
+
*/
|
|
84
|
+
usage?: {
|
|
85
|
+
promptTokens: number;
|
|
86
|
+
completionTokens: number;
|
|
87
|
+
totalTokens: number;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Options for streaming text from an AI model.
|
|
93
|
+
*/
|
|
94
|
+
export interface StreamTextOptions {
|
|
95
|
+
/**
|
|
96
|
+
* Messages that form the conversation context.
|
|
97
|
+
*/
|
|
98
|
+
messages: Message[];
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Maximum duration (in milliseconds) before timing out.
|
|
102
|
+
* The default value and valid range are environment-dependent and can be
|
|
103
|
+
* configured via a system property. If not explicitly set, the system
|
|
104
|
+
* determines an appropriate timeout value.
|
|
105
|
+
*/
|
|
106
|
+
timeout?: number;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The maximum number of tokens (words/word fragments) the model can generate.
|
|
110
|
+
*/
|
|
111
|
+
maxTokens?: number;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Controls response randomness:
|
|
115
|
+
* - Lower values (e.g., 0) make responses deterministic.
|
|
116
|
+
* - Higher values (e.g., 1) increase variability.
|
|
117
|
+
*/
|
|
118
|
+
temperature?: number;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Reduces repeated token usage in generated text.
|
|
122
|
+
* Higher values promote more diverse output.
|
|
123
|
+
*/
|
|
124
|
+
frequencyPenalty?: number;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Callback function that is triggered for each received token.
|
|
128
|
+
* The function receives the token as a string.
|
|
129
|
+
*
|
|
130
|
+
* @param token The streamed token received from the AI model.
|
|
131
|
+
*/
|
|
132
|
+
onChunk: (token: string) => void;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Callback function triggered when the streaming operation completes.
|
|
136
|
+
*
|
|
137
|
+
* @param result The final result of the stream operation.
|
|
138
|
+
*/
|
|
139
|
+
onFinish: (result: StreamFinishResult) => void;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Final result object for a streaming text operation.
|
|
144
|
+
*/
|
|
145
|
+
export interface StreamFinishResult {
|
|
146
|
+
/**
|
|
147
|
+
* Always an empty string (for structural consistency with `GenerateTextResult`).
|
|
148
|
+
*/
|
|
149
|
+
text: string;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Contains an error message if something went wrong, otherwise an empty string.
|
|
153
|
+
*/
|
|
154
|
+
error: string;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The reason why the streaming process stopped.
|
|
158
|
+
* Possible values:
|
|
159
|
+
* - `stop`: Completed successfully.
|
|
160
|
+
* - `length`: Stopped due to reaching max tokens.
|
|
161
|
+
* - `error`: Failed unexpectedly.
|
|
162
|
+
* - `other`: Other reasons (model/system behavior).
|
|
163
|
+
*/
|
|
164
|
+
finishReason: string;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* (Optional) Token usage statistics for this request.
|
|
168
|
+
*/
|
|
169
|
+
usage?: {
|
|
170
|
+
promptTokens: number;
|
|
171
|
+
completionTokens: number;
|
|
172
|
+
totalTokens: number;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* AI SDK for interacting with Large Language Models (LLMs).
|
|
178
|
+
*/
|
|
179
|
+
export interface AI {
|
|
180
|
+
/**
|
|
181
|
+
* Generates text based on provided messages.
|
|
182
|
+
*
|
|
183
|
+
* @param llmConfiguration The AI model configuration node.
|
|
184
|
+
* @param options Options for text generation.
|
|
185
|
+
* @returns The generated text result.
|
|
186
|
+
*/
|
|
187
|
+
generateText(
|
|
188
|
+
llmConfiguration: Node,
|
|
189
|
+
options: GenerateTextOptions
|
|
190
|
+
): GenerateTextResult;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Streams generated text from an AI model.
|
|
194
|
+
*
|
|
195
|
+
* This function does not return a value. Instead, it processes streamed responses
|
|
196
|
+
* using the provided `onChunk` and `onFinish` callback functions.
|
|
197
|
+
*
|
|
198
|
+
* @param llmConfiguration The AI model configuration node.
|
|
199
|
+
* @param options Options for streaming text.
|
|
200
|
+
*/
|
|
201
|
+
streamText(llmConfiguration: Node, options: StreamTextOptions): void;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
declare namespace AI {}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* The AI SDK instance.
|
|
208
|
+
*/
|
|
209
|
+
declare var ai: AI;
|
|
210
|
+
|
|
211
|
+
export default ai;
|
|
@@ -175,6 +175,11 @@ export type CollaborationGroupWrapper = Wrapper & {
|
|
|
175
175
|
* current user must also have {@link senselogic.sitevision.api.security.PermissionUtil.Permission#CREATE_CLOSED_COLLABORATION_GROUP}
|
|
176
176
|
* on the wrapped collaboration group.
|
|
177
177
|
* </p>
|
|
178
|
+
* <p>
|
|
179
|
+
* <strong>Note!</strong> Setting a group to <em>CLOSED</em> will break any potential permission inheritance for the group page of the group.
|
|
180
|
+
* Hence the user that sets the group to {@link CollaborationGroupType#CLOSED} can potentially lose its permissions to access the (now closed)
|
|
181
|
+
* group!
|
|
182
|
+
* </p>
|
|
178
183
|
* @param aCollaborationGroupType the collaboration group type
|
|
179
184
|
* @since Sitevision 4.1
|
|
180
185
|
*/
|
|
@@ -1401,4 +1401,11 @@ export type NodeTypeUtilConstants = {
|
|
|
1401
1401
|
* @since SiteVision 2024.10.1
|
|
1402
1402
|
*/
|
|
1403
1403
|
getMETADATA_GEOLOCATION_DEFINITION_TYPE(): string;
|
|
1404
|
+
|
|
1405
|
+
/**
|
|
1406
|
+
* Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_MODULE_DEFINITION_TYPE}.
|
|
1407
|
+
* @return {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_MODULE_DEFINITION_TYPE}
|
|
1408
|
+
* @since SiteVision 2025.01.1
|
|
1409
|
+
*/
|
|
1410
|
+
getMETADATA_MODULE_DEFINITION_TYPE(): string;
|
|
1404
1411
|
};
|
|
@@ -207,5 +207,6 @@ var _default = exports["default"] = {
|
|
|
207
207
|
getMETADATA_SINGLE_TARGET_AUDIENCE_DEFINITION_TYPE: function getMETADATA_SINGLE_TARGET_AUDIENCE_DEFINITION_TYPE() {},
|
|
208
208
|
getMETADATA_MULTIPLE_TARGET_AUDIENCE_DEFINITION_TYPE: function getMETADATA_MULTIPLE_TARGET_AUDIENCE_DEFINITION_TYPE() {},
|
|
209
209
|
getGEOLOCATION_TYPE: function getGEOLOCATION_TYPE() {},
|
|
210
|
-
getMETADATA_GEOLOCATION_DEFINITION_TYPE: function getMETADATA_GEOLOCATION_DEFINITION_TYPE() {}
|
|
210
|
+
getMETADATA_GEOLOCATION_DEFINITION_TYPE: function getMETADATA_GEOLOCATION_DEFINITION_TYPE() {},
|
|
211
|
+
getMETADATA_MODULE_DEFINITION_TYPE: function getMETADATA_MODULE_DEFINITION_TYPE() {}
|
|
211
212
|
};
|