@sitevision/api 2024.4.2 → 2024.8.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 CHANGED
@@ -6,6 +6,7 @@ import './server/AuthenticationUtil';
6
6
  import './server/BookmarkUtil';
7
7
  import './server/BuddyIconRenderer';
8
8
  import './server/BuddyIconRenderer.BuddyIconSize';
9
+ import './server/ChannelUtil';
9
10
  import './server/ClientUtil';
10
11
  import './server/CollaborationFactory';
11
12
  import './server/CollaborationGroupFolderUtil';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitevision/api",
3
- "version": "2024.4.2",
3
+ "version": "2024.8.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": "31ee051966f010d3d166fcc78287e61bffcf6ff2"
33
+ "gitHead": "b1cf021d20a7d375727046c8316c02859138bdf7"
34
34
  }
@@ -0,0 +1,73 @@
1
+ import type { String } from "../../types/java/lang/String";
2
+
3
+ import type { Node } from "../../types/javax/jcr/Node";
4
+
5
+ /**
6
+ * Channel utility interface.
7
+ *
8
+ * <p>
9
+ * An instance of the Sitevision class implementing this interface can be obtained via
10
+ * {@link MessagesFactory#getChannelUtil()}.
11
+ * See {@link MessagesFactory} for how to obtain an instance of the <code>MessagesFactory</code> interface.
12
+ * </p>
13
+ * @author Elias Abrache
14
+ * @since Sitevision 2024.05.01
15
+ */
16
+ export interface ChannelUtil {
17
+ /**
18
+ * Creates a channel.
19
+ * <p>
20
+ * A <code>ConstraintViolationException</code> will be thrown if social collaboration is not enabled
21
+ * Or if current user is attempting to create a private channel without
22
+ * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#CREATE_PRIVATE_CHANNELS} permission.
23
+ * </p>
24
+ *
25
+ * <p>
26
+ * A <code>IllegalArgumentException</code> will be thrown if aName is null, blank or exceeds 80 characters.
27
+ * </p>
28
+ *
29
+ * <p>
30
+ * A <code>ItemExistsException</code> will be thrown if a channel with the same name already exists.
31
+ * </p>
32
+ *
33
+ * <p>
34
+ * A <code>RepositoryException</code> will be thrown If an error occurs while fetching channels
35
+ * </p>
36
+ * @param aName the name of the channel (Must be unique and must not exceed 80 characters)
37
+ * @param aDescription the description of the channel
38
+ * @param aPrivate whether the channel should be private or not
39
+ * @throws RepositoryException if an error occurs.
40
+ * @return a channel wrapper for the newly created <code>channel</code>, or <code>null</code>.
41
+ */
42
+ createChannel(
43
+ aName: String | string,
44
+ aDescription: String | string,
45
+ aPrivate: boolean
46
+ ): Node;
47
+
48
+ /**
49
+ * Searches for a channel by name.
50
+ *
51
+ * <p>
52
+ * <em>Permission note</em> Private channels can only be found by members.
53
+ * </p>
54
+ *
55
+ * <p>
56
+ * A <code>ConstraintViolationException</code> will be thrown if social collaboration is not enabled.
57
+ * </p>
58
+ *
59
+ * <p>
60
+ * A <code>RepositoryException</code> will be thrown if an error occurs while fetching channels.
61
+ * </p>
62
+ * @return the channel node, or null.
63
+ * @param aChannelName the name of the channel to search for.
64
+ * @throws RepositoryException if an error occurs.
65
+ */
66
+ findChannelByName(aChannelName: String | string): Node;
67
+ }
68
+
69
+ declare namespace ChannelUtil {}
70
+
71
+ declare var channelUtil: ChannelUtil;
72
+
73
+ export default channelUtil;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = {
8
+ createChannel: function createChannel() {},
9
+ findChannelByName: function findChannelByName() {}
10
+ };
11
+ exports["default"] = _default;
@@ -266,6 +266,42 @@ export interface ImageUtil {
266
266
  * @since Sitevision 4.5.5.2
267
267
  */
268
268
  toBase64(aImage: Node): string;
269
+
270
+ /**
271
+ * Sets the alt property for an image Node.
272
+ *
273
+ * <p>
274
+ * <strong>Permission note!</strong> Current user (the invoker of this method) must have
275
+ * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE WRITE} permission
276
+ * on the image node that should be updated. <em>Updating an image for a <code>sv:userIdentity</code> requires
277
+ * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#MANAGE_USER_IDENTITIES MANAGE_USER_IDENTITIES} permission
278
+ * on current page.</em>
279
+ * </p>
280
+ * @param aImage the sv:image Node, may not be null
281
+ * @param aAltText the alt text to set
282
+ * @throws ConstraintViolationException if aImage is not a sv:image or if current user is not authorized to alter the image node
283
+ * @throws RepositoryException if something else goes wrong
284
+ * @since Sitevision 2024.07.1
285
+ */
286
+ setAltText(aImage: Node, aAltText: String | string): void;
287
+
288
+ /**
289
+ * Sets the caption property for an image Node.
290
+ *
291
+ * <p>
292
+ * <strong>Permission note!</strong> Current user (the invoker of this method) must have
293
+ * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE WRITE} permission
294
+ * on the image node that should be updated. <em>Updating an image for a <code>sv:userIdentity</code> requires
295
+ * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#MANAGE_USER_IDENTITIES MANAGE_USER_IDENTITIES} permission
296
+ * on current page.</em>
297
+ * </p>
298
+ * @param aImage the sv:image Node, may not be null
299
+ * @param aCaptionText the caption text to set
300
+ * @throws ConstraintViolationException if aImage is not a sv:image or if current user is not authorized to alter the image node
301
+ * @throws RepositoryException if something else goes wrong
302
+ * @since Sitevision 2024.07.1
303
+ */
304
+ setCaptionText(aImage: Node, aCaptionText: String | string): void;
269
305
  }
