@sitevision/api 2024.4.2 → 2024.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.
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.7.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": "fcd74122108f19e03a0a9db51efc16286fc7a802"
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.06.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.06.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;
@@ -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;
@@ -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;