@sitevision/api 2025.4.2 → 2025.7.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.
@@ -0,0 +1,197 @@
1
+ import aiAssistant from '.';
2
+ import type { Node } from '../../types/javax/jcr/Node';
3
+ import type { Message, StreamFinishResult, UsageInfo } from '../ai';
4
+
5
+ export type SemanticQueryOptions = {
6
+ /**
7
+ * The query, typically the user message to be used in a conversation
8
+ */
9
+ query: string;
10
+
11
+ /**
12
+ * Max number of chunks. Valid numbers are between 1 and 20 and the default is 5.
13
+ */
14
+ maxHits?: number;
15
+ };
16
+
17
+ export type AskAssistantOptions = {
18
+ /**
19
+ * The user message in the conversation
20
+ */
21
+ message: string;
22
+
23
+ /**
24
+ * The key that identifies the conversation for current user
25
+ */
26
+ conversationIdentifier: string;
27
+
28
+ /**
29
+ * The potential knowledge needed to answer the user question/message (optional).
30
+ * A provided knowledge value will be included in the system message/prompt of this conversation. The value will replace potentially previous knowledge.
31
+ *
32
+ * Hints. This value is typically extracted via the querySemanticIndex method. And potential existing knowledge in the conversation can be retrieved via the getConversationKnowledge method.
33
+ */
34
+ knowledge?: string | string[];
35
+
36
+ /**
37
+ * Callback function that is triggered for each received token.
38
+ * The function receives the token as a string.
39
+ *
40
+ * @param token The streamed token received from the AI model.
41
+ */
42
+ onChunk: (token: string) => void;
43
+
44
+ /**
45
+ * Callback function triggered when the streaming operation completes.
46
+ *
47
+ * @param result The final result of the stream operation.
48
+ */
49
+ onFinish: (result: StreamFinishResult) => void;
50
+ /**
51
+ * Maximum duration (in milliseconds) before timing out.
52
+ * The default value and valid range are environment-dependent and can be
53
+ * configured via a system property. If not explicitly set, the system
54
+ * determines an appropriate timeout value.
55
+ */
56
+ timeout?: number;
57
+
58
+ /**
59
+ * The maximum number of tokens (words/word fragments) the model can generate.
60
+ */
61
+ maxTokens?: number;
62
+
63
+ /**
64
+ * Controls response randomness:
65
+ * - Lower values (e.g., 0) make responses deterministic.
66
+ * - Higher values (e.g., 1) increase variability.
67
+ */
68
+ temperature?: number;
69
+
70
+ /**
71
+ * Reduces repeated token usage in generated text.
72
+ * Higher values promote more diverse output.
73
+ */
74
+ frequencyPenalty?: number;
75
+ };
76
+
77
+ export type AskLLMOptions = {
78
+ /**
79
+ * Messages that represent a conversation
80
+ */
81
+ messages: Message[];
82
+
83
+ /**
84
+ * The maximum amount of time, in milliseconds, that Sitevision will wait for a response before the connection times out.
85
+ * Default 30000 (30s)
86
+ */
87
+ timeout?: number;
88
+
89
+ /**
90
+ * Specifies the maximum number of tokens (words or word fragments) that the model can generate in the response. This includes both the prompt and the completion.
91
+ */
92
+ maxTokens?: number;
93
+
94
+ /**
95
+ * Controls the randomness or creativity of the model's output. Lower values make the output more deterministic and focused, while higher values introduce more variability and creativity.
96
+ */
97
+ temperature?: number;
98
+
99
+ /**
100
+ * Penalizes the model for using the same tokens repeatedly. A higher value reduces the likelihood of repeating the same phrases, promoting more diverse language usage.
101
+ */
102
+ frequencyPenalty?: number;
103
+ };
104
+
105
+ export type KnowledgeEntry = {
106
+ /**
107
+ * The unique identifier for the source of the knowledge.
108
+ */
109
+ id: string;
110
+
111
+ /**
112
+ * The knowledge text, typically a string.
113
+ */
114
+ text: string;
115
+ };
116
+
117
+ export type LLMResponse = {
118
+ text: string;
119
+
120
+ error: string;
121
+
122
+ finishReason: string;
123
+
124
+ usage: UsageInfo;
125
+ };
126
+
127
+ /**
128
+ * AI SDK for interacting with Large Language Models (LLMs).
129
+ */
130
+ export interface AIAssistant {
131
+ /**
132
+ * Returns a new, unique conversationIdentifier string - the key needed to identify a conversation for current user.
133
+ * @param aiAssistant The AI Assistant instance.
134
+ * @returns A unique conversation identifier string.
135
+ */
136
+ createConversation(aiAssistant: Node): string;
137
+
138
+ /**
139
+ * Retrieves the memory (context) of a specific conversation. Will not include any system messages.
140
+ *
141
+ * @param aiAssistant The AI Assistant instance.
142
+ * @param conversationIdentifier The unique identifier of the conversation.
143
+ * @returns An array of messages representing the conversation memory.
144
+ */
145
+ getConversationMemory(
146
+ aiAssistant: Node,
147
+ conversationIdentifier: string
148
+ ): Message[];
149
+
150
+ /**
151
+ * Retrieves the knowledge string used in the conversation.
152
+ *
153
+ * @param aiAssistant The AI Assistant instance.
154
+ * @param conversationIdentifier The unique identifier of the conversation.
155
+ * @returns A string representing the conversation knowledge.
156
+ */
157
+ getConversationKnowledge(
158
+ aiAssistant: Node,
159
+ conversationIdentifier: string
160
+ ): string;
161
+
162
+ /**
163
+ * Queries a semantic index for knowledge entries based on the provided options.
164
+ *
165
+ * @param aiAssistant The AI Assistant instance.
166
+ * @param options Options for the semantic query.
167
+ * @returns An array of knowledge entries matching the query.
168
+ */
169
+ querySemanticIndex(
170
+ aiAssistant: Node,
171
+ options: SemanticQueryOptions
172
+ ): KnowledgeEntry[];
173
+
174
+ /**
175
+ * Asks the AI Assistant a question and will receive a streamed response.
176
+ *
177
+ * @param aiAssistant The AI Assistant instance.
178
+ * @param options Options for the assistant query.
179
+ */
180
+ askAssistant(aiAssistant: Node, options: AskAssistantOptions);
181
+
182
+ /**
183
+ * Method to generate text using the LLM of an AI Assistant configuration. Useful for non-interactive use cases such as summarization,
184
+ * @param aiAssistant The AI Assistant instance.
185
+ * @param options Options for the LLM query.
186
+ */
187
+ askLLM(aiAssistant: Node, options: AskLLMOptions): LLMResponse;
188
+ }
189
+
190
+ declare namespace AIAssistant {}
191
+
192
+ /**
193
+ * The AI Assistant SDK instance.
194
+ */
195
+ declare var aiAssistant: AIAssistant;
196
+
197
+ export default aiAssistant;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = exports["default"] = {
8
+ createConversation: function createConversation() {},
9
+ getConversationMemory: function getConversationMemory() {},
10
+ getConversationKnowledge: function getConversationKnowledge() {},
11
+ querySemanticIndex: function querySemanticIndex() {},
12
+ askAssistant: function askAssistant() {},
13
+ askLLM: function askLLM() {}
14
+ };
@@ -20,6 +20,10 @@ import type { String } from "../../../../../java/lang/String";
20
20
  * This renderer provides the ability to render <em>"plain" HTML</em> output for a Text module