270
306
 
271
307
  declare namespace ImageUtil {}
@@ -13,6 +13,8 @@ var _default = {
13
13
  updateBinaryContentFromBase64: function updateBinaryContentFromBase64() {},
14
14
  updateBinaryContentFromTemporary: function updateBinaryContentFromTemporary() {},
15
15
  renameImage: function renameImage() {},
16
- toBase64: function toBase64() {}
16
+ toBase64: function toBase64() {},
17
+ setAltText: function setAltText() {},
18
+ setCaptionText: function setCaptionText() {}
17
19
  };
18
20
  exports["default"] = _default;
@@ -83,6 +83,10 @@ import type { String } from "../../types/java/lang/String";
83
83
  * Default is no data attributes
84
84
  * </li>
85
85
  * <li style="margin-top:5px">
86
+ * <em>ariaAttributes</em> - Additional HTML5 aria-* attributes.<br>
87
+ * Default is no aria attributes
88
+ * </li>
89
+ * <li style="margin-top:5px">
86
90
  * <em>download</em> - Whether or not to add the HTML5-specific <em>download</em> attribute
87
91
  * (indication to the browser to download the link target instead of navigating to it).<br>
88
92
  * Default is <code>false</code>
@@ -347,6 +351,7 @@ export interface LinkRenderer {
347
351
  * <li><code>clearAccessKey()</code></li>
348
352
  * <li><code>clearOpenNewWindow()</code></li>
349
353
  * <li><code>clearDataAttributes()</code></li>
354
+ * <li><code>clearAriaAttributes()</code></li>
350
355
  * <li><code>clearUseDownload()</code></li>
351
356
  * <li><code>clearLang()</code></li>
352
357
  * <li><code>clearHrefLang()</code></li>
@@ -359,6 +364,7 @@ export interface LinkRenderer {
359
364
  * @see #clearAccessKey()
360
365
  * @see #clearOpenNewWindow()
361
366
  * @see #clearDataAttributes()
367
+ * @see #clearAriaAttributes()
362
368
  * @see #clearUseDownload()
363
369
  * @see #clearLang()
364
370
  * @see #clearHrefLang()
@@ -636,7 +642,7 @@ export interface LinkRenderer {
636
642
  clearUseParameterEncoding(): void;
637
643
 
638
644
  /**
639
- * Adds an HTML5 data-* attribute to the link element.
645
+ * Adds a data-* attribute to the link element.
640
646
  * Data attributes is optional when the result is rendered. Default is no data attributes.
641
647
  * <p>
642
648
  * There can only be one data attribute per name (i.e. when a data attribute is added it will always replace the possibly existing
@@ -648,7 +654,7 @@ export interface LinkRenderer {
648
654
  * </p>
649
655
  * <ul>
650
656
  * <li>
651
- * A <strong>name</strong> that is <code>null</code> or <em>whitespace-only</em> will be completely ignored,
657
+ * A <strong>name</strong> that is <code>null</code>, <em>whitespace-only</em> or <em>prefix-only</em> will be completely ignored,
652
658
  * i.e. no data attribute will be rendered.
653
659
  * </li>
654
660
  * <li>
@@ -668,11 +674,50 @@ export interface LinkRenderer {
668
674
  addDataAttribute(aName: String | string, aValue: String | string): void;
669
675
 
670
676
  /**
671
- * Removes all existing data attributes
677
+ * Removes all existing data attributes.
672
678
  * @since Sitevision 3.0
673
679
  */
674
680
  clearDataAttributes(): void;
675
681
 
682
+ /**
683
+ * Adds an aria-* attribute to the link element.
684
+ * Aria attributes are optional when the result is rendered. Default is no aria attributes.
685
+ * <p>
686
+ * There can only be one aria attribute per name (i.e. when an aria attribute is added it will always replace the possibly existing
687
+ * aria attribute that already use that name).
688
+ * </p>
689
+ *
690
+ * <p>
691
+ * Notes about names and values:
692
+ * </p>
693
+ * <ul>
694
+ * <li>
695
+ * A <strong>name</strong> that is <code>null</code>, <em>whitespace-only</em> or <em>prefix-only</em> will be completely ignored,
696
+ * i.e. no aria attribute will be rendered.
697
+ * </li>
698
+ * <li>
699
+ * A <strong>name</strong> that isn't properly prefixed with <em>"aria-"</em> will be prefixed when the aria attribute is rendered.
700
+ * </li>
701
+ * <li>
702
+ * A <strong>value</strong> that is <code>null</code> or <em>whitespace-only</em> will be rendered as an aria attribute without value.
703
+ * </li>
704
+ * <li>
705
+ * A <strong>value</strong> should not be escaped/encoded. The <em>useEncoding</em> attribute will determine what to do
706
+ * when the aria attributes are rendered.
707
+ * </li>
708
+ * </ul>
709
+ * @param aName the name of the aria attribute
710
+ * @param aValue the value of the aria attribute
711
+ * @since Sitevision 2024.08.1
712
+ */
713
+ addAriaAttribute(aName: String | string, aValue: String | string): void;
714
+
715
+ /**
716
+ * Removes all existing aria attributes.
717
+ * @since Sitevision 2024.08.1
718
+ */
719
+ clearAriaAttributes(): void;
720
+
676
721
  /**
677
722
  * Sets what access key the link should have (accesskey attribute on the a element)
678
723
  * The accesskey attribute is optional when the result is rendered. Default is <code>null</code>.
@@ -31,6 +31,8 @@ var _default = {
31
31
  clearUseParameterEncoding: function clearUseParameterEncoding() {},
32
32
  addDataAttribute: function addDataAttribute() {},
33
33
  clearDataAttributes: function clearDataAttributes() {},
34
+ addAriaAttribute: function addAriaAttribute() {},
35
+ clearAriaAttributes: function clearAriaAttributes() {},
34
36
  setAccessKey: function setAccessKey() {},
35
37
  clearAccessKey: function clearAccessKey() {},
36
38
  setRel: function setRel() {},
@@ -1,3 +1,4 @@
1
+ import type { ChannelUtil } from "../ChannelUtil";
1
2
  import type { Node } from "../../types/javax/jcr/Node";
2
3
  import type { ChannelWrapper } from "../../types/senselogic/sitevision/api/message/ChannelWrapper";
3
4
 
@@ -13,6 +14,13 @@ import type { ChannelWrapper } from "../../types/senselogic/sitevision/api/messa
13
14
  * @since Sitevision 2024.03.01
14
15
  */
15
16
  export interface MessagesFactory {
17
+ /**
18
+ * Gets an instance of a channel utility class.
19
+ * @return a channel utility class
20
+ * @since Sitevision 2024.05.01
21
+ */
22
+ getChannelUtil(): ChannelUtil;
23
+
16
24
  /**
17
25
  * Gets a wrapper for the specified channel.
18
26
  * @param aChannel the channel node (node of type sv:topic).
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _default = {
8
+ getChannelUtil: function getChannelUtil() {},
8
9
  getChannelWrapper: function getChannelWrapper() {}
9
10
  };
10
11
  exports["default"] = _default;
@@ -126,6 +126,18 @@ export interface NodeTypeUtil extends NodeTypeUtilConstants {
126
126
  */
127
127
  LINK_TYPE: "sv:link";
128
128
 
129
+ /**
130
+ * The primary node type name for a LLM configuration.
131
+ * @since Sitevision 2024.08.1
132
+ */
133
+ LLM_CONFIGURATION_TYPE: "sv:llmConfiguration";
134
+
135
+ /**
136
+ * The primary node type name for a LLM configuration repository.
137
+ * @since Sitevision 2024.08.1
138
+ */
139
+ LLM_CONFIGURATION_REPOSITORY_TYPE: "sv:llmConfigurationRepository";
140
+
129
141
  /**
130
142
  * The primary node type name for a node index.
131
143
  * @since Sitevision 3.6
@@ -474,6 +474,13 @@ export interface ResourceLocatorUtil {
474
474
  * @since Sitevision 2024.04.2
475
475
  */
476
476
  getCssRuleRepository(): Node;
477
+
478
+ /**
479
+ * Gets the LLM configuration repository (sv:llmConfigurationRepository) for the site of current node.
480
+ * @return the LLM configuration repository, or null if indeterminable.
481
+ * @since Sitevision 2024.08.1
482
+ */
483
+ getLlmConfigurationRepository(): Node;
477
484
  }
478
485
 
479
486
  declare namespace ResourceLocatorUtil {}
@@ -49,6 +49,7 @@ var _default = {
49
49
  getSiteCookieRepository: function getSiteCookieRepository() {},
50
50
  getImageFilterRepository: function getImageFilterRepository() {},
51
51
  getWorkStatusTemplateRepository: function getWorkStatusTemplateRepository() {},
52
- getCssRuleRepository: function getCssRuleRepository() {}
52
+ getCssRuleRepository: function getCssRuleRepository() {},
53
+ getLlmConfigurationRepository: function getLlmConfigurationRepository() {}
53
54
  };
54
55
  exports["default"] = _default;
@@ -4,6 +4,7 @@ export interface AppData {
4
4
  get(...key: string[]): unknown;
5
5
  getNode(key: string): Node;
6
6
  getArray(key: string): Node[];
7
+ getNumber(key: string): number;
7
8
  }
8
9
 
9
10
  declare namespace AppData {}
@@ -7,6 +7,7 @@ exports["default"] = void 0;
7
7
  var _default = {
8
8
  get: function get() {},
9
9
  getArray: function getArray() {},
10
- getNode: function getNode() {}
10
+ getNode: function getNode() {},
11
+ getNumber: function getNumber() {}
11
12
  };
12
13
  exports["default"] = _default;
@@ -1,5 +1,6 @@
1
1
  import type { Node } from "../../../../../javax/jcr/Node";
2
2
 
3
+ import type { String } from "../../../../../java/lang/String";
3
4
  import type { Wrapper } from "../../base/Wrapper";
4
5
 
5
6
  /**
@@ -34,8 +35,9 @@ export type ChannelWrapper = Wrapper & {
34
35
  * <strong>Permission notes!</strong>
35
36
  * </p>
36
37
  * <p>
37
- * <em>Open channels</em> require the operating user to either have membership or the
38
- * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#MANAGE_CHANNELS} permission.
38
+ * <em>Open channels</em> require the operating user to have either membership or the
39
+ * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#MANAGE_CHANNELS} permission
40
+ * when adding members other than self.
39
41
  * </p>
40
42
  * <p>
41
43
  * <em>Private channels</em> require the operating user to have membership.
@@ -88,4 +90,42 @@ export type ChannelWrapper = Wrapper & {
88
90
  * @return true if aUserIdentity was removed as member from the wrapped channel, false otherwise.&#xA; false is always returned if aUserIdentity is null or not a member of the wrapped channel.
89
91
  */
90
92
  removeMember(aUserIdentity: Node): boolean;
93
+
94
+ /**
95
+ * Checks if a user identity is a member of the wrapped channel.
96
+ * @param aUserIdentity a user identity (or user)
97
+ * @return true if aUserIdentity is a member of the wrapped channel, false otherwise.&#xA; false is always returned if aUserIdentity is null.
98
+ * @since Sitevision 2024.05.01
99
+ */
100
+ isMember(aUserIdentity: Node): boolean;
101
+
102
+ /**
103
+ * Alters the name of the wrapped channel.
104
+ *
105
+ * <p>
106
+ * <em>Permission note</em> Only the author or members with the
107
+ * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#MANAGE_CHANNELS} permission can alter the channel name.
108
+ * </p>
109
+ *
110
+ * <p>
111
+ * The new channel name most not exceed 80 characters in length and must be unique otherwise false will be returned.
112
+ * </p>
113
+ * @param aChannelName the new name of the channel
114
+ * @return true if channel could be renamed to aChannelName, false otherwise.
115
+ * @since Sitevision 2024.05.01
116
+ */
117
+ renameChannel(aChannelName: String | string): boolean;
118
+
119
+ /**
120
+ * Alters the description of the wrapped channel.
121
+ *
122
+ * <p>
123
+ * <em>Permission note</em> Only the author or members with the
124
+ * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#MANAGE_CHANNELS} permission can alter the channel description.
125
+ * </p>
126
+ * @param aChannelDescription the new description of the channel
127
+ * @return true if channel description was set to aChannelDescription, false otherwise.
128
+ * @since Sitevision 2024.05.01
129
+ */
130
+ setChannelDescription(aChannelDescription: String | string): boolean;
91
131
  };
@@ -6,6 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports["default"] = void 0;
7
7
  var _default = {
8
8
  addMember: function addMember() {},
9
- removeMember: function removeMember() {}
9
+ removeMember: function removeMember() {},
10
+ isMember: function isMember() {},
11
+ renameChannel: function renameChannel() {},
12
+ setChannelDescription: function setChannelDescription() {}
10
13
  };
11
14
  exports["default"] = _default;
@@ -114,6 +114,20 @@ export type NodeTypeUtilConstants = {
114
114
  */
115
115
  getLINK_TYPE(): string;
116
116
 
117
+ /**
118
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#LLM_CONFIGURATION_TYPE}.
119
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#LLM_CONFIGURATION_TYPE}
120
+ * @since Sitevision 2024.08.1
121
+ */
122
+ getLLM_CONFIGURATION_TYPE(): string;
123
+
124
+ /**
125
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#LLM_CONFIGURATION_REPOSITORY_TYPE}.
126
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#LLM_CONFIGURATION_REPOSITORY_TYPE}
127
+ * @since Sitevision 2024.08.1
128
+ */
129
+ getLLM_CONFIGURATION_REPOSITORY_TYPE(): string;
130
+
117
131
  /**
118
132
  * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#NODE_INDEX_TYPE}.
119
133
  * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#NODE_INDEX_TYPE}
@@ -22,6 +22,8 @@ var _default = {
22
22
  getLAYOUT_TYPE: function getLAYOUT_TYPE() {},
23
23
  getLINKED_LAYOUT_TYPE: function getLINKED_LAYOUT_TYPE() {},
24
24
  getLINK_TYPE: function getLINK_TYPE() {},
25
+ getLLM_CONFIGURATION_TYPE: function getLLM_CONFIGURATION_TYPE() {},
26
+ getLLM_CONFIGURATION_REPOSITORY_TYPE: function getLLM_CONFIGURATION_REPOSITORY_TYPE() {},
25
27
  getNODE_INDEX_TYPE: function getNODE_INDEX_TYPE() {},
26
28
  getPAGE_TYPE: function getPAGE_TYPE() {},
27
29
  getPORTLET_TYPE: function getPORTLET_TYPE() {},