21
21
  * <em>(typically what you want when the HTML of the Text module should be used outside of Sitevision, i.e. headless)</em>.
22
22
  * </li>
23
+ * <li>
24
+ * This renderer also supports rendering output as <em>Markdown</em>,
25
+ * which is particularly useful for large language model (LLM) applications and other modern content workflows.
26
+ * </li>
23
27
  * </ul>
24
28
  *
25
29
  * <p>
@@ -43,14 +47,15 @@ import type { String } from "../../../../../java/lang/String";
43
47
  *
44
48
  * <p>
45
49
  * <strong>Example of how this renderer could be used:</strong><br>
46
- * E.g. You want to get all output types (html, plain html, text) from two Text modules on a specific page.
50
+ * E.g. You want to get all output types (html, plain html, text, markdown) from two Text modules on a specific page.
47
51
  * </p>
48
52
  * <pre><code> var textRendererBuilder = require('TextModuleRendererBuilder'),
49
53
  * textRenderer,
50
54
  * page,
51
55
  * htmlData = { "type": "HTML" },
52
56
  * plainHtmlData = { "type": "Plain HTML" },
53
- * textData = { "type": "Text" };
57
+ * textData = { "type": "Text" },
58
+ * markdownData = { "type": "Markdown" };
54
59
  *
55
60
  * <em>// Get the page where the Text modules are located...</em>
56
61
  * page = ...
@@ -64,6 +69,7 @@ import type { String } from "../../../../../java/lang/String";
64
69
  * htmlData.heading = textRenderer.renderHtml();
65
70
  * plainHtmlData.heading = textRenderer.renderPlainHtml();
66
71
  * textData.heading = textRenderer.renderText();
72
+ * markdownData.heading = textRenderer.renderMarkdown();
67
73
  * }
68
74
  *
69
75
  * <em>// Update the TextModuleRenderer with another Text module and render (if possible)</em>
@@ -72,6 +78,7 @@ import type { String } from "../../../../../java/lang/String";
72
78
  * htmlData.content = textRenderer.renderHtml();
73
79
  * plainHtmlData.content = textRenderer.renderPlainHtml();
74
80
  * textData.content = textRenderer.renderText();
81
+ * markdownData.content = textRenderer.renderMarkdown();
75
82
  * }</code></pre>
76
83
  * <p>
77
84
  * The JSON result of the Javascript objects in the example script above could be something like this:
@@ -95,6 +102,13 @@ import type { String } from "../../../../../java/lang/String";
95
102
  * "type": "Text",
96
103
  * "heading": "Heading",
97
104
  * "content": "Some content"
105
+ * }
106
+ *
107
+ * <strong>// markdownData</strong>
108
+ * {
109
+ * "type": "Markdown",
110
+ * "heading": "# Heading",
111
+ * "content": "Some content"
98
112
  * }</code></pre>
99
113
  *
100
114
  * <p>
@@ -231,4 +245,16 @@ export type TextModuleRenderer = {
231
245
  * @see #renderHtml()
232
246
  */
233
247
  renderPlainHtml(): string;
248
+
249
+ /**
250
+ * Renders Markdown for the loaded Text module.
251
+ *
252
+ * <p>
253
+ * <strong>Note!</strong> The returned value will always be empty string if the {@link #isLoaded()} state is <code>false</code>
254
+ * when invoking this render method <em>(i.e. you would typically always check the loaded state before calling this method).</em>
255
+ * </p>
256
+ * @return the Markdown representation of the loaded Text module, or empty String if rendering fails or no Text module is loaded
257
+ * @since Sitevision 2025.07.1
258
+ */
259
+ renderMarkdown(): string;
234
260
  };
@@ -11,5 +11,6 @@ var _default = exports["default"] = {
11
11
  isLoaded: function isLoaded() {},
12
12
  renderHtml: function renderHtml() {},
13
13
  renderText: function renderText() {},
14
- renderPlainHtml: function renderPlainHtml() {}
14
+ renderPlainHtml: function renderPlainHtml() {},
15
+ renderMarkdown: function renderMarkdown() {}
15
16
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Get methods for accessing field constants defined in {@link senselogic.sitevision.api.script.proxy.ExceptionSuppressingProxy}.
2
+ * Get methods for accessing field constants defined in deprecated {@link senselogic.sitevision.api.script.proxy.ExceptionSuppressingProxy}.
3
3
  *
4
4
  * <p>
5
5
  * The sole purpose of this interface is to provide access to {@link senselogic.sitevision.api.script.proxy.ExceptionSuppressingProxy}
@@ -7,6 +7,7 @@
7
7
  * </p>
8
8
  * @author Magnus Lövgren
9
9
  * @since Sitevision 3.6.2
10
+ * @deprecated this interface is deprecated and will be removed in a future version of Sitevision
10
11
  */
11
12
  export type ExceptionSuppressingProxyConstants = {
12
13
  /**
@@ -1367,6 +1367,13 @@ export type NodeTypeUtilConstants = {
1367
1367
  */
1368
1368
  getTARGET_AUDIENCE_TYPE(): string;
1369
1369
 
1370
+ /**
1371
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#TARGET_AUDIENCE_GROUP_REPOSITORY_TYPE}.
1372
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#TARGET_AUDIENCE_GROUP_REPOSITORY_TYPE}
1373
+ * @since Sitevision 2025.07.1
1374
+ */
1375
+ getTARGET_AUDIENCE_GROUP_REPOSITORY_TYPE(): string;
1376
+
1370
1377
  /**
1371
1378
  * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#TARGET_AUDIENCE_GROUP_TYPE}.
1372
1379
  * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#TARGET_AUDIENCE_GROUP_TYPE}
@@ -1422,4 +1429,18 @@ export type NodeTypeUtilConstants = {
1422
1429
  * @since Sitevision 2025.03.1
1423
1430
  */
1424
1431
  getSEMANTIC_INDEX_REPOSITORY_TYPE(): string;
1432
+
1433
+ /**
1434
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#AI_ASSISTANT_TYPE}.
1435
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#AI_ASSISTANT_TYPE}
1436
+ * @since Sitevision 2025.07.1
1437
+ */
1438
+ getAI_ASSISTANT_TYPE(): string;
1439
+
1440
+ /**
1441
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#AI_ASSISTANT_REPOSITORY_TYPE}.
1442
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#AI_ASSISTANT_REPOSITORY_TYPE}
1443
+ * @since Sitevision 2025.07.1
1444
+ */
1445
+ getAI_ASSISTANT_REPOSITORY_TYPE(): string;
1425
1446
  };
@@ -203,6 +203,7 @@ var _default = exports["default"] = {
203
203
  getCSS_RULE_TYPE: function getCSS_RULE_TYPE() {},
204
204
  getTARGET_AUDIENCE_REPOSITORY_TYPE: function getTARGET_AUDIENCE_REPOSITORY_TYPE() {},
205
205
  getTARGET_AUDIENCE_TYPE: function getTARGET_AUDIENCE_TYPE() {},
206
+ getTARGET_AUDIENCE_GROUP_REPOSITORY_TYPE: function getTARGET_AUDIENCE_GROUP_REPOSITORY_TYPE() {},
206
207
  getTARGET_AUDIENCE_GROUP_TYPE: function getTARGET_AUDIENCE_GROUP_TYPE() {},
207
208
  getMETADATA_SINGLE_TARGET_AUDIENCE_DEFINITION_TYPE: function getMETADATA_SINGLE_TARGET_AUDIENCE_DEFINITION_TYPE() {},
208
209
  getMETADATA_MULTIPLE_TARGET_AUDIENCE_DEFINITION_TYPE: function getMETADATA_MULTIPLE_TARGET_AUDIENCE_DEFINITION_TYPE() {},
@@ -210,5 +211,7 @@ var _default = exports["default"] = {
210
211
  getMETADATA_GEOLOCATION_DEFINITION_TYPE: function getMETADATA_GEOLOCATION_DEFINITION_TYPE() {},
211
212
  getMETADATA_MODULE_DEFINITION_TYPE: function getMETADATA_MODULE_DEFINITION_TYPE() {},
212
213
  getSEMANTIC_INDEX_TYPE: function getSEMANTIC_INDEX_TYPE() {},
213
- getSEMANTIC_INDEX_REPOSITORY_TYPE: function getSEMANTIC_INDEX_REPOSITORY_TYPE() {}
214
+ getSEMANTIC_INDEX_REPOSITORY_TYPE: function getSEMANTIC_INDEX_REPOSITORY_TYPE() {},
215
+ getAI_ASSISTANT_TYPE: function getAI_ASSISTANT_TYPE() {},
216
+ getAI_ASSISTANT_REPOSITORY_TYPE: function getAI_ASSISTANT_REPOSITORY_TYPE() {}
214
217
  };
@@ -8,48 +8,17 @@ import type { String } from "../../../../../../java/lang/String";
8
8
  * context they were created for.
9
9
  * </p>
10
10
  * @author Magnus Lövgren
11
- * @see VelocityRenderer
12
- * @since Sitevision 2.7_06
13
11
  * @since Sitevision 3.0
14
12
  */
15
13
  export type VelocityEvaluator = {
16
14
  /**
17
- * Renders a template that is parsed/evaluated by Velocity.
15
+ * Renders a template string that is parsed/evaluated by Velocity.
18
16
  *
19
17
  * <p>
20
18
  * <strong>Note!</strong> This method is intended for usage from within Velocity only
21
- * (e.g. <code>$aVelocityEvaluatorInstance.evaluate($aTemplateString)</code>),
22
- * see {@link VelocityRenderer} for an example.
19
+ * (e.g. <code>$aVelocityEvaluatorInstance.evaluate($aTemplateString)</code>).
23
20
  * </p>
24
- *
25
- * <p>
26
- * <em>
27
- * <strong>Tip when evaluating velocity files in a custom portlet!</strong>
28
- * The path to your portlet's velocity file(-s) are class loader dependant and therefore likely to have
29
- * it's root from the "classes" folder of your war. An example, your portlet war looks like this:
30
- * </em>
31
- * </p>
32
- * <pre><em>
33
- * [META-INF]
34
- * |- context.xml
35
- * [WEB-INF]
36
- * |- portlet.xml
37
- * |- web.xml
38
- * |- [classes]
39
- * | |- [com]
40
- * | |- [mycompany]
41
- * | |- [myportlet]
42
- * | |- MyPortlet.class
43
- * |- [resources]
44
- * |- myvelocityfile.vm
45
- * </em></pre>
46
- * <p>
47
- * <em>
48
- * If you want to use a VelocityEvaluator to evaluate the <code>myvelocityfile.vm</code> in the <code>MyPortlet.class</code>,
49
- * your velocity file path would likely be <code>"../resources/myvelocityfile.vm"</code>.
50
- * </em>
51
- * </p>
52
- * @param aTemplate a String containing the Velocity code to be parsed or a path to a velocity template file&#xA; (suffix must be ".vm" and path must not contain any space character)
21
+ * @param aTemplate a String containing the Velocity code to be evaluated
53
22
  */
54
23
  evaluate(aTemplate: String | string): void;
55
24
  };
@@ -2,94 +2,15 @@ import type { Iterator } from "../../../../../../java/util/Iterator";
2
2
  import type { Collection } from "../../../../../../java/util/Collection";
3
3
 
4
4
  /**
5
- * Decorates the iterator of a collection with a {@link ExceptionSuppressingIterator} to ensure exceptions are suppressed for all
6
- * iterator invocations.
7
- *
8
- * <p>
9
- * The sole purpose of the <code>ExceptionSuppressingCollection</code> is to provide easy access to a decorated iterator
10
- * (i.e. an {@link ExceptionSuppressingIterator}). You should <em>not</em> create a collection of exception suppressing proxys
11
- * (i.e. <code>Collection&lt;ExceptionSuppressingProxy&gt;</code>) yourself. You should use <code>ExceptionSuppressingCollection</code>
12
- * with your "regular" collection since the actual proxying is done by the iterator itself.
13
- * </p>
14
- * <p>
15
- * Note that the <code>next</code> method of the interator returns an instance of a <em>Dynamic proxy</em> so not all methods can be invoked
16
- * directly on the returned object. To invoke a method that is not proxied (i.e. a method not declared in an interface the object implements),
17
- * you must extract the "real" object from the proxy and use that reference when invoking the method. See {@link ExceptionSuppressingIterator}
18
- * for more information about the iterator and {@link ExceptionSuppressingProxy} for more information about dynamic proxies and how to extract
19
- * "real" object.
20
- * </p>
21
- *
22
- * <p>
23
- * <strong>Important note! </strong>This interface is intended to be used <em>only</em> in contexts where exceptions when iterating a
24
- * collection will cause <em>serious</em> trouble if they arise and the context doesn't provide proper exception handling
25
- * (e.g. when rendering a Velocity template). Suppressing exceptions is generally a bad idea and using this decorator will affect performance.
26
- * Hence, this interface should only be used where the upsides with suppressing exceptions outweighs the downsides.
27
- * This interface should be used only as a temporary patch/solution until the "real" problem causing the exception has been solved.
28
- * </p>
29
- *
30
- * <p>
31
- * An instance of the Sitevision class implementing this interface can be obtained via
32
- * {@link senselogic.sitevision.api.Utils#getExceptionSuppressingCollection(java.util.Collection)}.
33
- * See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the <code>Utils</code> interface.
34
- * </p>
35
- *
36
- * <p>
37
- * ----------------------------------------------------------------------------------------------------
38
- * </p>
39
- *
40
- * <p>
41
- * <strong>Example of how <code>ExceptionSuppressingCollection</code> could be used in Velocity:</strong>
42
- * </p>
43
- *
44
- * <p>Case description:</p>
45
- * <p>
46
- * <em>You have a Velocity template where you iterate a collection. Sometimes a certain method throws an exception.
47
- * The rendered output of the template gets corrupt whenever an exception is thrown and you have not yet tracked down the root
48
- * cause of the exception. Until the root cause is found and the problem is fixed, you need a temporary solution that ignores
49
- * exceptions to keep template output acceptable. Since the method is declared in an interface and implemented in the instance
50
- * you're invoking, you're in sheer luck. You can decorate your collection with a <code>ExceptionSuppressingCollection</code>
51
- * to get a decorated iterator. When interating, all returned elements are proxied by an <code>ExceptionSuppressingProxy</code>.
52
- * Invoking the method through the proxy will suppress exceptions and you can diminish the output problems.
53
- * Note that you should invoke the real object for all non-problematic methods and methods that can't be proxied
54
- * (i.e. methods not declared in an interface). To get a reference to the real object,
55
- * use {@link ExceptionSuppressingProxy#getProxiedObject()}.</em>
56
- * </p>
57
- * <p>
58
- * This is what the code looks like before your temporary fix:
59
- * </p>
60
- * <pre><code>
61
- * #foreach ($item in $myCollection)
62
- * &lt;p&gt;
63
- * $item.thisNeverThrowsExceptions()
64
- * $item.thisMethodSometimesThrowsExceptions()
65
- * &lt;/p&gt;
66
- * #end
67
- * </code></pre>
68
- * <p>
69
- * This is how you could use an <code>ExceptionSuppressingCollection</code> to apply a temporary fix:
70
- * </p>
71
- * <pre><code>
72
- * <em>## Decorate collection</em>
73
- * #set ($decoratedCollection = $sitevisionUtils.getExceptionSuppressingCollection($myCollection))
74
- *
75
- * #foreach ($item in $decoratedCollection)
76
- * &lt;p&gt;
77
- * <em>## Get the real object and invoke non-problematic method as usual</em>
78
- * #set ($realObject = $item.getProxiedObject())
79
- *
80
- * $realObject.thisNeverThrowsExceptions()
81
- * $!item.thisMethodSometimesThrowsExceptions() <em>## Executed through a proxy, might return null</em>
82
- * &lt;/p&gt;
83
- * #end
84
- * &lt;/p&gt;
85
- * </code></pre>
5
+ * Deprecated interface that will be removed in a future version of Sitevision.
86
6
  * @author Magnus Lövgren
87
7
  * @since Sitevision 2.6.1_09
8
+ * @deprecated this interface is deprecated and will be removed in a future version of Sitevision
88
9
  */
89
10
  export type ExceptionSuppressingCollection = Collection & {
90
11
  /**
91
- * Returns an exception suppressing iterator that ensures no exceptions will be thrown during iteration.
92
- * @return a {@link ExceptionSuppressingIterator} that suppresses exceptions and returns proxied items
12
+ * Returns a ExceptionSuppressingProxy Iterator for the decorated collection.
13
+ * @return a {@link ExceptionSuppressingIterator}
93
14
  */
94
15
  iterator(): Iterator;
95
16
  };
@@ -3,32 +3,10 @@ import type { ExceptionSuppressingProxy } from "../ExceptionSuppressingProxy";
3
3
  import type { Iterator } from "../../../../../../java/util/Iterator";
4
4
 
5
5
  /**
6
- * Decorates an iterator with exception suppressing behaviour and returns {@link ExceptionSuppressingProxy}s in order to ensure that no
7
- * invocation will throw an exception.
8
- *
9
- * <p>
10
- * This iterator is of type <code>ExceptionSuppressingProxy</code> that is an implementation of a <em>Dynamic proxy</em> so not all
11
- * methods can be directly invoked on objects retrieved by the <code>next</code> method. See {@link ExceptionSuppressingCollection}
12
- * for an example of how this iterator can be used easily from Velocity and how to invoke methods not declared in an interface.
13
- * See {@link ExceptionSuppressingProxy} for more information about dynamic proxies.
14
- * </p>
15
- * <p>
16
- * <strong>Important note! </strong>This interface is intended to be used <em>only</em> in contexts where exceptions thrown during iteration will
17
- * cause <em>serious</em> trouble if they arise and the context doesn't provide proper exception handling (e.g. when executing a Velocity template).
18
- * Suppressing exceptions is generally a bad idea and using this iterator will affect performance.
19
- * Hence, this interface should only be used where the upsides with suppressing exceptions far outweighs the downsides.
20
- * This interface should be used only as a temporary patch/solution until the "real" problem causing the exception has been solved.
21
- * </p>
22
- *
23
- * <p>
24
- * An instance of the Sitevision class implementing this interface can be obtained directly via
25
- * {@link senselogic.sitevision.api.Utils#getExceptionSuppressingIterator(java.util.Iterator)}
26
- * or indirectly via {@link senselogic.sitevision.api.Utils#getExceptionSuppressingCollection(java.util.Collection)}.
27
- * You would typically use the latter if you should iterate a collection with the Velocity #foreach loop.
28
- * See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the <code>Utils</code> interface.
29
- * </p>
6
+ * Deprecated interface that will be removed in a future version of Sitevision.
30
7
  * @author Magnus Lövgren
31
8
  * @since Sitevision 2.6.1_09
9
+ * @deprecated this interface is deprecated and will be removed in a future version of Sitevision
32
10
  */
33
11
  export type ExceptionSuppressingIterator = Iterator & {
34
12
  /**
@@ -36,47 +14,22 @@ export type ExceptionSuppressingIterator = Iterator & {
36
14
  * if <code>next</code> would return an element rather than throwing an exception.)
37
15
  *
38
16
  * <p>
39
- * This method will never throw an exception
17
+ * This method will never throw an exception
40
18
  * </p>
41
19
  * @return <code>true</code> if the decorated iterator has more elements, <code>false</code> if not or if an exception is thrown&#xA; by the decorated iterator
42
20
  */
43
21
  hasNext(): boolean;
44
22
 
45
23
  /**
46
- * Returns a proxy for the next element of the decorated iterator. Calling this method repeatedly until the {@link #hasNext()} method
47
- * returns <code>false</code> will return each element in the underlying collection exactly once.
48
- *
49
- * <p>
50
- * <strong>Note!</strong> The returned element will be embedded in an <code>ExceptionSuppressingProxy</code> that will be reused for
51
- * <em>all</em> next() invocations on this iterator. In other words, the proxied item of the returned element will change,
52
- * but never the returned element itself. This implies that you shouldn't keep references to an item retrieved from a next()
53
- * invocation during iteration. If you do, don't be surprised if the element contains something else than it did when you set the reference...
54
- * </p>
55
- *
56
- * <p>
57
- * This method will never throw an exception.
58
- * </p>
59
- * <p>
60
- * <strong>Note! </strong>Be aware of <code>null</code> items since they're never proxied. If the underlying collection contains a
61
- * <code>null</code> item, this iterator will just return <code>null</code>, not a proxy. In other words: even though this method
62
- * won't throw any exceptions, invoking a method on the returned object might throw a <code>NullPointerException</code>.
63
- * </p>
64
- * @return the next element, or <code>null</code> if an exception is thrown.
24
+ * Returns a ExceptionSuppressingProxy for the next element of the decorated iterator.
25
+ * @return the next element of the decorated iterator, or <code>null</code> if an exception is thrown.
65
26
  */
66
27
  next(): ExceptionSuppressingProxy;
67
28
 
68
29
  /**
69
- * Tries to remove from the underlying collection the last element returned by decorated iterator (optional operation).
70
- * This method can be called only once per call to <code>next</code>. The behavior of an iterator is unspecified if
71
- * the underlying collection is modified while the iteration is in progress in any way other than by calling this method.
72
- *
73
- * <p>
74
- * This method will never throw an exception.
75
- * </p>
30
+ * Tries to remove from the decorated iterator.
76
31
  * <p>
77
- * <strong>Note!</strong> Since exceptions are suppressed, you can never tell if the remove operation actually succeeded
78
- * or if the underlying collection doesn't support removal (i.e. <code>UnsupportedOperationException</code> thrown by the
79
- * decorated iterator is catched by this iterator).
32
+ * This method will never throw an exception.
80
33
  * </p>
81
34
 
82
35
  */